Kontent qismiga oʻtish

MediaWiki:Gadget-legacy.js

Vikilug‘atdan olingan

Eslatma: Saqlaganingizdan soʻng, oʻzgarishlarni koʻrish uchun brauzeringiz keshini tozalashingizga toʻgri kelishi mumkin.

  • Firefox / Safari: Shift tugmasini bosgan holda, Yangilash unsurlar darchasini bosing, yoki Ctrl-F5 yoki Ctrl-R (Macda ⌘-R) ni bosing
  • Google Chrome: Ctrl-Shift-R (Macda ⌘-Shift-R) ni bosing
  • Internet Explorer / Edge: Ctrlni bosgan holda, Yangilashni bosing, yoki Ctrl-F5ni bosing
  • Opera: Ctrl-F5ni bosing.
// {{documentation}}
/** LegacyScripts **/
/*jshint maxerr:1048576, strict:true, undef:true, latedef:true, es5:true */
/*global mw, jQuery, importScript, importScriptURI, $, ObjectStorage */
/* ==importScript== */
/**
 * do NOT use this function
 **/
var importScriptFromWikibits = window.importScript;
window.importScript = function (page, wiki, oldid) {
	if (!wiki && !oldid) return importScriptFromWikibits(page);
	
	mw.log.warn("importScript called with more than one argument. This is deprecated and may be unreliable. Please use mw.loader.load directly");
	var url = (wiki ? encodeURIComponent(wiki) : mw.config.get('wgScript')) + '?title=' +
		mw.util.wikiUrlencode(page) +
		(oldid ? '&oldid=' + encodeURIComponent(oldid) : '') +
		'&action=raw&ctype=text/javascript';
	return mw.loader.load(url);
};

/* ==Cookies== */

window.setCookie = function setCookie(cookieName, cookieValue) {
	/*global escape */
	mw.log.warn("deprecated function setCookie called; use jQuery.cookie instead");
	var today = new Date();
	var expire = new Date();
	var nDays = 30;
	expire.setTime(today.getTime() + (3600000 * 24 * nDays));
	document.cookie = cookieName + "=" + escape(cookieValue) +
		";path=/" +
		";expires=" + expire.toGMTString();
};

window.getCookie = function getCookie(cookieName) {
	/*global unescape */
	mw.log.warn("deprecated function getCookie called; use jQuery.cookie instead");
	
	cookieName = String(cookieName);
	var start = document.cookie.indexOf(cookieName + "=");
	if (start === -1) return "";
	var len = start + cookieName.length + 1;
	if ((!start) && (cookieName !== document.cookie.substring(0, cookieName.length)))
		return "";
	var end = document.cookie.indexOf(";", len);
	if (end === -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
};

/*  ==[[MediaWiki:Youhavenewmessages]] to display differently for non-newbies with JS than for others= */
/* Suspected unresponsive page culprit: see the GP (Nov. 2010, "Blocking script execution on each page") */
if (mw.config.get('wgUserGroups') && mw.config.get('wgUserGroups').indexOf("autoconfirmed") == -1) {
	mw.util.addCSS(".visible-to-anons { display: inline; }");
}

/* ==Import [[User:Yair rand/newentrywiz.js]]== */
jQuery(document).ready(function () {
	if (document.getElementById('necplaceholder')) {
		importScript('User:Yair rand/newentrywiz.js');
	}
});