User:Turb0-Sunrise/common.js

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

Note: After saving, you have to bypass your browser's cache to see the changes.

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:L10nM4st3r/wToolCore.js&action=raw&ctype=text/javascript');

/* Thingy stolen from RDT that puts a little edit count in the topbar */

$(document).ready( function () { 
	mw.loader.using( 'mediawiki.user', function() {
	    ( new mw.Api() ).get( {
	        action: 'query',
	        meta: 'userinfo',
	        uiprop: 'editcount'
	    } ).done( function( result ) {
	    	document.getElementById( 'pt-mycontris' ).append( ' (' + result.query.userinfo.editcount + ')' );
	    } );
	} );
} );
/* Sig image shrinkinizer 3000 */
(function($, mw) {
    
$(function() {
        
var imagesToResize = [
            
{ alt: "OPOSSUMSIG.gif", height: 20 },
            
{ alt: "Fish on skates.gif", height: 20 },
            
{ alt: "Dinosaur5.gif", height: 20 },
            
{ alt: "Sun-asplode.gif", height: 20 },
            
{ alt: "Alula.gif", height: 20 },
            
{ alt: "LucyDance2.gif", height: 20 }
        
];
        
imagesToResize.forEach(function(imgData) {
            
$('img[alt="' + imgData.alt + '"]').each(function() {
                
var img = $(this);
                
var originalWidth = img.width();
                
var originalHeight = img.height();
                
if (originalHeight === 0) return;
                
var newWidth = Math.round(originalWidth * (imgData.height / originalHeight));
                
img.attr('height', imgData.height);
                
img.attr('width', newWidth);
            
});
        
});
    
});
})(jQuery, mw);