File tree Expand file tree Collapse file tree 2 files changed +10
-16
lines changed
Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -751,14 +751,7 @@ def __call__(self, element):
751751 headings_list = [h [1 ] for h in headings ]
752752 if headings_list :
753753 maxlevel = max (headings_list )
754- headtogglelink = html .a (
755- attrib = {
756- html .class_ : "moin-showhide" ,
757- html .href_ : "#" ,
758- html .onclick_ : "$('.moin-table-of-contents ol').toggle();return false;" ,
759- },
760- children = ["[+]" ],
761- )
754+ headtogglelink = html .a (attrib = {html .class_ : "moin-showhide" , html .href_ : "#" }, children = ["[+]" ])
762755 elem_h = html .div (
763756 attrib = {html .class_ : "moin-table-of-contents-heading" }, children = [_ ("Contents" ), headtogglelink ]
764757 )
@@ -790,14 +783,7 @@ def stack_top_append(elem):
790783 if need_item :
791784 stack .pop ()
792785 stack_push (html .li ({html .id_ : f"li{ id } " }))
793- togglelink = html .a (
794- attrib = {
795- html .href_ : "#" ,
796- html .onclick_ : f"$('#li{ id } ol').toggle();return false;" ,
797- html .class_ : "moin-showhide" ,
798- },
799- children = ["[+]" ],
800- )
786+ togglelink = html .a (attrib = {html .href_ : "#" , html .class_ : "moin-showhide" }, children = ["[+]" ])
801787 elem_a = html .a (attrib = {html .href : "#" + id }, children = [text ])
802788 stack_top_append (elem_a )
803789 old_toggle = togglelink
Original file line number Diff line number Diff line change @@ -919,6 +919,14 @@ $(document).ready(function () {
919919
920920 // placing initToggleComments after enhanceEdit prevents odd autoscroll issue when editing hidden comments
921921 moin . initToggleComments ( ) ;
922+ $ ( '.moin-table-of-contents .moin-showhide' ) . on ( 'click' , function ( event ) {
923+ event . preventDefault ( ) ;
924+ var parent = $ ( this ) . parent ( ) ;
925+ if ( $ ( parent ) . is ( '.moin-table-of-contents-heading' ) ) {
926+ parent = $ ( parent ) . parent ( ) ;
927+ }
928+ $ ( parent ) . find ( 'ol:first-of-type' ) . toggle ( ) ;
929+ } ) ;
922930
923931 moin . restoreFlashMessages ( ) ;
924932} ) ;
You can’t perform that action at this time.
0 commit comments