1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.10.3.1

This commit is contained in:
gnosygnu
2015-10-18 22:17:57 -04:00
parent 8e18af05b6
commit 4f43f51b18
1935 changed files with 12500 additions and 12889 deletions

View File

@@ -0,0 +1,178 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
class Xoapi_doc {}
/*
xowa {
app {
exit();
env {
version_previous;
}
fsys {
plat_jar;
plat_url();
}
startup {
tabs {
type; // [blank,xowa,custom,previous]
previous;
custom;
custom_is_expr;
}
}
}
nav {
go_bwd();
go_fwd();
goto();
wiki {
main_page();
random();
sandbox();
}
}
gui {
browser {
url {
focus();
exec_by_paste();
exec_new_tab_by_paste();
restore();
exec();
}
search {
focus();
exec();
}
tabs {
new_dflt__at_dflt__focus_y();
new_link__at_dflt__focus_n();
new_link__at_dflt__focus_y();
new_href__at_dflt__focus_y();
new_dupe__at_dflt__focus_y();
close_cur();
select_bwd();
select_fwd();
move_bwd();
move_fwd();
close_others();
close_to_bgn();
close_to_end();
close_undo();
pin_toggle();
select_by_idx_1();
select_by_idx_2();
select_by_idx_3();
select_by_idx_4();
select_by_idx_5();
select_by_idx_6();
select_by_idx_7();
select_by_idx_8();
select_by_idx_9();
}
html {
focus();
selection_focus_toggle();
load_tid; // [mem,url]
}
find {
show();
show_by_paste();
hide();
exec();
type();
find_bwd();
find_fwd();
case_toggle();
wrap_toggle();
}
prog {
focus();
show_short_link;
}
info {
focus();
clear();
launch();
warn_enabled;
note_enabled;
}
prog_log {
show();
}
}
font {
increase();
decrease();
reset();
}
page {
edit {
copy();
select_all();
save();
save_draft();
preview();
focus_edit_box();
dbg_tmpl();
dbg_html();
exec();
}
selection {
copy();
select_all();
save_file_as();
}
view {
mode_read();
mode_edit();
mode_html();
reload();
refresh();
print();
save_as();
}
}
}
html {
}
net {
}
usr {
}
special {
}
xtns {
}
bldr {
wikis {
filters {
dansguardians {
}
}
imports {
one_file = 'y';
schema_is_1 = 'y';
text_zip_tid = '.gz';
html_zip_tid = '.gz';
}
}
}
}
*/

View File

@@ -0,0 +1,81 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.guis.cmds.*;
public class Xoapi_root implements GfoInvkAble {
private Xoae_app app;
public Xoapi_root(Xoae_app app) {
app_api.Ctor_by_app(app);
usr_api.Ctor_by_app(app);
bldr_api.Ctor_by_app(app);
html_api.Ctor_by_app(app);
}
public void Init_by_kit(Xoae_app app) {
this.app = app;
app_api.Init_by_kit(app);
nav_api.Init_by_kit(app);
gui_api.Init_by_kit(app);
html_api.Init_by_kit(app);
net_api.Init_by_kit(app);
usr_api.Init_by_kit(app);
xtns_api.Init_by_kit(app);
}
public void Init_by_app(Xoae_app app) {
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.general");
html_api.Page().Toggle_mgr().Img_dir_(img_dir);
usr_api.Init_by_app(app);
}
public Xoapi_app App() {return app_api;} private final Xoapi_app app_api = new Xoapi_app();
public Xoapi_nav Nav() {return nav_api;} private final Xoapi_nav nav_api = new Xoapi_nav();
public Xoapi_gui Gui() {return gui_api;} private final Xoapi_gui gui_api = new Xoapi_gui();
public Xoapi_html Html() {return html_api;} private final Xoapi_html html_api = new Xoapi_html();
public Xoapi_bldr Bldr() {return bldr_api;} private final Xoapi_bldr bldr_api = new Xoapi_bldr();
public Xoapi_net Net() {return net_api;} private final Xoapi_net net_api = new Xoapi_net();
public Xoapi_usr Usr() {return usr_api;} private final Xoapi_usr usr_api = new Xoapi_usr();
public Xoapi_special Special() {return special_api;} private final Xoapi_special special_api = new Xoapi_special();
public Xoapi_xtns Xtns() {return xtns_api;} private final Xoapi_xtns xtns_api = new Xoapi_xtns();
public Xoapi_app_wikis Wikis() {return app_wikis;} private final Xoapi_app_wikis app_wikis = new Xoapi_app_wikis();
public String Test_str() {return test_str;} public void Test_str_(String v) {test_str = v;} private String test_str; // TEST
private void Exec(String key) {
Xog_cmd_itm cmd_itm = app.Gui_mgr().Cmd_mgr().Get_or_null(key);
if (cmd_itm == null) app.Usr_dlg().Warn_many("", "", "could not find cmd; key=~{0}", key);
app.Gfs_mgr().Run_str_for(app, cmd_itm.Cmd());
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_app)) return app_api;
else if (ctx.Match(k, Invk_bldr)) return bldr_api;
else if (ctx.Match(k, Invk_nav)) return nav_api;
else if (ctx.Match(k, Invk_gui)) return gui_api;
else if (ctx.Match(k, Invk_html)) return html_api;
else if (ctx.Match(k, Invk_net)) return net_api;
else if (ctx.Match(k, Invk_usr)) return usr_api;
else if (ctx.Match(k, Invk_special)) return special_api;
else if (ctx.Match(k, Invk_xtns)) return xtns_api;
else if (ctx.Match(k, Invk_exec)) Exec(m.ReadStr("v"));
else if (ctx.Match(k, Invk_wikis)) return app_wikis;
else if (ctx.Match(k, Invk_test_str)) return test_str;
else if (ctx.Match(k, Invk_test_str_)) test_str = m.ReadStr("v");
return this;
}
private static final String
Invk_exec = "exec"
, Invk_app = "app", Invk_bldr = "bldr", Invk_nav = "nav", Invk_gui = "gui", Invk_html = "html", Invk_net = "net", Invk_usr = "usr", Invk_special = "special", Invk_xtns = "xtns"
, Invk_test_str = "test_str", Invk_test_str_ = "test_str_"
, Invk_wikis = "wikis"
;
}

View File

@@ -0,0 +1,42 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.guis.views.*;
import gplx.xowa.apps.apis.xowa.apps.*; import gplx.xowa.apps.apis.xowa.envs.*; import gplx.xowa.apps.apis.xowa.startups.*;
public class Xoapi_app implements GfoInvkAble {
private Xog_win_itm win;
public void Ctor_by_app(Xoae_app app) {
fsys.Ctor_by_app(app);
}
public void Init_by_kit(Xoae_app app) {
win = app.Gui_mgr().Browser_win();
}
public Xoapi_fsys Fsys() {return fsys;} private Xoapi_fsys fsys = new Xoapi_fsys();
public void Exit() {win.App__exit();}
public Xoapi_env Env() {return env;} private Xoapi_env env = new Xoapi_env();
public Xoapi_startups Startup() {return startup;} private Xoapi_startups startup = new Xoapi_startups();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_exit)) this.Exit();
else if (ctx.Match(k, Invk_fsys)) return fsys;
else if (ctx.Match(k, Invk_startup)) return startup;
else if (ctx.Match(k, Invk_env)) return env;
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_exit = "exit", Invk_startup = "startup", Invk_env = "env", Invk_fsys = "fsys";
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.wikis.*;
public class Xoapi_app_wiki implements GfoInvkAble {
public Xoapi_wiki_lang Lang() {return lang;} private final Xoapi_wiki_lang lang = new Xoapi_wiki_lang();
public void Subscribe(GfoEvObj sub) {lang.Subscribe(sub);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_lang)) return lang;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_lang = "lang";
public static final Xoapi_app_wiki Dflt = new Xoapi_app_wiki();
}

View File

@@ -0,0 +1,34 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
public class Xoapi_app_wikis implements GfoInvkAble {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public Xoapi_app_wiki Get(byte[] domain) {
Xoapi_app_wiki rv = (Xoapi_app_wiki)hash.Get_by(domain);
if (rv == null) {
rv = new Xoapi_app_wiki();
hash.Add(domain, rv);
}
return rv;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return Get(m.ReadBry("v"));
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_get = "get";
}

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.bldrs.*;
public class Xoapi_bldr implements GfoInvkAble {
public void Ctor_by_app(Xoa_app app) {wiki.Ctor_by_app(app);}
public Xoapi_bldr_wiki Wiki() {return wiki;} private final Xoapi_bldr_wiki wiki = new Xoapi_bldr_wiki();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_wiki)) return wiki;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_wiki = "wiki";
}

View File

@@ -0,0 +1,36 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.gui.*;
public class Xoapi_gui implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
browser.Init_by_kit(app);
font.Init_by_kit(app);
page.Init_by_kit(app);
}
public Xoapi_browser Browser() {return browser;} private Xoapi_browser browser = new Xoapi_browser();
public Xoapi_font Font() {return font;} private Xoapi_font font = new Xoapi_font();
public Xoapi_page Page() {return page;} private Xoapi_page page = new Xoapi_page();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_browser)) return browser;
else if (ctx.Match(k, Invk_font)) return font;
else if (ctx.Match(k, Invk_page)) return page;
return this;
}
private static final String Invk_browser = "browser", Invk_font = "font", Invk_page = "page";
}

View File

@@ -0,0 +1,40 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.html.*;
public class Xoapi_html implements GfoInvkAble {
public void Ctor_by_app(Xoae_app app) {
page.Ctor_by_app(app);
}
public void Init_by_kit(Xoae_app app) {
tidy.Init_by_kit(app);
modules.Init_by_kit(app);
}
public Xoapi_tidy Tidy() {return tidy;} private final Xoapi_tidy tidy = new Xoapi_tidy();
public Xoapi_modules Modules() {return modules;} private final Xoapi_modules modules = new Xoapi_modules();
public Xoapi_skins Skins() {return skins;} private final Xoapi_skins skins = new Xoapi_skins();
public Xoapi_page Page() {return page;} private final Xoapi_page page = new Xoapi_page();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_tidy)) return tidy;
else if (ctx.Match(k, Invk_modules)) return modules;
else if (ctx.Match(k, Invk_skins)) return skins;
else if (ctx.Match(k, Invk_page)) return page;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_tidy = "tidy", Invk_modules = "modules", Invk_skins = "skins", Invk_page = "page";
}

View File

@@ -0,0 +1,40 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.guis.views.*;
import gplx.xowa.apps.apis.xowa.navs.*;
public class Xoapi_nav implements GfoInvkAble {
private Xog_win_itm win;
public void Init_by_kit(Xoae_app app) {
win = app.Gui_mgr().Browser_win();
wiki.Init_by_kit(app);
}
public Xoapi_wiki Wiki() {return wiki;} private Xoapi_wiki wiki = new Xoapi_wiki();
public void Goto(String page) {win.Page__navigate_by_url_bar(page);}
public void Go_bwd() {win.Page__navigate_by_history(Bool_.N);}
public void Go_fwd() {win.Page__navigate_by_history(Bool_.Y);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_go_bwd)) this.Go_bwd();
else if (ctx.Match(k, Invk_go_fwd)) this.Go_fwd();
else if (ctx.Match(k, Invk_goto)) this.Goto(m.ReadStr("v"));
else if (ctx.Match(k, Invk_wiki)) return wiki;
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_go_bwd = "go_bwd", Invk_go_fwd = "go_fwd", Invk_goto = "goto", Invk_wiki = "wiki";
}

View File

@@ -0,0 +1,42 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
public class Xoapi_net implements GfoInvkAble, GfoEvObj {
public Xoapi_net() {this.ev_mgr = GfoEvMgr.new_(this);}
public GfoEvMgr EvMgr() {return ev_mgr;} private GfoEvMgr ev_mgr;
public void Init_by_kit(Xoae_app app) {
}
public boolean Enabled() {return enabled;} private boolean enabled = true;
public void Enabled_(boolean v) {
this.enabled = v;
gplx.ios.IoEngine_system.Web_access_enabled = v;
GfoEvMgr_.PubVal(this, gplx.xowa.guis.menus.dom.Xog_mnu_evt_mgr.Evt_selected_changed, v);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return this.Enabled();
else if (ctx.Match(k, Invk_enabled_n_)) this.Enabled_(Bool_.N);
else if (ctx.Match(k, Invk_enabled_y_)) this.Enabled_(Bool_.Y);
else if (ctx.Match(k, Invk_enabled_x_)) this.Enabled_(this.Enabled());
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_enabled = "enabled", Invk_enabled_n_ = "enabled_n_", Invk_enabled_y_ = "enabled_y_", Invk_enabled_x_ = "enabled_x_"
;
public static final String Evt_enabled_changed = "enabled_changed";
}

View File

@@ -0,0 +1,31 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.specials.*;
public class Xoapi_special implements GfoInvkAble {
public void Ctor_by_app(Xoae_app app) {
}
public void Init_by_kit(Xoae_app app) {
}
public Xoapi_search Search() {return search;} private Xoapi_search search = new Xoapi_search();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_search)) return search;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_search = "search";
}

View File

@@ -0,0 +1,45 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.usrs.*;
public class Xoapi_usr implements GfoInvkAble {
public void Ctor_by_app(Xoae_app app) {
bookmarks.Ctor_by_app(app);
history.Ctor_by_app(app);
logs.Ctor_by_app(app);
}
public void Init_by_app(Xoa_app app) {
cache.Init_by_app(app);
}
public void Init_by_kit(Xoae_app app) {
bookmarks.Init_by_kit(app);
history.Init_by_kit(app);
}
public Xoapi_bookmarks Bookmarks() {return bookmarks;} private final Xoapi_bookmarks bookmarks = new Xoapi_bookmarks();
public Xoapi_history History() {return history;} private final Xoapi_history history = new Xoapi_history();
public Xoapi_logs Logs() {return logs;} private final Xoapi_logs logs = new Xoapi_logs();
public Xoapi_cache Cache() {return cache;} private final Xoapi_cache cache = new Xoapi_cache();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_bookmarks)) return bookmarks;
else if (ctx.Match(k, Invk_history)) return history;
else if (ctx.Match(k, Invk_logs)) return logs;
else if (ctx.Match(k, Invk_cache)) return cache;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_bookmarks = "bookmarks", Invk_history = "history", Invk_logs = "logs", Invk_cache = "cache";
}

