Currently working on a fix for the DokuCrypt2 plugin. I suspect the deferred JS loading is tripping me up.
How do I call a function that is defined in my script.js file... once the page loads? I have this in my actions.php file:
class action_plugin_dokucrypt2 extends DokuWiki_Action_Plugin {
function register($controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'c_hookjs');
}
function c_hookjs(&$event, $param) {
$event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8','_data'=>'','_data'=>"jQuery(function(){ return(decryptEditSetup()); });");
}
}
This is throwing a console error of jquery is not defined.
An older version of this plugin used:
$event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8','_data'=>'','_data'=>"addInitEvent(function() { return(decryptEditSetup()); });");
but the addInitEvent() function no longer exists. Is there some official way to let a plugin run code on page load?
Thank you!