MediaWiki:Common.js: различия между версиями

Материал из RSB-Doc
Перейти к навигации Перейти к поиску
YuSer (обсуждение | вклад)
Нет описания правки
YuSer (обсуждение | вклад)
Нет описания правки
Строка 29: Строка 29:
}
}


alert('1');
importScriptURI('http://transfer/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Test.js&dontcountme=s');
alert('2');
importScript('MediaWiki:Test.js');
importScript('MediaWiki:Test.js');
alert('3');

Версия от 16:21, 3 декабря 2008

var loadedScripts = {}; // included-scripts tracker
function importScriptURI(url) {
	if (loadedScripts[url]) {
		return null;
	}
	loadedScripts[url] = true;
	var s = document.createElement('script');
	s.setAttribute('src',url);
	s.setAttribute('type','text/javascript');
	document.getElementsByTagName('head')[0].appendChild(s);
	return s;
}

function importScript(page){
   importScriptURI('http://transfer/index.php?action=raw&ctype=text/javascript&title='+encodeURIComponent(page.replace(/ /g,'_')));
alert('ok');
}

var auto_comment = 0;

if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0)
{
       if (wgCanonicalNamespace != "Special")
       {
               document.write('<script type="text/javascript" src="/index.php' +
               '?title=MediaWiki:Onlyifediting.js&action=raw' +
               '&ctype=text/javascript&dontcountme=s"></script>');
       }
}

importScript('MediaWiki:Test.js');