User:PSL600/monobook.js: Difference between revisions

From Halopedia, the Halo wiki

No edit summary
(Alright looking into this. This stuff aint supported. I'll explain a lil on the talk page why I purged it also.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{
imageId: 'button-redirect',
imageFile: '//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png',
speedTip: 'Redirect',
tagOpen: '#REDIRECT[[',
tagClose: ']]',
sampleText: 'Target page name'
},
{
imageId: 'button-strike',
imageFile: '//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png',
speedTip: 'Strike',
tagOpen: '<s>',
tagClose: '</s>',
sampleText: 'Strike-through text'
},
{
imageId: 'button-enter',
imageFile: '//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png',
speedTip: 'Line break',
tagOpen: '<br/>',
tagClose: '',
sampleText: ''
},
{
imageId: 'button-subscript',
imageFile: '//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png',
speedTip: 'Subscript',
tagOpen: '<sub>',
tagClose: '</sub>',
sampleText: 'Subscript text'
},
{
imageId: 'button-superscript',
imageFile: '//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png',
speedTip: 'Superscript',
tagOpen: '<sup>',
tagClose: '</sup>',
sampleText: 'Superscript text'
},
{
imageId: 'button-small',
imageFile: '//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png',
speedTip: 'Small',
tagOpen: '<small>',
tagClose: '</small>',
sampleText: 'Small text'
},
{
imageId: 'button-hide-comment',
imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png',
speedTip: 'Insert hidden Comment',
tagOpen: '<!-- ',
tagClose: ' -->',
sampleText: 'Comment'
},
{
imageId: 'button-gallery',
imageFile: '//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png',
speedTip: 'Insert a picture gallery',
tagOpen: '\n<gallery>\n',
tagClose: '\n</gallery>',
sampleText: 'File:Example.svg|Caption1\nFile:Example.jpg|Caption2'
},
{
imageId: 'button-blockquote',
imageFile: '//upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png',
speedTip: 'Insert block of quoted text',
tagOpen: '<blockquote>\n',
tagClose: '\n</blockquote>',
sampleText: 'Block quote'
},
{
imageId: 'button-insert-table',
imageFile: '//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png',
speedTip: 'Insert a table',
tagOpen: '{| class="wikitable"\n|',
tagClose: '\n|}',
sampleText: '-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3'
},
{
imageId: 'button-insert-reflink',
imageFile: '//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png',
speedTip: 'Insert a reference',
tagOpen: '<ref>',
tagClose: '</ref>',
sampleText: 'Insert footnote text here'
},
{
imageId: 'button-insert-template',
imageFile: '//upload.wikimedia.org/wikipedia/commons/4/43/Button-template.png',
speedTip: 'Insert template braces',
tagOpen: '{{',
tagClose: '}}',
sampleText: 'Insert template name'
},
{
imageId: 'button-insert-underline',
imageFile: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
speedTip: 'Insert underlined text',
tagOpen: '<u>',
tagClose: '</u>',
sampleText: 'Underlined text'
},
{
imageId: 'button-insert-gallery',
imageFile: '//upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png',
speedTip: 'Insert a gallery',
tagOpen: '<gallery>',
tagClose: '</gallery>',
sampleText: 'Insert gallery images'
},
{
imageId: 'button-insert-wplink',
imageFile: '//upload.wikimedia.org/wikipedia/commons/7/7f/Button_link_to_Wikipedia.png',
speedTip: 'Insert a link to a Wikipedia article',
tagOpen: '[[wikipedia:',
tagClose: ']]',
sampleText: 'Wikipedia article name'
},
{
imageId: 'button-insert-wplink',
imageFile: '//upload.wikimedia.org/wikipedia/commons/0/0d/Button_wikification.png',
speedTip: 'Insert a link to a Wiktionary word definition',
tagOpen: '[[wikt:',
tagClose: ']]',
sampleText: 'Wiktionary definition'
},
{
imageId: 'button-insert-poem',
imageFile: '//upload.wikimedia.org/wikipedia/commons/d/d3/Button_definition_list.png',
speedTip: 'Insert a poem',
tagOpen: '<poem>',
tagClose: '</poem>',
sampleText: 'Text'
},
{
imageId: 'button-insert-subpage',
imageFile: '//upload.wikimedia.org/wikipedia/commons/0/0c/Button_Link_DifferentName.png',
speedTip: 'Link to a subpage',
tagOpen: '[[/',
tagClose: ']]',
sampleText: 'Subpage'
},
{
imageId: 'button-insert-textcenter',
imageFile: '//upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png',
speedTip: 'Text centered',
tagOpen: '<center>',
tagClose: '</center>',
sampleText: 'Centered text'
},
{
imageId: 'button-insert-textcenter',
imageFile: '//upload.wikimedia.org/wikipedia/commons/d/d5/Button_noinclude.png',
speedTip: 'noinclude',
tagOpen: '<noinclude>',
tagClose: '</noinclude>',
sampleText: 'noinclude text'
},
{
imageId: 'button-insert-plainlink',
imageFile: '//upload.wikimedia.org/wikipedia/commons/2/26/Button_plainlinks.png',
speedTip: 'Insert a external link without the external link icon',
tagOpen: '<span class="plainlinks">',
tagClose: '</span>',
sampleText: 'Enter URL here'
}
);
}


