Benutzer:Mediator/common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K |
K |
||
| Zeile 1: | Zeile 1: | ||
// [[Benutzer:Mediator/popups.js]] | // [[Benutzer:Mediator/popups.js]] | ||
| − | + | var popScript = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-popups.js'; | |
| − | + | var popStyleSheet = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-navpop.css'; | |
| + | if ( window.localCSS ) { popStyleSheet = 'http://localhost:8080/js/navpop.css'; } | ||
| + | |||
| + | function popups_importScriptURI(url) { | ||
| + | var s = document.createElement('script'); | ||
| + | s.setAttribute('src',url); | ||
| + | s.setAttribute('type','text/javascript'); | ||
| + | document.getElementsByTagName('head')[0].appendChild(s); | ||
| + | return s; | ||
| + | } | ||
| + | |||
| + | function popups_importStylesheetURI(url) { | ||
| + | return document.createStyleSheet ? document.createStyleSheet(url) : popups_appendCSS('@import "' + url + '";'); | ||
| + | } | ||
| + | |||
| + | function popups_appendCSS(text) { | ||
| + | var s = document.createElement('style'); | ||
| + | s.type = 'text/css'; | ||
| + | s.rel = 'stylesheet'; | ||
| + | if (s.styleSheet) s.styleSheet.cssText = text //IE | ||
| + | else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null | ||
| + | document.getElementsByTagName('head')[0].appendChild(s); | ||
| + | return s; | ||
| + | } | ||
| + | |||
| + | popups_importStylesheetURI(popStyleSheet); | ||
| + | popups_importScriptURI(popScript); | ||
| + | |||
// Normally features are enabled | // Normally features are enabled | ||
var toFix = true; | var toFix = true; | ||
Aktuelle Version vom 10. Mai 2013, 01:29 Uhr
// [[Benutzer:Mediator/popups.js]]
var popScript = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-popups.js';
var popStyleSheet = '//en.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-navpop.css';
if ( window.localCSS ) { popStyleSheet = 'http://localhost:8080/js/navpop.css'; }
function popups_importScriptURI(url) {
var s = document.createElement('script');
s.setAttribute('src',url);
s.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
return s;
}
function popups_importStylesheetURI(url) {
return document.createStyleSheet ? document.createStyleSheet(url) : popups_appendCSS('@import "' + url + '";');
}
function popups_appendCSS(text) {
var s = document.createElement('style');
s.type = 'text/css';
s.rel = 'stylesheet';
if (s.styleSheet) s.styleSheet.cssText = text //IE
else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null
document.getElementsByTagName('head')[0].appendChild(s);
return s;
}
popups_importStylesheetURI(popStyleSheet);
popups_importScriptURI(popScript);
// Normally features are enabled
var toFix = true;
// In special pages, histories and previews disable them
if (wgCanonicalNamespace == "Special" || /*
*/ location.href.indexOf('&action=history') != -1 || /*
*/ location.href.indexOf('&action=submit') != -1)
toFix = false;
//
window.popupRedlinkRemoval = toFix;
window.popupFixRedirs = toFix;
window.popupFixDabs = toFix;