forked from moegirlwiki/piecemeal-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_jQuery_External.php
More file actions
38 lines (25 loc) · 851 Bytes
/
load_jQuery_External.php
File metadata and controls
38 lines (25 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$wgHooks['SkinAfterBottomScripts'][] = 'fnRemoveAnnoingJS';
//使得不需要jquery的代码不用jquery
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;
}
//添加外部JS
$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;
}