View File

@@ -0,0 +1,35 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.xtns.*;
public class Xoapi_xtns implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
scribunto.Init_by_kit(app);
}
public Xoapi_scribunto Scribunto() {return scribunto;} private final Xoapi_scribunto scribunto = new Xoapi_scribunto();
public Xoapi_wikibase Wikibase() {return wikibase;} private final Xoapi_wikibase wikibase = new Xoapi_wikibase();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_scribunto)) return scribunto;
else if (ctx.Match(k, Invk_wikibase)) return wikibase;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String
Invk_scribunto = "scribunto"
, Invk_wikibase = "wikibase"
;
}

View File

@@ -0,0 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.apps; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
public class Xoapi_fsys implements GfoInvkAble {
public void Ctor_by_app(Xoae_app app) {
this.plat_jar = Env_.AppUrl();
this.root_dir = app.Fsys_mgr().Root_dir();
}
public Io_url Plat_jar() {return plat_jar;} private Io_url plat_jar;
public Io_url Plat_url(String s) {return Io_url_.new_any_(root_dir.Gen_sub_path_for_os(s));} private Io_url root_dir;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_plat_jar)) return plat_jar;
else if (ctx.Match(k, Invk_plat_url)) return Plat_url(m.ReadStr("v"));
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_plat_jar = "plat_jar", Invk_plat_url = "plat_url";
}

View File

@@ -0,0 +1,31 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
import gplx.xowa.apps.apis.xowa.bldrs.imports.*;
public class Xoapi_bldr_wiki implements GfoInvkAble {
public void Ctor_by_app(Xoa_app app) {filter.Ctor_by_app(app);}
public Xoapi_filter Filter() {return filter;} private final Xoapi_filter filter = new Xoapi_filter();
public Xoapi_import Import() {return import_api;} private final Xoapi_import import_api = new Xoapi_import();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_filter)) return filter;
else if (ctx.Match(k, Invk_import)) return import_api;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_filter = "filter", Invk_import = "import";
}

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.bldrs.filters; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*;
import gplx.xowa.apps.apis.xowa.bldrs.filters.dansguardians.*;
public class Xoapi_filter implements GfoInvkAble {
public void Ctor_by_app(Xoa_app app) {dansguardian.Ctor_by_app(app);}
public Xoapi_dansguardian Dansguardian() {return dansguardian;} private final Xoapi_dansguardian dansguardian = new Xoapi_dansguardian();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_dansguardian)) return dansguardian;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_dansguardian = "dansguardian";
}

View File

@@ -0,0 +1,76 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.bldrs.filters.dansguardians; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
import gplx.ios.*; import gplx.xowa.bldrs.filters.dansguardians.*;
public class Xoapi_dansguardian implements GfoInvkAble {
public void Ctor_by_app(Xoa_app app) {
root_dir = app.Fsys_mgr().Bin_xowa_dir().GenSubDir_nest("cfg", "bldr", "filter");
}
public boolean Enabled() {return enabled;} private boolean enabled = Bool_.N;
public Io_url Root_dir() {return root_dir;} private Io_url root_dir;
public int Score_init() {return score_init;} private int score_init = 0;
public int Score_fail() {return score_fail;} private int score_fail = 0;
public boolean Case_match() {return case_match;} private boolean case_match = Bool_.N;
public boolean Wildcard_enabled() {return wildcard_enabled;} private boolean wildcard_enabled = Bool_.N;
public byte[] Wildcard_char() {return wildcard_char;} private byte[] wildcard_char = Byte_ascii.Space_bry;
public byte[][] Wildcard_list() {return wildcard_list;} private byte[][] wildcard_list = Bry_.Ary(Byte_ascii.Space_bry);// \s,.!?:;'"-() /@#$%^&*()[]{}<>_+=|\~`
public int Target_tid() {return target_tid;} private int target_tid = Dg_match_mgr.Target_tid_wikitext;
public boolean Log_enabled() {return log_enabled;} private boolean log_enabled = Bool_.Y;
public Dg_match_mgr New_mgr(String domain_str, Io_url wiki_root_dir) {
if (!enabled) return null;
Io_url log_url = wiki_root_dir.GenSubFil("dansguardian_log.sqlite3");
Dg_match_mgr rv = new Dg_match_mgr(root_dir.GenSubDir(domain_str), score_init, score_fail, case_match, log_enabled, log_url);
return rv;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_root_dir)) return root_dir.Raw();
else if (ctx.Match(k, Invk_root_dir_)) root_dir = m.ReadIoUrl("v");
else if (ctx.Match(k, Invk_score_init)) return Int_.To_str(score_init);
else if (ctx.Match(k, Invk_score_init_)) score_init = m.ReadInt("v");
else if (ctx.Match(k, Invk_score_fail)) return Int_.To_str(score_fail);
else if (ctx.Match(k, Invk_score_fail_)) score_fail = m.ReadInt("v");
else if (ctx.Match(k, Invk_case_match)) return Yn.To_str(case_match);
else if (ctx.Match(k, Invk_case_match_)) case_match = m.ReadYn("v");
else if (ctx.Match(k, Invk_wildcard_enabled)) return Yn.To_str(wildcard_enabled);
else if (ctx.Match(k, Invk_wildcard_enabled_)) wildcard_enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_wildcard_char)) return String_.new_u8(wildcard_char);
else if (ctx.Match(k, Invk_wildcard_char_)) wildcard_char = m.ReadBry("v");
else if (ctx.Match(k, Invk_wildcard_list)) return "";
else if (ctx.Match(k, Invk_wildcard_list_)) {}
else if (ctx.Match(k, Invk_target_tid)) return Int_.To_str(target_tid);
else if (ctx.Match(k, Invk_target_tid_)) target_tid = m.ReadInt("v");
else if (ctx.Match(k, Invk_log_enabled)) return Yn.To_str(log_enabled);
else if (ctx.Match(k, Invk_log_enabled_)) log_enabled = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_enabled = "enabled" , Invk_enabled_ = "enabled_"
, Invk_root_dir = "root_dir" , Invk_root_dir_ = "root_dir_"
, Invk_score_init = "score_init" , Invk_score_init_ = "score_init_"
, Invk_score_fail = "score_fail" , Invk_score_fail_ = "score_fail_"
, Invk_case_match = "case_match" , Invk_case_match_ = "case_match_"
, Invk_wildcard_enabled = "wildcard_enabled" , Invk_wildcard_enabled_ = "wildcard_enabled_"
, Invk_wildcard_char = "wildcard_char" , Invk_wildcard_char_ = "wildcard_char_"
, Invk_wildcard_list = "wildcard_list" , Invk_wildcard_list_ = "wildcard_list_"
, Invk_target_tid = "target_tid" , Invk_target_tid_ = "target_tid_"
, Invk_log_enabled = "log_enabled" , Invk_log_enabled_ = "log_enabled_"
;
}

View File

@@ -0,0 +1,49 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.bldrs.filters.titles; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
public class Xoapi_title implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
// wordlist_dir = app.Fsys_mgr().Bin_xtns_dir().GenSubDir_nest("xowa", "DansGuardian");
}
public boolean Enabled() {return enabled;} private boolean enabled = Bool_.Y;
public Io_url Wordlist_dir() {return wordlist_dir;} private Io_url wordlist_dir;
public int Score_init() {return score_init;} private int score_init = 0;
public int Score_pass() {return score_pass;} private int score_pass = 0;
public boolean Log_enabled() {return log_enabled;} private boolean log_enabled = Bool_.Y;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_wordlist_dir)) return Int_.To_str(score_init);
else if (ctx.Match(k, Invk_wordlist_dir_)) wordlist_dir= m.ReadIoUrl("v");
else if (ctx.Match(k, Invk_score_init)) return Int_.To_str(score_init);
else if (ctx.Match(k, Invk_score_init_)) score_init = m.ReadInt("v");
else if (ctx.Match(k, Invk_score_pass)) return Int_.To_str(score_pass);
else if (ctx.Match(k, Invk_score_pass_)) score_pass = m.ReadInt("v");
else if (ctx.Match(k, Invk_log_enabled)) return Yn.To_str(enabled);
else if (ctx.Match(k, Invk_log_enabled_)) log_enabled = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_enabled = "enabled" , Invk_enabled_ = "enabled_"
, Invk_wordlist_dir = "wordlist_dir" , Invk_wordlist_dir_ = "wordlist_dir_"
, Invk_score_init = "score_init" , Invk_score_init_ = "score_init_"
, Invk_score_pass = "score_pas" , Invk_score_pass_ = "score_pass_"
, Invk_log_enabled = "log_enabled" , Invk_log_enabled_ = "log_enabled_"
;
}

View File

@@ -0,0 +1,93 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*;
import gplx.ios.*; import gplx.xowa.wikis.data.*;
public class Xoapi_import implements GfoInvkAble {
public long Layout_all_max() {return layout_all_max;} private long layout_all_max = 0; // disable by default; may set to 200 MB in future
public long Layout_text_max() {return layout_text_max;} private long layout_text_max = Io_size_.To_long_by_int_mb(1500); // 1.5 GB
public long Layout_html_max() {return layout_html_max;} private long layout_html_max = Io_size_.To_long_by_int_mb(1500); // 1.5 GB
public long Layout_file_max() {return layout_file_max;} private long layout_file_max = Io_size_.To_long_by_int_mb(1500); // 1.5 GB
public long Cat_link_db_max() {return cat_link_db_max;} private long cat_link_db_max = Io_size_.To_long_by_int_mb(1500); // 3.6 GB; v1
public long Text_db_max() {return text_db_max;} private long text_db_max = Io_size_.To_long_by_int_mb(1500); // 3.0 GB; v1
public long Html_db_max() {return html_db_max;} private long html_db_max = Io_size_.To_long_by_int_mb(1500); // 3.0 GB; v2; use same as text
public long File_db_max() {return file_db_max;} private long file_db_max = Io_size_.To_long_by_int_mb(1500); // 3.2 GB; v2
public byte[] Ns_file_map() {return ns_file_map;} private byte[] ns_file_map = Ns_file_map__each;
public byte Zip_tid_text() {return zip_tid_text;} private byte zip_tid_text = Io_stream_.Tid_gzip;
public byte Zip_tid_html() {return zip_tid_html;} private byte zip_tid_html = Io_stream_.Tid_gzip;
public String User_name() {return user_name;} private String user_name = "anonymous";
public Xowd_core_db_props New_props(String domain_str, long dump_file_size) {
Xowd_db_layout layout_text, layout_html, layout_file;
if (dump_file_size < layout_all_max)
layout_text = layout_html = layout_file = Xowd_db_layout.Itm_all;
else {
layout_text = dump_file_size < layout_text_max ? Xowd_db_layout.Itm_few : Xowd_db_layout.Itm_lot;
layout_html = dump_file_size < layout_html_max ? Xowd_db_layout.Itm_few : Xowd_db_layout.Itm_lot;
layout_file = dump_file_size < layout_file_max ? Xowd_db_layout.Itm_few : Xowd_db_layout.Itm_lot;
}
return new Xowd_core_db_props(2, layout_text, layout_html, layout_file, zip_tid_text, zip_tid_html);
}
public byte[] New_ns_file_map(long dump_file_size) {
return dump_file_size < layout_text_max ? Bry_.Empty : Ns_file_map__each;
}
public void Zip_tid_text_raw_() {zip_tid_text = Io_stream_.Tid_raw;} // TEST:
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_layout_all_max)) return Io_size_.To_str_mb(layout_all_max);
else if (ctx.Match(k, Invk_layout_all_max_)) layout_all_max = Io_size_.To_long_by_msg_mb(m, layout_all_max);
else if (ctx.Match(k, Invk_layout_text_max)) return Io_size_.To_str_mb(layout_text_max);
else if (ctx.Match(k, Invk_layout_text_max_)) layout_text_max = Io_size_.To_long_by_msg_mb(m, layout_text_max);
else if (ctx.Match(k, Invk_layout_html_max)) return Io_size_.To_str_mb(layout_html_max);
else if (ctx.Match(k, Invk_layout_html_max_)) layout_html_max = Io_size_.To_long_by_msg_mb(m, layout_html_max);
else if (ctx.Match(k, Invk_layout_file_max)) return Io_size_.To_str_mb(layout_file_max);
else if (ctx.Match(k, Invk_layout_file_max_)) layout_file_max = Io_size_.To_long_by_msg_mb(m, layout_file_max);
else if (ctx.Match(k, Invk_cat_link_db_max)) return Io_size_.To_str_mb(cat_link_db_max);
else if (ctx.Match(k, Invk_cat_link_db_max_)) cat_link_db_max = Io_size_.To_long_by_msg_mb(m, cat_link_db_max);
else if (ctx.Match(k, Invk_text_db_max)) return Io_size_.To_str_mb(text_db_max);
else if (ctx.Match(k, Invk_text_db_max_)) text_db_max = Io_size_.To_long_by_msg_mb(m, text_db_max);
else if (ctx.Match(k, Invk_html_db_max)) return Io_size_.To_str_mb(html_db_max);
else if (ctx.Match(k, Invk_html_db_max_)) html_db_max = Io_size_.To_long_by_msg_mb(m, html_db_max);
else if (ctx.Match(k, Invk_file_db_max)) return Io_size_.To_str_mb(file_db_max);
else if (ctx.Match(k, Invk_file_db_max_)) file_db_max = Io_size_.To_long_by_msg_mb(m, file_db_max);
else if (ctx.Match(k, Invk_ns_file_map)) return String_.new_u8(ns_file_map);
else if (ctx.Match(k, Invk_ns_file_map_)) ns_file_map = m.ReadBry("v");
else if (ctx.Match(k, Invk_zip_tid_text)) return Io_stream_.To_str(zip_tid_text);
else if (ctx.Match(k, Invk_zip_tid_text_)) zip_tid_text = Io_stream_.To_tid(m.ReadStr("v"));
else if (ctx.Match(k, Invk_zip_tid_list)) return Options_zip_tid__list;
else if (ctx.Match(k, Invk_zip_tid_html)) return Io_stream_.To_str(zip_tid_html);
else if (ctx.Match(k, Invk_zip_tid_html_)) zip_tid_html = Io_stream_.To_tid(m.ReadStr("v"));
else if (ctx.Match(k, Invk_user_name)) return user_name;
else if (ctx.Match(k, Invk_user_name_)) user_name = m.ReadStr("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static KeyVal[] Options_zip_tid__list = KeyVal_.Ary(KeyVal_.new_("raw", "text"), KeyVal_.new_("gzip"), KeyVal_.new_("bzip2"));
private static final String
Invk_layout_all_max = "layout_all_max" , Invk_layout_all_max_ = "layout_all_max_"
, Invk_layout_text_max = "layout_text_max" , Invk_layout_text_max_ = "layout_text_max_"
, Invk_layout_html_max = "layout_html_max" , Invk_layout_html_max_ = "layout_html_max_"
, Invk_layout_file_max = "layout_file_max" , Invk_layout_file_max_ = "layout_file_max_"
, Invk_cat_link_db_max = "cat_link_db_max" , Invk_cat_link_db_max_ = "cat_link_db_max_"
, Invk_text_db_max = "text_db_max" , Invk_text_db_max_ = "text_db_max_"
, Invk_html_db_max = "html_db_max" , Invk_html_db_max_ = "html_db_max_"
, Invk_file_db_max = "file_db_max" , Invk_file_db_max_ = "file_db_max_"
, Invk_ns_file_map = "ns_file_map" , Invk_ns_file_map_ = "ns_file_map_"
, Invk_zip_tid_text = "zip_tid_text" , Invk_zip_tid_text_ = "zip_tid_text_", Invk_zip_tid_list = "zip_tid_list"
, Invk_zip_tid_html = "zip_tid_html" , Invk_zip_tid_html_ = "zip_tid_html_"
, Invk_user_name = "user_name" , Invk_user_name_ = "user_name_"
;
public static final byte[] Ns_file_map__each = Bry_.new_a7("<each>");
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.envs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
public class Xoapi_env implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {}
public String Version_previous() {return version_previous;} private String version_previous = "";
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_version_previous)) return version_previous;
else if (ctx.Match(k, Invk_version_previous_)) version_previous = m.ReadStr("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_version_previous = "version_previous", Invk_version_previous_ = "version_previous_";
}

