Skip to content

Commit 50187e9

Browse files
committed
visualization menu options should apply even to newly loaded docs
1 parent 7f81639 commit 50187e9

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

udapi/block/write/corefhtml.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@
110110
$("#main").append(data);
111111
add_mention_listeners($("#doc" + doc_num + " .m"));
112112
$("#doc" + doc_num + " .sentence").each(add_show_tree_button);
113+
$('.eid').toggle($('#show-eid')[0].checked);
114+
$('.etype').toggle($('#show-etype')[0].checked);
115+
$('.sent_id').toggle($('#show-sent_id')[0].checked);
116+
$('.showtree').toggle($('#show-trees')[0].checked);
117+
$('.m').toggleClass('nocolor', ! $('#show-color')[0].checked);
118+
$('.m').toggleClass('nobox', ! $('#show-boxes')[0].checked);
119+
$('.head').toggleClass('nobold', ! $('#show-heads')[0].checked);
120+
$('.empty').toggle($('#show-empty')[0].checked);
121+
$('.sentence').toggleClass('display-inline', ! $('#show-breaks')[0].checked);
122+
$('.par').toggle($('#show-pars')[0].checked);
123+
$('h1').toggle($('#show-docs')[0].checked);
113124
loading_now = false;
114125
}
115126
@@ -257,17 +268,17 @@ def process_document(self, doc):
257268

258269
print('<div id="main">')
259270
print('<div id="main-menu">Show<br><div>\n'
260-
f' <input id="show-eid" type="checkbox" {"checked" if self.show_eid else ""} onclick="$(\'.eid\').toggle();"><label for="show-eid">eid</label><br>\n'
261-
f' <input id="show-etype" type="checkbox" {"checked" if self.show_etype else ""} onclick="$(\'.etype\').toggle();"><label for="show-etype">etype</label><br>\n'
262-
' <input id="show-sent_id" type="checkbox" onclick="$(\'.sent_id\').toggle();"><label for="show-sent_id">sent_id</label><br>\n'
263-
' <input id="show-trees" type="checkbox" checked onclick="$(\'.showtree\').toggle();"><label for="show-trees">trees</label><br>\n'
264-
' <input id="show-color" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nocolor\');"><label for="show-color">colors</label><br>\n'
265-
' <input id="show-boxes" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nobox\');"><label for="show-boxes">boxes</label></div><div>\n'
266-
' <input id="show-heads" type="checkbox" checked onclick="$(\'.head\').toggleClass(\'nobold\');"><label for="show-heads">heads in bold</label><br>\n'
267-
' <input id="show-empty" type="checkbox" checked onclick="$(\'.empty\').toggle();"><label for="show-empty">empty words</label><br>\n'
268-
' <input id="show-breaks" type="checkbox" checked onclick="$(\'.sentence\').toggleClass(\'display-inline\');"><label for="show-breaks">sentence per line</label><br>\n'
269-
' <input id="show-pars" type="checkbox" checked onclick="$(\'.par\').toggle();"><label for="show-pars">paragraphs</label><br>\n'
270-
' <input id="show-docs" type="checkbox" checked onclick="$(\'h1\').toggle();"><label for="show-docs">document names</label><br>\n'
271+
f' <input id="show-eid" type="checkbox" {"checked" if self.show_eid else ""} onclick="$(\'.eid\').toggle(this.checked);"><label for="show-eid">eid</label><br>\n'
272+
f' <input id="show-etype" type="checkbox" {"checked" if self.show_etype else ""} onclick="$(\'.etype\').toggle(this.checked);"><label for="show-etype">etype</label><br>\n'
273+
' <input id="show-sent_id" type="checkbox" onclick="$(\'.sent_id\').toggle(this.checked);"><label for="show-sent_id">sent_id</label><br>\n'
274+
' <input id="show-trees" type="checkbox" checked onclick="$(\'.showtree\').toggle(this.checked);"><label for="show-trees">trees</label><br>\n'
275+
' <input id="show-color" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nocolor\',!this.checked);"><label for="show-color">colors</label><br>\n'
276+
' <input id="show-boxes" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nobox\',!this.checked);"><label for="show-boxes">boxes</label></div><div>\n'
277+
' <input id="show-heads" type="checkbox" checked onclick="$(\'.head\').toggleClass(\'nobold\',!this.checked);"><label for="show-heads">heads in bold</label><br>\n'
278+
' <input id="show-empty" type="checkbox" checked onclick="$(\'.empty\').toggle(this.checked);"><label for="show-empty">empty words</label><br>\n'
279+
' <input id="show-breaks" type="checkbox" checked onclick="$(\'.sentence\').toggleClass(\'display-inline\',!this.checked);"><label for="show-breaks">sentence per line</label><br>\n'
280+
' <input id="show-pars" type="checkbox" checked onclick="$(\'.par\').toggle(this.checked);"><label for="show-pars">paragraphs</label><br>\n'
281+
' <input id="show-docs" type="checkbox" checked onclick="$(\'h1\').toggle(this.checked);"><label for="show-docs">document names</label><br>\n'
271282
'</div></div>\n'
272283
'<button id="menubtn" title="Visualization options" onclick="menuclick(this)"><div class="b1"></div><div class="b2"></div><div class="b3"></div></button>\n')
273284

0 commit comments

Comments
 (0)