Cambios

Saltar a: navegación, buscar

MediaWiki:Common.js

10 723 bytes eliminados, 07:01 10 abr 2014
sin resumen de edición
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada página. */( function() {//<source lang="JavaScript">'use strict';
/** Extra toolbar options *************************************************** *Instead of cluttering up the global scope with *variables, they should instead be set as a *property of this global variable * * DescriptionE.g: Adds extra buttons to the editing toolbar.Instead of * myVar = 'blah'; * use * To disable this script, add <code>mwCustomEditButtons mcw.myVar = 'blah';
*/
window.mcw = {};
/* Legacy support */
mcw.baseURL = '/';
mcw.wikiURL = '/';
if (mwCustomEditButtons) {
mwCustomEditButtons.push({
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip": "Redirect",
"tagOpen": "#REDIRECT [[",
"tagClose": "]]",
"sampleText": "Target page name"
});
mwCustomEditButtons/* Variables for interface text used throughout the script, for ease of translating */mcw.push(i18n = { "imageFile": "http://upload.wikimedia.org/wikipedia/en /c/c9/Button_strike.png", "speedTip": "Strike",Collapsible tables and page loader "tagOpen" hideText: "<s>"'hide', "tagClose" showText: "</s>"'show', "sampleText": "Strike-through text" });
mwCustomEditButtons.push({ "imageFile": "http://upload.wikimedia.org/wikipedia /en/1/13/Button_enter.png",Page loader "speedTip" loadErrorTitle: "Line break"'An error occurred loading the content', "tagOpen": "<br />", "tagClose": "", "sampleText": "" });
mwCustomEditButtons.push({ "imageFile": "http: //File upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png", "speedTip": "Superscript", "tagOpen": "<sup>", "tagClose": "</sup>", "sampleText" defaultLicense: "Superscript text"'License' });
mwCustomEditButtons/* Add extra buttons to the classic toolbar */if ( mw.pushuser.options.get({ "imageFile": "http://upload'showtoolbar' ) && !mw.wikimediauser.org/wikipedia/en/7/70/Button_lower_letteroptions.png",get( 'usebetatoolbar' ) ) { "speedTip" importScript( 'MediaWiki: "Subscript",Toolbar.js' ); "tagOpen": "<sub>", "tagClose": "</sub>", "sampleText": "Subscript text" });
mwCustomEditButtons.push({
"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
"speedTip": "Small",
"tagOpen": "<small>",
"tagClose": "</small>",
"sampleText": "Small Text"
});
mwCustomEditButtons.push({ "imageFile": "http://upload.wikimedia.org/wikipedia/en/3* Wait for DOMContentLoaded */34/Button_hide_comment.png", "speedTip": "Insert hidden Comment", "tagOpen": "<!-- ", "tagClose": " -->", "sampleText": "Comment" }$( function();{
mwCustomEditButtons.push({/** * Collapsible tables * "imageFile": " * Based on http://uploadwww.wikimediamediawiki.org/wikipediawiki/enManual:Collapsible_tables#Common.js_script_.28before_1.18.29 */1/12/Button_gallerymcw.png",makeCollapsible = function( $content ) { "speedTip": "Insert a picture gallery", if ( $content === undefined ) { "tagOpen": "\n<gallery>\n", $content = $( 'table.collapsible' ); "tagClose": "\n</gallery>", } else { "sampleText": "Image:Example $content = $content.jpg|Caption1\nImage:Examplefind( 'table.jpg|Caption2"collapsible' ); } if ( !$content.length ){ return false; }
mwCustomEditButtons.push({ var buttonText = ' <span class="collapsible-button"imageFile>[<span class=": jslink"http://upload>' + mcw.wikimediai18n.org/wikipedia/en/f/fdhideText + '</Button_blockquote.png", "speedTip": "Insert block of quoted text", "tagOpen": "<blockquotespan>\n", "tagClose": "\n]</blockquotespan>", "sampleText": "Block quote" })';
mwCustomEditButtons $content.pusheach(function() { "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png", "speedTip": "Insert a var $table", "tagOpen": '{| class="wikitable"\n|', "tagClose": "\n|}"$( this ), "sampleText": "-\n! $header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1$collapseButton, cell 2\n| row 1firstWidth, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3" })secondWidth;
mwCustomEditButtons // 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 .pushcollapse-button' ); if (!$header.length ) { "imageFile" $header = $table.find( 'tr: "httpfirst > th:first' ); } //uploadNo header or the table body is empty if ( !$header.wikimedialength || !$table.find( 'tr:not(tr:first)' ).text().replace( /\n/g, '' ).orglength ) { return true; } //wikipediaFor the button to float properly, it has to be /commonsbefore/7the cell text if ( $table.hasClass( 'collapse-button-none' ) ) { $header.append( buttonText ); } else { $header.prepend( buttonText ); } /79/Button_reflinkFind max button size, and set its min-width to it $collapseButton = $table.find( '.collapsible-button' ); firstWidth = $collapseButton.width(); $collapseButton.find( '> .jslink' ).text( mcw.i18n.png"showText ); secondWidth = $collapseButton.width(); if ( firstWidth != secondWidth ) { if ( firstWidth < secondWidth ) { $collapseButton.css( 'min-width',secondWidth ); "speedTip": "Insert a reference" } else { $collapseButton.css( 'min-width',firstWidth ); } } "tagOpen": "<ref // 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' ); // Stop table sorting activating when clicking the link e.stopPropagation(); if ( $table.hasClass( 'collapsed' ) ) { $table.removeClass( 'collapsed' ).addClass( 'expanded' ); $( this ).text( mcw.i18n.hideText ); } else { $table.removeClass( 'expanded' ).addClass( 'collapsed' ); $( this ).text( mcw.i18n.showText ); }} );mcw.makeCollapsible(); /** * Fix edit summary prompt for undo * * Fixes the fact that the undo function combined with the "tagCloseno edit summary prompter" * causes problems if leaving the edit summary unchanged. * Added by [[wikipedia:User: "</ref>"Deskana]],code by [[wikipedia:User:Tra]]. "sampleText" * See https: //bugzilla.wikimedia.org/show_bug.cgi?id=8912 */if ( document.location.search.indexOf( "Insert footnote text hereundo=") !== -1 && document.getElementsByName( 'wpAutoSummary' )[0] ) { } document.getElementsByName( 'wpAutoSummary' )[0].value='1';
}
//fix edit summary prompt for undo
//this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the
//edit summary unchanged
//this was added by [[User:Deskana]], code by [[User:Tra]]
//see bug 8912
addOnloadHook(function () {
if (document.location.search.indexOf("undo=") != -1
&& document.getElementsByName('wpAutoSummary')[0]) {
document.getElementsByName('wpAutoSummary')[0].value='1';
}
})
 
/**
* Element animator (used in [[Template:Grid]])
*
* Will cycle the active class on any child elements * within an element with the animated class.
*/
mcw.animation = function() { if ( mcw.animate === undefined && $( '.animated' ).length ) { mcw.animate = setInterval( function() { $( '.animated' ).each( function() { var $current = $( this ).findchildren( '.active' ).removeClass( 'active' ), $next = $current.nextnextAll( ':not(.skip):first' ); if ( !current.$next().length ) { $next = $( this ).children(':not(.skip):first' ); } $current.eqremoveClass( 0 'active' ); } $next.addClass( 'active' ); } ); }, 2000 ); }};mcw.animation();
/**
* Pause grid GUI templates with lots of cells in them (e.g. [[Template:Grid/Crafting Table]]) on mouseover
*
* This is so people have a chance to look at each image on the cell
* and click on pages they want to view.
*/
function pauseGrid( grid ) { $( grid '#mw-content-text' ).hoveron( { 'mouseenter': function() { $( this ).find( '.grid .animated' ).removeClass( 'animated' ).addClass( 'paused' ); }, 'mouseleave': function() { $( this ).find( '.grid .paused' ).removeClass( 'paused' ).addClass( 'animated' ); } );}pauseGrid( , '.grid-generic, .grid-Crafting_Table' );pauseGrid( ', .grid-Furnace' );pauseGrid( ', .grid-Brewing_Stand' );
/**
* Add fake last-child class in navboxes for IE8
*/
if ( $.client.profile().name === 'msie' && $.client.profile().versionBase === '8' ) {
$( '.navbox-list li:last' ).addClass( 'last-child' );
}
/**
* Page loader
* Use with [[Template:LoadPage]]
*/
var baseURL $loadPage = $( '.load-page');if ( $loadPage.length ) { /'/ We need the spinner to show loading is happening, loadText = 'Load contentbut we don't want // to have a delay while the module downloads, showText = 'Expand contentso we'll load this now, hideText = // regardless of if something is clicked mw.loader.load( 'Collapse contentjquery.spinner'); var $buttonText = $( '<span/>' ) .addClass( 'load-page-button' ) .findcss( { display: 'inline-block', marginLeft: '0.mw-headline8em', fontWeight:first' normal' } ) .appendhtml( '<span class="load-page-button" style="margin-left:10px;font-weight:normal">[<span class="jslink">' + loadText mcw.i18n.hideText + '</span>]</span>' );  $loadPage.find( '.loadmw-page-button > .jslinkheadline:first' ).liveeach( 'click', function() { var $this = button, firstWidth, secondWidth; // Add the button $( this ), .append( $body = $thisbuttonText.closestclone( '.load-page' )); // Find max button size, and set its min-width to it $content button = $body( this ).find( '> .load-page-contentbutton' ); firstWidth = $button.width(); if ( $bodybutton.hasClassfind( 'loading> .jslink' ) .text( mcw.i18n.showText ) {; return secondWidth = $button.width(); } if ( firstWidth != secondWidth ) { if ( firstWidth < secondWidth ) { $thisbutton.textcss('min-width', secondWidth ) === loadText ) ; } else { $bodybutton.addClasscss( 'loadingmin-width' , firstWidth ); } } } );} $( 'body#mw-content-text' ).csson( 'cursorclick', 'wait.load-page-button > .jslink' , function();{ var $this = $.ajax( {this ), url: baseURL + 'api.php?format $button =json&action=parse&prop=text&redirects=1&page=' + mw$this.util.wikiUrlencodeparent( ), $body= $this.dataclosest( '.load-page' ) ), dataType: $content = $body.find( 'json.load-page-content', timeout: 20000 } ).done( function( data ) {; if ( data.error ) { if ( !$body.data( '#error-dialogloaded' ).length ) { return var oldButton = $button.html(); } // Just in-case the spinner module is still not ready yet mw.loader.using( 'jquery.ui.dialogspinner', function() { $bodybutton.removeClasshtml( 'loading' ); $.createSpinner( 'body' ).css( 'cursor', 'auto' ); $( '#netbar' ).after( '<div id="error-dialog" />' } ); $( '#error-dialog' ) new mw.htmlApi( '<p><strong>Error:</strong> ' + data.error.info + '</p>' ).dialogget( { title action: 'Hey! Listen!parse', resizable prop: false'text', width title: 400mw.config.get( 'wgPageName' ), modal: true, buttons text: '{ 'Retry+ '{: function() { ' + $thisbody.click(); $( this ).dialogdata( 'destroypage' ); $( + '#error-dialog}}' } ).removedone(); }, Cancel: function(data ) { $content.html( this )data.parse.dialog( text['destroy' ); $( '#error-dialog*' ] ).removeshow(); return; } } } ); } ); return; } $contentbutton.html( dataoldButton ).parsefind( '> .text[jslink'*'] ); $this.text( mcw.i18n.hideText ); $body.removeClassdata( 'loadingloaded' , true ); $( 'body' ) // Add Ajax compatible functions here // TODO: Use mw.hook once we get MW1.22 mcw.cssanimation( 'cursor', 'auto' ); } ) mcw.failmakeCollapsible( function( error $content ) {; if ( $content.find( '#error-dialogtable.sortable' ).length ) { return; } mw.loader.using( 'jquery.ui.dialogtablesorter', function() { $bodycontent.removeClassfind( 'loadingtable.sortable' ).tablesorter(); $( 'body' ).css( 'cursor', 'auto' } ); } $( '#netbar' } ).afterfail( '<div id="error-dialog" />' ); if function( !_, error.responseText ){ $( '#error-dialog' )button.html( '<p><strong>Error:</strong> No response from the server</p>' oldButton ); } else { $( '#error-dialog var errorText = ' ).html( '<p><strong>Error:</strong> ' + error.responseText + '</p>' ); } $ if ( '#error-dialog' ).dialog( { title: 'Hey! Listen!', resizable: false, width: 400, modal: true, buttons: { 'Retry': function(textStatus ) { $this errorText = error.click()textStatus; $ } else if ( this )error.dialog( 'destroy' error );{ $( '# errorText = error.error-dialog' ).remove()info; }, Cancel: function mw.notify() errorText, { $( this )title: mcw.dialog( 'destroy' ); $( '#error-dialog' )i18n.remove(); return; } } loadErrorTitle, autoHide: false } ); } ); } ); } else if ( $this.text() === mcw.i18n.showText ) { $content.show(); $this.text( mcw.i18n.hideText ); } else { $content.hide(); $this.text( mcw.i18n.showText ); }
} );
 
/**
* Frame parser (for [[Template:Grid]]) * * Requests the urls for all the animated grids on a page in 2 * API requests (due to a bug, 1 API request when it is fixed) * and appends them to the correct location.Make simple search suggestions box separately styled
*/
var baseURL = '/', wikiURL = '/wiki/', $grids = $( 'mw.grid' ), titles = [], titleCount = 0, section = 0;if ( $grids.length ) { $grids.each( function() { var imgs = $( this )loader.datausing( 'imgs' ), mod = $( this )mediawiki.data( searchSuggest'mod' ); if ( !imgs ) { return true; } imgs = imgs.split( ';' ); imgs.shift(); $.each( imgs, function() { if ( !this.trim() ) { return true; } if ( titleCount === 50 ) { titleCount = 0; section++; } if ( !titles[section] ) { titles[section] = ''; } if ( this.indexOf( ':' ) > -1 ) { this.replace( /([^:]*):?([^,]*)/, function( $, mod, name ) { if ( mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + '.png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'; titleCount++; } } else { if ( titles[section].indexOf( 'Filesuggestions:Grid first' + name.trim() + ' (' + mod.trimaddClass() + ').png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + ' (' + mod.trim() + searchbar').png|'; titleCount++; } } } ); } else { this.replace( /([^,]*)/, function( $, name ) { if ( !mod || mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + '.png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'; titleCount++; } } else { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png|'; titleCount++; } } } ); } } ); } ); /* Thanks to bug 23750 (https://bugzilla.wikimedia.org/show_bug.cgi?id=23750) * &redirects doesn't work properly with prop=imageinfo. Some of the images * will return without any imageinfo, even though they are valid. * So the redirects have to be resolved in a separate request... */ if ( titles ) { var promise = [], redirects = {}, urls = {}; $.each( titles, function( index ) { var titleSection = this.slice( 0, -1 ); promise.push( $.ajax( { type: 'POST', url: baseURL + 'api.php?action=query&format=json&redirects', data: { titles: titleSection }, timeout: 20000 } ).done( function( data ) { if ( data.query.redirects ) { $.each( data.query.redirects, function() { redirects[this.to] = this.from; titles[index] = titles[index].replace( this.from, this.to ); } ); } } ).fail( function( error ) { console.error( error ); } ) ); } ); $.when.apply( $, promise ).then( function() { promise.length = 0; $.each( titles, function() { var titles = this.slice( 0, -1 ); promise.push( $.ajax( { type: 'POST', url: baseURL + 'api.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=32&iiurlheight=32', data: { titles: titles }, timeout: 20000 } ).done( function( data ) { $.each( data.query.pages, function( index ) { if ( index < 0 ) { return true; } if ( redirects.hasOwnProperty( this.title ) ) { urls[redirects[this.title].replace( /File:Grid (. *).png/, '$1' )] = this.imageinfoCollapsible details for [0].thumburl; } else { urls[this.title.replace( /FileTemplate:Grid (.*).png/, '$1' )] = this.imageinfo[0].thumburl; } } ); } ).fail( function( error ) { console.error( error ); } ) ); } ); $.when.apply( $, promise ).then( function() { $grids.each( function() { var $grid = $( this ), imgs = $grid.data( 'imgs' ), mod = $( this ).data( 'mod' ), html = ''; if ( !imgs ) { return true; } imgs = imgs.split( ';' ); imgs.shift(); $.each( imgs, function() { if ( !this.trim() ) { html += gridFormat(); return true; } if ( this.indexOf( ':' ) > -1 ) { this.replace( /([^:]*):?([^,]*),?(\d*)/, function( $, mod, name, num ) { if ( mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { html += gridFormat( name.trim(), name.trim(), urls[name.trim()], num ); } else { var img = name.trim() + ' (' + mod.trim() + ')'; html += gridFormat( img, 'Mods/' + mod.trim() + '/' + name.trim(), urls[img], num ); } } ); } else { this.replace( /([^,History2]*),?(\d*)/, function( $, name, num ) { if ( !mod || mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { html += gridFormat( name.trim(), name.trim(), urls[name.trim()], num ); } else { var img = name.trim() + ' (' + mod.trim() + ')'; html += gridFormat( img, 'Mods/' + mod.trim() + '/' + name.trim(), urls[img], num ); } } ); } } ); $grid.find( '> .border > span > .animated' ).append( html ); } ); } ); } ); }} function gridFormat( name, link, url, num ) { var html = '<span class="image">'; if ( name ) { if ( url ) { html += '<a title="' + link + '" href="' + wikiURL + link.replace( / /g, '_' ) + '"><img width="32" height="32" src="' + url + '" alt="' + name + '"></a>'; if ( num ) { html += '<span class="number"><a title="' + link + '" href="' + wikiURL + link.replace( / /g, '_' ) + '">' + num + '</a></span>'; } } else { html += '<a class="new" title="File:Grid ' + name + '.png" href="' + baseURL + 'index.php?title=Special:Upload&wpDestFile=Grid_' + name.replace( / /g, '_' ) + '.png"></a>'; } } else { html += '&nbsp;'; } return html += '</span>';}   /** Edittools javascript loader ************************************************
*
* Allows version history to be split up into snapshots *//*if ( $( '.history2' ).find( 'pre' ).length ) { var histExpandText = 'View snapshot history', histCollapseText = 'Hide snapshot history'; Description $( '.history2 th: Pulls in first' ).append( '<span class="toggleHistDetails">[[MediaWiki:Edittools<span class="jslink">' + histExpandText + '</span>]</span>' ); var histLink = $( '.toggleHistDetails .jslink' ); histLink.click( function() { if ( $( '.history2 .details' ).length ) { $( '.history2 .overview' ).toggle(); $( '.history2 .details' ).toggle(); } else { $( '.history2 tr' ).each( function() { if ( !$( this ).find( 'pre' ).length || !$( this ).js]]find( 'th' ). Includes a cache-bypassinglength ) { return true; } * var header = $( this ), row = header, text = header.find( '> td' ).html() + '</td></tr>', rowspan = header.find( '> th' ).prop( 'rowspan' ); version number in the URL in order to allow any changes to the edittools to row.addClass( 'overview' ); if ( rowspan > 1 ) { for ( var i = 1; i < rowspan; i++ ) { row = row.next(); if ( !row.length ) { break; } row.addClass( 'overview' ); * be rapidly deployed to users text += '\n<tr><td>' + row.find( '> td' ).html() + '</td></tr>'; } } * * Note that var versions = text.split( '<pre>' ), by defaultdata = []; rowspan = 0; $.each( versions, function() { var parts = this function does nothing unless the element with.split( '</' + 'pre>' ), version = parts[0].replace( /\n/g, '' ), text = parts[1]; * if ( !version || !text ) { return true; } the ID text = text.replace( /<tr>/g, '<tr class="editpage-specialcharsdetails" >' ); if (which contains the old edittools code intext.slice( text.lastIndexOf( '</tr>' ) ).indexOf( '<td>' ) > -1 ) { * [[MediaWiki:Edittools]] text = text.slice( 0, and will be retained as a placeholder in the newtext.lastIndexOf( '</tr>' ) ); } * if ( text.slice( text.lastIndexOf( '<td>' ) ).indexOf( '</td>' ) < 0 ) { text += '</td></tr>'; } implementation if ( version.match( /\d\dw\d\d\w/ ) ) has { version = '<a class named title="Version history/Development versions" href="/' + 'Version_history/Development_versions#' + version + '">' + version + '</a>'; } else { version = '<a title="Version history" href="edittools-/' + 'Version_history#' + version-NNN+ '", where NNN is >' + version + '</a>'; } * number var rows; if ( text.match( /<td>/g ) ) { rows = text.match( /<td>/g ).length + 1; } else { rows = 1; } rowspan += rows; data. If the class name has push( '<th rowspan="test' + rows + '" before the number, the code will only>' + version + '</th><td>' + text ); } ); * run for users who have set var html = '<tr class="details"window.testJsEdittools ><th rowspan= true" in their user JS' + rowspan + '">' + header.find( '> th' ). * The html() + '</th>' + data.join( '<tr class="testdetails" should be retained in the class name until the new edittools>' ); * implementation is ready and fully tested, and until at least 30 days have $( '<table>' + html + '</table>' ).find( 'td > ol' ).each( function() { * passed since var text = $( this loader stub was added ).html(); html = html.split(which will be in 27 June 2008'<ol>' + text + '</ol>' ).join( '<ul>' + text + '</ul>' ); } ); * row.after( html ); } ); * For compatibility with Alex Smotrov $( '.history2 .overview's original implementation, on which this).hide(); } * code is loosely based if (see [[mw:User talk:Alex Smotrov/edittoolshistLink.js]]text() === histExpandText), this{ * loader can also be disabled by setting "window histLink.noDefaultEdittools = true"text( histCollapseText ); } else { histLink.text( histExpandText ); } } );}*/ /** * Maintainers: [[User:Ilmari Karonen]]Issue tracker loader
*/
/**if ( $( '#issue-list' ).length ) {
var page = $( '#issue-list' ).data( 'name' ) || mw.config.get( 'wgPageName' ),
amount = $( '#issue-list' ).data( 'num' ) || 20;
if ( $.isArray( page ) ) {
page = page.join( '" OR summary ~ "' );
}
var jql = encodeURIComponent( 'project in (MC, MCPE) AND resolution = Unresolved AND ( summary ~ "' + page + '" )' );
//Prevent the static edittools from flashing before the compact edittools below is loaded.
appendCSS('div.edittools-text { display:none; }');
addOnloadHook $.ajax(function () { 'https:// needs to be deferred until the DOM has fully loadedmojang.atlassian.net/rest/api/latest/search?maxResults=' + amount + '&fields=summary&jql=' + jql var placeholder = document ).getElementByIddone( function("editpage-specialchars"search );{ if (!placeholder || windowsearch.noDefaultEdittoolsissues.length ) { //Show the static edittools again for users with "window $( '#issue-list' ).noDefaultEdittools=true". appendCSStext('divNo issues were found.edittools-text { display:block; }'); returnfalse; } var match = /(?:^| )edittools-version-(\d+)(?: |$)/.exec(placeholder.className);
// set window var compIssues = [], pocketIssues = []; $.each( search.testJsEdittools = true to enable testing before full deploymentissues, function() { if (!match && windowthis.key.testJsEdittoolsindexOf( 'MCPE' ) < 0 ){ match compIssues.push( '<li>[<a href= "https://mojang.atlassian.net/browse/' + this.key + '">' + this.key + '</(?:^| )edittoolsa>] -version-(test\d' + this.fields.summary +'</li>' ); } else { pocketIssues.push(?'<li>[<a href="https: |$)//mojang.atlassian.net/browse/' + this.key + '">' + this.key + '</a>] - ' + this.exec(placeholderfields.classNamesummary + '</li>' ); } } );
var html = ''; if (!matchcompIssues.length ) return;{ var url html = wgScript '<p><b>Computer:</b></p><ul>' + compIssues.join( '\n' ) + '?title</ul>'; } if ( pocketIssues.length ) { html +=MediaWiki'\n<p><b>Pocket Edition:Edittools.js&action=raw&ctype=text</b></javascript&nocache=p><ul>' + match[1]; importScriptURIpocketIssues.join(url'\n' )+ '</ul>'; });
if ( search.total > amount ) {
var extra = search.total - amount;
html += '\n<p><a href="https://mojang.atlassian.net/issues/?jql=' + jql + '">View ' + extra + ' more result';
// Turn on spellchecking in the edit summary field, for Firefox. // Temporary until [[bugzilla:21604]] is deployedaddOnloadHook( function() { var wpSummary = document.getElementById( "wpSummary" ); if ( wpSummary && typeof wpSummary.spellcheck != undefined ) wpSummary.spellcheck = true;} ); / Collapsible tables /if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) extra > -1 ){ var script html += document.createElement( 'scripts' ); script.src } html += '</index.php?title=MediaWiki:CollapsibleTables.js&action=raw&ctype=texta></javascriptp>'; script.type = 'text/javascript'; } document.getElementsByTagName $( 'head#issue-list' )[0].appendChild( script ); hookEvent( 'load', function() { new CollapsibleTableshtml(html ); } );
}
*/
/**
* Frame parser (for [[Template:Grid]])Set unlicensed as the default license on file pages * * Requests That way the urls file will be categorised so someone can find a license for all the animated grids on a page in 2 * API requests (due to a bug, 1 API request when it is fixed) * and appends them to the correct location.file
*/
var baseURL = '/', wikiURL = '/wiki/', $grids = $( '.grid' ), titles = [], titleCount = 0, section = 0;if ( $gridsmw.length ) { $gridsconfig.each( function() { var imgs = $( this ).dataget( 'imgswgCanonicalSpecialPageName' ), mod = $( this ).data( 'mod' ); if ( !imgs ) { return true; } imgs = imgs.split( ';' ); imgs.shift(); $.each( imgs, function() { if ( !this.trim() ) { return true; } if ( titleCount === 50 ) { titleCount = 0; section++; } if ( !titles[section] ) { titles[section] = 'Upload'; } if ( this.indexOf( ':' ) > -1 ) { this.replace( /([^:]*):?([^,]*)/, function( $, mod, name ) { if ( mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + '.png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'; titleCount++; } } else { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png|'; titleCount++; } } } ); } else { this.replace( /([^,]*)/, function( $, name ) { if ( !mod || mod.trim().toLowerCase() === 'v#wpLicense' || mod.trim().toLowerCaseval() === 'vanilla' ) { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + '.png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'; titleCount++; } } else { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + ' (' + mod.trim() + ').png|'; titleCount++; } } } ); } } ); } ); /* Thanks to bug 23750 (https://bugzilla.wikimedia.org/show_bug.cgi?id=23750) * &redirects doesn't work properly with prop=imageinfo. Some of the images * will return without any imageinfo, even though they are valid. * So the redirects have to be resolved in a separate request... */ if ( titles ) { var promise = [], redirects = {}, urls = {}; $.each( titles, function( index ) { var titleSection = this.slice( 0, -1 ); promise.push( $.ajax( { type: 'POST', url: baseURL + 'api.php?action=query&format=json&redirects#wpLicense', data: { titles: titleSection }, timeout: 20000 } ).done( function( data ) { if ( data.query.redirects ) { $.each( data.query.redirects, function() { redirects[this.to] = this.from; titles[index] = titles[index].replaceval( thismcw.from, thisi18n.to defaultLicense ); } ); } } ) mw.fail( function( error ) { consoleloader.errorusing( error ); } ) ); } ); $.when.apply( $, promise ).then( function() { promise.length = 0; $.each( titles, function() { var titles = this.slice( 0, -1 ); promise.push( $.ajax( { type: 'POST', url: baseURL + 'apimediawiki.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=32&iiurlheight=32', data: { titles: titles }, timeout: 20000 } ).done( function( data ) { $.each( data.query.pages, function( index ) { if ( index < 0 ) { return true; } if ( redirects.hasOwnProperty( thislegacy.title ) ) { urls[redirects[this.title].replace( /File:Grid (.*).png/, '$1upload' )] = this.imageinfo[0].thumburl; } else { urls[this.title.replace( /File:Grid (.*).png/, '$1' )] = this.imageinfo[0].thumburl; } } ); } ).fail( function( error ) { console.error( error ); } ) ); } ); $.when.apply( $, promise ).then( function() { $grids.each( function() { var $grid = $( this ), imgs = $grid.data( 'imgs' ), mod = $( this ).data( 'mod' ), html = ''; if ( !imgs ) { return true; } imgs change = imgs.splitsetInterval( ';' ); imgs.shift(); $.each( imgs, function() { if ( !this.trim() licenseSelectorCheck ) { html += gridFormat(); return true; } if ( this.indexOf( ':' ) > -1 ) { this.replace( /([^:]*):?([^,]*),?(\d*)/, function( $, mod, name, num ) { if ( mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla#wpLicense' ) { html += gridFormat( name.trim(), name.trim(), urls[name.trim()], num ); } else { var img = name.trim() + ' (' + mod.trimchange() + ')'; html += gridFormat( img, 'Mods/' + mod.trim() + '/' + name.trim clearInterval(), urls[img], num ); } } change ); } else { this.replace( /([^,]*),?(\d*)/, function( $, name, num ) { if ( !mod || mod.trim().toLowerCase() === 'v' || mod.trim().toLowerCase() === 'vanilla' ) { html += gridFormat( name.trim(), name.trim(), urls[name.trim()], num ); } else { var img = name.trim() + ' (' + mod.trim() + ')'; html += gridFormat( img, 'Mods/' + mod.trim() + '/' + name.trim(), urls[img], num ); } } 500 ); } } ); $grid.find( '> .border > span > .animated' ).append( html ); } ); } ); } ); }
}
function gridFormat /** * Creates minecraft style tooltips * * Replaces normal tooltips. Supports minecraft [[formatting codes]] ( nameexcept k), linkand a description with line breaks (/). * Use mcw.useNativeMinetip = true to use normal tooltips, urlwith the description added */mcw.minetip = { // Add normal minetip events, num removing legacy tooltip create: function() { var html = '<span class="image">'tooltip; if $( name '#mw-content-text' ) .on( { if 'mouseenter.minetip': function( url e ) { html + var $elem = $( this ), title = $elem.data( '<a minetip-title' ), description ="$elem.data( ' + link + minetip-text'" href); // No title or title only contains formatting codes if ( title ==="' + wikiURL + linkundefined || title && title.replace( / &([0-9a-fl-o])|\s+/g, '_' ) + === '' ) { // Use title attribute of the element or the first link directly under it var attrTitle = $elem.attr( 'title' ) || $elem.find( '"><img widtha:first' ).attr( 'title' ); if ( title ==="32" heightundefined ) { title ="32" srcattrTitle; } else { title +="attrTitle; } if ( title ) { // Set the retrieved title as data for future use $elem.data( 'minetip-title', title ); } else { return; } } $elem.add( '*', $elem ).filter( '[title]' ).removeAttr( 'title' + url + ); if ( title === 0 ) { return; } var text = '<span class=" alt=title">' + name title + '">&f</aspan>'; if ( num description ) { html text += '\n<span class="numberdescription"><a title="' + link + '" href="' + wikiURL + link description.replace( /\\\/ /g, '_&#47;' ) + .replace( /\//g, '"<br>' ) + num + '&f</aspan>'; } if ( !$( '#minetip-tooltip' ).length ) { $( 'body' ).append( '<div id="minetip-tooltip"/span>'); } } else tooltip = $( '#minetip-tooltip' ); // Add classes for minecraft formatting codes while ( text.match( /&[0-9a-el-o]/ ) ) { html + text = text.replace( /&([0-9a-el-o])(.*?)(&f|$)/g, '<a span class="newformat-$1" title>$2</span>&f' ); } // Remove reset formatting text ="Filetext.replace( /&f/g, '' ); tooltip.html( text ); // Trigger a mouse movement to position the tooltip $elem.trigger( 'mousemove', e ); }, 'mousemove.minetip':Grid function( e, trigger ) { if ( !$( '#minetip-tooltip' ).length ) { $( this ).trigger( 'mouseenter' ); return; } // Get event data from remote trigger e = trigger || e; var top = e.clientY - 34, left = e.clientX + name 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'.png" hreft go off the top of the screen } else if ( top < 0 ) { top ="0; // Don' t go off the bottom of the screen } else if ( top + baseURL + height > winHeight ) { top = winHeight - height; } // Apply the positions tooltip.css( { top: top, left: left } ); }, 'mouseleave.minetip': function() { if ( !tooltip ) { return; } tooltip.remove(); } }, '.minetip, .grid .image, .grid .item, .grid2 .item' ).off( 'index.php?title=SpecialminetipNative' ); }, // Remove all events destroy:Upload&wpDestFile=Grid_function() { $( '#mw-content-text' ).off( '.minetip .minetipNative' ); $( '#minetip-tooltip' + name).replaceremove( ); }, / /gAdd native browser tooltip events, removing normal minetip native: function() { $( '#mw-content-text' ).on( 'mouseenter.minetipNative', '.minetip, .grid .image, .grid .item, .grid2 .item', function() { var title = $( this ).data( 'minetip-title' ), description = $( this ).data( '_minetip-text' ) + , existingTitle = $( this ).attr( 'title') || $( this ).png"find( '><a:first' ).attr( 'title' ); if ( title || title === 0 || $( this ).attr( 'title' ) ) { //a>Remove titles within so they don't interfere $( this ).find( '[title]' ).removeAttr( 'title' ); } if ( title === 0 ) { $( this ).removeAttr( 'title'); return; }else if ( !title && ( !existingTitle || !description ) ) { return; } else if ( !title && existingTitle ) { $( this ).data( 'minetip-title', existingTitle ); } var text = title || existingTitle; if ( description ) { html text += '&nbsp;\n'+ description; } // Remove formatting return html + text = text.replace( /&([0-9a-fl-o])/g, '' ) .replace( /\\\//g, '&#47;' ) .replace( /\//g, '\n' ) .replace( /&#47;/g, '</span>'); $( this ).attr( 'title', text ); } ).off( '.minetip' ); }}; if ( mcw.useNativeMinetip ) { mcw.minetip.native();} else { mcw.minetip.create();
}
} );
} )();
552
ediciones

Menú de navegación