I have an extension that affects wiki tables using JavaScript. In order for it to work, I need it to load *before* one of the core JS modules, jquery.tablesorter. Is there a supported way to modify the ResourceLoader dependencies of jquery.tablesorter?
Effectively I want to do something like:
$r = getResourceLoader(); $r->moduleInfos['jquery.tablesorter']['dependencies'][] = 'my.custom.extension.js';
before any JS modules actually get used.
Thanks, DanB
________________________________ My email address has changed to danb@cimpress.com. Please update your address book.
Cimpress is the new name for Vistaprint NV, the world’s leader in mass customization. Read more about Cimpress at www.cimpress.com.
________________________________
It's not "supported", but I see no reason why it couldn't work. You'd probably want to do it from the ResourceLoaderRegisterModules hook (which is fired after core modules are registered). Also, $moduleInfos is protected (because you're not supposed to modify it :D), so you'd have to cheat with some reflection to access it probably.
But perhaps there's a simpler way? What are you trying to do? The simplest thing would be to just create your module, give it 'position'=>'top' to make it execute before almost all other modules load, and add it on all pages from some hook.
Thanks for the suggestion to use position=top. I'll try that. DanB
________________________________ My email address has changed to danb@cimpress.com. Please update your address book.
Cimpress is the new name for Vistaprint NV, the world’s leader in mass customization. Read more about Cimpress at www.cimpress.com. ________________________________
On 15 Jan 2015, at 09:29, Daniel Barrett danb@cimpress.com wrote:
I have an extension that affects wiki tables using JavaScript. In order for it to work, I need it to load *before* one of the core JS modules, jquery.tablesorter. Is there a supported way to modify the ResourceLoader dependencies of jquery.tablesorter?
Effectively I want to do something like:
$r = getResourceLoader(); $r->moduleInfos['jquery.tablesorter']['dependencies'][] = 'my.custom.extension.js';
before any JS modules actually get used.
Thanks, DanB
You shouldn't have to do that.
What is your code doing to jQuery Tablesorter? Where do you intend to reference/use that additional code?
-- Krinkle
wikitech-l@lists.wikimedia.org