View File

@@ -0,0 +1,53 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.gui.browsers.*;
public class Xoapi_browser implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
url.Init_by_kit(app);
search.Init_by_kit(app);
tabs.Init_by_kit(app);
html.Init_by_kit(app);
find.Init_by_kit(app);
prog.Init_by_kit(app);
info.Init_by_kit(app);
prog_log.Init_by_kit(app);
}
public Xoapi_url Url() {return url;} private Xoapi_url url = new Xoapi_url();
public Xoapi_search Search() {return search;} private Xoapi_search search = new Xoapi_search();
public Xoapi_tabs Tabs() {return tabs;} private Xoapi_tabs tabs = new Xoapi_tabs();
public Xoapi_html_box Html() {return html;} private Xoapi_html_box html = new Xoapi_html_box();
public Xoapi_find Find() {return find;} private Xoapi_find find = new Xoapi_find();
public Xoapi_prog Prog() {return prog;} private Xoapi_prog prog = new Xoapi_prog();
public Xoapi_info Info() {return info;} private Xoapi_info info = new Xoapi_info();
public Xoapi_prog_log Prog_log() {return prog_log;} private Xoapi_prog_log prog_log = new Xoapi_prog_log();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_url)) return url;
else if (ctx.Match(k, Invk_search)) return search;
else if (ctx.Match(k, Invk_tabs)) return tabs;
else if (ctx.Match(k, Invk_html)) return html;
else if (ctx.Match(k, Invk_find)) return find;
else if (ctx.Match(k, Invk_prog)) return prog;
else if (ctx.Match(k, Invk_info)) return info;
else if (ctx.Match(k, Invk_prog_log)) return prog_log;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String
Invk_url = "url", Invk_search = "search", Invk_tabs = "tabs", Invk_html = "html"
, Invk_find = "find", Invk_prog = "prog", Invk_info = "info", Invk_prog_log = "prog_log";
}

View File

@@ -0,0 +1,55 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.cfgs.gui.*; import gplx.xowa.htmls.*;
public class Xoapi_font implements GfoInvkAble {
private Xoae_app app;
public void Init_by_kit(Xoae_app app) {
this.app = app;
}
public void Increase() {Adj(1);}
public void Decrease() {Adj(-1);}
public void Reset() {Set(false, Xoh_page_mgr.Font_size_default, Xocfg_win.Font_size_default);}
private void Adj(int adj) {
float html_font_size = app.Html_mgr().Page_mgr().Font_size() + adj;
float gui_font_size = app.Gui_mgr().Win_cfg().Font().Size() + adj; // (html_font_size * .75f) - 4; // .75f b/c 16px = 12 pt; -4 b/c gui font is currently 4 pt smaller
if (html_font_size < 1 || gui_font_size < 1) return;
Set(true, html_font_size, gui_font_size);
}
private void Set(boolean enabled, float html_font_size, float gui_font_size) {
if (html_font_size <= 0) return; // font must be positive
app.Html_mgr().Page_mgr().Font_enabled_(enabled);
app.Html_mgr().Page_mgr().Font_size_(html_font_size);
app.Cfg_mgr().Set_by_app("app.html.page.font_enabled", "y");
app.Cfg_mgr().Set_by_app("app.html.page.font_size", Float_.To_str(app.Html_mgr().Page_mgr().Font_size()));
app.Gui_mgr().Win_cfg().Font().Size_(gui_font_size);
app.Cfg_mgr().Set_by_app("app.gui.win_opts.font.size", Float_.To_str(gui_font_size));
app.Cfg_mgr().Db_save_txt();
app.Gui_mgr().Browser_win().Page__reload(); // NOTE: force reload; needed if viewing Help:Options/HTML, else Font size won't update
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_increase)) this.Increase();
else if (ctx.Match(k, Invk_decrease)) this.Decrease();
else if (ctx.Match(k, Invk_reset)) this.Reset();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_increase = "increase", Invk_decrease = "decrease", Invk_reset = "reset"
;
}

View File

@@ -0,0 +1,36 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.gui.pages.*;
public class Xoapi_page implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
view.Init_by_kit(app);
selection.Init_by_kit(app);
edit.Init_by_kit(app);
}
public Xoapi_view View() {return view;} private Xoapi_view view = new Xoapi_view();
public Xoapi_edit Edit() {return edit;} private Xoapi_edit edit = new Xoapi_edit();
public Xoapi_selection Selection() {return selection;} private Xoapi_selection selection = new Xoapi_selection();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_view)) return view;
else if (ctx.Match(k, Invk_selection)) return selection;
else if (ctx.Match(k, Invk_edit)) return edit;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_view = "view", Invk_selection = "selection", Invk_edit = "edit";
}

View File

@@ -0,0 +1,90 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
public class Xoapi_find implements GfoInvkAble {
private Xog_find_box find_box;
public void Init_by_kit(Xoae_app app) {
find_box = new Xog_find_box(app);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_show)) find_box.Show();
else if (ctx.Match(k, Invk_show_by_paste)) find_box.Show_by_paste();
else if (ctx.Match(k, Invk_exec)) find_box.Exec();
else if (ctx.Match(k, Invk_type)) find_box.Exec(); // NOTE: same as exec; provided so that exec doesn't accidentally overwrite auto-type for find
else if (ctx.Match(k, Invk_find_fwd)) find_box.Exec_by_dir(Bool_.Y);
else if (ctx.Match(k, Invk_find_bwd)) find_box.Exec_by_dir(Bool_.N);
else if (ctx.Match(k, Invk_case_toggle)) find_box.Case_toggle();
else if (ctx.Match(k, Invk_wrap_toggle)) find_box.Wrap_toggle();
else if (ctx.Match(k, Invk_hide)) find_box.Hide();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_show = "show", Invk_show_by_paste = "show_by_paste", Invk_hide = "hide", Invk_exec = "exec", Invk_type = "type"
, Invk_find_bwd = "find_bwd", Invk_find_fwd = "find_fwd", Invk_case_toggle = "case_toggle", Invk_wrap_toggle = "wrap_toggle";
}
class Xog_find_box {
private Xoae_app app; private Xog_win_itm win; private GfuiTextBox find_box;
private String prv_find_text; private boolean dir_fwd = true, case_match = false, wrap_search = true;
public Xog_find_box(Xoae_app app) {
this.app = app;
this.win = app.Gui_mgr().Browser_win();
this.find_box = win.Find_box();
}
public void Show() {app.Gui_mgr().Layout().Find_show();}
public void Hide() {
app.Gui_mgr().Layout().Find_close();
Xog_tab_itm tab = win.Tab_mgr().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
if (tab.View_mode() == Xopg_page_.Tid_read) // do not fire find("") for edit / html, else focus issues; DATE:2015-06-10
Exec_find(prv_find_text, Bool_.N);
}
public void Show_by_paste() {
this.Show();
if (win.Tab_mgr().Active_tab_is_null()) return; // if no active_tab, just show box; don't try to copy what's on tab;
find_box.Text_(win.Active_html_itm().Html_selected_get_text_or_href());
}
public void Exec_by_dir(boolean fwd) {
boolean changed = dir_fwd != fwd;
dir_fwd = fwd;
Exec();
if (changed) // clicking on buttons calls Exec_by_dir; in case of repeated clicks on same button, don't flash changed message again
win.Usr_dlg().Prog_direct("Find direction changed to " + (fwd ? "forward" : "backward"));
}
public void Exec() {
prv_find_text = find_box.Text();
Exec_find(prv_find_text, Bool_.Y);
}
private void Exec_find(String find, boolean highlight_matches) {
Xog_tab_itm tab = win.Tab_mgr().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
find = String_.Replace(find, "\\", "\\\\"); // NOTE: backslashes are always literal, never escape codes; EX: "C:\new" "\n" means "\n", not (byte)10; DATE:2015-08-17
boolean find_in_hdoc = tab.View_mode() == Xopg_page_.Tid_read;
if (find_in_hdoc)
tab.Html_box().Html_js_eval_proc_as_str(Xog_js_procs.Win__find_in_hdoc , find, dir_fwd, case_match, wrap_search, highlight_matches);
else
tab.Html_box().Html_js_eval_proc_as_str(Xog_js_procs.Win__find_in_textarea , find, dir_fwd, case_match, wrap_search);
win.Usr_dlg().Prog_direct("");
}
public void Case_toggle() {
case_match = !case_match;
win.Usr_dlg().Prog_direct("Case match " + (case_match ? "enabled" : "disabled"));
}
public void Wrap_toggle() {
wrap_search = !wrap_search;
win.Usr_dlg().Prog_direct("Wrap search " + (wrap_search ? "enabled" : "disabled"));
}
}

View File

@@ -0,0 +1,53 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
public class Xoapi_html_box implements GfoInvkAble, GfoEvMgrOwner {
private Xog_win_itm win;
public Xoapi_html_box() {
evMgr = GfoEvMgr.new_(this);
}
public GfoEvMgr EvMgr() {return evMgr;} private GfoEvMgr evMgr;
public void Init_by_kit(Xoae_app app) {this.win = app.Gui_mgr().Browser_win();}
public byte Load_tid() {return load_tid;} private byte load_tid;
public void Focus() {
Xog_tab_itm tab = win.Active_tab(); if (tab == Xog_tab_itm_.Null) return;
Gfui_html html_box = tab.Html_itm().Html_box();
html_box.Focus();
if (tab.View_mode() != Xopg_page_.Tid_read) // if edit / html, place focus in edit box
html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__elem_focus, Xog_html_itm.Elem_id__xowa_edit_data_box);
}
public void Selection_focus() {
Xog_tab_itm tab = win.Active_tab(); if (tab == Xog_tab_itm_.Null) return;
Gfui_html html_box = tab.Html_itm().Html_box();
html_box.Html_js_eval_proc_as_str(Xog_js_procs.Selection__toggle_focus_for_anchor);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_focus)) this.Focus();
else if (ctx.Match(k, Invk_selection_focus_toggle)) this.Selection_focus();
else if (ctx.Match(k, Invk_load_tid)) return Gxw_html_load_tid_.Xto_key(load_tid);
else if (ctx.Match(k, Invk_load_tid_)) {load_tid = Gxw_html_load_tid_.Xto_tid(m.ReadStr("v")); GfoEvMgr_.PubVal(this, Evt_load_tid_changed, load_tid);}
else if (ctx.Match(k, Invk_load_tid_list)) return Gxw_html_load_tid_.Options__list;
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_focus = "focus", Invk_selection_focus_toggle = "selection_focus_toggle"
, Invk_load_tid = "load_tid", Invk_load_tid_ = "load_tid_", Invk_load_tid_list = "load_tid_list"
;
public static final String Evt_load_tid_changed = "load_tid_changed";
}

View File

