Hot to disable bootstrap, mootools, caption, jquery...

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
User avatar
Leftfield
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4432
Joined: Fri Dec 08, 2006 3:33 am
Contact:

Hot to disable bootstrap, mootools, caption, jquery...

Post by Leftfield » Thu Aug 15, 2013 11:42 am

How to disable bootstrap, mootools, caption and jquery scripts with no core hacks? I am using latest J! 3.

Unset is not working for jquery and bootstrap.
JHtml::_('jquery.framework', false); in the template override doesn't work except for "jquery-noconflict.js".

BTW I am not interested in extension. ;)
Joomla Templates and Plugins /https://youjoomla.com/

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Thu Aug 15, 2013 2:42 pm

Dear all.

I am trying to achieve the same goal as Leftfield.

I followed the suggestions here: http://forum.joomla.org/viewtopic.php?f=713&t=771131

The single line method has no effect. The editing of the file works, but stops JQuery working in the back end too.

I would really appreciate any suggestions, I am trying to upgrade an old site to use Joomla 3 so there is no need for Jquery or Bootstrap, it uses Mootools.

Kind regards,

Jessica

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Wed Aug 21, 2013 9:10 am

Can anyone help with this?

thealien
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Thu Aug 18, 2005 2:42 pm

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by thealien » Wed Aug 21, 2013 12:23 pm

try this

<?php
// Remove Scripts
unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-more.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-core.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/modal.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);
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/bootstrap.min.js']);
?>

User avatar
Leftfield
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4432
Joined: Fri Dec 08, 2006 3:33 am
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by Leftfield » Wed Aug 21, 2013 2:11 pm

Correct script is:

Code: Select all

<?php
// Remove Scripts
$doc = JFactory::getDocument();
unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-more.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-core.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/modal.js']);
unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);
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/bootstrap.min.js']);
?>
Joomla Templates and Plugins /https://youjoomla.com/

thealien
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Thu Aug 18, 2005 2:42 pm

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by thealien » Wed Aug 21, 2013 2:17 pm

Thanks Leftfield!

User avatar
Leftfield
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4432
Joined: Fri Dec 08, 2006 3:33 am
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by Leftfield » Wed Aug 21, 2013 5:25 pm

Thank you! :)
Joomla Templates and Plugins /https://youjoomla.com/

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Thu Aug 22, 2013 3:37 pm

Thank you for your suggestions.

Unfortunately this is not working for me. I do not have anything else loading it. I have tried placing this both before and after the <jdoc:include type="head" />.

Do you have any other ideas?

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Thu Aug 22, 2013 3:45 pm

Actually I think I have found an answer here

http://stackoverflow.com/questions/1375 ... joomla-2-5

I have edited the lines after :

foreach ($document->_scripts as $strSrc => $strAttr)


in

/libraries/joomla/document/html/renderer/head.php

Thanks,

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Thu Aug 22, 2013 3:50 pm

Actually that still disables some of the back end

User avatar
Leftfield
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4432
Joined: Fri Dec 08, 2006 3:33 am
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by Leftfield » Thu Aug 22, 2013 4:00 pm

Can you attach your index.php file here like a text file?
Joomla Templates and Plugins /https://youjoomla.com/

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Thu Aug 22, 2013 4:01 pm

Dear Leftfield,

I thought I had found a solution but this did not work. Apologies for any confusion this has caused.

Please find my index.php attached.

Kind regards
You do not have the required permissions to view the files attached to this post.

User avatar
Leftfield
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4432
Joined: Fri Dec 08, 2006 3:33 am
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by Leftfield » Thu Aug 22, 2013 4:41 pm

I have tested your php file in my local and it worked like a charm. Huh, I am using php version 5.3.13. I really don't know does that matter.
Joomla Templates and Plugins /https://youjoomla.com/

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Fri Aug 23, 2013 2:34 pm

Hm odd, I might try packaging it up as a template and installing it again. Maybe that will help.

jessicajet
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 09, 2010 9:54 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by jessicajet » Tue Aug 27, 2013 11:26 am

Thank you for your help. I changed to template to include

JHtml::_('behavior.framework', true);

// Get params

JHtml::_('bootstrap.framework');

Which were missing

Then the removal script that Leftfield suggested worked.

