1jQuery(function () { 2 3 let $aContainer = jQuery('.plugin-acknowledge-assign'); 4 5 // if no container is found, create one in the last section 6 if ($aContainer.length === 0) { 7 const section = jQuery('.dokuwiki.mode_show') 8 .find('div.level1, div.level2, div.level3, div.level4, div.level5') 9 .filter(function (idx, el) { 10 return jQuery(el).parents('ul, ol, aside, nav, footer, header').length === 0; 11 }) 12 .last(); 13 if (section.length === 0) { 14 return; 15 } 16 $aContainer = jQuery('<div class="plugin-acknowledge-assign"></div>'); 17 section.append($aContainer); 18 } 19 20 $aContainer.on('submit', function (event) { 21 event.preventDefault(); 22 var $form = jQuery(event.target), 23 ack = $form.find("input[name='ack']")[0]; 24 25 $aContainer.load( 26 DOKU_BASE + "lib/exe/ajax.php", 27 { 28 call: "plugin_acknowledge_assign", 29 id: JSINFO.id, 30 ack: ack.checked === true ? 1 : 0 31 } 32 ); 33 }); 34 $aContainer.load( 35 DOKU_BASE + 'lib/exe/ajax.php', 36 { 37 call: 'plugin_acknowledge_assign', 38 id: JSINFO.id 39 } 40 ); 41}); 42