Cambios

Saltar a: navegación, buscar

MediaWiki:Common.js

12 778 bytes eliminados, 06:53 10 abr 2014
sin resumen de edición
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */( function() {/* Any JavaScript here will be loaded for all users on every page load. */'use strict';
// add &__vanilla=1 to URL to disable all scripts except gadgets (** * Instead of cluttering up the global scope with * variables, they should instead be set as enabled in [[Speciala * property of this global variable * * E.g:Preferences]])Instead ofif (mw.util.getParamValue( * myVar = '__vanillablah')) throw void 0; // return is invalid here. oh well. * use/ *== [[WT:PREFS]] v2 mcw.0 =myVar ='blah'; */window.mcw = {};
try { (function () {
"use strict";
var prefs;/* Legacy support */try { prefs mcw.baseURL = window.localStorage.getItem('AGprefs/');} catch (e) { prefs = jQuerymcw.cookie('AGprefs');}prefs wikiURL = prefs && (window.JSON ? window.JSON.parse(prefs) : eval('(' + prefs + ')/'));
if (wgUserGroups.indexOf('autoconfirmed') !== -1)
return;
if (wgUserGroups/* Variables for interface text used throughout the script, for ease of translating */mcw.indexOf('user') i18n === -1){ if ((wgAction === 'view') && (wgPageName === 'Wiktionary:Preferences/V2')) {/ Collapsible tables and page loader mw.loader.load( hideText: 'ext.gadget.AGprefshide');, } if (!prefs) return; mw.loader.state(showText: 'the_pope_is_an_atheist_woman_alienshow', 'missing');for (var key in prefs.modules) { if (prefs.modules[key]) { mw.loader.load(key); } else { // unavoidable race condition. to prevent it, every enabled-by-default gadget should have "site" as a dependency if (mw.Page loader.getState(key) !== 'ready') { mw.loader.moduleRegistry[key].dependencies.push( loadErrorTitle: 'the_pope_is_an_atheist_woman_alienAn error occurred loading the content'); mw.loader.state(key, 'missing'); } else { // XXXFile upload mw.log.warn(key + " defaultLicense: the milk has been spilt."); } }} for (var key in prefs.sheets) { importStylesheet('MediaWiki:Gadget-License' + key);};
for /* Add extra buttons to the classic toolbar */if (var key in prefsmw.user.options.scriptsget( 'showtoolbar' ) && !mw.user.options.get( 'usebetatoolbar' ) ) { importScript('MediaWiki:Gadget-Toolbar.js' + key);
}
if (wgUserGroups.indexOf('user') !== -1) {
var changes = [];
for (var key in prefs.gadgets)
changes.push('gadget-' + key + '=' + (prefs.gadgets[key] ? '1' : '0'));
 
(new mw.Api()).postWithToken('options', {
action: 'options',
change: changes.join('|')
}).fail(function () {
jQuery.cookie('AGprefs', null);
try { window.localStorage.removeItem('AGprefs'); } catch (e) { /* */ }
mw.util.jsMessage(
'<b>Your <a href="/wiki/Wiktionary:Preferences/V2">per-browser preferences</a> have been migrated</b><br/><br/>' +
'From now on, you should use your <a href="/wiki/Special:Preferenced">user preferences page</a>. ' +
'Preferences will no longer apply after you log out.'
);
});
}
})/* Wait for DOMContentLoaded */$(); } catch function(e) { mw.log.warn(e); } /*</pre>===importScript===<pre>*/
/**
* importScript inserts a javascript page either * from Wiktionary: importScript('User:Connel MacKensie/yetanother.js'); * from another Wikimedia wiki: importScript('User:Lupin/insane.js','en.wikipedia.org');Collapsible tables
*
* by specifying the third argument, an oldid can be passed to ensure that updates to the script are not includedBased on http://www. * by specifying the fourth argument, a specific version of JavaScript can be declaredmediawiki. * * based on [[w:MediaWikiorg/wiki/Manual:Collapsible_tables#Common.js]] 2007-11-js_script_.28before_1.18.29* */mcw.makeCollapsible = function importScript(page, wiki, oldid, jsver$content ) { if (wiki || oldid || jsver$content === undefined ) { mw$content = $( 'table.logcollapsible' ); } else { $content = $content.warnfind("importScript called with more than one argument'table. This may be unreliablecollapsible' ); } if ( !$content."length ){ return false;
}
var buttonText = ' <span class="collapsible-button">[<span class="jslink">' + mcw.i18n.hideText + '</span>]</span> ';
$content.each( function() {
var $table = $( this ), $header, $collapseButton, firstWidth, secondWidth;
// This table is already collapsible
if ( $table.data( 'collapsible' ) ) {
return true;
}
// Use the collapse-button if specified otherwise the first header cell of the first row
$header = $table.find( 'tr:first .collapse-button' );
if ( !$header.length ) {
$header = $table.find( 'tr:first > th:first' );
}
// No header or the table body is empty
if ( !$header.length || !$table.find( 'tr:not(tr:first)' ).text().replace( /\n/g, '' ).length ) {
return true;
}
// For the button to float properly, it has to be /before/ the cell text
if ( $table.hasClass( 'collapse-button-none' ) ) {
$header.append( buttonText );
} else {
$header.prepend( buttonText );
}
// Find max button size, and set its min-width to it
$collapseButton = $table.find( '.collapsible-button' );
firstWidth = $collapseButton.width();
$collapseButton.find( '> .jslink' ).text( mcw.i18n.showText );
secondWidth = $collapseButton.width();
if ( firstWidth != secondWidth ) {
if ( firstWidth < secondWidth ) {
$collapseButton.css( 'min-width', secondWidth );
} else {
$collapseButton.css( 'min-width', firstWidth );
}
}
// Set the text back to hide if it's not collapsed to begin with
if ( !$table.hasClass( 'collapsed' ) ) {
$collapseButton.find( '> .jslink' ).text( mcw.i18n.hideText );
}
$table.data( 'collapsible', true );
} );
};
$( '#mw-content-text' ).on( 'click', 'table.collapsible .collapsible-button .jslink', function( e ) { var $table = $( this ).closest( 'table.collapsible' ); // Default to localStop table sorting activating when clicking the link e.stopPropagation(); if (!wiki$table.hasClass( 'collapsed' ) ) { wiki=wgScript$table.removeClass( 'collapsed' ).addClass( 'expanded' ); $( this ).text( mcw.i18n.hideText );
} else {
wiki=$table.removeClass( 'expanded' ).addClass( '//collapsed'+escape); $(wikithis )+'/w/index.php'text( mcw.i18n.showText );
}
} );
mcw.makeCollapsible();
var url = wiki + '?title='
+ mw.util.wikiUrlencode(page)
+ (oldid ? '&oldid=' + encodeURIComponent(oldid) : '')
+ '&action=raw&ctype=text/javascript';
//Only include scripts once** * Fix edit summary prompt for undo * * Fixes the fact that the undo function combined with the "no edit summary prompter" * causes problems if (loadedScriptsleaving the edit summary unchanged. * Added by [[urlwikipedia:User:Deskana]]) { return false; } loadedScripts, code by [[urlwikipedia:User:Tra] ]. * See https://bugzilla.wikimedia.org/show_bug.cgi?id= true;8912 */ var scriptElem = if ( document.createElementlocation.search.indexOf("scriptundo="); scriptElem!== -1 && document.setAttributegetElementsByName("src",url'wpAutoSummary' ); scriptElem.setAttribute("type", jsver ? "application/javascript;version=" + jsver : "text/javascript"[0] );{ document.getElementsByTagNamegetElementsByName("head"'wpAutoSummary' )[0].appendChild(scriptElem); return truevalue='1';
}
/*</pre>
=== DOM creation ===
<pre>*/
/**
* Create a new DOM node for the current document. * Basic usage: var mySpan = newNode('span', "Hello World!") * Supports attributes and event handlers*: var mySpan = newNode('span', {style:"color: red", focus: function(){alert(this)}, id:"hello"}, "World, Hello!") * Also allows nesting to create trees: var myPar = newNode('p', newNode('b',{style:"color: blue"},"Hello"), mySpan)Element animator
*
* *event handlers, there are some issues with IE6 not registering event handlers Will cycle the active class on some nodes that are not yet attached to the DOM,any child elements * it may be safer to add event handlers later manuallywithin an element with the animated class.* */mcw.animation = function newNode(tagname){ var node if ( mcw.animate === documentundefined && $( '.createElement(tagnameanimated' );  for (var i = 1; i < arguments.length; ++i){ if (typeof arguments[i] mcw.animate == 'string') { // text node.appendChildsetInterval(document.createTextNodefunction(arguments[i])); } else if (typeof arguments[i] == 'object') { if $(arguments[i]'.nodeNameanimated' ) { //If it is a DOM Node node.appendChildeach( function(arguments[i]); } else { // Attributes (hopefully) for var $current = $(var j in arguments[i]this ){ if .children(j == 'class.active') { //Classname different because, $next = $current... node.className = arguments[i][j]; } else if nextAll(j == 'style:not(.skip):first') { //Style is special node.style.cssText = arguments[i][j]; } else if (typeof arguments[i][j] == 'function'!$next.length ) { //Basic event handlers newNode.addEventHandler $next = $(node, j, arguments[i][j]this ); } else { node.setAttributechildren( ':not(j, arguments[i][j].skip):first' ); //Normal attributes }
}
$current.removeClass( 'active' ); $next.addClass( 'active' ); }); }, 2000 );
}
 
node.addEventHandler = function(eventName, handler) {
newNode.addEventHandler(this, eventName, handler);
};
 
return node;
}
 
newNode.addEventHandler = function(node, eventName, handler)
{
try{ node.addEventListener(eventName,handler,false); //W3C
}catch(e){try{ node.attachEvent('on'+eventName,handler,"Language"); //MSIE
}catch(e){ node['on'+eventName]=handler; }} //Legacy
};
/*</pre>mcw.animation();
=== CSS ===
<pre>*/
/**
* Cross browser CSS - yurkPause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover * * @deprecated: Use mwThis is so people have a chance to look at each image on the cell * and click on pages they want to view.util.addCSS() instead
*/
var p_styleSheet=false; window.addCSSRule = function $(selector,cssText'#mw-content-text' ) { mw.log.warnon("deprecated function addCSSRule called; use mw.util.addCSS(css) instead");{ mw.util.addCSS( selector+'{mouseenter' + cssText + '}' );} /*</pre> ===Cookies===<pre>*/ /* @deprecated: Use $.cookie instead */function setCookie(cookieName, cookieValue) { mw.log.warn("deprecated function setCookie called; use jQuery.cookie instead"); var today = new Date $(this ); var expire = new Date(); var nDays = 30; expire.setTimefind( today'.getTime() + (3600000 * 24 * nDaysanimated' ) ); document.cookie = cookieName + "=" + escaperemoveClass(cookieValue'animated' ) + ";path=/" + ";expires="+expire.toGMTStringaddClass('paused' ); },  'mouseleave': function getCookie(cookieName) { mw.log.warn $("deprecated function getCookie called; use jQuery.cookie instead"this ); var start = document.cookie.indexOffind( cookieName + "=" ); if ( start == -1 ) return ""; var len = start + cookieName'.length + 1; if ( ( !start paused' ) && ( cookieName != document.cookie.substringremoveClass( 0, cookieName.length 'paused' ) ) ) { return ""; } var end = document.cookie.indexOfaddClass( ";", len 'animated' ); if ( end == -1 ) end = document.cookie.length; return unescape( document.cookie.substring( len, end ) );} function deleteCookie(cookieName) { mw.log.warn("deprecated function deleteCookie called; use jQuery.cookie instead"); if (getCookie(cookieName)) { document.cookie = cookieName + "=" + ";path=/" + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}, '.grid-generic, .grid-Crafting_Table, .grid-Furnace, .grid-Brewing_Stand' );
/*</pre>
==Wiktionary Customisation==/** * Add fake last-child class in navboxes for IE8<pre> */ if ( document$.client.getElementByIdprofile().name === 'footermsie'&& $.client.profile() .versionBase === '8' ) { jQuery$( '.navbox-list li:last' ).readyaddClass('last-child' );
}
//initialize the storage for script options. Gadgets that set script
//options should also include this line as they are loaded before us.
if ( typeof WiktScriptPrefs == 'undefined') {
WiktScriptPrefs = {};
}
/*</pre>* * Page loader * * Allows a page to be downloaded and shown within another page.=== * Use with [[MediaWikiTemplate:YouhavenewmessagesLoadPage]] to display differently for non-newbies with JS than for others===<pre> *//* Suspected unresponsive var $loadPage = $( '.load-page culprit: see the GP ' );if (Nov$loadPage. 2010, "Blocking script execution on each page"length ) *{ //We need the spinner to show loading is happening, but we don't want //* to have a delay while the module downloads, so we'll load this now, // regardless of if something is clicked mw.loader.load(wgUserGroups && wgUserGroups'jquery.joinspinner' ); var $buttonText = $(""'<span/>' ) .indexOfaddClass("autoconfirmed") > 'load-page-1button' ) .css( { addCSSRule(" display: 'inline-block', marginLeft: '0.msgfornewbies"8em', fontWeight: 'normal' } ) .html( '[<span class="display: nonejslink">' + mcw.i18n.hideText + '</span>]' );}else{ addCSSRule$loadPage.find("'.msgfornonnewbies", "displaymw-headline: none"first' ).each( function(){ var $button, firstWidth, secondWidth;} * //Add the button $( this ).append( $buttonText.clone() ); /*</preFind max button size, and set its min-width to it $button = $( this ).find( '>.load-page-button' ); firstWidth = $button.width(); $button.find( '> .jslink' ).text( mcw.i18n.showText ); secondWidth ===[[WT:FEED]]===$button.width();<pre>*/ if ( firstWidth !wgUserName = secondWidth ) { importScript if ( firstWidth < secondWidth ) { $button.css('User:Conradmin-width', secondWidth ); } else { $button.Irwin/feedback.jscss( 'min-width', firstWidth ); } } } );
}
/*</pre>
===WT:PREFS===
<pre>*/
if ( jQuery.cookie$('WiktPrefs#mw-content-text') || mw.config.geton('wgPageNameclick', ') == "Wiktionary:Per.load-page-browser_preferences") { //importScript('User:Connel_MacKenzie/custombutton > .jsjslink', function();{ importScriptvar $this = $('User:Hippietrail/custom.js'this );,} /*</pre> == $button =Edit page javascript===<pre>*/$(document)this.ready( functionparent() { , if ( wgAction $body == 'edit' || wgAction == 'submit' || document$this.getElementByIdclosest('editpage.load-specialcharspage') ) {, importScript $content = $body.find('MediaWiki:Edit.jsload-page-content'); } } if ( !$body.data( 'loaded' ) );/*</pre>{ var oldButton ===Page specific extensions===<pre>*/ /*</pre>====Wiktionary:Main Page====<pre>*/// Hide the title and "Redirected from" $button.html(maybe we should keep the redirected from so's people update their bookmarks );) // Broken Just in IE!-case the spinner module is still not ready yetif mw.loader.using( wgPageName == 'Wiktionary:Main_Pagejquery.spinner' && !, function( wgAction == 'view' || wgAction == 'submit' ) ){ mw $button.utilhtml( $.addCSScreateSpinner( '.firstHeading { display: block !important) ); }' ); new mw.utilApi().addCSSget( '#contentSub { display action: inline !important; }' );parse',} prop: 'text', if title: mw.config.get('wgPageName == 'Wiktionary), text: '{' + '{:Main_Page' + $body.data( 'page') + '}}' } ).done( function( data ) { $content.html(function data.parse.text['*'] ).show() {; mw $button.utilhtml( oldButton ).addPortletLinkfind('p-lang> .jslink', '//meta).text( mcw.wikimediai18n.org/wiki/Wiktionary#List_of_Wiktionaries',hideText ); 'Complete list', $body.data( 'interwiki-completelistloaded', 'Complete list of Wiktionaries'true ); });} // Add Ajax compatible functions here /*</pre>====SpecialTODO:Search====Use mw.hook once we get MW1.22<pre>*/ mcw.animation(); mcw.makeCollapsible( $content ); if ( wgPageName == $content.find( 'Special:Searchtable.sortable').length ) { importScript mw.loader.using('MediaWiki:SpecialSearchjquery.jstablesorter', function();{ importScript $content.find('User:Yair rand/FindTranstable.jssortable').tablesorter(); });jQuery(document } } ).readyfail(function (_, error ) { if(document $button.getElementByIdhtml('preloadGuide'oldButton )) {; importScript( var errorText = 'MediaWiki:SpecialSearch.js');}} if ( error.textStatus ); /*</pre>{ errorText ====Unsupported titles====<pre>*/error.textStatus; } else if (wgTitleerror.indexOf('Unsupported titles/'error ) { errorText === 0)error.error.info; } $(document) mw.readynotify(function () errorText, { //if (wgCanonicalNamespace != 'Appendix'title: mcw.i18n.loadErrorTitle, autoHide: false } ) return; //pages have been moved to mainspace, so commenting out this line var newTitle } ); } else if (document$this.getElementByIdtext('unsupportedpage')=== mcw.i18n.showText ) { newTitle = document$content.getElementByIdshow('unsupportedpage'); $this.text( mcw.i18n.titlehideText );
} else {
newTitle = "[" + wgTitle$content.slicehide(19) + "]"; $this.text( mcw.i18n.showText );
}
document.getElementById('firstHeading').innerHTML = newTitle;});
/*</pre>* ====Custom * Make simple search engines====suggestions box separately styled<pre> */ ifmw.loader.using( wgPageName=='Help:Tips_and_tricksmediawiki.searchSuggest' , function(){ importScript$('MediaWiki.suggestions:CustomSearchfirst' ).jsaddClass( 'searchbar');});
/*</pre>
 
====Turn headings in comments into real headings on JavaScript source pages====
<pre>*/
 
