1. Inoub
  2. General
  3. Saturday, June 27 2015, 11:54 AM
hi there,

how can we extend or overwrite easy-profile's .js files (eg. '/com_jsn/assets/js/tabs.js') without losing our changes next time we update the component? Is that possible just like it works with the template files?

thanks for your advice,
Bob :)
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend and our offices are closed.

Sorry, you need to overwrite this file on each update. Easy Profile extends Joomla user profile, so registration and edit profile pages are the same of Joomla. These pages are not a part of Easy Profile then we use a system plugin to load tabs.js

Complex Alternative:
We load js files with Joomla API, so to load tabs.js we use this function:
JFactory::getDocument()->addScript(JURI::root().'components/com_jsn/assets/js/tabs.js');


You can write system plugin to manipulate Joomla script references. Before compile HEAD section joomla trigger a system event called "onBeforeCompileHead"

so you can write a system plugin with a function like this:
function onBeforeCompileHead()
{
$app = JFactory::getApplication();
if (!$app->isAdmin()){
$doc = JFactory::getDocument();
unset($doc->_scripts[JURI::root().'components/com_jsn/assets/js/tabs.js']);
$doc->->addScript(JURI::root().'components/com_jsn/assets/js/custom_tabs.js');
}
}


NOTE: This code is not tested and not supported, this code is provided only to example purpose.
  1. more than a month ago
  2. General
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.