User:Gumr51/common.js
Jump to navigation
Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the central discussion page, Scriptorium. The code will be executed when previewing this page under some skins, including Monobook. You can in the interim if you wish to refresh the content sooner under another skin. |
The accompanying .css page for this skin is at User:Gumr51/common.css. |
//<syntaxhighlight lang="javascript">
/* CharInsert specific */
// activate pathoschild's proofreading script in personal space
mw.loader.load('//en.wikisource.org/w/index.php?title=User:Gumr51/common.js/proofreading.js&action=raw&ctype=text/javascript');
window.charinsertDontMove = false;
window.editToolsRecall = true;
window.charinsertCustom = { User: '— œ £ § · º Æ É Ñ Œ Ö à á â ã ä æ ç è é ê ë î ï ñ ô ö ō ù ú û ü ' };
if(window.updateEditTools) window.updateEditTools();
/**
* WikiEditor specific
*
* Custom buttons ONLY when Prefs set to - Enable enhanced editing toolbar - is selected,
* Enable wizards for... - must not be selected. Show [old]edit toolbar - should be off.
* based upon - https://github.com/he7d3r/mw-gadget-ExtraEditButtons
*/
var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'xlink' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'ilink' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'file' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'reference' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'signature' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'format', 'tool': 'nowiki' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'format', 'tool': 'newline' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'insert', 'tool': 'gallery' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'advanced', 'group': 'insert', 'tool': 'redirect' } )
.wikiEditor( 'removeFromToolbar', { 'section': 'help' } )
.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'underline': {
'labelMsg': 'wikieditor-toolbar-tool-underline',
'label': 'Underline',
'id': 'underline',
'filters': [ 'body:not(.ns-2, .ns-8, .ns-828)' ],
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/8/8b/Button_underline_he.png',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<u>",
'periMsg': 'wikieditor-toolbar-tool-underline-example',
'post': "</u>"
}
}
},
'strikeout': {
'labelMsg': 'wikieditor-toolbar-tool-strikeout',
'label': 'Strike out',
'id': 'strikeout',
'filters': [ 'body:not(.ns-2, .ns-8, .ns-828)' ],
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<s>",
'periMsg': 'wikieditor-toolbar-tool-strikeout-example',
'post': "</s>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'ilink': {
'labelMsg': 'wikieditor-toolbar-tool-ilink',
'label': 'Wiki link',
'id': 'ilink',
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/4/48/Toolbar_Insert_link.png',
'offset': [2, -1582],
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[",
'periMsg': 'wikieditor-toolbar-tool-ilink-example',
'post': "]]"
}
}
},
'xlink': {
'labelMsg': 'wikieditor-toolbar-tool-xlink',
'label': 'URL link',
'id': 'xlink',
'type': 'button',
'icon': 'upload.wikimedia.org/wikipedia/commons/5/55/Toolbar_insert_xlink.png',
'offset': [-70, 2],
'action': {
'type': 'encapsulate',
'options': {
'pre': "[",
'periMsg': 'wikieditor-toolbar-tool-xlink-example',
'post': "]"
}
}
},
'nowiki': {
'labelMsg': 'wikieditor-toolbar-tool-nowiki',
'label': 'NoWiki',
'id': 'nowiki',
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/8/80/Toolbar_insert_nowiki.png',
'offset': [-70, -70],
'action': {
'type': 'encapsulate',
'options': {
'pre': "<nowiki>",
'periMsg': 'wikieditor-toolbar-tool-nowiki-example',
'post': "</nowiki>"
}
}
},
'redirect': {
'labelMsg': 'wikieditor-toolbar-tool-redirect',
'label': 'ReDirect',
'id': 'redirect',
'filters': [ 'body:not(.ns-828, .ns-829)' ],
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/7/76/Insert_redirect.png',
'offset': [-70, -142],
'action': {
'type': 'encapsulate',
'options': {
'pre': mw.config.get( 'wgWikiEditorMagicWords' ).redirect + ' [[',
'periMsg': 'wikieditor-toolbar-tool-redirect-example',
'post': "]]",
'ownline': true
}
}
},
'signature': {
'labelMsg': 'wikieditor-toolbar-tool-signature',
'label': 'Your Signature',
'id': 'signature',
'filters': [ 'body.ns-talk, body.ns-4' ],
'type': 'button',
'icon': '//upload.wikimedia.org/wikipedia/commons/7/79/Insert-signature.png',
'offset': [2, -1872],
'action': {
'type': 'encapsulate',
'options': {
'pre': '— — [[User talk:Ineuw|Ineuw talk]] 21:58, 13 December 2016 (UTC)'
}
}
}
}
} );
};
/* Check for edit mode and required modules are available. Then, customize */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get( 'usebetatoolbar' ) ) {
mw.loader.using( 'ext.wikiEditor', function () {
$(document).ready( customizeToolbar );
} );
}
} );
}
// <nowiki>
mw.loader.load('//en.wikisource.org/w/index.php?title=User:Gumr51/common.js/typoscan.js&action=raw&ctype=text/javascript');
// </nowiki>