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

Pagebanner: Disable toc if pagebanner html exists; also, sync PageBanner css [#610]

This commit is contained in:
gnosygnu
2019-11-11 06:27:49 -05:00
parent 8653e665cc
commit 9483b56121
8 changed files with 118 additions and 23 deletions

View File

@@ -27,6 +27,7 @@ public class Xoh_file_mgr {
this.wiki = wiki; this.file_wtr = new Xoh_file_wtr__basic(wiki, html_mgr, html_wtr);
}
public Xoh_file_wtr__basic File_wtr() {return file_wtr;} private final Xoh_file_wtr__basic file_wtr;
public Xow_find_file_mgr Find_file_mgr() {return find_file_mgr;} public void Find_file_mgr_(Xow_find_file_mgr v) {this.find_file_mgr = v;} private Xow_find_file_mgr find_file_mgr;
public void Init_by_wiki(Xowe_wiki wiki) {
file_wtr.Init_by_wiki(wiki);
}
@@ -76,8 +77,14 @@ public class Xoh_file_mgr {
return false;
if (source_wiki.File_mgr().Version() == Xow_file_mgr.Version_2)
return ctx.App().User().User_db_mgr().File__xfer_itm_finder().Find(source_wiki, xfer.Lnki_exec_tid(), xfer, ctx.Page().Url_bry_safe());
else
else {
if (find_file_mgr != null) {
boolean rv = find_file_mgr.Find_file(xfer);
if (rv)
return rv;
}
return source_wiki.File_mgr().Find_meta(xfer);
}
}
private static boolean File_queue_add(Xowe_wiki wiki, Xof_xfer_itm xfer, boolean lnki_is_media_ns, boolean found) {
if (!wiki.File_mgr().Cfg_download().Enabled()) return false;

View File

@@ -0,0 +1,58 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.htmls.core.wkrs.lnkis.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.xowa.htmls.core.wkrs.lnkis.*;
import gplx.xowa.wikis.domains.*;
import gplx.xowa.files.*; import gplx.xowa.files.repos.*;
import gplx.xowa.htmls.core.wkrs.imgs.atrs.*;
public class Xow_find_file_mgr {
private final Xof_repo_itm repo_itm;
private final Xof_url_bldr url_bldr = new Xof_url_bldr();
private final byte[] wiki_domain;
private final Hash_adp_bry hash = Hash_adp_bry.cs();
public Xow_find_file_mgr(Xof_repo_itm repo_itm, String wiki_domain_str) {
this.repo_itm = repo_itm;
this.wiki_domain = Bry_.new_u8(wiki_domain_str);
}
public void Init_file(String orig_ttl_str, int orig_w, int orig_h) {this.Init_file(true, orig_ttl_str, orig_w, orig_h);}
public void Init_file(boolean repo_is_remote, String orig_ttl_str, int orig_w, int orig_h) {
byte orig_repo_id = repo_is_remote ? Xof_repo_tid_.Tid__remote : Xof_repo_tid_.Tid__local;
byte[] orig_repo_name = repo_is_remote ? Xow_domain_itm_.Bry__commons : wiki_domain;
byte[] orig_ttl_bry = Bry_.new_u8(orig_ttl_str);
Xof_ext orig_ext = Xof_ext_.new_by_ttl_(orig_ttl_bry);
byte[] orig_redirect = null;
this.Init_file(orig_repo_id, orig_repo_name, orig_ttl_bry, orig_ext, orig_w, orig_h, orig_redirect);
}
public void Init_file(byte orig_repo_id, byte[] orig_repo_name, byte[] orig_ttl_bry, Xof_ext orig_ext, int orig_w, int orig_h, byte[] orig_redirect) {
Xof_xfer_itm orig = new Xof_xfer_itm();
orig.Init_at_orig(orig_repo_id, orig_repo_name, orig_ttl_bry, orig_ext, orig_w, orig_h, orig_redirect);
hash.Add_bry_obj(orig_ttl_bry, orig);
}
public boolean Find_file(Xof_xfer_itm xfer) {
// find orig
Xof_xfer_itm orig = (Xof_xfer_itm)hash.Get_by_bry(xfer.Lnki_ttl());
// exit if not found
if (orig == null)
return false;
// orig found; calc xfer.html based on orig; note, this seems early to generate html, but need to generate a correct html_url as well as other props
Xof_img_size img_size = new Xof_img_size();
img_size.Html_size_calc(Xof_exec_tid.Tid_wiki_page, xfer.Lnki_w(), xfer.Lnki_h(), xfer.Lnki_type(), Xof_patch_upright_tid_.Tid_all, xfer.Lnki_upright(), orig.Orig_ext().Id(), orig.Orig_w(), orig.Orig_h(), Xof_img_size.Thumb_width_img);
xfer.Init_at_orig(orig.Orig_repo_id(), orig.Orig_repo_name(), orig.Orig_ttl(), orig.Orig_ext(), orig.Orig_w(), orig.Orig_h(), orig.Orig_redirect());
xfer.Init_at_html(Xof_exec_tid.Tid_wiki_page, img_size, repo_itm, url_bldr);
return true;
}
}