else if ((wgNamespaceNumber == 2 || wgNamespaceNumber == 8) && wgTitle.lastIndexOf('.js') != -1 && wgAction == 'view') {
importScript('MediaWiki:JavascriptHeadings.js');
}
 
/*</pre>
====Geonotice====
<pre>*/
/*Ended December 2009
else if (wgPageName == "Special:Watchlist") //watchlist scripts
{
importScriptURI('http://toolserver.org/~para/geoip.fcgi');
addOnloadHook(function() { importScriptURI('http://en.wiktionary.org/w/index.php?title=MediaWiki:Geonotice.js&action=raw&ctype=text/javascript&maxage=3600'); });
}
*/
/*</pre>
====New-section redirects====
<pre>*/
// This allows the new-section link (the "+" tab) to point to a different
// URL, as specified by the page (so that, for example, the new-section link
// for the Grease pit will add a new section to the appropriate monthly
// subpage):
importScript('MediaWiki:NewSectionRedirects.js');
/*</pre>
 
===Add editor.js for editing translations===
<pre>*/
 
importScript('User:Conrad.Irwin/editor.js');
 
/*</pre>
 
===Import newentrywiz.js===
<pre>*/
jQuery(document).ready(function(){
if(document.getElementById('necblah')){
importScript('User:Yair rand/newentrywiz.js');
}
});
 
 
/*</pre>
===Import adddefinition.js===
<pre>*/
importScript('User:Yair rand/adddefinition.js');
/*</pre>
===Import rhymesedit.js===
<pre>*/
wgNamespaceNumber == 106 && importScript("User:Yair rand/rhymesedit.js");
/*</pre>
===Import Targeted Translations===
<pre>*/
importScript("User:Yair rand/TargetedTranslations.js");
/*</pre>
 
==URL Fixes==
<pre>*/
/**
* doRedirect will redirect if a did you mean box is found, and create a Collapsible details for [[Template:History2]] * "redirected from X" if a rdfrom is passed in the get parameters * The first half is an ugly workaround for Bugzilla:3339, :(Allows version history to be split up into snapshots * The second half is an ugly workaround for not having serverware support ://*if ( $( '.history2' ).find('pre' ).length ) {**/ var histExpandText = 'View snapshot history', histCollapseText = 'Hide snapshot history';
/* $( '.history2 th:first' ).append( '</prespan class="toggleHistDetails">[<span class===Did you mean ____ redirects==="jslink">' + histExpandText + '<pre/span>*]</span>' );
jQuery var histLink = $(document'.toggleHistDetails .jslink' ); histLink.readyclick(function () { // REDIRECTED FROM if( window.location$( '.hrefhistory2 .indexOf('rdfrom=details') != -1 .length ) { var wiktDYMfrom = decodeURIComponent $(window'.locationhistory2 .hrefoverview' ).replacetoggle(/^); $('.+[&\?]rdfrom=([^&]+history2 .details' ).*|.*)?$/,"$2")toggle(); } else { jQuery $('#siteSub.history2 tr').aftereach( function() { newNode if ( !$( this ).find('divpre', {id: ).length || !$( this ).find( 'contentSubth').length ) { return true; } var header = $( this ), '(Auto-redirected from 'row = header, newNodetext = header.find('a> td', {href: mw).util.getUrlhtml(wiktDYMfrom) + '?redirect=no</td></tr>', rowspan = header.find( 'class> th': ).prop( 'newrowspan'}, wiktDYMfrom),; row.addClass( 'overview')'; if ( rowspan > 1 ) { for ( var i = 1; i < rowspan; i++ ){ row = row.next(); if ( !row.length ) { break; } else { // DID YOU MEAN row.addClass( 'overview' ); var target text += jQuery'\n<tr><td>' + row.find('#did-you-mean a> td').html(),+ '</td></tr>'; } } pagetitle var versions = jQuerytext.split('h1<pre>'), data = []; rowspan = 0; $.firsteach( versions, function(){ var parts = this.textsplit('</' + 'pre>' ), version = parts[0].replace(/^\s+|\s+$n/g, ''), text = parts[1]; if (target && target !version || !text ) { return true; } text = pagetitletext.replace( /<tr>/g, '<tr class="details">' ); && !window if ( text.locationslice( text.hreflastIndexOf( '</tr>' ) ).matchindexOf(/[&\?]redirect=no|[&\?]action'<td>' ) > -1 ) { text =text.slice( 0, text.lastIndexOf(?!view'</tr>' )/); && } if ( text.slice(jQuerytext.cookielastIndexOf('WiktionaryDisableAutoRedirect<td>') !).indexOf( '</td>' ) < 0 ) { text += 'true</td></tr>'; } if ( version.match( /\d\dw\d\d\w/ )) { version = '<a title="Version history/Development versions" href="/' + 'Version_history/Development_versions#' + version + '">' + version + '</a>'; } else { && wgArticleId version ='<a title="Version history" href= 0"/' + 'Version_history#' + version + '">' + version + '</a>'; } var rows; if ( text.match( /<td>/g ) ) { && ! rows = text.match( /Redirected from<td>/g ).length + 1; } else { rows = 1; } rowspan += rows; data.testpush(jQuery'<th rowspan="' + rows + '">' + version + '</th><td>' + text ); } ); var html = '<tr class="details"><th rowspan="' + rowspan + '">' + header.find('#contentSub> th').html()+ '</th>' + data.join( '<tr class="details">' ); $( '<table>' + html + '</table>' ).find( 'td > ol' ).each( function() { document var text = $( this ).location html(); html = mwhtml.utilsplit( '<ol>' + text + '</ol>' ).getUrljoin( target, { "rdfrom": pagetitle '<ul>' + text + '</ul>' ); } ); row.after( html ); } ); $( '.history2 .overview' ).hide();
}
}  // Random page in a given language document.location if ( histLink.toStringtext().replace(/[?&]rndlang=([^&#]+)[^#]*(?:#(.+))?/, function (m, lang, headlang== histExpandText) { var script = 'http://toolserver.org/~hippietrail/randompage histLink.fcgi';  var insert = document.getElementByIdtext('contentSub'histCollapseText ); if (headlang) } else { var heading = documenthistLink.getElementById(headlang); if (heading) heading = heading.parentNode; if (heading) { insert = newNodetext('div', {style: 'font-size: 84%; line-height: 1.2em;'}histExpandText ); heading.parentNode.insertBefore(insert, heading.nextSibling) }
}
} );
}*/
if (!insert || insert.innerHTML != "") return;/** * Issue tracker loader */ insert.appendChild/**if (newNode$('span#issue-list', ).length ) {style: var page = $( 'color: #888;issue-list'}, "Another ", newNode).data('aname', {href: script + '?langs=1'}, "Random"), " word in ", newNode|| mw.config.get('awgPageName'), {href: script + '?langname=' + lang}, decodeURIComponent(lang)) )); });}) /*</pre> ==amount =Fix Wikified section titles===<pre>*/jQuery$(document'#issue-list' ).ready(function data('num' ) {|| 20; // {temp|template} if (/\$.7B\.7Btemp\.7CisArray(.*?)\.7D\.7D/.test(window.location.hrefpage )) { var urlpage =window.locationpage.href.replacejoin(/\.7B\.7Btemp.7C/g, '".7B.7BOR summary ~ "' ); window.location = url;
}
}); jQuery(document).ready(function () { ifvar jql = encodeURIComponent(wgAction != 'edit') return; ifproject in (! /[?&]section=\d/.test(window.location.hrefMC, MCPE)) return; var wpSummary AND resolution = document.getElementByIdUnresolved AND (summary ~ "' + page + 'wpSummary" )'); if(! wpSummary) return; if(wpSummary.value$.substrajax(0, 3) != '/* ') return; if(wpSummary.value.substr(wpSummary.value.length - 4) != ' *https:/ ') return; wpSummary.value = wpSummary/mojang.valueatlassian.replace(net/\{\{temp(late)?\|rest/g, '{{');}); api/*<latest/pre>search?maxResults=' + amount + '&fields= Visibility toggling summary&jql==<pre>*/var VisibilityToggles = {' + jql // toggles[category] = [[show, hide],)...]; statuses[category] = [true, false,...]; buttons = <li> toggles: {}, statuses: {}, buttons: null,  // Add a new toggle, adds a Show/Hide category button in the toolbar, // and will call show_function and hide_function once on register, and every alternate click. register: done( function (category, show_function, hide_functionsearch ) {  var id = 0; if (!thissearch.issues.toggles[category]length ) { this.toggles[category] = []; this.statuses[category] = []; } else { id = this.toggles[category].length; } this.toggles[category].push$([show_function, hide_function]'#issue-list' ); this.statuses[category].pushtext(this'No issues were found.currentStatus(category)); this.addGlobalToggle(category);  (this.statuses[category][id] ? show_function : hide_function)();  return function () { var statuses = VisibilityToggles.statuses[category]; statuses[id] = !statuses[id] VisibilityToggles.checkGlobalToggle(category' ); return (statuses[id] ? show_function : hide_function)()false;
}
} var compIssues = [] // Add a new global toggle to the side bar addGlobalToggle: function(category) {pocketIssues = []; if $.each(documentsearch.getElementByIdissues, function('p-visibility-'+category)){ return; if (!this.buttons) { thiskey.buttons = newNodeindexOf('ulMCPE'); var collapsed = $.cookie("vector-nav-p-visibility"< 0 ) == "false", toolbox = newNode('div', {'class': "portal portlet "+(collapsed?"collapsed":"expanded"), 'id': 'p-visibility'}, newNode compIssues.push('h3', 'Visibility'), newNode('div', {'class': "pBody body<li>[<a href="}, collapsed?undefinedhttps:{//mojang.atlassian.net/browse/'style':'display:block;'}, + this.buttons) ); var sidebar = document.getElementById(key + 'mw-panel">') || document+ this.getElementById(key + 'column</a>] -one'); var insert = null; if (insert = (document+ this.getElementById('p-lang') || documentfields.getElementById(summary + 'p-feedback</li>'))) sidebar.insertBefore(toolbox, insert); } else{ sidebar.appendChild(toolbox);  } var status = thispocketIssues.currentStatus(category); var newToggle = newNodepush('<li', newNode('>[<a', { id: 'p-visibility-' + category, style: 'cursor: pointer', href="https: '#visibility-//mojang.atlassian.net/browse/' + category, click: function(e) { VisibilityTogglesthis.toggleGlobal(category); if (e && e.preventDefault) e.preventDefault(); else window.event.returnValue = false; return false; }}, (status ? key + 'Hide ' : 'Show ">') + category)); for (var i=0; i < this.buttons.childNodes.length; ikey +'</a>] - ' +) { if (this.buttonsfields.childNodes[i].id summary + '< newToggle.id) { this.buttons.insertBefore(newToggle, this.buttons.childNodes[i]/li>' ); return;
}
} );
var html = '';
if ( compIssues.length ) {
html = '<p><b>Computer:</b></p><ul>' + compIssues.join( '\n' ) + '</ul>';
}
thisif ( pocketIssues.buttons.appendChild(newTogglelength );{ },  html += '\n<p><b>Pocket Edition:</b></ Update the toggle-all buttons when all things are toggled one way checkGlobalToggle: function(category) { var statuses = this.statuses[category]; var status = statuses[0]; for (var i = 1; i p>< statusesul>' + pocketIssues.length; i++) { if join(status != statuses[i]'\n' ) return+ '</ul>';
}
document.getElementById if ('p-visibility-' + category)search.innerHTML = (status ? 'Hide ' : 'Show ') + category; },  // Toggle all un-toggled elements when the global button is clicked toggleGlobal: function(categorytotal > amount ) { var status extra = documentsearch.getElementById('ptotal -visibility-' + category).innerHTML.indexOf('Show ') == 0amount; for (var i html += 0; i '\n<p>< thisa href="https://mojang.toggles[category]atlassian.length; inet/issues/?jql=' + jql + '">View ' +extra + ) {' more result'; if (this.statuses[category][i] != statusextra > 1 ) { this.toggles[category][i][status ? 0 : 1](); this.statuses[category][i] html += status's';
}
html += '</a></p>';
}
document.getElementById('p-visibility-' + category).innerHTML = (status ? 'Hide ' : 'Show ') + category;
var current = jQuery.cookie('Visibility');
if (!current)
current = ";";
current = current.replace(';' + category + ';', ';');
if (status)
current = current + category + ";";
setCookie('Visibility', current);
},
currentStatus: function(category) { if (window.location.hash.toLowerCase().split$('_')[0] == '#issue-list' + category.toLowerCase()) return true; if (window.location.href.search(/[?]html(.*&)?hidecats=/) > 0html ) { var hidecats = window.location.href; hidecats = hidecats.replace(/^[^?]+[?]((?!hidecats=)[^&]*&)*hidecats=/, ''); hidecats = hidecats.replace(/&.*/, ''); hidecats = hidecats.split(','); for (var i = 0; i < hidecats.length; ++i) if (hidecats[i] == category || hidecats[i] == 'all') return false; else if (hidecats[i] == '!' + category || hidecats[i] == 'none') return true; } if (jQuery.cookie('WiktionaryPreferencesShowNav') == 'true') return true; if ((jQuery.cookie('Visibility') || "").indexOf(';' + category + ';') >= 0) return true; // TODO check category-specific cookies return false; }
}
*/
/*</pre>
=== NavBars ===
<pre>*/
var NavigationBarHide = 'hide ▲';
var NavigationBarShow = 'show ▼';
function NavToggleCategory(navFrame)/**{ * Set unlicensed as the default license on file pages var table = navFrame.getElementsByTagName('table')[0]; * if (table && table.className == "translations") return "translations"; * That way the file will be categorised so someone can find a license for the file */ var heading = navFrame.previousSibling; while (heading) { if (/[hH][4-6]/.test(headingmw.nodeName)) { if (headingconfig.getElementsByTagNameget('spanwgCanonicalSpecialPageName')[1]) heading = heading.getElementsByTagName(== 'spanUpload')[0];{ return if ( $(heading'#wpLicense' ).textval().toLowerCase() // jQuery=== ''s .text() is inconsistent about whitespace:{ .replace(/^\s+|\s+ $/g, '').replace(/\s+/g, ' #wpLicense') // remove numbers added by the "Auto-number headings" pref: .replace(/^[1-9][0-9.]+ ?/, ''); } else if val(/[hH][1-3]/mcw.test(headingi18n.nodeNamedefaultLicense )) break; heading = heading.previousSibling;
}
return "other boxes" mw.loader.using( 'mediawiki.legacy.upload', function() { var change = setInterval( function() { if ( licenseSelectorCheck ) { $( '#wpLicense' ).change(); clearInterval( change ); } }, 500 ); } );
}
function createNavToggle(navFrame){
var navHead, navToggle, navContent;
for (var j=0; j < navFrame.childNodes.length; j++) {
var div = navFrame.childNodes[j];
switch (div.className) {
case 'NavHead':
navHead = div;
break;
case 'NavContent':
navContent = div;
break;
}
}
if (!navHead || !navContent)
return;
// Step 1, don't react when a subitem is clicked.
for (var i=0; i<navHead.childNodes.length; i++) {
var child = navHead.childNodes[i];
if (child.nodeName == "A") {
child.onclick = function (e)
{
if (e && e.stopPropagation)
e.stopPropagation();
else
window.event.cancelBubble = true;
}
}
}
// Step 2, toggle visibility when bar is clicked.
// NOTE This function was chosen due to some funny behaviour in Safari.
navToggle = newNode('a', {href: 'javascript:(function(){})()'}, '');
navHead.insertBefore(newNode('span', {'class': 'NavToggle'}, '[', navToggle, ']'), navHead.firstChild);
navHead./** * Creates minecraft style.cursor = "pointer";tooltips * navHead * Replaces normal tooltips.onclick = VisibilityToggles.registerSupports minecraft [[formatting codes]] (NavToggleCategory(navFrameexcept k), function showand a description with line breaks (/) {. navToggle * Use mcw.innerHTML useNativeMinetip = NavigationBarHide;true to use normal tooltips, with the description added if (navContent) */ navContent.stylemcw.display minetip = "block";{ } // Add normal minetip events,removing legacy tooltip create: function hide() { navToggle.innerHTML = NavigationBarShow var tooltip; if (navContent) navContent.style.display = "none"; });}; jQuery$(document'#mw-content-text' ).readyon( { 'mouseenter.minetip': function (e ){ var divs $elem = $(".NavFrame"this );, for (var i title =0; i<divs$elem.length; i++data( 'minetip-title' ) { // NOTE: some templates use a class of NavFrame for the style, but for legacy reasons, are not NavFrames if (divs[i] description = $elem.className == "NavFrame") { createNavToggledata(divs[i]); } } }'minetip-text' ); /*</pre>No title or title only contains formatting codes if ( title ===Hidden Quotes===<pre>*undefined || title && title.replace( function setupHiddenQuotes&(li[0-9a-fl-o]) { var HQToggle, liComp|\s+/g, dl; var HQShow = 'quotations ▼'; var HQHide ) === 'quotations ▲'; for (var k = 0; k < li.childNodes.length; k++) { // Look at each component Use title attribute of the definition.element or the first link directly under it liComp var attrTitle = li$elem.childNodes[k]; if ( liComp.nodeName.toLowerCaseattr('title' ) === "dl" && !dl ) { dl = liComp; } // If we find a ul or dl, we have quotes or example sentences, and thus need a button. if (/^(ul|UL)| $/elem.test(liComp.nodeName)) { HQToggle = newNodefind('> a', {href: first'javascript:(function(){}).attr()'}, 'title'); li.insertBefore if (newNode('span', title === undefined ) {'class': 'HQToggle'}, ' [', HQToggle, ']'), dl || liComp); HQToggle.onclick title = VisibilityToggles.register('quotations',attrTitle; function show() } else { HQToggle.innerHTML title += HQHideattrTitle; for } if (var child = li.firstChild; child != null; child = child.nextSiblingtitle ) { if (/^(ul|UL)/ Set the retrieved title as data for future use $/elem.testdata(child.nodeName)) { child.style.display = 'blockminetip-title', title ); } else { }return;
}
} $elem.add( '*',$elem ).filter( '[title]' ).removeAttr( 'title' ); function hideif (title === 0 ) { HQToggle.innerHTML return; } var text = '<span class= HQShow"title">' + title + '&f</span>'; if ( description ) { for text += '\n<span class="description">' + description.replace(var child = li/\\\//g, '&#47;' ).firstChildreplace( /\//g, '<br>' ) + '&f</span>'; child } if ( !$( '#minetip-tooltip' ).length ) { $( 'body' ).append( '<div id= null"minetip-tooltip"/>' ); child } tooltip = child$( '#minetip-tooltip' ); // Add classes for minecraft formatting codes while ( text.nextSiblingmatch( /&[0-9a-el-o]/ ) ) { if text = text.replace(/^&([0-9a-el-o])(.*?)(ul&f|UL$)/g, '<span class="format-$1">$2</span>&f' ); } // Remove reset formatting text = text.replace( /&f/g, '' ); tooltip.testhtml(childtext ); // Trigger a mouse movement to position the tooltip $elem.nodeNametrigger( 'mousemove', e ); }, 'mousemove.minetip': function( e, trigger ) { child if ( !$( '#minetip-tooltip' ).stylelength ) { $( this ).display = trigger( 'nonemouseenter'); return; } // Get event data from remote trigger e = trigger || e; var top = e.clientY - 34, left = e.clientX + 14, width = tooltip.outerWidth( true ), height = tooltip.outerHeight( true ), $win = $( window ), winWidth = $win.width(), winHeight = $win.height(); // If going off the right of the screen, go to the left of the cursor if ( left + width > winWidth ) { left -= width + 36; } // If now going off to the left of the screen, resort to going below the cursor if ( left < 0 ) { left = 0; top += 82; // Go above the cursor if too low if ( top + height > winHeight ) { }top -= 77 + height;
}
});// Don't go off the top of the screen  break; } }} jQuery(document).ready(function else if (top < 0 ) { if (wgNamespaceNumber = top = 0) { var ols, lis, li; // First, find all Don't go off the ordered lists, i.e. all bottom of the series of definitions.screen var ols = document.getElementsByTagName } else if ('ol'top + height > winHeight );{ for(var i top = 0winHeight - height; i < ols } // Apply the positions tooltip.length; i++) css( { // Then top: top, for every set left: left } ); }, find all the individual definitions. for 'mouseleave.minetip': function(var j = 0; j < ols[i].childNodes.length; j++) { li = ols[i].childNodes[j]; if (li.nodeName.toUpperCase() == 'LI'!tooltip ) { setupHiddenQuotes(li)return;
}
tooltip.remove();
}
} }}); /*</pre> == Interproject links ==<pre>*/ /*############ ProjectLinks### by [[user:Pathoschild]] (idea from an older, uncredited script)### * generates a sidebar list of links to other projects from {{projectlinks}}#########*/jQuery(document)'.minetip, .grid .image, .ready(function () { var elements = new Array(); var spans = documentgrid .getElementsByTagName('span');  // filter for projectlinks for (var i=0item, j=0; i<spans.length; i++) { if (spans[i]grid2 .className == 'interProjectitem') { elements[j] = spans[i].getElementsByTagNameoff('a.minetipNative')[0]; j++; } if (j == 0) return;, // sort alphabeticallyRemove all events destroy: function sortbylabel(a,b) { // get labels a = a.innerHTML.replace(/^.*<a[^>]*>$(.*)<\/a>.*$/i,'$1#mw-content-text'); b = b.innerHTML.replaceoff(/^'.*<a[^>]*>(.*)<\/a>minetip .*$/i,'$1minetipNative');  // return sort order if $(a < b'#minetip-tooltip' ) return -1; if .remove(a > b) return 1; return 0; } elements.sort(sortbylabel);, // Create the list of project linksAdd native browser tooltip events, removing normal minetip var pllist = newNodenative: function('ul'); for (var i=0; i<elements.length; i++) { pllist.appendChild(newNode$('li', elements[i])); } var collapsed = $.cookie("vector#mw-nav-pcontent-projects") == "false"; var projectBox = newNode('div', {'class': 'portlet portal text'+(collapsed?"collapsed":"expanded"), id: 'p-projects'}, newNode.on('h3mouseenter.minetipNative', 'In other projects'), newNode('div', {'class': 'pBody body'}, collapsed?undefined:{'style':'display:block;'}.minetip, pllist) );  var insert = document.getElementById('p-tb'); if (!insert) return;  if (insertgrid .nextSibling) insertimage, .parentNodegrid .insertBefore(projectBoxitem, insert.nextSibling); else insertgrid2 .parentNode.appendChild(projectBox);}); /*</pre>===Scripts specific to Internet Explorer===<pre>*/ if item', function(navigator.appName == "Microsoft Internet Explorer") { /** Internet Explorer bug fix ************************************************** * * Description: Fixes IE horizontal scrollbar bug * Maintainers: [[User:Tom-]]? */  var oldWidth; var docEl title = document.documentElement;  function fixIEScroll$(this ) { if (!oldWidth || docEl.clientWidth > oldWidth) doFixIEScrolldata('minetip-title' ); else setTimeout(doFixIEScroll, 1);  oldWidth description = docEl.clientWidth; }  function doFixIEScroll$(this ) { docEl.style.overflowX = data(docEl.scrollWidth 'minetip- docEl.clientWidth < 4text' ) ? "hidden" : ""; } document.attachEvent("onreadystatechange", fixIEScroll); document.attachEvent existingTitle = $("onresize", fixIEScroll);  // In print IE (7?this ) does not like line-height mw.util.addCSSattr( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}title');  // IE overflow bug mw|| $( this ).util.addCSSfind('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x> a: hidden !important; }first');  // IE zoomfix // Use to fix right floating div/table inside tables mw.util.addCSSattr('.iezoomfix div, .iezoomfix table { zoom: 1;}title'); // Import scripts specific to Internet Explorer 6 if (navigator.appVersion.substr(22, 1) == "6") { importScript("MediaWiki:Common.js/IE60Fixes.js") }} /*</pre>title || title ===Category page fixes===<pre>*/ 0 || $(documentthis ).readyattr(function($'title' ) ){ var s, c = "", lang; // Remove titles within so they don't interfere if $( wgNamespaceNumber === 14 && ( s = document.getElementById("catfix") this ) ) { lang = s.className.splitfind("CATFIX-")'[1title] if ' ).removeAttr(lang.length > 0'title' ) {; c = "#" + lang; } s if ( title === s.getElementsByTagName("*")[0] || document.createElement("span");{ $("#mw-pages>.mw-content-ltr").find("li>a").each(function(){ var li = this.parentNode, clone = s.cloneNode( false ); li.removeChildremoveAttr( this 'title' ); this.setAttribute("href", this.getAttribute("href", 2) + c ) return; clone.appendChild( this ); li.appendChild( clone ); }) }}) /*</pre>===Temporary button for enabling two proposed scripts===<pre>*/ else if ( $.cookie!title && ("YRNewStuff") !existingTitle || location.search.indexOf("tabbedlanguages=on"!description ) != -1 ){ importScript("User:Yair rand/editor2.js") importScript("User:Yair rand/TabbedLanguages2.js") return; jQuery(document).ready(function else if (!title && existingTitle ) { if $(document.getElementById('YRNewStuff-enable-button'this )) { document.getElementByIddata('YRNewStuffminetip-enable-button').innerHTML = "" var toggle = newNode('spantitle', {click: function (existingTitle ) { if( $.cookie("YRNewStuff") ){ $.cookie("YRNewStuff", null,{path:"/"}) toggle.innerHTML = "Enable tabbed languages and definition editing options.";
}
else{ $.cookie var text = title || existingTitle; if ("YRNewStuff",1,description ) {expires:30,path:"/"}) toggle.innerHTML text += "Disable tabbed languages and definition editing options."'\n' + description;
}
} } // Remove formatting text = text.replace( /&([0-9a-fl-o])/g, '' ) .replace($/\\\//g, '&#47;' ) .cookiereplace("YRNewStuff"/\//g, '\n' )?"Disable":"Enable")+" tabbed languages and definition editing options ."replace( /&#47;/g, '/' ); document $( this ).getElementByIdattr('YRNewStuff-enable-buttontitle', text ); } ).appendChildoff(toggle'.minetip' );
}
});
/*</pre>if ( mcw.useNativeMinetip ) {===WT:ES Discussion tool=== mcw.minetip.native();<pre>*/} else { wgPageName == "Wiktionary:Etymology_scriptorium" && importScript mcw.minetip.create("User:Yair rand/DiscussionSandbox.js");}
$(document).ready(function() {
$("table.unit-tests th.unit-tests-img-corner").bind("click", function () {
var table = this;
while (table.tagName !== "TABLE")
table = table.parentNode;
table.classList.toggle("unit-tests-hide-passing");
})
});
/** * Collapsible tables * * @version 2.0.1 (2013-03-26) * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js * @author [[User:R. Koot]] * @author [[User:Krinkle]] * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which * is supported in MediaWiki core. */ var autoCollapse = 2;var collapseCaption = 'hide';var expandCaption = 'show'; function collapseTable( tableIndex ) { var Button = document.getElementById( 'collapseButton' + tableIndex ); var Table = document.getElementById( 'collapsibleTable' + tableIndex ); if ( !Table || !Button ) { return false; } var Rows = Table.rows; if ( Button.firstChild.data == collapseCaption ) { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = 'none'; } Button.firstChild.data = expandCaption; } else { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = Rows[0].style.display; } Button.firstChild.data = collapseCaption; }} function createClickHandler( tableIndex ) { return function ( e ) { e.preventDefault(); collapseTable( tableIndex ); }} function createCollapseButtons() { var tableIndex = 0; var NavigationBoxes = {}; var Tables = document.getElementsByTagName( 'table' ); for ( var i = 0; i < Tables.length; i++ ) { if ( $( Tables[i] ).hasClass( 'collapsible' ) ) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0]; if ( !HeaderRow ) { continue; } var Header = HeaderRow.getElementsByTagName( 'th' )[0]; if ( !Header ) { continue; } NavigationBoxes[tableIndex] = Tables[i]; Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex ); var Button = document.createElement( 'span' ); var ButtonLink = document.createElement( 'a' ); var ButtonText = document.createTextNode( collapseCaption ); Button.style.styleFloat = 'right'; Button.style.cssFloat = 'right'; Button.style.fontWeight = 'normal'; Button.style.textAlign = 'right'; Button.style.width = '6em'; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); $( ButtonLink ).on( 'click', createClickHandler( tableIndex ) ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( '[' ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( ']' ) ); Header.insertBefore( Button, Header.childNodes[0] ); tableIndex++; } } for ( var i = 0; i < tableIndex; i++ ) { if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) { collapseTable( i ); } }} $( createCollapseButtons );
552
ediciones

Menú de navegación