MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */


/* Automatically add Aboutfile template to file upload description. Source: nl.wikipedia.org/wiki/MediaWiki:Common.js */
/* Alternating wiki logo */
$(function() {
$(function() {
if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !document.getElementById('wpForReUpload') && !document.getElementsByClassName('mw-destfile-warning')[0] && !document.getElementsByClassName('error')[0]) {
var logos = ['/images/b/bc/Wiki.png', '/images/9/97/Wiki_3.png', '/images/d/d7/Wiki_2.png'];
uploadDescription = document.getElementById('wpUploadDescription');
$('#p-logo a').css('background-image', 'url(' + logos[Math.floor(Math.random() * logos.length)] + ')');
var doubleBracket = '{' + '{';
uploadDescription.value = doubleBracket + 'aboutfile\n|description=\n|purpose=\n|game=\n|source=\n}}';
}
});
});


Line 17: Line 14:
});
});


/* Shrinking talk bubble sprites */
/* Automatically add aboutfile template to file upload description. Source: nl.wikipedia.org/wiki/MediaWiki:Common.js */
$(function() {
$(function() {
if (document.readyState != "complete") {
if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !document.getElementById('wpForReUpload') && !document.getElementsByClassName('mw-destfile-warning')[0] && !document.getElementsByClassName('error')[0]) {
setTimeout(arguments.callee, 100);
uploadDescription = document.getElementById('wpUploadDescription');
return;
var doubleBracket = '{' + '{';
uploadDescription.value = doubleBracket + 'aboutfile\n|description=\n|purpose=\n|game=\n|source=\n}}';
}
}
$("table.talkbubble").each(function() {
$(this).find("td").first().width(90).css("text-align", "center").find("img").each(function () {
if ($(this).width() > 90) $(this).css("height", "auto").width(90);
});
});
});
});


Line 38: Line 31:
});
});


/* Alternating wiki logo */
/* Shrinking talk bubble sprites */
$(function() {
$(function() {
var logos = ['/images/b/bc/Wiki.png', '/images/9/97/Wiki_3.png', '/images/d/d7/Wiki_2.png'];
if (document.readyState != "complete") {
$('#p-logo a').css('background-image', 'url(' + logos[Math.floor(Math.random() * logos.length)] + ')');
setTimeout(arguments.callee, 100);
return;
}
$("table.talkbubble").each(function() {
$(this).find("td").first().width(90).css("text-align", "center").find("img").each(function () {
if ($(this).width() > 90) $(this).css("height", "auto").width(90);
});
});
});
});


// ==================
/* Code for Template:Suite3 - Author: Soxra */
// Code for Template:Suite3
// Author: Soxra
// ==================
$(function() {
$(function() {
$(".morphMaster").each(function() {
$(".morphMaster").each(function() {