Difference between revisions 237183 and 237184 on ptwikibooks/** * Add a link to [[Special:RecentChanges]] indicating the current version of MW * @tracking: [[Special:GlobalUsage/User:Helder.wiki/Tools/AddMediaWikiVersionLinkToRecentChanges.js]] ([[File:User:Helder.wiki/Tools/AddMediaWikiVersionLinkToRecentChanges.js]]) */ function addMWVersion( data ){ if( !data.query ) { return; } var geral = data.query.general, curRev = geral['git-hash'], oldRev = $.cookie( 'mw-last-checked-rev' ) || 99292String(undefined), // Last checked revision HTML = geral.generator + ': ' + curRev, branch = geral.generator.match( /MediaWiki (.+)/ )[ 1 ]; mw.util.addCSS( '#my-mw-version { z-index:1; font-size:75%; position:absolute; top: 2px; left:2px; }' + '#my-mw-version a.updated { color:green; font-weight:bold; }' ); var $div = $( '<div id="my-mw-version"></div>' ), $versionLink = $( '<a>' + HTML + '</a>' ).attr( { 'href': '//www.mediawiki.org/wiki/Special:Code/MediaWiki?path=%2Fbranches%2Fwmf%2F' + branch, 'class': 'updated', 'title': 'Ver as alterações recentes no branch /wmf/' + branch + '.' } ), $okLink = $( '<a>ok</a>' ) .attr( 'href', '//pt.wikibooks.org/wiki/User:Helder.wiki/Tools/AddMediaWikiVersionLinkToRecentChanges.js?action=edit' ) .click(function(e){ e.preventDefault(); $.cookie( 'mw-last-checked-rev', curRev, { expires: 30, path: '/' } ); document.location.reload( false ); // Reloads the document (from the cache) }), $normalLink = $('<a>' + HTML + '</a>' ) .attr( 'href', mw.util.wikiGetlink( 'Special:Version' ) ); if ( oldRev !== String(curRev) ) { $div.append( $versionLink ) .append( ' ( ' ) .append( $okLink ) .append( ' )' ); } else { $div.append( $normalLink ); } $div.appendTo( '#mw-head' ); } if ( 'Recentchanges' == mw.config.get( 'wgCanonicalSpecialPageName' ) ) { mw.loader.using( ['mediawiki.api'], function () { var api = new mw.Api(); api.get( { 'action': 'query', 'meta': 'siteinfo' }, { ok: addMWVersion } ); } ); } All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://pt.wikibooks.org/w/index.php?diff=prev&oldid=237184.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|