mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Pagebanner: Fix TOC not working from header; also, hide TOC always, not just on 2nd+ load [#610]
This commit is contained in:
parent
5ddf50d5b5
commit
46aab7944d
@ -44,12 +44,15 @@ public class Srch_special_cmd implements Gfo_invk, Srch_rslt_cbk, Xog_tab_close_
|
||||
Search_db();
|
||||
}
|
||||
private void Search_db() {
|
||||
for (int loop = 0; loop < 20; loop++) {
|
||||
// NOTE: wait for gui to load, else AJAX calls will return before SWT is ready; DATE:2019-11-17
|
||||
// NOTE: this fires async in one thread while page_load fires async in another thread;
|
||||
for (int loop = 0; loop < 30; loop++) {
|
||||
if (tab_data.Gui_loaded())
|
||||
break;
|
||||
else
|
||||
Thread_adp_.Sleep(1000);
|
||||
Thread_adp_.Sleep(100);
|
||||
}
|
||||
|
||||
synchronized (mgr) { // THREAD: needed else multiple Special:Search pages will fail at startup; DATE:2016-03-27
|
||||
tab_close_mgr.Add(this);
|
||||
// DEPRECATE: causes search to fail when using go back / go forward; DELETE:2016-05; DATE:2016-03-27
|
||||
|
@ -195,7 +195,8 @@ public class Xoh_page_wtr_wkr {
|
||||
if (page.Root() != null) { // NOTE: will be null if blank; occurs for one test: Logo_has_correct_main_page; DATE:2015-09-29
|
||||
page.Html_data().Toc_mgr().Clear(); // NOTE: always clear tocs before writing html; toc_itms added when writing html_hdr; DATE:2016-07-17
|
||||
wiki.Html_mgr().Html_wtr().Write_doc(tidy_bfr, ctx, hctx, page.Root().Data_mid(), page.Root());
|
||||
if (wiki.Html_mgr().Html_wtr().Cfg().Toc__show())
|
||||
if (wiki.Html_mgr().Html_wtr().Cfg().Toc__show()
|
||||
&& page.Html_data().Xtn_pgbnr().Show_toc_in_html())
|
||||
gplx.xowa.htmls.core.wkrs.tocs.Xoh_toc_wtr.Write_toc(tidy_bfr, page, hctx);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.xowa.htmls.core.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
public class Xoh_html_wtr_cfg {
|
||||
public boolean Toc__show() {return toc__show;} public Xoh_html_wtr_cfg Toc__show_(boolean v) {toc__show = v; return this;} private boolean toc__show;
|
||||
public boolean Pgbnr__show() {return pgbnr__show;} public Xoh_html_wtr_cfg Pgbnr__show_(boolean v) {pgbnr__show = v; return this;} private boolean pgbnr__show;
|
||||
public boolean Lnki__id() {return lnki__id;} public Xoh_html_wtr_cfg Lnki__id_(boolean v) {lnki__id = v; return this;} private boolean lnki__id;
|
||||
public boolean Lnki__title() {return lnki__title;} public Xoh_html_wtr_cfg Lnki__title_(boolean v) {lnki__title = v; return this;} private boolean lnki__title;
|
||||
public boolean Lnki__visited() {return lnki__visited;} public Xoh_html_wtr_cfg Lnki__visited_y_() {lnki__visited = true; return this;} private boolean lnki__visited;
|
||||
|
@ -37,7 +37,7 @@ public class Xoh_hdr_html {
|
||||
|
||||
// write TOC tag if (a) TOC enabled and (b) 1st hdr
|
||||
if ( hdr.First_in_doc()
|
||||
&& cfg.Toc__show()
|
||||
&& cfg.Toc__show()
|
||||
&& page.Wtxt().Toc().Enabled()
|
||||
&& !page.Wtxt().Toc().Flag__toc()) // __TOC__ not specified; place at top; NOTE: if __TOC__ was specified, then it would be placed wherever __TOC__ appears
|
||||
gplx.xowa.htmls.core.wkrs.tocs.Xoh_toc_wtr.Write_placeholder(page, bfr);
|
||||
|
@ -134,7 +134,6 @@ public class Pgbnr_func extends Pf_func_base {
|
||||
}
|
||||
if (banner_html != null) {
|
||||
bfr.Add(banner_html);
|
||||
wiki.Html_mgr().Html_wtr().Cfg().Toc__show_(false); // disable toc, else it will show twice (once in page banner; once in html); DATE:2019-11-11
|
||||
}
|
||||
}
|
||||
public static byte[] Get_banner_html(Xowe_wiki wiki, Xop_ctx ctx, Xoh_wtr_ctx hctx, Pgbnr_cfg cfg, Xoa_ttl banner_ttl, Pgbnr_itm itm) {
|
||||
|
@ -40,6 +40,7 @@ public class Pgbnr_itm implements Mustache_doc_itm {
|
||||
public byte[] Style() {return style;} private byte[] style;
|
||||
public double Data_pos_x() {return data_pos_x;}
|
||||
public double Data_pos_y() {return data_pos_y;}
|
||||
public boolean Show_toc_in_html() {return show_toc_in_html;} private boolean show_toc_in_html = false; // default to false so that TOC does not show up in both PageBanner and HTML body; DATE:2019-11-17
|
||||
|
||||
public void Clear_by_hdump() {
|
||||
this.exists = false;
|
||||
|
Loading…
Reference in New Issue
Block a user