I must be doing something wrong here, but by adding a couple of console.log() at the beginning and end of my userscript function and the template's publish.js seems to show me that my userscript.js is executing
before the plugin JavaScript, which makes no sense to me at this time:
Start userscript bit
End userscript bit; publish length: 1
Begin template bit
End template bit
Here's my userscript.js function:
jQuery(document).on('bootstrap3:plugins', function(e) {
console.log("Start userscript bit");
var $publish = jQuery('.approval');
if ($publish.length) {
$publish.appendTo('#pagefooter_approval');
}
console.log("End userscript bit; publish length: "+$publish.length);
});
(I made a small change to put the banner inside a div I created using the Wrap plugin for the purpose in my pagefooter, but that shouldn't matter?)
I would expect userscript.js to be executed last precisely so that it can override, but as it stands, my userscript.js code works, but is immediately undone by publish.js; the only way around this for now is for me to hack publish.js not to move the div. Again, I get the feeling I'm doing something wrong, but I can't tell what.
Thank you again for the time you spent on this, and for pointing me at userscript.js which was absolutely the right tool for the job.