МедияУики:Common.js/Core.js
От БГ-Фантастика
/** Namespace constants */ var NS_MEDIA = -2, NS_SPECIAL = -1, NS_MAIN = 0, NS_TALK = 1, NS_USER = 2, NS_USER_TALK = 3, NS_PROJECT = 4, NS_PROJECT_TALK = 5, NS_IMAGE = 6, NS_IMAGE_TALK = 7, NS_MEDIAWIKI = 8, NS_MEDIAWIKI_TALK = 9, NS_TEMPLATE = 10, NS_TEMPLATE_TALK = 11, NS_HELP = 12, NS_HELP_TALK = 13, NS_CATEGORY = 14, NS_CATEGORY_TALK = 15; var DEFAULT_USER_LANGUAGE = "bg", FALLBACK_USER_LANGUAGE = "en"; /** Checks if a value exists in an array */ function inArray(val, arr) { var len = arr.length; for (var i = 0 ; i < len ; i++) { if (arr[i] === val) { return true; } } return false; } function importScript(page) { var uri = wgScript + '?title=' + encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') + '&action=raw&ctype=text/javascript'; return importScriptURI(uri); } 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; }