User:El Grafo/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:El Grafo/common.css. |
// make HotCat auto-save always, even if multiple categories are changed
mw.loader.using("mediawiki.user", function () {
$('body').delegate('#hotcatCommitForm', 'submit', function () {
// The variable "this" refers to the form. Its fields can be accessed directly, e.g.
// this.wpTextbox1 gives you the textarea containing the page text of the edit.
var submitType = this.wpDiff;
if (submitType && (!this.oldid || this.oldid.value == '0')) {
// Switch form submission from diff to save. Don't do this if "oldid" is set to anything but '0':
// that indicates an edit conflict with yourself, and in that case you really, really do want
// to see the diff!
this.wpEditToken.value = mw.user.tokens.get("csrfToken");
submitType.name = submitType.value = 'wpSave';
}
return true;
});
});
//<nowiki>
//catALot///////////////////////////////////////
////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = {"watchlist":"preferences","minor":true,"editpages":true,"docleanup":false,"subcatcount":50};
////////////////////////////////////catALotEnd//
//</nowiki>
importScript("User:The Photographer/QICvote.js");
////////// tab with Jeffrey's Image Metadata Viewer //////////
/*global mw, $*/
/*jshint curly:false */
$(document).ready(function() {
if (mw.config.get('wgNamespaceNumber') !== 6 || mw.config.get('wgAction') !== "view" || !document.getElementById('file')) return;
var $link = $('.fullImageLink a[class!="mw-thumbnail-link"]'),
$image = $link.find('img'),
imageurl = $link.attr('href');
if (imageurl === undefined || $image.length < 1) return; // No preview image, e.g. for large PNGs or video
if (imageurl.substring(0, 2) == '//')
imageurl = 'https:' + imageurl;
mw.util.addPortletLink('p-cactions', 'http://exif.regex.info/exif.cgi?url=' + encodeURIComponent(imageurl), 'Jeffrey s Image Metadata Viewer', 'ca-Jeffrey', null);
});
//
// Calculate Megapixels on image pages
// from: User:Colin/vector.js
function calculateMegapixels() {
var data = $('.fileInfo').text();
pixel_filter = /([\d,]+) × ([\d,]+)/;
if(pixel_filter.test(data)) {
pixel_filter.exec(data);
var wt = RegExp.$1, ht = RegExp.$2
, w = parseFloat( wt.replace(/,/,'') )
, h = parseFloat( ht.replace(/,/,'') );
$('.fileInfo').append( $('<span></span>').text(' (' + ((w*h)/(1024.0*1024.0)).toFixed(2) + ' Megapixel)' ) );
}
}
if( mw.config.get('wgAction') == 'view' && mw.config.get('wgNamespaceNumber') == 6 ) $(document).ready(calculateMegapixels);
//syntax highlighter
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript');
// SDC Tool
importScript('User:Magnus Manske/sdc_tool.js') ;
//extra speedy DR buttons from User:Jeff_G./common.js
window.AjaxDeleteExtraButtons = [
{
'label': 'F10 personal noncontrib',
'tag': '{'+'{SD|F10}}',
'img_summary': 'Requesting speedy deletion because of [[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors)',
'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=[[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors)}}',
'talk_summary': 'Notification of possible speedy deletion for %FILE% due to [[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors)',
}, {
'label': 'G10 advert',
'tag': '{'+'{SD|G10}}',
'img_summary': 'Requesting speedy deletion because of [[COM:CSD#G10|CSD G10]] (files created as advertisements)',
'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=[[COM:CSD#G10|CSD G10]] (files created as advertisements)}}',
'talk_summary': 'Notification of possible speedy deletion for %FILE% due to [[COM:CSD#G10|CSD G10]] (files created as advertisements)',
}, {
'label': 'F10 & G10 Combo',
'tag': '{'+'{speedy|1=[[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors)['+'[Category:Personal files for speedy deletion]] and [[COM:CSD#G10|CSD G10]] (files created as advertisements)['+'[Category:Advertisements for speedy deletion]]}}',
'img_summary': 'Requesting speedy deletion because of [[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors) and [[COM:CSD#G10|CSD G10]] (files created as advertisements)',
'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=[[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors) and [[COM:CSD#G10|CSD G10]] (files created as advertisements)}}',
'talk_summary': 'Notification of possible speedy deletion for %FILE% due to [[COM:CSD#F10|CSD F10]] (personal photos of or by non-contributors) and [[COM:CSD#G10|CSD G10]] (files created as advertisements)',
}, {
'label': 'generic speedy',
'tag': '{'+'{speedy|1=%PARAMETER%}}',
'img_summary': 'Requesting speedy deletion because %PARAMETER%',
'prompt_text': 'Why speedy delete?',
'talk_tag': '{'+'{subst:speedynote|1=%FILE%|2=%PARAMETER%}}',
'talk_summary': 'Notification of possible speedy deletion for %FILE%',
}
];