Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/moin/converters/html_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,7 @@ def __call__(self, element):
headings_list = [h[1] for h in headings]
if headings_list:
maxlevel = max(headings_list)
headtogglelink = html.a(
attrib={
html.class_: "moin-showhide",
html.href_: "#",
html.onclick_: "$('.moin-table-of-contents ol').toggle();return false;",
},
children=["[+]"],
)
headtogglelink = html.a(attrib={html.class_: "moin-showhide", html.href_: "#"}, children=["[+]"])
elem_h = html.div(
attrib={html.class_: "moin-table-of-contents-heading"}, children=[_("Contents"), headtogglelink]
)
Expand Down Expand Up @@ -790,14 +783,7 @@ def stack_top_append(elem):
if need_item:
stack.pop()
stack_push(html.li({html.id_: f"li{id}"}))
togglelink = html.a(
attrib={
html.href_: "#",
html.onclick_: f"$('#li{id} ol').toggle();return false;",
html.class_: "moin-showhide",
},
children=["[+]"],
)
togglelink = html.a(attrib={html.href_: "#", html.class_: "moin-showhide"}, children=["[+]"])
elem_a = html.a(attrib={html.href: "#" + id}, children=[text])
stack_top_append(elem_a)
old_toggle = togglelink
Expand Down
8 changes: 8 additions & 0 deletions src/moin/static/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,14 @@ $(document).ready(function () {

// placing initToggleComments after enhanceEdit prevents odd autoscroll issue when editing hidden comments
moin.initToggleComments();
$('.moin-table-of-contents .moin-showhide').on('click', function (event) {
event.preventDefault();
var parent = $(this).parent();
if ($(parent).is('.moin-table-of-contents-heading')) {
parent = $(parent).parent();
}
$(parent).find('ol:first-of-type').toggle();
});

moin.restoreFlashMessages();
});
Loading