I wish these could be switched on and off in admin to accommodate preference for alternative third party scripts.

Thank you to everyone who took the time to make a suggestion, especially Leftfield.

User avatar
pisandelli
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Tue Jul 21, 2009 8:27 pm
Location: Fortaleza Ceará

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by pisandelli » Thu Oct 10, 2013 6:36 pm

Cool! For me it worked well!! :pop

But there is another problem with this "head". The charset is not in the HTML5 standard, is there any way to remove it or replace it without hacking the source code?

Isn't annoying this way of Joomla do your <head>? In my opinion, we should have the freedom to insert our own JS and CSS librarys. In my case I like to put JS on the bottom of my file and the CSS on the top. Using the <jdoc:include type="head" /> tag, it always be a mess! And I can't optimize my site as i would like... or is there a way to do this?

User avatar
pisandelli
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Tue Jul 21, 2009 8:27 pm
Location: Fortaleza Ceará

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by pisandelli » Fri Oct 11, 2013 1:47 pm

Guys, i found this. Now I can use the HTML5 standards... It's a very nice override.
https://gist.github.com/proweb/4634662

Cheers!

rjsig
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Mar 13, 2012 2:31 pm
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by rjsig » Sat Nov 30, 2013 12:55 am

@pisandelli or @Leftfield, That index does look pretty tight. Will it work just as well with 3.2.0?

I had noticed, for example, the following two bits show up an update or two ago:

//unset($this->_scripts[JURI::root(true) . "/media/jui/js/jquery-migrate.min.js"]);
//unset($this->_scripts[JURI::root(true) . "/media/system/js/tabs-state.js"]);

Please advise.

laces
Joomla! Apprentice
Joomla! Apprentice
Posts: 49
Joined: Sun Nov 23, 2014 6:01 am

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by laces » Sun Nov 23, 2014 7:41 pm

I have followed the steps, but it is still including bootstrap.min.js as well as a <script>. I am posting the changes made to my template as well as the output.

Code: Select all

  $app = JFactory::getApplication();
    $sitename = $app->get('sitename');

  $doc = JFactory::getDocument();
    $head = $doc->getHeadData();
      unset($head['metaTags']['http-equiv']);
      unset($head['metaTags']['standard']['title']);
      unset($head['metaTags']['standard']['rights']);
      unset($head['metaTags']['standard']['language']);
    $doc->setHeadData($head);
    $doc->setGenerator('');
    $doc->setMetadata('X-UA-Compatible', 'IE=edge,chrome=1');
    $doc->setMetadata('viewport', 'width=device-width, initial-scale=1.0');
    $doc->setMetadata('Author', 'none');
    $doc->setMetadata('copyright', htmlspecialchars($app->getCfg('sitename')));
    //$doc->setMetadata('google-verification', 'xxxxxxxxxxxxxxxx');

    $doc->addStyleSheet('templates/' . $this->template . '/css/style.css');
    $doc->addStyleSheet('templates/' . $this->template . '/css/bootstrap.min.css');
    $doc->addScript('templates/' . $this->template . '/js/bootstrap.min.js');

    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/jui/js/bootstrap.min.js']);
    unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);

Code: Select all

  <script src="/site/media/jui/js/bootstrap.min.js" type="text/javascript"></script>
  <script type="text/javascript">
jQuery(window).on('load',  function() {
				new JCaption('img.caption');
			});
jQuery(document).ready(function(){
	jQuery('.hasTooltip').tooltip({"html": true,"container": "body"});
});
  </script>

User avatar
hozefasaleh
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Sep 15, 2011 4:06 pm
Contact:

Re: Hot to disable bootstrap, mootools, caption, jquery...

Post by hozefasaleh » Mon Mar 21, 2016 2:30 pm

I am making a bootstrap 3 template based on the protostar default template of joomla. I want to remove boostrap.min.js file coming from /media/jui/js/ .
I have added the code

Code: Select all

unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);
in my index.php file of the template at various places (I mean first item in file, inbetween, before

Code: Select all

<jdoc:include type="head" />
and after it and so on), the bootstrap is loading two times as my template file is loading once and then again joomla default load it.

Is there any solution for me to remove this in my template ?


Locked

Return to “General Questions/New to Joomla! 3.x”