2712
ediciones
Cambios
m
/* 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';
if (mwCustomEditButtons) { mwCustomEditButtonswindow.push(mcw = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#REDIRECT [[", "tagClose": "]]", "sampleText": "Target page name" }); mwCustomEditButtons.push({ "imageFile": "http:/* Legacy support */uploadmcw.wikimedia.orgbaseURL = '/wikipedia/en/c/c9/Button_strike.png", "speedTip": "Strike", "tagOpen": "<s>", "tagClose": "</s>", "sampleText": "Strike-through text" })'; mwCustomEditButtonsmcw.push({ "imageFile": "http:wikiURL = '//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png", "speedTip": "Line break", "tagOpen": "<br />", "tagClose": "", "sampleText": "" })'; mwCustomEditButtons.push({ "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png"* Variables for interface text used throughout the script, "speedTip": "Superscript", "tagOpen": "<sup>", "tagClose": "<for ease of translating */sup>", "sampleText": "Superscript text" }); mwCustomEditButtonsmcw.push(i18n = { "imageFile": "http: //upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",Collapsible tables and page loader "speedTip" hideText: "Subscript"'ocultar', "tagOpen" showText: "<sub>", "tagClose": "</sub>"'mostrar', "sampleText": "Subscript text" }); mwCustomEditButtons.push({ "imageFile": "http:/ /upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",Page loader "speedTip" loadErrorTitle: "Small", "tagOpen": "<small>", "tagClose": "</small>"'An error occurred loading the content', "sampleText": "Small Text" }); mwCustomEditButtons.push({ "imageFile": "http: //File upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png", "speedTip" defaultLicense: "Insert hidden Comment", "tagOpen": "<!-- ", "tagClose": " -->", "sampleText": "Comment"'License' }); mwCustomEditButtons.push({ "imageFile": "http://upload.wikimedia.org* Add extra buttons to the classic toolbar */wikipedia/en/1/12/Button_gallery.png", "speedTip": "Insert a picture gallery", "tagOpen": "\n<gallery>\n", "tagClose": "\n</gallery>", "sampleText": "Image:Exampleif ( mw.jpg|Caption1\nImage:Exampleuser.jpg|Caption2" }); mwCustomEditButtonsoptions.pushget({ "imageFile": "http://upload'showtoolbar' ) && !mw.wikimediauser.org/wikipedia/en/f/fd/Button_blockquote.png", "speedTip": "Insert block of quoted text", "tagOpen": "<blockquote>\n", "tagClose": "\n</blockquote>", "sampleText": "Block quote" }); mwCustomEditButtonsoptions.pushget({ "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png", "speedTip": "Insert a table", "tagOpen": '{| class="wikitable"\n|usebetatoolbar', "tagClose": "\n|}", "sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3" }); ) { mwCustomEditButtons.push importScript({ "imageFile"'MediaWiki: "http://uploadToolbar.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png", "speedTip": "Insert a reference", "tagOpen": "<ref>", "tagClose": "</ref>", "sampleText": "Insert footnote text here" }js' );
//fix edit summary prompt * Wait 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/DOMContentLoaded */this was added by [[User:Deskana]], code by [[User:Tra]]//see bug 8912addOnloadHook$(function () { if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) { document.getElementsByName('wpAutoSummary')[0].value='1'; }})
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' );
$( '.navbox-list li:last' ).addClass( 'last-child' );
$( '.load-page-button > .jslink' ).live( 'click', function() { var $this = $( this ), $body = $this.closest( '.load-page' ), $content = $body.find( '.load-page-content' ); if ( $body.hasClass( 'loading' ) ) { return; } if ( $this.text() === loadText ) { $body.addClass( 'loading' ); $( 'body' ).css( 'cursor', 'wait' ); $.ajax( { url: baseURL + 'api.php?format=json&action=parse&prop=text&redirects=1&page=' + mw.util.wikiUrlencode( $body.data( 'page' ) ), dataType: 'json', timeout: 20000 } ).done( function( data ) { if ( data.error ) { if ( $( '#error-dialog' ).length ) { return; } mw.loader.using( 'jquery.ui.dialog', function() { $body.removeClass( 'loading' ); $( 'body' ).css( 'cursor', 'auto' ); $( '#netbar' ).after( '<div id="error-dialog" />' );** $( '#error-dialog' ).html( '<p><strong>Error:</strong> ' + data.error.info + '</p>' ).dialog( { title: 'Hey! Listen!', resizable: false, width: 400, modal: true, buttons: { 'Retry': function() { $this.click(); * Make simple search suggestions box separately styled $( this ).dialog( 'destroy' ); $( '#error-dialog' ).remove(); }, Cancel: function() { $( this ).dialog( 'destroy' ); $( '#error-dialog' ).remove(); return; } } } ); } ); return; } $content.html( data.parse.text[' *'] ); $this.text( hideText ); $body.removeClass( 'loading' ); $( 'body' ).css( 'cursor', 'auto' ); } ).fail( function( error ) {/ if ( $( '#error-dialog' ).length ) { return; } mw.loader.using( 'jquerymediawiki.ui.dialogsearchSuggest', function() { $body.removeClass( 'loading' ); $( 'body' ).css( 'cursor', 'auto' ); $( '#netbar' ).after( '<div id="error-dialog" />' ); if ( !error.responseText ){ $( '#error-dialog' ).html( '<p><strong>Errorsuggestions:</strong> No response from the server</p>' ); } else { $( '#error-dialogfirst' ).htmladdClass( '<p><strong>Error:</strong> ' + error.responseText + '</p>' ); } $( '#error-dialog' ).dialog( { title: 'Hey! Listen!', resizable: false, width: 400, modal: true, buttons: { 'Retry': function() { $this.click(); $( this ).dialog( 'destroy' ); $( '#error-dialog' ).remove(); }, Cancel: function() { $( this ).dialog( 'destroy' ); $( searchbar'#error-dialog' ).remove(); return; } } } ); } ); } ); } else if ( $this.text() === showText ) { $content.show(); $this.text( hideText ); } else { $content.hide(); $this.text( showText ); }
var baseURL = '/', wikiURL = '/wiki/', $grids = **if ( $( '.grid#issue-list' ), titles = [], titleCount = 0, section = 0;if ( $grids.length ) { $grids.each( function() { var imgs page = $( this ).data( 'imgs#issue-list' ), mod = $( this ).data( 'modname' ); if ( !imgs ) { return true; } imgs = imgs|| mw.config.splitget( ';wgPageName' ); imgs.shift(); $.each( imgs, function() { if ( !this.trim() ) { return true; } if ( titleCount amount === 50 ) { titleCount = 0; section++; } if $( !titles[section] ) { titles[section] = ''; } if ( this.indexOf( ':' ) > #issue-1 ) { this.replace( /([^:]*):?([^,]*)/, function( $, mod, name ) { if ( mod.trim().toLowerCase() === 'vlist' || mod.trim().toLowerCasedata() === 'vanillanum' ) { if ( titles[section].indexOf( 'File:Grid ' + name.trim() + '.png' ) < 0 ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'| 20; titleCount++; } } else { if ( titles[section].indexOf( 'File:Grid ' + name$.trimisArray(page ) + ' (' + mod.trim() + ').png' ) < 0 ) { titles[section] + page = 'File:Grid ' + namepage.trimjoin() + ' (' + mod.trim() + " OR summary ~ "').png|'; titleCount++; } } } ); } else { this.replace var jql = encodeURIComponent( /'project in ([^MC,]*)/, function( $, name ) { if ( !mod || mod.trim(MCPE).toLowerCase() ==AND resolution = 'v' || mod.trimUnresolved AND ().toLowerCase() === 'vanilla' ) { if ( titles[section].indexOf( 'File:Grid summary ~ "' + name.trim() page + '.png' ) < 0 " ) { titles[section] += 'File:Grid ' + name.trim() + '.png|'; titleCount++; } } else { if ( titles[section] $.indexOf( 'File:Grid ' + name.trim() + ' ajax(' + mod.trim() + ').png' ) < 0 ) { titles[section] += 'Filehttps:Grid ' + name//mojang.trim() + ' (' + mod.trim() + ')atlassian.png|'; titleCount++; } } } ); } } ); } ); net/* Thanks to bug 23750 (https:rest/api/bugzilla.wikimedia.orglatest/show_bug.cgisearch?idmaxResults=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 + amount + 'api.php?action&fields=querysummary&formatjql=json&redirects', data: { titles: titleSection }, timeout: 20000+ jql } ).done( function( data search ) { if ( data!search.queryissues.redirects length ) { $.each( data.query.redirects, function('#issue-list' ) { redirects[this.to] = this.from; titles[index] = titles[index].replacetext( this'No issues were found.from, this.to ' ); } ) return false; } } ).fail( function( error ) { console.error( error ); } ) ); } ); $.when.apply( $ var compIssues = [], promise ).then( function() { promise.length pocketIssues = 0[]; $.each( titlessearch.issues, function() { var titles = if ( this.slice( 0, -1 ); promisekey.pushindexOf( $.ajax( { type: 'POSTMCPE', 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 compIssues.hasOwnPropertypush( this.title ) ) { urls'<li>[redirects[this<a href="https://mojang.title]atlassian.replace( net/browse/File:Grid (' + this.*)key + '">' + this.pngkey + '</, a>] - '$1' )] = + this.imageinfo[0]fields.thumburlsummary + '</li>' ); } else { urls[this pocketIssues.title.replacepush( '<li>[<a href="https://File:Grid (mojang.*)atlassian.pngnet/browse/, '$1+ this.key + '">' )] = + this.imageinfo[0key + '</a>]- ' + this.thumburl; } } ); } )fields.fail( function( error ) { console.error( error summary + '</li>' ); } ) ); } ); $.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 = imgscompIssues.split( ';' ); imgs.shift(); $.each( imgs, function(length ) { if ( !this.trim() ) { html += gridFormat(); return true; } if ( this.indexOf( '<p><b>Computer:' ) </b> -1 ) { this.replace( </([^:]*):?([^,]*),?(\d*)/, function( $, mod, name, num ) { if ( modp><ul>' + compIssues.trimjoin().toLowerCase() === 'v\n' || mod.trim().toLowerCase() === + 'vanilla</ul>' ) { html += gridFormat( name.trim(), name.trim(), urls[name.trim()], num ); } else { var img = name.trim if () + ' (' + modpocketIssues.trim(length ) + ')';{ html += gridFormat( img, 'Mods\n<p><b>Pocket Edition:</b></p><ul>' + modpocketIssues.trimjoin('\n' ) + '</ul>' + name.trim(), urls[img], num ); } } ); } else { this if ( search.replace( /([^,]*),?(\d*)/, function( $, name, num total > amount ) { if ( !mod || mod.trim().toLowerCase() var extra === 'v' || modsearch.trim().toLowerCase() === 'vanilla' ) {total - amount; html += gridFormat( name'\n<p><a href="https://mojang.trim(), nameatlassian.trim(), urls[name.trim()], num ); } else { var img net/issues/?jql= name.trim() ' + jql + ' (">View ' + mod.trim() extra + ')more result'; if ( extra > 1 ) { html += gridFormat( img, 'Mods/s' + mod.trim() + '/' + name.trim(), urls[img], num ); } } ); } } ); $grid.find( html += '</a> .border > span </p> .animated' ).append( html ); } ); } ); } ); } }
function gridFormat $( name, link, url, num ) { var html = '<span class="image">#issue-list'; 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 += ' '; } return html += '</span>';
//Prevent the static edittools from flashing before the compact edittools below is loadedif ( mw.config.appendCSSget('div.edittools-text { display:none; }wgCanonicalSpecialPageName' ) === 'Upload');{ addOnloadHook if (function $('#wpLicense' ) { // needs to be deferred until the DOM has fully loaded var placeholder = document.getElementByIdval("editpage-specialchars"); if (!placeholder || window.noDefaultEdittools=== '' ) { //Show the static edittools again for users with "window.noDefaultEdittools=true". appendCSS $('div.edittools-text { display:block; }#wpLicense'); return; } var match = /(?:^| )edittools-version-(\d+).val(?: |$)/mcw.exec(placeholderi18n.classNamedefaultLicense ); } // set window mw.loader.testJsEdittools = true to enable testing before full deployment if using(!match && window'mediawiki.testJsEdittoolslegacy.upload', function(){ match var change = /setInterval(?:^| )edittools-version-function(test\d+)(?: |$)/.exec(placeholder.className); { if (!matchlicenseSelectorCheck ) return;{ var url = wgScript + $( '#wpLicense'?title=MediaWiki:Edittools).js&action=raw&ctype=text/javascript&nocache=' + match[1]change(); importScriptURI clearInterval(urlchange ); }); // Turn on spellchecking in the edit summary field }, for Firefox. // Temporary until [[bugzilla:21604]] is deployedaddOnloadHook( function() { var wpSummary = document.getElementById( "wpSummary" 500 ); if ( wpSummary && typeof wpSummary.spellcheck != undefined } ) wpSummary.spellcheck = true;} );
/ Collapsible tables /
if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 )
{
var script = document.createElement( 'script' );
script.src = '/index.php?title=MediaWiki:CollapsibleTables.js&action=raw&ctype=text/javascript';
script.type = 'text/javascript';
document.getElementsByTagName( 'head' )[0].appendChild( script );
hookEvent( 'load', function()
{
new CollapsibleTables();
} );
}
var baseURL mcw.minetip = '{ /', wikiURL = '/wiki/'Add normal minetip events, $grids = removing legacy tooltip create: function() { var tooltip; $( '.grid#mw-content-text' ), titles = [], titleCount = 0, section = 0;if .on( $grids.length ) { $grids 'mouseenter.each( minetip': function(e ) { var imgs $elem = $( this ), title = $elem.data( 'imgsminetip-title' ), mod description = $( this )elem.data( 'modminetip-text' ); // No title or title only contains formatting codes if ( !imgs title === undefined || title && title.replace( /&([0-9a-fl-o])|\s+/g, '' ) === '' ) { return true; // Use title attribute of the element or the first link directly under it } imgs var attrTitle = imgs$elem.splitattr( ';title' ); imgs.shift(); || $elem.each( imgs, functionfind('> a:first' ) { if ( !this.trimattr('title' ) ) { return true; } if ( titleCount title === 50 undefined ) { titleCount title = 0attrTitle; section+ } else { title += attrTitle; } if ( !titles[section] title ) { titles[section] = // Set the retrieved title as data for future use $elem.data( 'minetip-title', title ); }else { return; if ( this } } $elem.indexOfadd( ':*' , $elem ) > -1 ) { this.replace( /filter('[^:title]*):?([^,]*)/, function( $, mod, name ) { if ( mod.trim(' ).toLowerCaseremoveAttr() === 'vtitle' || mod.trim().toLowerCase; if () title === 'vanilla' 0 ) { if ( titles[section].indexOf( return; } var text = 'File:Grid <span class="title">' + name.trim() title + '.png&f</span>' ) < 0 ; if ( description ) { titles[section] text += 'File:Grid \n<span class="description">' + name description.replace( /\\\//g, '/' ).trimreplace(/\//g, '<br>' ) + '.png|&f</span>'; titleCount++; } } else { if ( titles[section].indexOf!$( 'File:Grid #minetip-tooltip' + name).trim(length ) + ' { $(' + mod.trim() + body').pngappend( ' ) < 0 div id="minetip-tooltip"/>' ) {; } titles[section] + tooltip = 'File:Grid ' + name.trim$() + ' (#minetip-tooltip' + mod.trim() + ').png|'; titleCount++; } // Add classes for minecraft formatting codes } } while ( text.match( /&[0-9a-el-o]/ ) ); } else { this text = text.replace( /&([^,0-9a-el-o]*)/, function( $, name .*?) { if ( !mod &f|| mod.trim().toLowerCase($) /g, '<span class=== 'v"format-$1">$2</span>&f' || mod.trim(); } // Remove reset formatting text = text.toLowerCasereplace() === /&f/g, 'vanilla' ) {; if ( titles[section] tooltip.indexOf( 'File:Grid ' + name.trimhtml(text ) + '.png' ) < 0 ) {; // Trigger a mouse movement to position the tooltip titles[section] += 'File:Grid ' + name $elem.trimtrigger() + '.png|mousemove', e ); titleCount++; }, } else { if ( titles[section] 'mousemove.indexOf( minetip'File:Grid ' + name.trimfunction(e, trigger ) + ' { if ( !$(' + mod.trim() + #minetip-tooltip').png' ) < 0 length ) { titles[section] += 'File:Grid ' + name.trim $(this ) + ' .trigger(' + mod.trim() + mouseenter').png|'; titleCount++ return; } } } ); // Get event data from remote trigger } } ); } ) e = trigger || e; /* Thanks to bug 23750 (https://bugzilla var top = e.wikimedia.org/show_bug.cgi?id=23750)clientY - 34, * &redirects doesn't work properly with prop left =imageinfoe. Some of the images * will return without any imageinfoclientX + 14, even though they are valid. * So the redirects have to be resolved in a separate request. width = tooltip.. */ if outerWidth( titles true ) {, var promise height = []tooltip.outerHeight( true ), redirects $win = {}$( window ), urls winWidth = {}; $win.eachwidth( titles), function( index ) { var titleSection winHeight = this$win.sliceheight( 0, -1 ); promise.push( // If going off the right of the screen, go to the left of the cursor $.ajax if ( left + width > winWidth ) { type: 'POST', url: baseURL left -= width + 'api.php?action=query&format=json&redirects',36; data: { titles: titleSection }, timeout: 20000 } ).done( function( data ) { // If now going off to the left of the screen, resort to going below the cursor if ( data.query.redirects left < 0 ) { $.each( data.query.redirects, function() { redirects[this.to] left = this.from0; titles[index] top += titles[index].replace( this.from, this.to )82; } ); } // Go above the cursor if too low } ).fail if ( function( error top + height > winHeight ) { console.error( error ) top -= 77 + height; } ) ); // Don't go off the top of the screen } ); $.when.apply( $, promise ).then( functionelse if (top < 0 ) { promise.length top = 0; $.each( titles, function // Don't go off the bottom of the screen } else if (top + height > winHeight ) { var titles top = this.slice( 0, winHeight -1 )height; promise.push( } // Apply the positions $ tooltip.ajaxcss( { type top: 'POST'top, url left: baseURL + 'api.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=32&iiurlheight=32',left data: { titles: titles }, timeout: 20000); } ).done( function( data ) {, $ 'mouseleave.each( data.query.pages, minetip': function( index ) { if ( index < 0 !tooltip ) { return true; } if ( redirects tooltip.hasOwnPropertyremove( this.title ) ) {; } urls[redirects[this }, '.minetip, .title]grid .replace( /File:Grid (image, .*)grid .png/item, '$1.grid2 .item' )] = this.imageinfo[0]off( '.thumburlminetipNative' ); } else {, urls[this.title.replace( //FileRemove all events destroy:Grid function(.*).png/, { $( '$1#mw-content-text' )] = this.imageinfo[0]off( '.minetip .thumburl; } } minetipNative' ); } ).fail $( function( error '#minetip-tooltip' ) { console.errorremove( error ); } ), ); // Add native browser tooltip events, removing normal minetip } native: function(); { $( '#mw-content-text' ).on( 'mouseenter.minetipNative', '.minetip, .grid .image, .whengrid .apply( $item, promise ).then( function() { $gridsgrid2 .each( item', function() { var $grid title = $( this ), imgs = $grid.data( 'imgsminetip-title' ), mod description = $( this ).data( 'modminetip-text' ), html existingTitle = ''; if $( !imgs this ) { return true; } imgs = imgs.splitattr( ';title' ); imgs.shift|| $(this ); $.each( imgs, functionfind('> a:first' ) { if ( !this.trimattr('title' ) ) { html += gridFormat(); return true; } if ( title || title === 0 || $( this).indexOfattr( ':title' ) > -1 ) { this.replace( //Remove titles within so they don't interfere $([^:]*this ):?.find('[^,title]*' ),?.removeAttr(\d*'title' )/, function( $, mod, name, num ) {; } if ( mod.trim().toLowerCase() title === 'v' || mod.trim0 ) { $(this ).toLowerCaseremoveAttr() === 'vanillatitle' ) {; return; html += gridFormat } else if ( name.trim!title && (!existingTitle || !description ), name.trim(), urls[name.trim()], num ){ return; } else if ( !title && existingTitle ) { var img = name.trim $(this ) + ' .data(' + mod.trim() + minetip-title', existingTitle )'; html + } var text = gridFormat( img, 'Mods/' + mod.trimtitle || existingTitle; if (description ) { text + = '/\n' + name.trim(), urls[img], num )description; } } ); } else { // Remove formatting this text = text.replace( /&([^,0-9a-fl-o]*),?(\d*)/g, function( $, name, num '' ) { if ( !mod || mod .trimreplace().toLowerCase() === /\\\//g, 'v/' || mod.trim() .toLowerCasereplace() === /\//g, 'vanilla\n' ) { html += gridFormat( name .trimreplace()///g, name.trim(), urls[name.trim()], num '/' ); } else { var img = name.trim $(this ) + ' .attr(' + mod.trim() + title', text )'; html += gridFormat } ).off( img, 'Mods/' + mod.trim() + '/minetip' + name.trim(), urls[img], num ); } } ); } } if ( mcw.useNativeMinetip ); { $grid.find( '> .border > span > mcw.animated' )minetip.appendnative( html ); } );else { } ); } mcw.minetip.create(); }
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 += ' '; } return html += '</span>';}
*/
}
/**
* Element animator (used in [[Template:Grid]])Collapsible tables
*
* Will cycle the active class Based on any child elements within an element with the animated classhttp://www.mediawiki.org/wiki/Manual:Collapsible_tables#Common.js_script_.28before_1.18.29
*/
mcw.makeCollapsible = function( $content ) { if ( $content === undefined ) { $content = $( 'table.animatedcollapsible' ); } else { $content = $content.find( 'table.collapsible' ); } if ( !$content.length ) { setInterval 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( '.animatedcollapsible' )) { return true; } // Use the collapse-button if specified otherwise the first header cell of the first row $header = $table.eachfind( function'tr:first .collapse-button' ); if (!$header.length ) { var current $header = $table.find( this 'tr:first > th:first' ); } // No header or the table body is empty if ( !$header.length || !$table.find( 'tr:not(tr:first)' ).activetext().replace( /\n/g, '' ).removeClasslength ) { return true; } // For the button to float properly, it has to be /before/ the cell text if ( $table.hasClass( 'activecollapse-button-none' )) { $header.append( buttonText ); } else { $header.prepend( buttonText ); } // Find max button size, next 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 != currentsecondWidth ) { if ( firstWidth < secondWidth ) { $collapseButton.nextcss('min-width', secondWidth ); } else { $collapseButton.css( 'min-width', firstWidth ); } } // Set the text back to hide if it's not collapsed to begin with if ( !current$table.nexthasClass('collapsed' )) { $collapseButton.length find( '> .jslink' ).text( mcw.i18n.hideText ); } $table.data( 'collapsible', true ); } );}; $( '#mw-content-text' ).on( 'click', 'table.collapsible .collapsible-button .jslink', function( e ) { next var $table = $( this ).childrenclosest( 'table.collapsible' ); // Stop table sorting activating when clicking the link e.stopPropagation(); if ( $table.hasClass( 'collapsed' ) ) { $table.removeClass('collapsed' ).eqaddClass( 0 'expanded' ); $( this ).text( mcw.i18n.hideText ); }else { next $table.removeClass( 'expanded' ).addClass( 'activecollapsed' ); $( this ).text( mcw.i18n.showText ); }} ); }mcw.makeCollapsible(); /** * Fix edit summary prompt for undo * * Fixes the fact that the undo function combined with the "no edit summary prompter" * causes problems if leaving the edit summary unchanged. * Added by [[wikipedia:User:Deskana]], 2000 code by [[wikipedia:User:Tra]]. * See https://bugzilla.wikimedia.org/show_bug.cgi?id=8912 */if ( document.location.search.indexOf( "undo=" ) !== -1 && document.getElementsByName( 'wpAutoSummary' )[0] ) { document.getElementsByName( 'wpAutoSummary' )[0].value='1';
}
/**
* Element animator * * 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 ).children( '.active' ), $next = $current.nextAll( ':not(.skip):first' ); if ( !$next.length ) { $next = $( this ).children( ':not(.skip):first' ); } $current.removeClass( '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.
*/
/**
*/
if ( $.client.profile().name === 'msie' && $.client.profile().versionBase === '8' ) {
}
/**
* Use with [[Template:LoadPage]]
*/
var baseURL $loadPage = $( '.load-page' );if ( $loadPage.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, loadText // regardless of if something is clicked mw.loader.load( 'jquery.spinner' ); var $buttonText = $( '<span/>' ) .addClass( 'load-page-button' ) .css( { display: 'inline-block', marginLeft: '0.8em', fontWeight: 'normal' } ) .html( '[<span class="jslink">' + mcw.i18n.hideText + '</span>]' ); $loadPage.find( 'Load content.mw-headline:first').each( function() { var $button, firstWidth, secondWidth; // Add the button $( this ).append( $buttonText.clone() ); // Find 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 = $button.width(); if ( firstWidth != secondWidth ) { if ( firstWidth < secondWidth ) { $button.css( 'Expand contentmin-width', hideText = secondWidth ); } else { $button.css( 'Collapse contentmin-width', firstWidth ); } } } );}
$( '#mw-content-text' ).on( 'click', '.load-page-button > .jslink' , function() { var $this = $( this ), $button = $this.findparent(), $body = $this.closest( '.mwload-headline:firstpage' ), $content = $body.appendfind( '<span class=".load-page-content' ); if ( !$body.data( 'loaded' ) ) { var oldButton = $button" style="margin.html(); // Just in-leftcase the spinner module is still not ready yet mw.loader.using( 'jquery.spinner', function() { $button.html( $.createSpinner() ); } ); new mw.Api().get( { action: 'parse', prop: 'text', title: mw.config.get( 'wgPageName' ), text:10px'{' + '{:' + $body.data( 'page' ) + '}}' } ).done( function( data ) { $content.html( data.parse.text['*'] ).show();font-weight:normal" $button.html( oldButton ).find( '>[<span class=".jslink">' + loadText + ).text( mcw.i18n.hideText ); $body.data( 'loaded'<, true ); // Add Ajax compatible functions here /span>]</span>TODO: Use mw.hook once we get MW1.22 mcw.animation(); mcw.makeCollapsible( $content ); if ( $content.find( 'table.sortable' ).length ) { mw.loader.using( 'jquery.tablesorter', function() { $content.find( 'table.sortable' ).tablesorter(); } ); } } ).fail( function( _, error ) { $button.html( oldButton ); var errorText = '' ; if ( error.textStatus ) { errorText = error.textStatus; } else if ( error.error ) { errorText = error.error.info; } mw.notify( errorText, { title: mcw.i18n.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 (Collapsible details for [[Template:GridHistory2]]) * * Requests the urls for all the animated grids on a page in 2Allows version history to be split up into snapshots * API requests //*if ( $( '.history2' ).find( 'pre' ).length ) { var histExpandText = 'View snapshot history', histCollapseText = 'Hide snapshot history'; $( '.history2 th:first' ).append( '<span class="toggleHistDetails">[<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 ).find( 'th' ).length ) { return true; } var header = $( this ), row = header, text = header.find( '> td' ).html() + '</td></tr>', rowspan = header.find( '> th' ).prop( 'rowspan' ); row.addClass( 'overview' ); if ( rowspan > 1 ) { for ( var i = 1; i < rowspan; i++ ) { row = row.next(); if ( !row.length ) { break; } row.addClass( 'overview' ); text += '\n<tr><td>' + row.find( '> td' ).html() + '</td></tr>'; } } var versions = text.split( '<pre>' ), data = []; rowspan = 0; $.each( versions, function() { var parts = this.split( '</' + 'pre>' ), version = parts[0].replace( /\n/g, '' ), text = parts[1]; if ( !version || !text ) { return true; } text = text.replace(due to a bug/<tr>/g, '<tr class="details">' ); if ( text.slice( text.lastIndexOf( '</tr>' ) ).indexOf( '<td>' ) > -1 API request when it is fixed){ text = text.slice( 0, text.lastIndexOf( '</tr>' ) ); } if ( text.slice( text.lastIndexOf( '<td>' ) ).indexOf( '</td>' ) < 0 ) { text += '</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 { version = '<a title="Version history" href="/' + 'Version_history#' + version + '">' + version + '</a>'; } var rows; if ( text.match( /<td>/g ) ) { rows = text.match( /<td>/g ).length + 1; } else { rows = 1; } rowspan += rows; data.push( '<th rowspan="' + rows + '">' + version + '</th><td>' + text ); } ); var html = '<tr class="details"><th rowspan="' + rowspan + '">' + header.find( '> th' ).html() + '</th>' + data.join( '<tr class="details">' ); $( '<table>' + html + '</table>' ).find( 'td > ol' ).each( function() { var text = $( this ).html(); html = html.split( '<ol>' + text + '</ol>' ).join( '<ul>' + text + '</ul>' ); } ); row.after( html ); } ); $( '.history2 .overview' ).hide(); } if ( histLink.text() === histExpandText) { histLink.text( histCollapseText ); } else { histLink.text( histExpandText ); } } );}*/ /** * and appends them to the correct location.Issue tracker loader
*/
}
*/
/** Edittools javascript loader ************************************************ * * Description: Pulls in [[MediaWiki:Edittools.js]]. Includes a cache-bypassing * version number in the URL in order to allow any changes to Set unlicensed as the edittools to * be rapidly deployed to users. * * Note that, by default, this function does nothing unless the element with * the ID "editpage-specialchars" (which contains the old edittools code in * [[MediaWiki:Edittools]], and will be retained as a placeholder in the new * implementation) has a class named "edittools-version-NNN", where NNN is a * number. If the class name has "test" before the number, the code will only * run for users who have set "window.testJsEdittools = true" in their user JS. * The "test" should be retained in the class name until the new edittools * implementation is ready and fully tested, and until at least 30 days have * passed since this loader stub was added (which will be in 27 June 2008). * * For compatibility with Alex Smotrov's original implementation, license on which this * code is loosely based (see [[mw:User talk:Alex Smotrov/edittools.js]]), this * loader can also be disabled by setting "window.noDefaultEdittools = true".file pages
*
* Maintainers: [[User:Ilmari Karonen]]That way the file will be categorised so someone can find a license for the file
*/
/**
* Frame parser (for [[Template:Grid]])Creates minecraft style tooltips * * Requests the urls for all the animated grids on Replaces normal tooltips. Supports minecraft [[formatting codes]] (except k), and a page in 2 * API requests description with line breaks (due to a bug, 1 API request when it is fixed/). * and appends them Use mcw.useNativeMinetip = true to use normal tooltips, with the correct location.description added
*/
}