Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
994 views
in Q2A Core by
I need to modify some functions in qa-ask.js. Can these be overridden in a plugin, or do I have to live with changing the source?
Q2A version: 1.5

3 Answers

0 votes
by

I think in function " head_script()" you can remove qa-ask.js value from $qa_content['script_rel'][] and add your new JS file with:

$this->output('<script src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'my-ask.js" type="text/javascript">');

It will include "my-ask.js" file from your plugin directory.

by
I'm pretty sure It can Also be done using advanced thems :D
+2 votes
by

Just redefine the functions in another Javascript file which is loaded after the Q2A core ones, and it will work fine. You can include your own Javascript function by using an advanced theme and overriding head_custom().

by
I thought this would throw a js error in the browser??? I'll give it a try.
0 votes
by
I used the default "page.js" file, changed other funtions, and added all my javascript in there, works without problems - even if this is not the cleanest way (as updating q2a will overwrite this file... needs 1 time copy + paste afterwards) :)
...