@@ -0,0 +1,46 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.views.*;
public class Xoapi_info implements Gfo_usr_dlg__gui__opt, GfoInvkAble {
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
public void Focus() {this.Win().Info_box().Focus();}
public void Clear() {app.Usr_dlg().Gui_wkr().Clear();}
public void Launch() {
Io_url session_fil = app.Log_wtr().Session_fil();
app.Prog_mgr().App_view_text().Run(session_fil);
}
public boolean Warn_enabled() {return warn_enabled;} private boolean warn_enabled;
public boolean Note_enabled() {return note_enabled;} private boolean note_enabled;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_focus)) this.Focus();
else if (ctx.Match(k, Invk_clear)) this.Clear();
else if (ctx.Match(k, Invk_launch)) this.Launch();
else if (ctx.Match(k, Invk_warn_enabled)) return Yn.To_str(warn_enabled);
else if (ctx.Match(k, Invk_warn_enabled_)) warn_enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_note_enabled)) return Yn.To_str(note_enabled);
else if (ctx.Match(k, Invk_note_enabled_)) note_enabled = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_focus = "focus", Invk_clear = "clear", Invk_launch = "launch"
, Invk_warn_enabled = "warn_enabled", Invk_warn_enabled_ = "warn_enabled_"
, Invk_note_enabled = "note_enabled", Invk_note_enabled_ = "note_enabled_"
;
}

View File

@@ -0,0 +1,34 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.views.*;
public class Xoapi_prog implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
public boolean Show_short_url() {return show_short_url;} private boolean show_short_url;
public void Focus() {this.Win().Prog_box().Focus();}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_focus)) this.Focus();
else if (ctx.Match(k, Invk_show_short_url)) return Yn.To_str(show_short_url);
else if (ctx.Match(k, Invk_show_short_url_)) show_short_url = m.ReadBool("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_focus = "focus", Invk_show_short_url = "show_short_url", Invk_show_short_url_ = "show_short_url_";
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.views.*;
public class Xoapi_prog_log implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
public void Show() {app.Gui_mgr().Show_prog();}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_show)) this.Show();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_show = "show";
}

View File

@@ -0,0 +1,34 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.views.*;
public class Xoapi_search implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
private GfuiTextBox Search_box() {return app.Gui_mgr().Browser_win().Search_box();}
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
public void Focus() {this.Search_box().Focus_select_all();}
public void Exec() {this.Win().Page__navigate_by_search();}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_focus)) this.Focus();
else if (ctx.Match(k, Invk_exec)) this.Exec();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_focus = "focus";
public static final String Invk_exec = "exec";
}

View File

@@ -0,0 +1,90 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.xowa.guis.views.*;
public class Xoapi_tabs implements GfoInvkAble {
private Xog_tab_mgr tab_mgr;
public void Init_by_kit(Xoae_app app) {
this.tab_mgr = app.Gui_mgr().Browser_win().Tab_mgr();
}
private boolean Active_tab_is_null() {return tab_mgr.Active_tab_is_null();}
public void New_dupe(boolean focus) {tab_mgr.Tabs_new_dupe(focus);}
public void New_dflt(boolean focus) {tab_mgr.Tabs_new_dflt(focus);}
public void New_link(boolean focus, String link) {tab_mgr.Tabs_new_link(focus, link);}
public void New_href(boolean focus) {
Xog_tab_itm tab = tab_mgr.Active_tab(); if (tab == Xog_tab_itm_.Null) return;
String link = tab.Html_itm().Html_selected_get_href_or_text();
if (String_.Len_eq_0(link)) {tab_mgr.Win().Usr_dlg().Prog_many("", "", "no link or text selected"); return;}
tab_mgr.Tabs_new_dflt(true);
tab_mgr.Win().Page__navigate_by_url_bar(link);
}
public void Close_cur() {tab_mgr.Tabs_close_cur();}
public void Select_bwd() {tab_mgr.Tabs_select(Bool_.N);}
public void Select_fwd() {tab_mgr.Tabs_select(Bool_.Y);}
public void Select_by_idx(int v) {tab_mgr.Tabs_select_by_idx(v - List_adp_.Base1);}
public void Move_bwd() {tab_mgr.Tabs_move(Bool_.N);}
public void Move_fwd() {tab_mgr.Tabs_move(Bool_.Y);}
public void Close_others() {tab_mgr.Tabs_close_others();}
public void Close_to_bgn() {tab_mgr.Tabs_close_to_bgn();}
public void Close_to_end() {tab_mgr.Tabs_close_to_end();}
public void Close_undo() {tab_mgr.Tabs_close_undo();}
public void Pin_toggle() {if (this.Active_tab_is_null()) return; tab_mgr.Active_tab().Pin_toggle();}
public void Tab_bookmark_all() {}//app.Gui_mgr().Browser_win().Tab_mgr().Tabs_close_others();}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_new_dflt__at_dflt__focus_y)) this.New_dflt(Bool_.Y);
else if (ctx.Match(k, Invk_new_link__at_dflt__focus_n)) this.New_link(Bool_.N, m.ReadStrOr("v", null));
else if (ctx.Match(k, Invk_new_link__at_dflt__focus_y)) this.New_link(Bool_.Y, m.ReadStrOr("v", null));
else if (ctx.Match(k, Invk_new_href__at_dflt__focus_y)) this.New_href(Bool_.Y);
else if (ctx.Match(k, Invk_new_dupe__at_dflt__focus_y)) this.New_dupe(Bool_.Y);
else if (ctx.Match(k, Invk_close_cur)) this.Close_cur();
else if (ctx.Match(k, Invk_select_bwd)) this.Select_bwd();
else if (ctx.Match(k, Invk_select_fwd)) this.Select_fwd();
else if (ctx.Match(k, Invk_move_bwd)) this.Move_bwd();
else if (ctx.Match(k, Invk_move_fwd)) this.Move_fwd();
else if (ctx.Match(k, Invk_close_others)) this.Close_others();
else if (ctx.Match(k, Invk_close_to_bgn)) this.Close_to_bgn();
else if (ctx.Match(k, Invk_close_to_end)) this.Close_to_end();
else if (ctx.Match(k, Invk_close_undo)) this.Close_undo();
else if (ctx.Match(k, Invk_pin_toggle)) this.Pin_toggle();
else if (ctx.Match(k, Invk_select_by_idx_1)) this.Select_by_idx(1);
else if (ctx.Match(k, Invk_select_by_idx_2)) this.Select_by_idx(2);
else if (ctx.Match(k, Invk_select_by_idx_3)) this.Select_by_idx(3);
else if (ctx.Match(k, Invk_select_by_idx_4)) this.Select_by_idx(4);
else if (ctx.Match(k, Invk_select_by_idx_5)) this.Select_by_idx(5);
else if (ctx.Match(k, Invk_select_by_idx_6)) this.Select_by_idx(6);
else if (ctx.Match(k, Invk_select_by_idx_7)) this.Select_by_idx(7);
else if (ctx.Match(k, Invk_select_by_idx_8)) this.Select_by_idx(8);
else if (ctx.Match(k, Invk_select_by_idx_9)) this.Select_by_idx(9);
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_new_dflt__at_dflt__focus_y = "new_dflt__at_dflt__focus_y"
, Invk_new_link__at_dflt__focus_n = "new_link__at_dflt__focus_n"
, Invk_new_link__at_dflt__focus_y = "new_link__at_dflt__focus_y"
, Invk_new_href__at_dflt__focus_y = "new_href__at_dflt__focus_y"
, Invk_new_dupe__at_dflt__focus_y = "new_dupe__at_dflt__focus_y"
, Invk_close_cur = "close_cur"
, Invk_select_bwd = "select_bwd", Invk_select_fwd = "select_fwd"
, Invk_move_bwd = "move_bwd", Invk_move_fwd = "move_fwd"
, Invk_close_others = "close_others", Invk_close_to_bgn = "close_to_bgn", Invk_close_to_end = "close_to_end", Invk_close_undo = "close_undo"
, Invk_pin_toggle = "pin_toggle"
, Invk_select_by_idx_1 = "select_by_idx_1", Invk_select_by_idx_2 = "select_by_idx_2", Invk_select_by_idx_3 = "select_by_idx_3", Invk_select_by_idx_4 = "select_by_idx_4", Invk_select_by_idx_5 = "select_by_idx_5"
, Invk_select_by_idx_6 = "select_by_idx_6", Invk_select_by_idx_7 = "select_by_idx_7", Invk_select_by_idx_8 = "select_by_idx_8", Invk_select_by_idx_9 = "select_by_idx_9"
;
}

View File

@@ -0,0 +1,62 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.views.*;
public class Xoapi_url implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
private GfuiTextBox Url_box() {return app.Gui_mgr().Browser_win().Url_box();}
public void Focus() {this.Url_box().Focus_select_all();}
public void Exec() {Exec_wkr(Bool_.N, this.Url_box().Text());}
public void Exec_by_paste() {Exec_wkr(Bool_.N, ClipboardAdp_.GetText());}
public void Exec_new_tab_by_paste() {Exec_wkr(Bool_.Y, ClipboardAdp_.GetText());}
public void Restore() {
Xog_tab_itm tab = app.Gui_mgr().Browser_win().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
this.Url_box().Text_(tab.Page().Url().To_str());
}
private void Exec_wkr(boolean new_tab, String urls_text) {
if (Op_sys.Cur().Tid_is_wnt())
urls_text = String_.Replace(urls_text, Op_sys.Wnt.Nl_str(), Op_sys.Lnx.Nl_str());
String[] urls = String_.Split(String_.Trim(urls_text), Op_sys.Lnx.Nl_str());
int urls_len = urls.length;
if (urls_len == 0) return;
if (urls_len == 1) {
String url = urls[0];
this.Url_box().Text_(url);
app.Gui_mgr().Browser_win().Page__navigate_by_url_bar(url);
}
else {
for (int i = 0; i < urls_len; i++) {
String url = urls[i];
if (String_.Has_at_bgn(url, "\"") && String_.Has_at_bgn(url, "\""))
url = String_.Mid(url, 1, String_.Len(url) - 1);
app.Gui_mgr().Browser_win().Tab_mgr().Tabs_new_link(url, false);
}
}
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_focus)) this.Focus();
else if (ctx.Match(k, Invk_exec)) this.Exec();
else if (ctx.Match(k, Invk_exec_by_paste)) this.Exec_by_paste();
else if (ctx.Match(k, Invk_exec_new_tab_by_paste)) this.Exec_new_tab_by_paste();
else if (ctx.Match(k, Invk_restore)) this.Restore();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_focus = "focus", Invk_exec_by_paste = "exec_by_paste", Invk_exec_new_tab_by_paste = "exec_new_tab_by_paste", Invk_restore = "restore";
public static final String Invk_exec = "exec";
}

View File

@@ -0,0 +1,57 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.wikis.pages.*;
public class Xoapi_edit implements GfoInvkAble {
private Xog_win_itm win;
public void Init_by_kit(Xoae_app app) {
win = app.Gui_mgr().Browser_win();
}
private boolean Active_tab_is_null() {return win.Tab_mgr().Active_tab_is_null();}
private boolean Active_tab_is_edit() {return !win.Tab_mgr().Active_tab_is_null() && win.Tab_mgr().Active_tab().View_mode() == Xopg_page_.Tid_edit;}
public void Copy() {if (Active_tab_is_null()) return; win.Kit().Clipboard().Copy(win.Active_html_itm().Html_selected_get_text_or_href());}
public void Select_all() {if (Active_tab_is_null()) return; GfoInvkAble_.InvkCmd(win.Win_box().Kit().Clipboard(), gplx.gfui.Gfui_clipboard_.Invk_select_all);}
public void Save() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Save(win.Active_tab(), false);}
public void Save_draft() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Save(win.Active_tab(), true);}
public void Preview() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Preview(win.Active_tab());}
public void Dbg_tmpl() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_page_.Tid_edit);}
public void Dbg_html() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_page_.Tid_html);}
public void Focus_edit_box(){if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Focus(win, Xog_html_itm.Elem_id__xowa_edit_data_box);}
public void Exec() {
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_copy)) this.Copy();
else if (ctx.Match(k, Invk_select_all)) this.Select_all();
else if (ctx.Match(k, Invk_save)) this.Save();
else if (ctx.Match(k, Invk_save_draft)) this.Save_draft();
else if (ctx.Match(k, Invk_preview)) this.Preview();
else if (ctx.Match(k, Invk_focus_edit_box)) this.Focus_edit_box();
else if (ctx.Match(k, Invk_dbg_tmpl)) this.Dbg_tmpl();
else if (ctx.Match(k, Invk_dbg_html)) this.Dbg_html();
else if (ctx.Match(k, Invk_exec)) this.Exec();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_copy = "copy"
, Invk_select_all = "select_all"
, Invk_save = "save", Invk_save_draft = "save_draft", Invk_preview = "preview"
, Invk_focus_edit_box = "focus_edit_box"
, Invk_dbg_tmpl = "dbg_tmpl", Invk_dbg_html = "dbg_html", Invk_exec = "exec"
;
}

View File

