Cåm (Message Wall | contribs) mNo edit summary |
Cåm (Message Wall | contribs) mNo edit summary |
||
Line 50: | Line 50: | ||
'u:dev:UnsafeScripts/code.js', // Allows import of scripts into .js pages |
'u:dev:UnsafeScripts/code.js', // Allows import of scripts into .js pages |
||
'u:kangaroopower:MediaWiki:Scope.js', // FindReplace function for source editor |
'u:kangaroopower:MediaWiki:Scope.js', // FindReplace function for source editor |
||
− | 'u:runescape:User: |
+ | 'u:runescape:User:Cqm/oldfilepages.js', // Changes file pages back to original styling |
'u:runescape:User:Joeytje50/tabkey.js', // Allows use of tabkey for use in scripts |
'u:runescape:User:Joeytje50/tabkey.js', // Allows use of tabkey for use in scripts |
||
'u:wikimarks:Client.js' // Customisable On The Wiki tab |
'u:wikimarks:Client.js' // Customisable On The Wiki tab |
Latest revision as of 12:25, 10 July 2013
/** __NOWYSIWYG__ <pre>
* =============================================
* The majority of the scripts here are for
* personal use as they modify parts of the
* oasis skin violating Terms of Use.
* =============================================
* @author Cåm
*/
/*jshint
forin:true, eqeqeq:true, quotmark:single, bitwise:true, strict:true,
undef:true, unused:false, curly:true, undef:true, browser:true,
trailing:true, jquery:true, indent:4
*/
/*global mediaWiki, importArticles, jQuery */
// import variables
var monoBookText = 'Monobook',
oasisText = 'Oasis',
fdButtons = [];
// Fastdelete button names
fdButtons[fdButtons.length] = { // RuneScape Wiki only
'summary': 'Successful [[RS:RFD|RfD]]',
'label': 'RfD'
};
fdButtons[fdButtons.length] = {
'summary': 'Housekeeping',
'label': 'Housekeeping'
};
/**
* Imports
* See [[Help:Including additional JavaScript and CSS]] for help with importArticles()
* See imported pages for documentation
* @todo Move AntiUnicruft & Tabkey to Greasemonkey (or equivalent)
*/
importArticles({
type: 'script',
articles: [
'u:dev:AjaxUndo/code.js', // Add an undo link to page diffs and histories
'u:dev:AllPagesHideRedirect/code.js', // Adds a hide redirect button to AllPages & PrefixIndex
'u:dev:AntiUnicruft/code.js', // Removes invisible characters
'u:dev:FastDelete/code.js', // Fast Delete buttons
'u:dev:HeaderLinks/code.js', // Icon to link to header tags
'u:dev:PortableCSSPad/code.js', // CSS testing input
'u:dev:SkinSwitchButton/code.js', // Switch between Monobook & Oasis
'u:dev:UnsafeScripts/code.js', // Allows import of scripts into .js pages
'u:kangaroopower:MediaWiki:Scope.js', // FindReplace function for source editor
'u:runescape:User:Cqm/oldfilepages.js', // Changes file pages back to original styling
'u:runescape:User:Joeytje50/tabkey.js', // Allows use of tabkey for use in scripts
'u:wikimarks:Client.js' // Customisable On The Wiki tab
]
});
(function ($, mw, window) {
'use strict';
var source;
/**
* Special:Editcount link in profile masthead
* Original by Matthew2602
* Fixed for Special:Contributions by Cåm
*/
function editcountMasthead() {
var user;
if ($('#UserProfileMasthead').length === 0) {
return;
}
if (mw.config.get('wgCanonicalNamespace') === 'Special') {
user = mw.config.get('wgTitle').split('/');
$('#UserProfileMasthead .tally em').html('<a href="/wiki/Special:Editcount/' + user[1] + '">' + $('#UserProfileMasthead .tally em').text() + '</a>');
} else {
$('#UserProfileMasthead .tally em').html('<a href="/wiki/Special:Editcount/' + mw.config.get('wgTitle') + '">' + $('#UserProfileMasthead .tally em').text() + '</a>');
}
}
/**
* Unchecks redirect checkbox on file pages
* Because redirects in file namespace do nothing
*/
function uncheckFileRedirects() {
if (mw.config.get('wgCanonicalSpecialPageName') === 'Movepage' && (/File/).test(mw.config.get('wgTitle'))) {
$('#wpLeaveRedirect').removeAttr('checked');
}
}
/**
* Prevent autoplay on youtube videos embedded into file pages
* Original from [[w:Thread:522896]]
* Fixed for file pages by Cåm
*/
// For user page youtube autoplay
// Normally embedded through templates and mediawiki pages
function switchAutoplay() {
if (!$('iframe[src*="youtube.com"]').length) {
return;
}
$('iframe[src*="youtube.com"]').each(function() {
source = $(this).attr('src');
if (source.indexOf('autoplay=1') !== -1) {
$(this).attr('src', source.replace('autoplay=1', 'autoplay=0'));
}
});
}
// For file pages
function removeAutoplay() {
var loading;
// abort if not on a file page
if (!$('#file').length) {
return;
}
// abort if not a video
// normal images use '#file > a > img'
// videos use '#file > iframe > (youtube stuff)'
if ($('#file > a').length) {
return;
}
// aborts the timer
function abortTimer() {
window.clearInterval(loading);
}
// used in setInterval
function iframeLoad() {
if ($('#file iframe[src*="youtube.com"]').length) {
switchAutoplay();
abortTimer();
}
}
// poor mans method
loading = window.setInterval(iframeLoad, 50); // 0.05s
}
$(function () {
editcountMasthead();
uncheckFileRedirects();
removeAutoplay();
switchAutoplay();
});
}(jQuery, mediaWiki, this));
/* </pre> */