mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.1.1'
This commit is contained in:
59
400_xowa/src/gplx/xowa/guis/cbks/js/Js_img_mgr.java
Normal file
59
400_xowa/src/gplx/xowa/guis/cbks/js/Js_img_mgr.java
Normal 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.guis.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
|
||||
import gplx.xowa.xtns.gallery.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.guis.views.*; import gplx.xowa.parsers.lnkis.*;
|
||||
public class Js_img_mgr {
|
||||
public static void Update_link_missing(Xog_js_wkr html_itm, String html_id) {
|
||||
html_itm.Html_redlink(html_id);
|
||||
}
|
||||
public static void Update_img(Xoa_page page, Xog_js_wkr js_wkr, Xof_file_itm itm) {
|
||||
Js_img_mgr.Update_img(page, js_wkr, itm.Html_img_wkr(), itm.Html_uid(), itm.Lnki_type(), itm.Html_elem_tid(), itm.Html_w(), itm.Html_h(), itm.Html_view_url()
|
||||
, itm.Orig_w(), itm.Orig_h(), itm.Orig_ext(), itm.Html_orig_url(), itm.Orig_ttl(), itm.Html_gallery_mgr_h());
|
||||
}
|
||||
private static void Update_img(Xoa_page page, Xog_js_wkr js_wkr, Js_img_wkr img_wkr, int uid, byte lnki_type, byte elem_tid, int html_w, int html_h, Io_url html_view_url
|
||||
, int orig_w, int orig_h, Xof_ext orig_ext, Io_url html_orig_url, byte[] lnki_ttl, int gallery_mgr_h) {
|
||||
if (!page.Wiki().App().Mode().Tid_supports_js()) return; // do not update html widget unless app is gui; null ref on http server; DATE:2014-09-17
|
||||
switch (elem_tid) {
|
||||
case Xof_html_elem.Tid_gallery_v2:
|
||||
img_wkr.Js_wkr__update_hdoc(page, js_wkr, uid, html_w, html_h, html_view_url, orig_w, orig_h, orig_ext, html_orig_url, lnki_ttl);
|
||||
return;
|
||||
}
|
||||
String html_id = To_doc_uid(uid);
|
||||
js_wkr.Html_img_update(html_id, html_view_url.To_http_file_str(), html_w, html_h);
|
||||
if (Xop_lnki_type.Id_is_thumbable(lnki_type)) { // thumb needs to set cls and width
|
||||
js_wkr.Html_atr_set(html_id, "class", gplx.xowa.htmls.core.wkrs.imgs.atrs.Xoh_img_cls_.Str__thumbimage);
|
||||
js_wkr.Html_atr_set("xowa_file_div_" + uid, "style", "width:" + html_w + "px;");
|
||||
}
|
||||
switch (elem_tid) {
|
||||
case Xof_html_elem.Tid_gallery:
|
||||
js_wkr.Html_atr_set("xowa_gallery_div3_" + uid, "style", "margin:" + Gallery_mgr_wtr_.Calc_vpad(gallery_mgr_h, html_h) + "px auto;");
|
||||
break;
|
||||
case Xof_html_elem.Tid_imap:
|
||||
img_wkr.Js_wkr__update_hdoc(page, js_wkr, uid, html_w, html_h, html_view_url, orig_w, orig_h, orig_ext, html_orig_url, lnki_ttl);
|
||||
break;
|
||||
case Xof_html_elem.Tid_vid:
|
||||
String html_id_vid = "xowa_file_play_" + uid;
|
||||
js_wkr.Html_atr_set(html_id_vid, "style", "width:" + html_w + "px;max-width:" + (html_w - 2) + "px;");
|
||||
js_wkr.Html_atr_set(html_id_vid, "href", html_orig_url.To_http_file_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static String To_doc_uid(int html_uid) {return gplx.xowa.htmls.Xoh_img_mgr.Str__html_uid + Int_.To_str(html_uid);}
|
||||
}
|
||||
23
400_xowa/src/gplx/xowa/guis/cbks/js/Js_img_wkr.java
Normal file
23
400_xowa/src/gplx/xowa/guis/cbks/js/Js_img_wkr.java
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
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.guis.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
|
||||
import gplx.xowa.files.*;
|
||||
public interface Js_img_wkr {
|
||||
void Js_wkr__update_hdoc(Xoa_page page, Xog_js_wkr js_wkr, int html_uid, int html_w, int html_h, Io_url html_view_url
|
||||
, int orig_w, int orig_h, Xof_ext orig_ext, Io_url html_orig_url, byte[] lnki_ttl);
|
||||
}
|
||||
29
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr.java
Normal file
29
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr.java
Normal 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.guis.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
|
||||
public interface Xog_js_wkr {
|
||||
void Html_img_update (String uid, String src, int w, int h);
|
||||
void Html_redlink (String html_uid);
|
||||
|
||||
void Html_atr_set (String uid, String key, String val);
|
||||
void Html_elem_replace_html (String uid, String html);
|
||||
void Html_elem_append_above (String uid, String html);
|
||||
void Html_elem_delete (String elem_id);
|
||||
void Html_gallery_packed_exec ();
|
||||
void Html_popups_bind_hover_to_doc ();
|
||||
}
|
||||
31
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr_.java
Normal file
31
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr_.java
Normal 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.guis.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
|
||||
public class Xog_js_wkr_ {
|
||||
public static final Xog_js_wkr Noop = new Xog_js_wkr__noop();
|
||||
}
|
||||
class Xog_js_wkr__noop implements Xog_js_wkr {
|
||||
public void Html_img_update (String uid, String src, int w, int h) {}
|
||||
public void Html_atr_set (String uid, String key, String val) {}
|
||||
public void Html_elem_replace_html (String uid, String html) {}
|
||||
public void Html_elem_append_above (String uid, String html) {}
|
||||
public void Html_redlink (String html_uid) {}
|
||||
public void Html_elem_delete (String elem_id) {}
|
||||
public void Html_gallery_packed_exec() {}
|
||||
public void Html_popups_bind_hover_to_doc() {}
|
||||
}
|
||||
38
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr__log.java
Normal file
38
400_xowa/src/gplx/xowa/guis/cbks/js/Xog_js_wkr__log.java
Normal 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.guis.cbks.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*; import gplx.xowa.guis.cbks.*;
|
||||
public class Xog_js_wkr__log implements Xog_js_wkr {
|
||||
private final List_adp log_list = List_adp_.New();
|
||||
public void Html_img_update (String uid, String src, int w, int h) {log_list.Add(Object_.Ary(Proc_img_update, uid, src, w, h));}
|
||||
public void Html_atr_set (String uid, String key, String val) {log_list.Add(Object_.Ary(Proc_atr_set, uid, key, val));}
|
||||
public void Html_redlink (String uid) {log_list.Add(Object_.Ary(Proc_redlink, uid));}
|
||||
public void Html_elem_replace_html (String uid, String html) {log_list.Add(Object_.Ary(Proc_replace_html, uid, html));}
|
||||
public void Html_elem_append_above (String uid, String html) {log_list.Add(Object_.Ary(Proc_append_above, uid, html));}
|
||||
public void Html_elem_delete (String elem_id) {log_list.Add(Object_.Ary(Proc_delete, elem_id));}
|
||||
public void Html_gallery_packed_exec() {log_list.Add(Object_.Ary(Proc_gallery_packed_exec));}
|
||||
public void Html_popups_bind_hover_to_doc() {log_list.Add(Object_.Ary(Proc_popups_bind_hover_to_doc));}
|
||||
|
||||
public void Log__clear() {log_list.Clear();}
|
||||
public int Log__len() {return log_list.Count();}
|
||||
public Object[] Log__get_at(int i) {return (Object[])log_list.Get_at(i);}
|
||||
|
||||
public static final String
|
||||
Proc_img_update = "img_update", Proc_atr_set = "atr_set", Proc_redlink = "redlink", Proc_replace_html = "replace_html"
|
||||
, Proc_append_above = "append_above", Proc_delete = "delete", Proc_gallery_packed_exec = "gallery_packed_exec", Proc_popups_bind_hover_to_doc = "popups_bind_hover_to_doc"
|
||||
;
|
||||
}
|
||||
Reference in New Issue
Block a user