@@ -0,0 +1,52 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
public class Xoapi_selection implements GfoInvkAble {
private Xoae_app app; private Xog_win_itm win;
public void Init_by_kit(Xoae_app app) {
this.app = app;
win = app.Gui_mgr().Browser_win();
}
private boolean Active_tab_is_null() {return win.Tab_mgr().Active_tab_is_null();}
public void Copy() {if (Active_tab_is_null()) return; win.Kit().Clipboard().Copy(win.Active_html_itm().Html_selected_get_text_or_href());}
public void Select_all() {if (Active_tab_is_null()) return; GfoInvkAble_.InvkCmd(win.Win_box().Kit().Clipboard(), gplx.gfui.Gfui_clipboard_.Invk_select_all);}
public void Save_file_as() {
if (this.Active_tab_is_null()) return;
Xog_html_itm html_itm = win.Tab_mgr().Active_tab().Html_itm();
String src = html_itm.Html_selected_get_src_or_empty();
if (String_.Len_eq_0(src)) {app.Usr_dlg().Prog_many("", "", "no file selected: tab=~{0}", html_itm.Owner_tab().Page().Url().To_str()); return;}
Io_url src_url = Io_url_.http_any_(src, Op_sys.Cur().Tid_is_wnt());
String trg_name = src_url.NameAndExt();
if (String_.Has(src, "/thumb/")) trg_name = src_url.OwnerDir().NameOnly();
String trg = app.Gui_mgr().Kit().New_dlg_file(Gfui_kit_.File_dlg_type_save, "Select file to save to:").Init_file_(trg_name).Ask();
if (String_.Len_eq_0(trg)) return;
Io_url trg_url = Io_url_.new_fil_(trg);
Io_mgr.Instance.CopyFil(src_url, trg_url, true);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_copy)) this.Copy();
else if (ctx.Match(k, Invk_select_all)) this.Select_all();
else if (ctx.Match(k, Invk_save_file_as)) this.Save_file_as();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_copy = "copy", Invk_select_all = "select_all", Invk_save_file_as = "save_file_as"
;
}

View File

@@ -0,0 +1,61 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.wikis.pages.*;
public class Xoapi_view implements GfoInvkAble {
private Xoae_app app; private Xog_win_itm win;
public void Init_by_kit(Xoae_app app) {
this.app = app; this.win = app.Gui_mgr().Browser_win();
}
private boolean Active_tab_is_null() {return win.Tab_mgr().Active_tab_is_null();}
public void Mode_read() {Mode(Xopg_page_.Tid_read);}
public void Mode_edit() {Mode(Xopg_page_.Tid_edit);}
public void Mode_html() {Mode(Xopg_page_.Tid_html);}
private void Mode(byte v) {if (Active_tab_is_null()) return; win.Page__mode_(v);}
public void Reload() {if (Active_tab_is_null()) return; win.Page__reload();}
public void Refresh() {if (Active_tab_is_null()) return; win.Page__refresh();}
public void Print() {
if (this.Active_tab_is_null()) return;
win.Active_html_box().Html_js_eval_proc_as_str(Xog_js_procs.Win__print_preview);
}
public void Save_as() {
if (this.Active_tab_is_null()) return;
Xog_tab_itm tab = win.Tab_mgr().Active_tab();
String file_name = Xoa_app_.Utl__encoder_mgr().Fsys_safe().Encode_str(String_.new_u8(tab.Page().Ttl().Full_url())) + ".html";
String file_url = app.Gui_mgr().Kit().New_dlg_file(Gfui_kit_.File_dlg_type_save, "Select file to save to:").Init_file_(file_name).Ask();
if (String_.Len_eq_0(file_url)) return;
Io_mgr.Instance.SaveFilStr(file_url, tab.Html_box().Text());
app.Usr_dlg().Prog_many("", "", "saved page: file=~{0}", file_url);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_mode_read)) this.Mode_read();
else if (ctx.Match(k, Invk_mode_edit)) this.Mode_edit();
else if (ctx.Match(k, Invk_mode_html)) this.Mode_html();
else if (ctx.Match(k, Invk_reload)) this.Reload();
else if (ctx.Match(k, Invk_refresh)) this.Refresh();
else if (ctx.Match(k, Invk_print)) this.Print();
else if (ctx.Match(k, Invk_save_as)) this.Save_as();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_mode_read = "mode_read", Invk_mode_edit = "mode_edit", Invk_mode_html = "mode_html"
, Invk_reload = "reload", Invk_refresh = "refresh"
, Invk_print = "print", Invk_save_as = "save_as"
;
}

View File

@@ -0,0 +1,36 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.html.modules.*;
public class Xoapi_modules implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
popups.Init_by_app(app);
}
public Xoapi_collapsible Collapsible() {return collapsible;} private Xoapi_collapsible collapsible = new Xoapi_collapsible();
public Xoapi_navframe Navframe() {return navframe;} private Xoapi_navframe navframe = new Xoapi_navframe();
public Xoapi_toc Toc() {return toc;} private Xoapi_toc toc = new Xoapi_toc();
public Xoapi_popups Popups() {return popups;} private Xoapi_popups popups = new Xoapi_popups();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_collapsible)) return collapsible;
else if (ctx.Match(k, Invk_navframe)) return navframe;
else if (ctx.Match(k, Invk_toc)) return toc;
else if (ctx.Match(k, Invk_popups)) return popups;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_collapsible = "collapsible", Invk_navframe = "navframe", Invk_toc = "toc", Invk_popups = "popups";
}

View File

@@ -0,0 +1,30 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.core.btries.*;
public class Xoapi_page implements GfoInvkAble {
public void Ctor_by_app(Xoae_app app) {
toggle_mgr.Ctor_by_app(app);
}
public Xoapi_toggle_mgr Toggle_mgr() {return toggle_mgr;} private final Xoapi_toggle_mgr toggle_mgr = new Xoapi_toggle_mgr();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_toggles)) return toggle_mgr;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_toggles = "toggles";
}

View File

@@ -0,0 +1,35 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.html.skins.*;
public class Xoapi_skins implements GfoInvkAble {
private Hash_adp hash = Hash_adp_.new_();
public Xoapi_skins() {
server.Sidebar_home_enabled_(true);
hash.Add("desktop", desktop);
hash.Add("server", server);
}
public Xoapi_skin_app_base Desktop() {return desktop;} private Xoapi_skin_app_base desktop = new Xoapi_skin_app_base();
public Xoapi_skin_app_base Server () {return server ;} private Xoapi_skin_app_base server = new Xoapi_skin_app_base();
private GfoInvkAble Get(String key) {return (GfoInvkAble)hash.Get_by(key);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return Get(m.ReadStr("v"));
return this;
}
private static final String Invk_get = "get";
}

View File

@@ -0,0 +1,40 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.htmls.tidy.*;
public class Xoapi_tidy implements GfoInvkAble {
private Xoae_app app;
public void Init_by_kit(Xoae_app app) {
this.app = app;
}
public void Toggle() {
app.Html_mgr().Tidy_mgr().Enabled_toggle();
app.Gui_mgr().Browser_win().Page__refresh();
}
public void Engine_(byte v) {
app.Html_mgr().Tidy_mgr().Wkr_tid_(v);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_toggle)) this.Toggle();
else if (ctx.Match(k, Invk_engine_tidy_)) Engine_(Xoh_tidy_wkr_.Tid_tidy);
else if (ctx.Match(k, Invk_engine_jtidy_)) Engine_(Xoh_tidy_wkr_.Tid_jtidy);
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_toggle = "toggle", Invk_engine_tidy_ = "engine_tidy_", Invk_engine_jtidy_ = "engine_jtidy_";
}

View File

@@ -0,0 +1,93 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
public class Xoapi_toggle_itm implements GfoInvkAble {
private final Xoae_app app; // NOTE: needed to get "img_dir" below
private byte[] img_title_val_y, img_title_val_n;
public Xoapi_toggle_itm(Xoae_app app, byte[] key_bry) {
this.app = app; this.key_bry = key_bry;
}
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
public byte[] Heading_bry() {return heading_bry;} private byte[] heading_bry;
public byte[] Icon_src() {return icon_src;} private byte[] icon_src = Bry_.Empty;
public byte[] Icon_title() {return icon_title;} private byte[] icon_title = Bry_.Empty;
public byte[] Elem_display() {return elem_display;} private byte[] elem_display = Bry_.Empty;
public byte[] Html_toggle_hdr_cls() {return html_toggle_hdr_cls;} public Xoapi_toggle_itm Html_toggle_hdr_cls_(byte[] v) {html_toggle_hdr_cls = v; return this;} private byte[] html_toggle_hdr_cls = Bry_.Empty;
public boolean Visible() {return visible;} private boolean visible;
public Xoapi_toggle_itm Init(byte[] heading_bry) {
this.heading_bry = heading_bry; // NOTE: sets "Wikis" or "In other languages"; Wikidata twisties are empty;
this.icon_title = app.Usere().Msg_mgr().Val_by_key_obj(visible ? Img_title_msg_y : Img_title_msg_n); // set title ("show" or "hide")
Html_toggle_gen();
return this;
}
public Xoapi_toggle_itm Init_fsys(Io_url img_dir) {
if (Img_src_y == null) {
Img_src_y = img_dir.GenSubFil("twisty_down.png").To_http_file_bry();
Img_src_n = img_dir.GenSubFil("twisty_right.png").To_http_file_bry();
}
return this;
}
public void Init_msgs(byte[] img_title_val_y, byte[] img_title_val_n) {
this.img_title_val_y = img_title_val_y;
this.img_title_val_n = img_title_val_n;
Html_toggle_gen();
}
public byte[] Html_toggle_btn() {return html_toggle_btn;} private byte[] html_toggle_btn;
public byte[] Html_toggle_hdr() {return html_toggle_hdr;} private byte[] html_toggle_hdr;
private void Assert_img_src() {
if (Img_src_y == null) {
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.general");
Img_src_y = img_dir.GenSubFil("twisty_down.png").To_http_file_bry();
Img_src_n = img_dir.GenSubFil("twisty_right.png").To_http_file_bry();
}
}
private void Html_toggle_gen() {
Assert_img_src();// NOTE: must call Assert_img_src else wikidata twisties will be missing img; DATE:2015-08-05
if (visible) {
icon_src = Img_src_y;
icon_title = img_title_val_y;
elem_display = Img_display_y;
}
else {
icon_src = Img_src_n;
icon_title = img_title_val_n;
elem_display = Img_display_n;
}
Bry_fmtr fmtr = Bry_fmtr.new_(); Bry_bfr bfr = Bry_bfr.new_(8);
html_toggle_btn
= fmtr.Fmt_("<a href='javascript:xowa_toggle_visible(\"~{key}\");' style='text-decoration: none !important;'>~{heading}<img id='~{key}-toggle-icon' src='~{src}' title='~{title}' /></a>")
.Keys_("key", "src", "title", "heading").Bld_bry_many(bfr, key_bry, icon_src, icon_title, heading_bry)
;
html_toggle_hdr
= fmtr.Fmt_(" id='~{key}-toggle-elem' style='~{display}~{toggle_hdr_cls}'")
.Keys_("key", "display", "toggle_hdr_cls").Bld_bry_many(bfr, key_bry, elem_display, html_toggle_hdr_cls)
;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_visible)) return Yn.To_str(visible);
else if (ctx.Match(k, Invk_visible_)) this.visible = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_visible = "visible", Invk_visible_ = "visible_";
private static byte[] Img_src_y, Img_src_n; // assume these are the same for all itms
private static final byte[]
Img_title_msg_y = Bry_.new_a7("hide"), Img_title_msg_n = Bry_.new_a7("show")
, Img_display_y = Bry_.new_a7("display:;"), Img_display_n = Bry_.new_a7("display:none;")
;
}

View File

@@ -0,0 +1,52 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.cfgs.*;
public class Xoapi_toggle_mgr implements GfoInvkAble {
private Xoae_app app;
private final Ordered_hash hash = Ordered_hash_.New_bry();
public void Ctor_by_app(Xoae_app app) {this.app = app;}
public Xoapi_toggle_itm Get_or_new(String key_str) {
byte[] key_bry = Bry_.new_u8(key_str);
Xoapi_toggle_itm rv = (Xoapi_toggle_itm)hash.Get_by(key_bry);
if (rv == null) {
rv = new Xoapi_toggle_itm(app, key_bry);
hash.Add(key_bry, rv);
}
return rv;
}
public void Img_dir_(Io_url v) {
int len = hash.Count();
for (int i = 0; i < len; ++i) {
Xoapi_toggle_itm itm = (Xoapi_toggle_itm)hash.Get_at(i);
itm.Init_fsys(v);
}
}
public void Save(Xoa_cfg_mgr cfg_mgr) {
int len = hash.Count();
for (int i = 0; i < len; ++i) {
Xoapi_toggle_itm itm = (Xoapi_toggle_itm)hash.Get_at(i);
cfg_mgr.Set_by_app("xowa.api.html.page.toggles.get('" + String_.new_u8(itm.Key_bry()) + "').visible", Yn.To_str(itm.Visible()));
}
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return this.Get_or_new(m.ReadStr("key"));
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_get = "get";
}

View File

@@ -0,0 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
public class Xoapi_collapsible implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
}
public boolean Collapsed() {return collapsed;} private boolean collapsed;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
;
}

View File

@@ -0,0 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
public class Xoapi_navframe implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
}
public boolean Collapsed() {return collapsed;} private boolean collapsed;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
;
}

View File

