Topic on Talk:JQuery

Jump to navigation Jump to search

How to disable load /resources/jquery/jquery.js in mediawiki1.17?

4
Peachey88 (talkcontribs)

I'd like use google jquery instead of mediawiki's jquery. that will make site load faster.

Krinkle (talkcontribs)

MediaWiki 1.17 comes with ResourceLoader which loads jQuery minified and combined with other files in one request. The gain of loading it from a CDN is minimal at best in this case. Not supported in core.

Netsu (talkcontribs)

HA-HA

$wgHooks['SkinAfterBottomScripts'][] = 'fnRemoveAnnoingJS';

function fnRemoveAnnoingJS($skin, &$text) {

  $n = "\n";
  $t = "\t";
  $text = $text.'<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

jQuery.noConflict(true);

/*]]>*/
</script>'.
  $n.
  '<script type="text/javascript" src="/fileYouWantToWorkWithoutStupidBuggy.1.4.2.js"></script>';

  return true;

}

$wgHooks['ParserBeforeTidy'][] = 'wgAddJquery';

function wgAddJquery(&$parser, &$text) {

  global $addJqueryScripts;
  if ($addJqueryScripts === true) return true;

  $parser->mOutput->addHeadItem(
    '<script language="JavaScript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>'
  );

  $addJqueryScripts = true;

  return true;

}
86.43.191.217 (talkcontribs)

JQuery is not loaded by Mediawiki 1.19 and above. Nothing seems to work and there is no documentation on how to make it work.

How and where is jQuery actuially loaded?

Reply to "How to disable load /resources/jquery/jquery.js in mediawiki1.17?"