1- jQuery ( function ( ) {
1+ jQuery ( function ( ) {
22 /* DOKUWIKI:include script/helpers.js */
33 /* DOKUWIKI:include script/service.js */
44 /* DOKUWIKI:include script/elements.js */
55
66 // add diagram edit button to all SVGs included in wiki pages
7- const $images = jQuery ( 'img, object' ) . filter ( '.media, .medialeft, .mediacenter, .mediaright' ) ;
7+ const $images = jQuery ( 'img' ) . filter ( '.media, .medialeft, .mediacenter, .mediaright' ) ;
88
99 // collect image IDs with file extension
1010 const imageIds = $images . map ( function ( key , image ) {
11- return extractIdFromMediaUrl ( image . currentSrc ) ;
11+ return extractIdFromMediaUrl ( image . src ) ;
1212 } ) . toArray ( ) ;
1313
1414 let ajaxData = { } ;
@@ -18,21 +18,18 @@ jQuery( function() {
1818 // callback to attach buttons to editable diagrams
1919 const attachButtons = function ( result ) {
2020 const diagrams = JSON . parse ( result ) ;
21- $images . each ( function ( ) {
22- const current = jQuery ( this ) ;
23- // FIXME what is the difference?
24- const src = this . nodeName === 'OBJECT' ? current . attr ( 'data' ) : current . attr ( 'src' ) ;
25-
26- const id = extractIdFromMediaUrl ( src ) ;
21+ $images . each ( function ( ) {
22+ const id = extractIdFromMediaUrl ( this . src ) ;
23+ const $current = jQuery ( this ) ;
2724 if ( diagrams . includes ( id ) ) {
2825 let $editButton = editDiagramButton ( id ) ;
29- if ( current . parent ( ) [ 0 ] . nodeName === 'A' ) {
30- current . parent ( ) . after ( "<br>" , $editButton ) ;
26+ if ( $ current. parent ( ) [ 0 ] . nodeName === 'A' ) {
27+ $ current. parent ( ) . after ( "<br>" , $editButton ) ;
3128 } else {
32- current . after ( "<br>" , $editButton ) ;
29+ $ current. after ( "<br>" , $editButton ) ;
3330 }
3431 }
35- } ) ;
32+ } ) ;
3633 } ;
3734
3835 // query backend about permissions and SVG properties before attaching edit buttons
@@ -63,10 +60,10 @@ jQuery( function() {
6360 width : 600 ,
6461 appendTo : '.dokuwiki' ,
6562 modal : true ,
66- open : ( ) => {
63+ open : function ( ) {
6764 const ns = isMMPage ? jQuery ( '.panelHeader h3 strong' ) . html ( ) : jQuery ( '#media__ns' ) . html ( ) ;
6865 jQuery ( '#drawio__current-ns' ) . text ( ns ) ;
69- } ,
66+ }
7067 } ) ;
7168 } ) ;
7269 $mm_tree . prepend ( $createLink ) ;
@@ -80,11 +77,11 @@ jQuery( function() {
8077 const targetNode = $df [ 0 ] ;
8178
8279 // observe the target node descendants
83- const config = { childList : true , subtree : true } ;
80+ const config = { childList : true , subtree : true } ;
8481
8582 // add edit diagram button to file actions
86- const addEditButton = function ( mutationsList , observer ) {
87- for ( let mutation of mutationsList ) {
83+ const addEditButton = function ( mutationsList , observer ) {
84+ for ( let mutation of mutationsList ) {
8885 // div.file has been filled with new content (detail view)
8986 if ( mutation . type === 'childList' ) {
9087 const $svgLink = jQuery ( 'a.mf_svg' ) ;
@@ -105,4 +102,4 @@ jQuery( function() {
105102 const observer = new MutationObserver ( addEditButton ) ;
106103 observer . observe ( targetNode , config ) ;
107104 } ) ;
108- } ) ;
105+ } ) ;
0 commit comments