@@ -0,0 +1,242 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
import gplx.xowa.htmls.modules.popups.*;
public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
private Xoae_app app;
public Xoapi_popups() {
evMgr = GfoEvMgr.new_(this);
}
public GfoEvMgr EvMgr() {return evMgr;} private GfoEvMgr evMgr;
public void Init_by_app(Xoae_app app) {this.app = app;}
public boolean Enabled() {return enabled;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = true;
public int Show_init_word_count() {return show_init_word_count;} private int show_init_word_count = Dflt_show_init_word_count;
public int Show_more_word_count() {return show_more_word_count;} private int show_more_word_count = Dflt_show_more_word_count;
public int Show_all_if_less_than() {return show_all_if_less_than;} private int show_all_if_less_than = Dflt_show_all_if_less_than;
public int Win_show_delay() {return win_show_delay;} private int win_show_delay = Dflt_win_show_delay;
public int Win_hide_delay() {return win_hide_delay;} private int win_hide_delay = Dflt_win_hide_delay;
public int Win_max_w() {return win_max_w;} private int win_max_w = Dflt_win_max_w;
public int Win_max_h() {return win_max_h;} private int win_max_h = Dflt_win_max_h;
public int Win_show_all_max_w() {return win_show_all_max_w;} private int win_show_all_max_w = Dflt_win_show_all_max_w;
public boolean Win_bind_focus_blur() {return win_bind_focus_blur;} private boolean win_bind_focus_blur = Dflt_win_bind_focus_blur;
public byte[] Xnde_ignore_ids() {return xnde_ignore_ids;} private byte[] xnde_ignore_ids = Dflt_xnde_ignore_ids;
public int Scan_len() {return scan_len;} private int scan_len = Dflt_scan_len;
public int Scan_max() {return scan_max;} private int scan_max = Dflt_scan_max;
public byte[] Ns_allowed() {return ns_allowed;} private byte[] ns_allowed = Dflt_ns_allowed;
public int Read_til_stop_fwd() {return read_til_stop_fwd;} private int read_til_stop_fwd = Dflt_read_til_stop_fwd;
public int Read_til_stop_bwd() {return read_til_stop_bwd;} private int read_til_stop_bwd = Dflt_read_til_stop_bwd;
public int Stop_if_hdr_after() {return stop_if_hdr_after;} private int stop_if_hdr_after = Dflt_stop_if_hdr_after;
public int Tmpl_tkn_max() {return tmpl_tkn_max;} private int tmpl_tkn_max = Dflt_tmpl_tkn_max;
public byte[] Tmpl_keeplist() {return tmpl_keeplist;} private byte[] tmpl_keeplist = Dflt_tmpl_keeplist;
public byte[] Html_fmtr_popup() {return html_fmtr_popup;} private byte[] html_fmtr_popup = Dflt_html_fmtr_popup;
public byte[] Html_fmtr_popup_dflt() {return html_fmtr_popup_dflt;} private byte[] html_fmtr_popup_dflt = Dflt_html_fmtr_popup;
public byte[] Html_fmtr_viewed() {return html_fmtr_viewed;} private byte[] html_fmtr_viewed = Dflt_html_fmtr_viewed;
public byte[] Html_fmtr_viewed_dflt() {return html_fmtr_viewed_dflt;} private byte[] html_fmtr_viewed_dflt = Dflt_html_fmtr_viewed;
public byte[] Html_fmtr_wiki() {return html_fmtr_wiki;} private byte[] html_fmtr_wiki = Dflt_html_fmtr_wiki;
public byte[] Html_fmtr_wiki_dflt() {return html_fmtr_wiki_dflt;} private byte[] html_fmtr_wiki_dflt = Dflt_html_fmtr_wiki;
public byte[] Html_fmtr_next_sect_fmt() {return html_fmtr_next_sect;} private byte[] html_fmtr_next_sect = Dflt_html_fmtr_next_sect;
public byte[] Html_fmtr_next_sect_fmt_dflt() {return html_fmtr_next_sect_dflt;} private byte[] html_fmtr_next_sect_dflt = Dflt_html_fmtr_next_sect;
public void Show_more(String popup_id) {
Xowe_wiki wiki = app.Gui_mgr().Browser_win().Active_tab().Wiki();
wiki.Html_mgr().Head_mgr().Popup_mgr().Show_more(popup_id);
}
public void Show_all(String popup_id) {
Xowe_wiki wiki = app.Gui_mgr().Browser_win().Active_tab().Wiki();
wiki.Html_mgr().Head_mgr().Popup_mgr().Show_all(popup_id);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_show_more)) Show_more(m.ReadStr("popup_id"));
else if (ctx.Match(k, Invk_show_all)) Show_all (m.ReadStr("popup_id"));
else if (ctx.Match(k, Invk_show_init_word_count)) return show_init_word_count;
else if (ctx.Match(k, Invk_show_init_word_count_)) {show_init_word_count = Set_int_gt_0(m, show_init_word_count, Evt_show_init_word_count_changed);}
else if (ctx.Match(k, Invk_show_more_word_count)) return show_more_word_count;
else if (ctx.Match(k, Invk_show_more_word_count_)) {show_more_word_count = Set_int_gt_0(m, show_more_word_count, Evt_show_more_word_count_changed);}
else if (ctx.Match(k, Invk_show_all_if_less_than)) return show_all_if_less_than;
else if (ctx.Match(k, Invk_show_all_if_less_than_)) {show_all_if_less_than = Set_int(m, show_all_if_less_than, Evt_show_all_if_less_than_changed);}
else if (ctx.Match(k, Invk_win_show_delay)) return win_show_delay;
else if (ctx.Match(k, Invk_win_show_delay_)) {win_show_delay = Set_int(m, win_show_delay, Evt_win_show_delay_changed);}
else if (ctx.Match(k, Invk_win_hide_delay)) return win_hide_delay;
else if (ctx.Match(k, Invk_win_hide_delay_)) {win_hide_delay = Set_int(m, win_hide_delay, Evt_win_hide_delay_changed);}
else if (ctx.Match(k, Invk_win_max_w)) return win_max_w;
else if (ctx.Match(k, Invk_win_max_w_)) {win_max_w = Set_int(m, win_max_w, Evt_win_max_w_changed);}
else if (ctx.Match(k, Invk_win_max_h)) return win_max_h;
else if (ctx.Match(k, Invk_win_max_h_)) {win_max_h = Set_int(m, win_max_h, Evt_win_max_h_changed);}
else if (ctx.Match(k, Invk_win_show_all_max_w)) return win_show_all_max_w;
else if (ctx.Match(k, Invk_win_show_all_max_w_)) {win_show_all_max_w = m.ReadInt("v");}
else if (ctx.Match(k, Invk_win_bind_focus_blur)) return Yn.To_str(win_bind_focus_blur);
else if (ctx.Match(k, Invk_win_bind_focus_blur_)) win_bind_focus_blur = m.ReadYn("v");
else if (ctx.Match(k, Invk_xnde_ignore_ids)) return String_.new_u8(xnde_ignore_ids);
else if (ctx.Match(k, Invk_xnde_ignore_ids_)) {xnde_ignore_ids = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_xnde_ignore_ids_changed, xnde_ignore_ids);}
else if (ctx.Match(k, Invk_scan_len)) return scan_len;
else if (ctx.Match(k, Invk_scan_len_)) {scan_len = Set_int_gt_0(m, scan_len, Evt_scan_len_changed);}
else if (ctx.Match(k, Invk_scan_max)) return scan_max;
else if (ctx.Match(k, Invk_scan_max_)) {scan_max = Set_int_gt_0(m, scan_max, Evt_scan_max_changed);}
else if (ctx.Match(k, Invk_read_til_stop_fwd)) return read_til_stop_fwd;
else if (ctx.Match(k, Invk_read_til_stop_fwd_)) {read_til_stop_fwd = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_read_til_stop_fwd_changed, read_til_stop_fwd);}
else if (ctx.Match(k, Invk_read_til_stop_bwd)) return read_til_stop_bwd;
else if (ctx.Match(k, Invk_read_til_stop_bwd_)) {read_til_stop_bwd = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_read_til_stop_bwd_changed, read_til_stop_bwd);}
else if (ctx.Match(k, Invk_stop_if_hdr_after)) return stop_if_hdr_after;
else if (ctx.Match(k, Invk_stop_if_hdr_after_)) {stop_if_hdr_after = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_stop_if_hdr_after_changed, stop_if_hdr_after);}
else if (ctx.Match(k, Invk_ns_allowed)) return String_.new_u8(ns_allowed);
else if (ctx.Match(k, Invk_ns_allowed_)) {ns_allowed = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_ns_allowed_changed, ns_allowed);}
else if (ctx.Match(k, Invk_tmpl_tkn_max)) return tmpl_tkn_max;
else if (ctx.Match(k, Invk_tmpl_tkn_max_)) {tmpl_tkn_max = m.ReadInt("v"); GfoEvMgr_.PubVal(this, Evt_tmpl_tkn_max_changed, tmpl_tkn_max);}
else if (ctx.Match(k, Invk_tmpl_keeplist)) return String_.new_u8(tmpl_keeplist);
else if (ctx.Match(k, Invk_tmpl_keeplist_)) {tmpl_keeplist = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_tmpl_keeplist_changed, tmpl_keeplist);}
else if (ctx.Match(k, Invk_html_fmtr_popup)) return String_.new_u8(html_fmtr_popup);
else if (ctx.Match(k, Invk_html_fmtr_popup_)) {html_fmtr_popup = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_html_fmtr_popup_changed, html_fmtr_popup);}
else if (ctx.Match(k, Invk_html_fmtr_popup_dflt)) return String_.new_u8(html_fmtr_popup_dflt);
else if (ctx.Match(k, Invk_html_fmtr_popup_dflt_)) {html_fmtr_popup_dflt = m.ReadBry("v");}
else if (ctx.Match(k, Invk_html_fmtr_viewed)) return String_.new_u8(html_fmtr_viewed);
else if (ctx.Match(k, Invk_html_fmtr_viewed_)) {html_fmtr_viewed = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_html_fmtr_viewed_changed, html_fmtr_viewed);}
else if (ctx.Match(k, Invk_html_fmtr_viewed_dflt)) return String_.new_u8(html_fmtr_viewed_dflt);
else if (ctx.Match(k, Invk_html_fmtr_viewed_dflt_)) {html_fmtr_viewed_dflt = m.ReadBry("v");}
else if (ctx.Match(k, Invk_html_fmtr_wiki)) return String_.new_u8(html_fmtr_wiki);
else if (ctx.Match(k, Invk_html_fmtr_wiki_)) {html_fmtr_wiki = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_html_fmtr_wiki_changed, html_fmtr_wiki);}
else if (ctx.Match(k, Invk_html_fmtr_wiki_dflt)) return String_.new_u8(html_fmtr_wiki_dflt);
else if (ctx.Match(k, Invk_html_fmtr_wiki_dflt_)) {html_fmtr_wiki_dflt = m.ReadBry("v");}
else if (ctx.Match(k, Invk_html_fmtr_next_sect)) return String_.new_u8(html_fmtr_next_sect);
else if (ctx.Match(k, Invk_html_fmtr_next_sect_)) {html_fmtr_next_sect = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_html_fmtr_next_sect_changed, html_fmtr_next_sect);}
else if (ctx.Match(k, Invk_html_fmtr_next_sect_dflt)) return String_.new_u8(html_fmtr_next_sect_dflt);
else if (ctx.Match(k, Invk_html_fmtr_next_sect_dflt_)) {html_fmtr_next_sect_dflt = m.ReadBry("v");}
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private int Set_int_gt_0(GfoMsg m, int cur_val, String evt) {
int tmp = m.ReadInt("v");
if (tmp < 1) return cur_val;
GfoEvMgr_.PubVal(this, evt, tmp);
return tmp;
}
private int Set_int(GfoMsg m, int cur_val, String evt) {
int tmp = m.ReadInt("v");
GfoEvMgr_.PubVal(this, evt, tmp);
return tmp;
}
private static final String
Invk_enabled = "enabled", Invk_enabled_ = "enabled_"
, Invk_show_init_word_count = "show_init_word_count", Invk_show_init_word_count_ = "show_init_word_count_"
, Invk_show_more_word_count = "show_more_word_count", Invk_show_more_word_count_ = "show_more_word_count_"
, Invk_show_all_if_less_than = "show_all_if_less_than", Invk_show_all_if_less_than_ = "show_all_if_less_than_"
, Invk_xnde_ignore_ids = "xnde_ignore_ids", Invk_xnde_ignore_ids_ = "xnde_ignore_ids_"
, Invk_scan_len = "scan_len", Invk_scan_len_ = "scan_len_"
, Invk_scan_max = "scan_max", Invk_scan_max_ = "scan_max_"
, Invk_show_more = "show_more", Invk_show_all = "show_all"
, Invk_html_fmtr_popup = "html_fmtr_popup" , Invk_html_fmtr_popup_ = "html_fmtr_popup"
, Invk_html_fmtr_viewed = "html_fmtr_viewed" , Invk_html_fmtr_viewed_ = "html_fmtr_viewed_"
, Invk_html_fmtr_wiki = "html_fmtr_wiki" , Invk_html_fmtr_wiki_ = "html_fmtr_wiki_"
, Invk_html_fmtr_next_sect = "html_fmtr_next_sect" , Invk_html_fmtr_next_sect_ = "html_fmtr_next_sect_"
, Invk_html_fmtr_popup_dflt = "html_fmtr_popup_dflt" , Invk_html_fmtr_popup_dflt_ = "html_fmtr_popup_dflt_"
, Invk_html_fmtr_viewed_dflt = "html_fmtr_viewed_dflt" , Invk_html_fmtr_viewed_dflt_ = "html_fmtr_viewed_dflt_"
, Invk_html_fmtr_wiki_dflt = "html_fmtr_wiki_dflt" , Invk_html_fmtr_wiki_dflt_ = "html_fmtr_wiki_dflt_"
, Invk_html_fmtr_next_sect_dflt = "html_fmtr_next_sect_dflt" , Invk_html_fmtr_next_sect_dflt_ = "html_fmtr_next_sect_dflt_"
, Invk_win_show_delay = "win_show_delay", Invk_win_show_delay_ = "win_show_delay_"
, Invk_win_hide_delay = "win_hide_delay", Invk_win_hide_delay_ = "win_hide_delay_"
, Invk_win_bind_focus_blur = "win_bind_focus_blur", Invk_win_bind_focus_blur_ = "win_bind_focus_blur_"
, Invk_win_max_w = "win_max_w", Invk_win_max_w_ = "win_max_w_"
, Invk_win_max_h = "win_max_h", Invk_win_max_h_ = "win_max_h_"
, Invk_win_show_all_max_w = "win_show_all_max_w", Invk_win_show_all_max_w_ = "win_show_all_max_w_"
, Invk_read_til_stop_fwd = "read_til_stop_fwd", Invk_read_til_stop_fwd_ = "read_til_stop_fwd_"
, Invk_read_til_stop_bwd = "read_til_stop_bwd", Invk_read_til_stop_bwd_ = "read_til_stop_bwd_"
, Invk_stop_if_hdr_after = "stop_if_hdr_after", Invk_stop_if_hdr_after_ = "stop_if_hdr_after_"
, Invk_ns_allowed = "ns_allowed", Invk_ns_allowed_ = "ns_allowed_"
, Invk_tmpl_tkn_max = "tmpl_tkn_max", Invk_tmpl_tkn_max_ = "tmpl_tkn_max_"
, Invk_tmpl_keeplist = "tmpl_keeplist", Invk_tmpl_keeplist_ = "tmpl_keeplist_"
;
public static final String
Evt_show_init_word_count_changed = "show_init_word_count_changed"
, Evt_show_more_word_count_changed = "show_more_word_count_changed"
, Evt_show_all_if_less_than_changed = "show_all_if_less_than_changed"
, Evt_win_show_delay_changed = "win_show_delay_changed"
, Evt_win_hide_delay_changed = "win_hide_delay_changed"
, Evt_win_max_w_changed = "win_max_w_changed"
, Evt_win_max_h_changed = "win_max_h_changed"
, Evt_xnde_ignore_ids_changed = "xnde_ignore_ids_changed"
, Evt_scan_len_changed = "scan_len_changed"
, Evt_scan_max_changed = "scan_max_changed"
, Evt_read_til_stop_fwd_changed = "read_til_stop_fwd_changed"
, Evt_read_til_stop_bwd_changed = "read_til_stop_bwd_changed"
, Evt_stop_if_hdr_after_changed = "stop_if_hdr_after_changed"
, Evt_ns_allowed_changed = "ns_allowed_changed"
, Evt_tmpl_tkn_max_changed = "tmpl_tkn_max_changed"
, Evt_tmpl_keeplist_changed = "tmpl_keeplist"
, Evt_html_fmtr_popup_changed = "html_fmtr_popup_changed"
, Evt_html_fmtr_viewed_changed = "html_fmtr_viewed_changed"
, Evt_html_fmtr_wiki_changed = "html_fmtr_wiki_changed"
, Evt_html_fmtr_next_sect_changed = "html_fmtr_next_sect_changed"
;
public static final byte[]
Dflt_xnde_ignore_ids = Bry_.new_a7("coordinates")
, Dflt_tmpl_keeplist = Bry_.new_a7("en.wikipedia.org|formatnum;age;age_in_days;age_in_years_and_days*;nts;number_table_sorting*;as_of;oldstyledatedy;gregorian_serial_date;currentminute;currentsecond;dmca;spaced_ndash;trim;month*;convert*;worldpop*;ipa*;lang*;nowrap*;h:*;mvar;math;vgy;audio;iso_639_name;transl;translate;linktext;zh;nihongo*;japanese_name;ko-hhrm;mp|\n")
, Dflt_html_fmtr_popup = Bry_.new_a7(String_.Concat_lines_nl_skip_last
( "<div dir=~{page_lang_ltr}>"
, " <div>~{content}"
, " </div>"
, " <hr/>"
, " <div>"
, " <span class='data_val'><b>~{page_title}</b></span>~{wiki_item}"
, " <span class='data_key'>~{<>msgs.get('api-xowa.html.modules.popups.msgs.size-name');<>}</span><span class='data_val'>~{page_size}</span>"
, " <span class='data_key'>~{<>msgs.get('api-xowa.html.modules.popups.msgs.edited-name');<>}</span><span class='data_val'>~{edit_time}</span>~{view_time_item}"
, " </div>"
, " <hr/>"
, " <div style='float:bottom;'>"
, " <span><a href='xowa-cmd:xowa.api.nav.goto(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.url.exec-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/page/open.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_y-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tabs/new.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_n(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_n-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tabs/new_background.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.usr.bookmarks.add(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.usr.bookmarks.add-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/bookmarks/add.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.html.modules.popups.show_more(\"~{popup_id}\");' title='~{<>msgs.get('api-xowa.html.modules.popups.show_more-tip');<>}'><img src='~{xowa_root_dir}bin/any/xowa/html/res/src/xowa/popups/imgs/show_more.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.html.modules.popups.show_all (\"~{popup_id}\");' title='~{<>msgs.get('api-xowa.html.modules.popups.show_all-tip');<>}'> <img src='~{xowa_root_dir}bin/any/xowa/html/res/src/xowa/popups/imgs/show_all.png' ></a></span>"
, " <span><a href='/wiki/Special:XowaPopupHistory' title='~{<>msgs.get('api-xowa.html.modules.popups.history-tip');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/history/show.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"home/wiki/Help:Options/Popups\");' title='~{<>msgs.get('api-xowa.nav.cfg.main-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tools/options.png'></a></span>"
, " </div>"
, "</div>"
))
, Dflt_html_fmtr_viewed = Bry_.new_a7("\n <span class='data_key'>~{<>msgs.get('api-xowa.html.modules.popups.msgs.view_time-name');<>}</span><span class='data_val'>~{viewed_val}</span>")
, Dflt_html_fmtr_wiki = Bry_.new_a7("\n <span class='data_key'>~{<>msgs.get('api-xowa.html.modules.popups.msgs.wiki-name');<>}</span><span class='data_val'>~{wiki_val}</span>")
, Dflt_html_fmtr_next_sect = Bry_.new_a7("\n\n<span class='next_sect'>~{<>msgs.get('api-xowa.html.modules.popups.msgs.next_sect-name');<>}~{next_sect_val}</span>")
;
public static final String[]
Dflt_html_fmtr_popup_keys = String_.Ary("content", "page_lang_ltr", "page_url", "page_title", "popup_id", "wiki_item", "page_size", "edit_time", "view_time_item", "xowa_root_dir")
, Dflt_html_fmtr_viewed_keys = String_.Ary("viewed_val")
, Dflt_html_fmtr_wiki_keys = String_.Ary("wiki_val")
, Dflt_html_fmtr_next_sect_keys = String_.Ary("next_sect_val")
;
public static final byte[]
Dflt_ns_allowed = Bry_.Empty
;
public static final int
Dflt_show_init_word_count = 128
, Dflt_show_more_word_count = 192
, Dflt_show_all_if_less_than = -1
, Dflt_show_all_win_max_w = -1
, Dflt_win_show_delay = 600, Dflt_win_hide_delay = 400
, Dflt_win_max_w = -1, Dflt_win_max_h = -1
, Dflt_win_show_all_max_w = 800
, Dflt_scan_len = 1 * Io_mgr.Len_kb
, Dflt_scan_max = 32 * Io_mgr.Len_kb
, Dflt_read_til_stop_fwd = 32
, Dflt_read_til_stop_bwd = 16
, Dflt_stop_if_hdr_after = 96
, Dflt_tmpl_tkn_max = 8 * Io_mgr.Len_kb
;
public static final boolean
Dflt_win_bind_focus_blur = false
;
}

