1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2014-07-20 23:42:54 -04:00
parent bc10cd76b6
commit e882217c62
408 changed files with 3648 additions and 2687 deletions

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.apis; import gplx.*; import gplx.xowa.*;
import gplx.xowa.apis.xowa.*; import gplx.xowa.gui.cmds.*;
public class Xoapi_root implements GfoInvkAble {
public Xoa_app app;
private Xoa_app app;
public Xoapi_root(Xoa_app app) {usr_api.Ctor_by_app(app);}
public void Init_by_kit(Xoa_app app) {
this.app = app;

View File

@@ -17,16 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
import gplx.xowa.gui.views.*;
import gplx.xowa.apis.xowa.startups.*;
public class Xoapi_app implements GfoInvkAble {
private Xog_win_itm win;
public void Init_by_kit(Xoa_app app) {
win = app.Gui_mgr().Browser_win();
}
public void Exit() {win.App__exit();}
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_startup)) return startup;
else return GfoInvkAble_.Rv_unhandled;
return this;
}
private static final String Invk_exit = "exit";
private static final String Invk_exit = "exit", Invk_startup = "startup";
}

View File

@@ -24,10 +24,12 @@ public class Xoapi_html implements GfoInvkAble {
}
public Xoapi_tidy Tidy() {return tidy;} private Xoapi_tidy tidy = new Xoapi_tidy();
public Xoapi_modules Modules() {return modules;} private Xoapi_modules modules = new Xoapi_modules();
public Xoapi_skins Skins() {return skins;} private Xoapi_skins skins = new Xoapi_skins();
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 return GfoInvkAble_.Rv_unhandled;
}
private static final String Invk_tidy = "tidy", Invk_modules = "modules";
private static final String Invk_tidy = "tidy", Invk_modules = "modules", Invk_skins = "skins";
}

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
import gplx.gfui.*; import gplx.xowa.gui.views.*;
public class Xoapi_info implements GfoInvkAble {
public class Xoapi_info implements Gfo_usr_dlg_ui_opt, GfoInvkAble {
public void Init_by_kit(Xoa_app app) {this.app = app;} private Xoa_app app;
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
public void Focus() {this.Win().Info_box().Focus();}
@@ -26,12 +26,21 @@ public class Xoapi_info implements GfoInvkAble {
Io_url session_fil = app.Log_wtr().Session_fil();
app.Fsys_mgr().App_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.Xto_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.Xto_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";
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

@@ -36,7 +36,7 @@ public class Xoapi_view implements GfoInvkAble {
public void Save_as() {
if (this.Active_tab_is_null()) return;
Xog_tab_itm tab = win.Tab_mgr().Active_tab();
String file_name = app.Url_converter_fsys_safe().Encode_str(String_.new_utf8_(tab.Page().Ttl().Full_url())) + ".html";
String file_name = app.Encoder_mgr().Fsys_safe().Encode_str(String_.new_utf8_(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._.SaveFilStr(file_url, tab.Html_box().Text());

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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
import gplx.xowa.apis.xowa.html.skins.*;
public class Xoapi_skins implements GfoInvkAble {
private HashAdp hash = HashAdp_.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.Fetch(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

@@ -21,7 +21,7 @@ public class Xoapi_collapsible implements GfoInvkAble {
}
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.X_to_str(collapsed);
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;

View File

@@ -21,7 +21,7 @@ public class Xoapi_navframe implements GfoInvkAble {
}
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.X_to_str(collapsed);
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;

View File

@@ -60,7 +60,7 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
wiki.Html_mgr().Module_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.X_to_str(enabled);
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_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"));
@@ -80,7 +80,7 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
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.X_to_str(win_bind_focus_blur);
else if (ctx.Match(k, Invk_win_bind_focus_blur)) return Yn.Xto_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_utf8_(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);}
@@ -184,7 +184,7 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
;
public static final byte[]
Dflt_xnde_ignore_ids = Bry_.new_ascii_("coordinates")
, Dflt_tmpl_keeplist = Bry_.new_ascii_("en.wikipedia.org|formatnum;age_in_days;as_of;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|\n")
, Dflt_tmpl_keeplist = Bry_.new_ascii_("en.wikipedia.org|formatnum;age;age_in_days;age_in_years_and_days*;nts;number_table_sorting*;as_of;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|\n")
, Dflt_html_fmtr_popup = Bry_.new_ascii_(String_.Concat_lines_nl_skip_last
( "<div dir=~{page_lang_ltr}>"
, " <div>~{content}"

View File

@@ -21,7 +21,7 @@ public class Xoapi_toc implements GfoInvkAble {
}
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.X_to_str(collapsed);
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
return this;

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.apis.xowa.html.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
public class Xoapi_skin_app_base implements GfoInvkAble {
public void Init_by_kit(Xoa_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.Xto_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

@@ -1,78 +0,0 @@
/*
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.apis.xowa.startup; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
class Xoapi_startup_tabs implements GfoInvkAble {
public String[] Calc_startup_strs() {
switch (type) {
case Xoapi_startup_tabs_type_.Tid_blank: return new String[] {gplx.xowa.specials.xowa.default_tab.Default_tab_page.Ttl_full_str};
case Xoapi_startup_tabs_type_.Tid_xowa: return new String[] {gplx.xowa.users.Xouc_pages_mgr.Page_xowa};
case Xoapi_startup_tabs_type_.Tid_custom: return String_.SplitLines_nl(custom);
case Xoapi_startup_tabs_type_.Tid_previous: return String_.SplitLines_nl(previous);
default: throw Err_.unhandled(type);
}
}
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;} public Xoapi_startup_tabs Previous_(String v) {previous = v; return this;} private String previous = "";
public byte Type() {return type;} private byte type = Xoapi_startup_tabs_type_.Tid_xowa;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_type)) return Xoapi_startup_tabs_type_.X_to_key(type);
else if (ctx.Match(k, Invk_type_)) type = Xoapi_startup_tabs_type_.X_to_tid(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.X_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_custom = "custom", Invk_custom_ = "custom_"
, Invk_custom_is_expr = "custom_is_expr", Invk_custom_is_expr_ = "custom_is_expr_"
;
}
class Xoapi_startup_tabs_type_ {
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 X_to_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_.not_implemented_();
}
}
public static byte X_to_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_.not_implemented_();
}
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_blank), KeyVal_.new_(Key_xowa), KeyVal_.new_(Key_previous), KeyVal_.new_(Key_custom));
}
/*
startup {
tabs {
type = 'previous|blank|custom|xowa_home';
custom = 'en.wikipedia.org/wiki/{{{MONTHNAME}}} {{{DAY}}';
custom_has_wikitext = 'n';
}
}
*/

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.apis.xowa.startups; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
import gplx.xowa.apis.xowa.startups.tabs.*;
public class Xoapi_startups implements GfoInvkAble {
public void Init_by_kit(Xoa_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,54 @@
/*
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.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.startups.*;
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;} public Xoapi_startup_tabs Previous_(String v) {previous = v; return this;} 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_xowa;
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.Xto_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() {
if (manual != null) return new String[] {manual};
switch (type) {
case Xoapi_startup_tabs_tid_.Tid_blank: return new String[] {gplx.xowa.specials.xowa.default_tab.Default_tab_page.Ttl_full_str};
case Xoapi_startup_tabs_tid_.Tid_xowa: return new String[] {gplx.xowa.users.Xouc_pages_mgr.Page_xowa};
case Xoapi_startup_tabs_tid_.Tid_custom: return String_.SplitLines_nl(String_.Trim(custom));
case Xoapi_startup_tabs_tid_.Tid_previous: return String_.SplitLines_nl(String_.Trim(previous));
default: throw Err_.unhandled(type);
}
}
}

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.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.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_.not_implemented_();
}
}
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_.not_implemented_();
}
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

@@ -42,7 +42,7 @@ public class Xoapi_bookmarks implements GfoInvkAble {
}
public void Show() {win.Page__navigate_by_url_bar("home/wiki/Data:Bookmarks");}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_enabled)) return Yn.X_to_str(this.Enabled());
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(this.Enabled());
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
else if (ctx.Match(k, Invk_add)) this.Add(m.ReadStrOr("v", null));
else if (ctx.Match(k, Invk_show)) this.Show();

View File

@@ -26,7 +26,7 @@ public class Xoapi_history implements GfoInvkAble {
public void Goto_recent() {win.Page__navigate_by_url_bar(app.User().History_mgr().Get_at_last(app));}
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.X_to_str(this.Enabled());
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_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();

View File

@@ -28,7 +28,7 @@ public class Xoapi_logs implements GfoInvkAble {
Io_mgr._.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.X_to_str(this.Enabled());
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(this.Enabled());
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;