I want to delete JCaption from head, jquery and jcaption file i deactivated with following methods:
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']);
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-noconflict.js']);
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-migrate.min.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);
To delete jcaption on previous versions where mootools in using is it's needed:
$this->_script = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script);
I tried also so to delete it on jquery but i don't have with preg_replace() experience, what's to do to delete JCatpion from head?
My code:
$this->_script = preg_replace('%jQuery\(window\)\.on(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\');\s*}\);\s*%', '', $this->_script);