View File

@@ -0,0 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
public class Xoapi_toc implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
}
public boolean Collapsed() {return collapsed;} private boolean collapsed = false;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_collapsed = "collapsed", Invk_collapsed_ = "collapsed_"
;
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.html.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
public class Xoapi_skin_app_base implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
}
public boolean Sidebar_home_enabled() {return sidebar_home_enabled;} public void Sidebar_home_enabled_(boolean v) {sidebar_home_enabled = v;} private boolean sidebar_home_enabled;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_sidebar_home_enabled)) return Yn.To_str(sidebar_home_enabled);
else if (ctx.Match(k, Invk_sidebar_home_enabled_)) sidebar_home_enabled = m.ReadYn("v");
return this;
}
private static final String Invk_sidebar_home_enabled = "sidebar_home_enabled", Invk_sidebar_home_enabled_ = "sidebar_home_enabled_";
}

View File

@@ -0,0 +1,40 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.navs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.guis.views.*;
import gplx.xowa.htmls.hrefs.*;
public class Xoapi_wiki implements GfoInvkAble {
private Xog_win_itm win;
public void Init_by_kit(Xoae_app app) {
win = app.Gui_mgr().Browser_win();
}
public void Random() {win.Page__navigate_by_url_bar("Special:Random");}
public void Sandbox() {win.Page__navigate_by_url_bar("Project:Sandbox");}
public void Main_page() {
win.Tab_mgr().Active_tab_assert(); // force an active tab in case all tabs are closed; needed for win.Active_page() below; DATE:2014-09-17
win.Page__navigate_by_url_bar(win.Active_tab().Wiki().Domain_str() + Xoh_href_.Str__wiki); // NOTE: add "/wiki/" to generate non-page like url; EX: "home" -> "home/wiki/" which will be interpreted as a url, as opposed to "home" which will be intrepretted as page; DATE:2014-04-14
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_main_page)) this.Main_page();
else if (ctx.Match(k, Invk_random)) this.Random();
else if (ctx.Match(k, Invk_sandbox)) this.Sandbox();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_main_page = "main_page", Invk_random = "random", Invk_sandbox = "sandbox";
}

View File

@@ -0,0 +1,73 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
private final Xow_domain_crt_kv_itm_mgr multi_wikis_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_wikis_bry = Dflt_multi_wikis_bry;
private final Xow_domain_crt_kv_itm_mgr multi_sorts_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_sorts_bry = Dflt_multi_sorts_bry;
public Xoapi_search() {
this.evMgr = GfoEvMgr.new_(this);
multi_wikis_mgr.Parse_as_itms(multi_wikis_bry);
multi_sorts_mgr.Parse_as_arys(multi_sorts_bry);
}
public GfoEvMgr EvMgr() {return evMgr;} private GfoEvMgr evMgr;
public int Results_per_page() {return results_per_page;} private int results_per_page = 20;
public boolean Async_db() {return async_db;} private boolean async_db = true;
public void Multi_wikis_bry_(byte[] v) {
if (!multi_wikis_mgr.Parse_as_itms(v)) return;
this.multi_wikis_bry = v;
GfoEvMgr_.PubVal(this, Evt_multi_wikis_changed, v);
}
public Xow_domain_crt_itm Multi_wikis_crt(Xow_domain_itm cur_domain) {
return multi_wikis_mgr.Find_itm(cur_domain, cur_domain);
}
public void Multi_sorts_bry_(byte[] v) {
if (!multi_sorts_mgr.Parse_as_arys(v)) return;
this.multi_sorts_bry = v;
GfoEvMgr_.PubVal(this, Evt_multi_sorts_changed, v);
}
public Xow_domain_crt_itm[] Multi_sorts_crt(Xow_domain_itm cur_domain) {
return multi_sorts_mgr.Find_ary(cur_domain, cur_domain);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_results_per_page)) return results_per_page;
else if (ctx.Match(k, Invk_results_per_page_)) results_per_page = m.ReadInt("v");
else if (ctx.Match(k, Invk_async_db)) return Yn.To_str(async_db);
else if (ctx.Match(k, Invk_async_db_)) async_db = m.ReadYn("v");
else if (ctx.Match(k, Invk_multi_wikis)) return String_.new_u8(multi_wikis_bry);
else if (ctx.Match(k, Invk_multi_wikis_)) Multi_wikis_bry_(m.ReadBry("v"));
else if (ctx.Match(k, Invk_multi_sorts)) return String_.new_u8(multi_sorts_bry);
else if (ctx.Match(k, Invk_multi_sorts_)) Multi_sorts_bry_(m.ReadBry("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_results_per_page = "results_per_page" , Invk_results_per_page_ = "results_per_page_"
, Invk_async_db = "async_db" , Invk_async_db_ = "async_db_"
, Invk_multi_wikis = "multi_wikis" , Invk_multi_wikis_ = "multi_wikis_"
, Invk_multi_sorts = "multi_sorts" , Invk_multi_sorts_ = "multi_sorts_"
;
public static final String
Evt_multi_wikis_changed = "multi_wikis_changed"
, Evt_multi_sorts_changed = "multi_sorts_changed"
;
public static final byte[]
Dflt_multi_wikis_bry = Bry_.new_a7("<any>|<self>")
, Dflt_multi_sorts_bry = Bry_.new_a7("<any>|<self>,*.wikipedia,*.wikivoyage,*.wiktionary,*.wikisource,*.wikiquote,*.wikibooks,*.wikiversity,*.wikinews")
;
}

View File

@@ -0,0 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.startups; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.startups.tabs.*;
public class Xoapi_startups implements GfoInvkAble {
public void Init_by_kit(Xoae_app app) {
}
public Xoapi_startup_tabs Tabs() {return tabs;} private Xoapi_startup_tabs tabs = new Xoapi_startup_tabs();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_tabs)) return tabs;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_tabs = "tabs";
}

View File