mw.loader.using( 'user.options', function () {
// This can be the string "0" if the user disabled the preference ([[bugzilla:52542#c3]])
if ( mw.user.options.get( 'usebetatoolbar' ) != 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'mediawiki.toolbar' ),
$.ready
).then( addExtraButtons );
}
} );
mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Majr/goToTop.js&action=raw&ctype=text/javascript' );
/* Welcome script from [[User:ITechieGamer]] */
/* Add image at the top right corner to blocked users' userpages */
if ( mw.config.get( 'wgRelevantUserName' ) ) {
$( function() {
'use strict';
var title = 'This user is blocked';
( new mw.Api() ).get( {
action: 'query',
format: 'json',
list: 'blocks',
formatversion: 2,
bkusers: mw.config.get( 'wgRelevantUserName' )
} ).done( function( data ) {
if ( data.query.blocks.length ) {
$( '.mw-indicators' ).prepend(
'<a href="//commons.wikimedia.org/wiki/File:Blocked_user.svg" class="mw-indicator" id="gadget-blockindicator" title="' + title + '">' +
'<img src="//upload.wikimedia.org/wikipedia/commons/4/4f/Blocked_user.svg" height="20">' +
'</a>'
);
}
} );
} );
}
/* and also a padlock to locked user accounts userpages */
if ( mw.config.get( 'wgRelevantUserName' ) ) {
$( function() {
'use strict';
var title = 'This user account has been locked';
( new mw.Api() ).get( {
action: 'query',
format: 'json',
list: 'locks',
formatversion: 2,
lkusers: mw.config.get( 'wgRelevantUserName' )
} ).done( function( data ) {
if ( data.query.locks.length ) {
$( '.mw-indicators' ).prepend(
'<a href="//meta.miraheze.org/wiki/Locked_account" class="mw-indicator" id="gadget-lockindicator" title="' + title + '">' +
'<img src="//upload.wikimedia.org/wikipedia/commons/4/4f/Padlock-purple.svg" height="20">' +
'</a>'
);
}
} );
} );
}
// Scripts, some imported from Wiki Pedia, and modified to use on this wiki //
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Gadget-popups.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Gadget-edittop.js&action=raw&ctype=text/javascript');
/**
* charinsert loader
*/
$( function () {
    var tab, tablink;
    tab = document.getElementById('ca-addsection');
    if ( !tab ) {
        return;
    }
    tablink = tab.getElementsByTagName('a')[0];
    if ( !tablink ) {
        return;
    }
    tablink.firstChild.nodeValue = '+';
    if ( mw.config.get( 'skin' ) === 'monobook' ) {
      tablink.style.paddingLeft = ".4em";
      tablink.style.paddingRight = ".4em";
    }
});
// This only shows alerts for things after this handler is installed of course.
// Because this is a gadget, error reporting can thus be inconsistent.
var originalErrorHandler = window.onerror || null;
// Column and error args are optional
window.onerror = function ( message, url, line, colomn, error ) {
var $msg = $( '<p>' );
if ( url ) {
$( '<span>' )
.text( url + ' at line ' + line + ': ' )
.appendTo( $msg );
}
$( '<span>' )
.text( message )
.appendTo( $msg );
mw.notify( $msg, {
autoHide: true,
autoHideSeconds: 10,
tag: null,
title: 'An error occured:',
type: 'error'
} );
if (originalErrorHandler) {
return originalErrorHandler.apply(this, arguments);
}
};
// unbind on leaving the page
$( window )
.on( 'unload', function () {
window.onerror = originalErrorHandler;
} );
$( function() {
'use strict';
var restrictions = mw.config.get( 'wgRestrictionEdit' );
if ( restrictions ) {
if ( restrictions.indexOf( 'sysop' ) !== -1 ) {
$( '.mw-indicators' ).prepend( '<img title="Fully Protected" id="gadget-protectionindicators-' + restrictions[ 0 ] + '" src="//upload.wikimedia.org/wikipedia/commons/5/59/Padlock.svg" height="20" />' );
} else if ( restrictions.indexOf( 'autoconfirmed' ) !== -1 ) {
$( '.mw-indicators' ).prepend( '<img title="Semi Protected" id="gadget-protectionindicators-' + restrictions[ 0 ] + '" src="//upload.wikimedia.org/wikipedia/commons/f/fc/Padlock-silver.svg" height="20" />' );
}
}
}
);
// See [[User:Equazcion/SafetyEdit]]
if ( 
// Activate on edits
(( wgAction == "edit" ) || ( wgAction == "submit" ))){
// Insert the checkbox
$('#mw-editpage-watch').after('&#160;<input title="Click this box to enable the Save button" class="ruSure" type="checkbox"></input>&#160;<label style="color:#62090B;" title="Enable the Save button" for="ruSure">Enable save</label>');
// Disable the save button on load
$('input[name="wpSave"]').prop("disabled", true);
// Set summary line to disable enter key saving when it recieves focus.
// Unbinding on load doesn't work since MediaWiki JS will bind after this.
$('#wpSummary').focus(function(){
$(this).unbind();
});
// Set the change function for the checkbox
$('input.ruSure').change(function(){
if ($(this).prop("checked")){
// We use the name attribute so all potential save buttons (produced by other scripts etc) are affected
$('input[name="wpSave"]').prop("disabled", false);
// If checked, undo our summary line focus event from above
$('#wpSummary').unbind('focus');
// Make enter key on summary line save again
$('#wpSummary').keydown(function(event){
if (event.keyCode == 13) {
$('form#editform').submit();
return false;
}
});
} else {
$('input[name="wpSave"]').prop("disabled", true);
// Here we can just unbind without a focus event, because MediaWiki JS won't supercede us again
$('#wpSummary').unbind();
}
});
}
//[[Category:Wikipedia scripts]]
$( '#ca-nstab-user a' ).text( 'Userpage' );
$( '#ca-talk a' ).text( 'Talk' );
$( '#ca-history a' ).text( 'Page history' );

Latest revision as of 05:42, September 17, 2018