MediaWiki:Gadget-legacy.js

De Viccionari

Nota: Després de publicar, possiblement necessitareu refrescar la memòria cau del vostre navegador per a veure'n els canvis.

  • Firefox / Safari: Premeu Majús i alhora cliqueu el botó Actualitzar, o pressioneu Ctrl+F5 o Ctrl+R (⌘+R en un Mac)
  • Google Chrome: Premeu Ctrl+Majús+R (⌘+Shift+R en un Mac)
  • Internet Explorer / Edge: Premeu Ctrl i alhora cliqueu a Actualitza o pressioneu Ctrl+F5
  • Opera: Premeu Ctrl-F5.
/** LegacyScripts **/
/*jshint maxerr:1048576, strict:true, undef:true, latedef:true, es5:true */
/*global mw, jQuery, importScript, importScriptURI, $ */

/* ===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);
};

/* === DOM creation === */
//legacy.js has dependency on [[MediaWiki:Gadget-LegacyScriptsNewNode.js]]

/* ===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));
};

//Formulari per a entrades noves
jQuery(document).ready(function() {
   if(document.getElementById('necblah')){
      importScript('Usuari:Aleator/novaentrada.js');
   }
});