@@ -0,0 +1,87 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.startups.*;
import gplx.xowa.specials.*;
public class Xoapi_startup_tabs implements GfoInvkAble {
public String Custom() {return custom;} private String custom;
public boolean Custom_is_expr() {return custom_is_expr;} private boolean custom_is_expr;
public String Previous() {return previous;} private String previous;
public String Manual() {return manual;} public void Manual_(String v) {manual = v;} private String manual;
public byte Type() {return type;} private byte type = Xoapi_startup_tabs_tid_.Tid_previous;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_type)) return Xoapi_startup_tabs_tid_.Xto_key(type);
else if (ctx.Match(k, Invk_type_)) type = Xoapi_startup_tabs_tid_.Xto_tid(m.ReadStr("v"));
else if (ctx.Match(k, Invk_type_list)) return Xoapi_startup_tabs_tid_.Options__list;
else if (ctx.Match(k, Invk_previous)) return previous;
else if (ctx.Match(k, Invk_previous_)) previous = m.ReadStr("v");
else if (ctx.Match(k, Invk_custom)) return custom;
else if (ctx.Match(k, Invk_custom_)) custom = m.ReadStr("v");
else if (ctx.Match(k, Invk_custom_is_expr)) return Yn.To_str(custom_is_expr);
else if (ctx.Match(k, Invk_custom_is_expr_)) custom_is_expr = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_type = "type", Invk_type_ = "type_", Invk_type_list = "type_list"
, Invk_custom = "custom", Invk_custom_ = "custom_"
, Invk_previous = "previous", Invk_previous_ = "previous_"
, Invk_custom_is_expr = "custom_is_expr", Invk_custom_is_expr_ = "custom_is_expr_"
;
public String[] Calc_startup_strs(Xoae_app app) {
List_adp rv = List_adp_.new_();
String xowa_home = gplx.xowa.users.Xouc_pages_mgr.Page_xowa;
if (manual == null) {
switch (type) {
case Xoapi_startup_tabs_tid_.Tid_blank: rv.Add(Xows_special_meta_.Itm__default_tab.Ttl_str()); break;
case Xoapi_startup_tabs_tid_.Tid_xowa: rv.Add(xowa_home); break;
case Xoapi_startup_tabs_tid_.Tid_custom: Add_ary(rv, custom); break;
case Xoapi_startup_tabs_tid_.Tid_previous: Add_ary(rv, previous); break;
default: throw Err_.new_unhandled(type);
}
}
else
rv.Add(manual);
Add_xowa_home_if_new_version(rv, app, xowa_home);
return rv.To_str_ary();
}
private static void Add_ary(List_adp list, String s) {
if (String_.Len_eq_0(s)) return;
String[] ary = String_.SplitLines_nl(String_.Trim(s));
int len = ary.length;
for (int i = 0; i < len; ++i) {
String itm = ary[i];
if (String_.Len_eq_0(itm)) continue;
list.Add(itm);
}
}
private static void Add_xowa_home_if_new_version(List_adp rv, Xoae_app app, String xowa_home) {
if (gplx.xowa.apps.versions.Xoa_version_.Compare(app.Api_root().App().Env().Version_previous(), Xoa_app_.Version) == CompareAble_.Less) {
boolean xowa_home_exists = false;
int len = rv.Count();
for (int i = 0; i < len; ++i) {
String itm = (String)rv.Get_at(i);
if (String_.Eq(itm, xowa_home)) {
xowa_home_exists = true;
break;
}
}
if (!xowa_home_exists)
rv.Add(xowa_home);
}
}
}

View File

@@ -0,0 +1,39 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.startups.*;
public class Xoapi_startup_tabs_tid_ {
public static final byte Tid_blank = 0, Tid_xowa = 1, Tid_previous = 2, Tid_custom = 3;
public static final String Key_blank = "blank", Key_xowa = "xowa", Key_previous = "previous", Key_custom = "custom";
public static String Xto_key(byte v) {
switch (v) {
case Tid_blank: return Key_blank;
case Tid_xowa: return Key_xowa;
case Tid_previous: return Key_previous;
case Tid_custom: return Key_custom;
default: throw Err_.new_unimplemented();
}
}
public static byte Xto_tid(String s) {
if (String_.Eq(s, Key_blank)) return Tid_blank;
else if (String_.Eq(s, Key_xowa)) return Tid_xowa;
else if (String_.Eq(s, Key_previous)) return Tid_previous;
else if (String_.Eq(s, Key_custom)) return Tid_custom;
else throw Err_.new_unimplemented();
}
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_blank), KeyVal_.new_(Key_xowa), KeyVal_.new_(Key_previous), KeyVal_.new_(Key_custom));
}

View File

@@ -0,0 +1,59 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.guis.history.*; import gplx.xowa.guis.views.*;
import gplx.xowa.users.bmks.*;
import gplx.xowa.wikis.*;
public class Xoapi_bookmarks implements GfoInvkAble {
private Xoae_app app; private Xog_win_itm win;
public void Ctor_by_app(Xoae_app app) {this.app = app;}
public void Init_by_kit(Xoae_app app) {this.win = app.Gui_mgr().Browser_win();}
public boolean Enabled() {return enabled;} private boolean enabled = true;
public void Enabled_(boolean v) {enabled = v;}
public boolean Delete_confirm() {return delete_confirm;} private boolean delete_confirm = true;
public void Show() {win.Page__navigate_by_url_bar("home/wiki/Special:XowaBookmarks");}
public String Add(String url_str) {
if (!enabled) return app.Html__bridge_mgr().Msg_bldr().To_json_str__empty();
Xoa_url url = null;
if (url_str == null) {
Xog_tab_itm tab = win.Active_tab(); if (tab == Xog_tab_itm_.Null) return app.Html__bridge_mgr().Msg_bldr().Clear().Notify_pass_("bookmark added").To_json_str(); // called by http_server; return success
url = tab.Page().Url();
}
else
url = app.User().Wikii().Utl__url_parser().Parse(Bry_.new_u8(url_str));
app.User().User_db_mgr().Bmk_mgr().Itms__add(Xoud_bmk_mgr.Owner_root, url);
String msg = "bookmark added: " + String_.new_u8(url.Page_bry());
String rv = app.Html__bridge_mgr().Msg_bldr().Clear().Notify_pass_(msg).To_json_str();
win.Active_tab().Html_box().Html_js_eval_proc_as_str("xowa.cmds.exec_by_str", "xowa.notify", "{\"text\":\"" + msg + "\",\"status\":\"success\"}");
return rv;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
else if (ctx.Match(k, Invk_delete_confirm)) return Yn.To_str(delete_confirm);
else if (ctx.Match(k, Invk_delete_confirm_)) delete_confirm = m.ReadYn("v");
else if (ctx.Match(k, Invk_add)) return this.Add(m.ReadStrOr("v", null));
else if (ctx.Match(k, Invk_show)) this.Show();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_enabled = "enabled", Invk_enabled_ = "enabled_"
, Invk_delete_confirm = "delete_confirm", Invk_delete_confirm_ = "delete_confirm_"
, Invk_add = "add", Invk_show = "show";
}

View File

@@ -0,0 +1,51 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.ios.*; import gplx.xowa.files.caches.*;
public class Xoapi_cache implements GfoInvkAble {
private Xou_cache_mgr cache_mgr;
public void Init_by_app(Xoa_app app) {this.cache_mgr = app.User().User_db_mgr().Cache_mgr();}
private String Info() {
cache_mgr.Page_bgn();
Bry_bfr bfr = Bry_bfr.new_(255);
KeyVal[] ary = cache_mgr.Info();
int len = ary.length;
for (int i = 0; i < len; ++i) {
KeyVal kv = ary[i];
bfr.Add_str_a7(kv.Key()).Add_str_a7(": ").Add_str_u8(kv.Val_to_str_or_empty()).Add_byte_nl();
}
return bfr.To_str_and_clear();
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_fsys_size_min)) return cache_mgr.Fsys_size_min() / Io_mgr.Len_mb;
else if (ctx.Match(k, Invk_fsys_size_min_)) cache_mgr.Fsys_size_min_(Io_size_.To_long_by_msg_mb(m, cache_mgr.Fsys_size_min()));
else if (ctx.Match(k, Invk_fsys_size_max)) return cache_mgr.Fsys_size_max() / Io_mgr.Len_mb;
else if (ctx.Match(k, Invk_fsys_size_max_)) cache_mgr.Fsys_size_max_(Io_size_.To_long_by_msg_mb(m, cache_mgr.Fsys_size_max()));
else if (ctx.Match(k, Invk_info)) return Info();
else if (ctx.Match(k, Invk_reduce_to_min)) cache_mgr.Reduce(cache_mgr.Fsys_size_min());
else if (ctx.Match(k, Invk_reduce_to_zero)) cache_mgr.Reduce(0);
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_fsys_size_min = "fsys_size_min" , Invk_fsys_size_min_ = "fsys_size_min_"
, Invk_fsys_size_max = "fsys_size_max" , Invk_fsys_size_max_ = "fsys_size_max_"
, Invk_info = "info"
, Invk_reduce_to_min = "reduce_to_min" , Invk_reduce_to_zero = "reduce_to_zero"
;
}

View File

@@ -0,0 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.guis.views.*;
public class Xoapi_history implements GfoInvkAble {
private Xoae_app app; private Xog_win_itm win;
public void Ctor_by_app(Xoae_app app) {this.app = app;}
public void Init_by_kit(Xoae_app app) {this.win = app.Gui_mgr().Browser_win();}
public boolean Enabled() {return enabled;} private boolean enabled = true;
public void Enabled_(boolean v) {enabled = v;}
public void Goto_recent() {win.Page__navigate_by_url_bar(app.Usere().History_mgr().Get_at_last());}
public void Show() {win.Page__navigate_by_url_bar("home/wiki/Special:XowaPageHistory");}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(this.Enabled());
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
else if (ctx.Match(k, Invk_goto_recent)) this.Goto_recent();
else if (ctx.Match(k, Invk_show)) this.Show();
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_enabled = "enabled", Invk_enabled_ = "enabled_", Invk_goto_recent = "goto_recent", Invk_show = "show";
}

View File

@@ -0,0 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.guis.views.*;
public class Xoapi_logs implements GfoInvkAble {
private Xoae_app app;
public void Ctor_by_app(Xoae_app app) {this.app = app;}
public void Init_by_kit(Xoae_app app) {}
public boolean Enabled() {return app.Log_wtr().Enabled();}
public void Enabled_(boolean v) {
app.Log_wtr().Enabled_(v);
if (!v)
Io_mgr.Instance.DeleteFil_args(app.Log_wtr().Session_fil()).MissingFails_off().Exec();
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(this.Enabled());
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_enabled = "enabled", Invk_enabled_ = "enabled_";
}

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.wikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.wikis.langs.*;
public class Xoapi_wiki_lang implements GfoInvkAble {
public Xoap_lang_variants Variants() {return variants;} private final Xoap_lang_variants variants = new Xoap_lang_variants();
public void Subscribe(GfoEvObj sub) {variants.Subscribe(sub);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_variants)) return variants;
else return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_variants = "variants";
}

View File

@@ -0,0 +1,43 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.wikis.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.wikis.*;
public class Xoap_lang_variants implements GfoInvkAble, GfoEvMgrOwner {
public Xoap_lang_variants() {
this.ev_mgr = GfoEvMgr.new_(this);
}
public GfoEvMgr EvMgr() {return ev_mgr;} private final GfoEvMgr ev_mgr;
public byte[] Current() {return current;} private byte[] current;
public void Current_(byte[] v) {
this.current = v;
GfoEvMgr_.PubVal(this, Evt_current_changed, v);
}
public void Subscribe(GfoEvObj sub) {
GfoEvMgr_.SubSame(this, Evt_current_changed, sub);
if (current != null) GfoInvkAble_.InvkCmd_val(sub, Evt_current_changed, current);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_current)) return String_.new_u8(current);
else if (ctx.Match(k, Invk_current_)) Current_(m.ReadBry("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_current = "current", Invk_current_ = "current_";
public static final String
Evt_current_changed = "current_changed"
;
}

View File

@@ -0,0 +1,38 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
public class Xoapi_scribunto implements GfoInvkAble {
private Xoae_app app;
public void Init_by_kit(Xoae_app app) {
this.app = app;
}
public void Engine_(byte v) {
Scrib_xtn_mgr scrib_xtn = (Scrib_xtn_mgr)app.Xtn_mgr().Get_or_fail(Scrib_xtn_mgr.XTN_KEY);
scrib_xtn.Engine_type_(v);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_engine_lua_)) Engine_(Scrib_engine_type.Type_lua);
else if (ctx.Match(k, Invk_engine_luaj_)) Engine_(Scrib_engine_type.Type_luaj);
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_engine_lua_ = "engine_lua_", Invk_engine_luaj_ = "engine_luaj_"
;
}

View File

@@ -0,0 +1,48 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.xtns.wdatas.*;
public class Xoapi_wikibase implements GfoInvkAble, GfoEvMgrOwner {
public Xoapi_wikibase() {
evMgr = GfoEvMgr.new_(this);
}
public GfoEvMgr EvMgr() {return evMgr;} private GfoEvMgr evMgr;
public byte[][] Core_langs() {return core_langs;} private byte[][] core_langs = Bry_.Ary("en");
public byte[][] Sort_langs() {return sort_langs;} private byte[][] sort_langs = Bry_.Ary("en", "de", "es", "fr", "it", "nl", "pl", "ru", "sv");
public byte[] Link_wikis() {return link_wikis;} private byte[] link_wikis = Bry_.new_a7("enwiki");
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_core_langs)) return Bry_.Add_w_dlm(Byte_ascii.Semic, core_langs);
else if (ctx.Match(k, Invk_core_langs_)) {core_langs = m.ReadBryAry(k, Byte_ascii.Semic); GfoEvMgr_.PubVal(this, Evt_core_langs_changed, core_langs);}
else if (ctx.Match(k, Invk_sort_langs)) return Bry_.Add_w_dlm(Byte_ascii.Semic, sort_langs);
else if (ctx.Match(k, Invk_sort_langs_)) {sort_langs = m.ReadBryAry(k, Byte_ascii.Semic); GfoEvMgr_.PubVal(this, Evt_sort_langs_changed, sort_langs);}
else if (ctx.Match(k, Invk_link_wikis)) return String_.new_u8(link_wikis);
else if (ctx.Match(k, Invk_link_wikis_)) {link_wikis = m.ReadBry(k); GfoEvMgr_.PubVal(this, Evt_link_wikis_changed, link_wikis);}
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String
Invk_core_langs = "core_langs", Invk_core_langs_ = "core_langs_"
, Invk_sort_langs = "sort_langs", Invk_sort_langs_ = "sort_langs_"
, Invk_link_wikis = "link_wikis", Invk_link_wikis_ = "link_wikis_"
;
public static final String
Evt_core_langs_changed = "core_langs_changed"
, Evt_link_wikis_changed = "link_wikis_changed"
, Evt_sort_langs_changed = "sort_langs_changed"
;
}