Szerkesztő:FoBe/common.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'math': {
label: 'math', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/6/68/TeX_logo.svg/22px-TeX_logo.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<math>", // text to be inserted
post: "</math>"
}
}
},
'strike': {
label: 'strikethrough!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Antu_format-text-strikethrough.svg/22px-Antu_format-text-strikethrough.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>", // text to be inserted
post: "</s>"
}
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
/*
Adds a toolbox link to do a copyvio check on the current page.
Install by adding:
importScript('User:The Earwig/copyvios.js'); // [[User:The Earwig/copyvios.js]]
to your [[Special:MyPage/common.js]].
*/
mw.loader.using('mediawiki.util', function() {
if (mw.config.get('wgNamespaceNumber') < 0) {
return;
}
var url = 'https://copyvios.toolforge.org/?lang=' + mw.config.get('wgContentLanguage') +
'&project=' + 'wikipedia' +
'&title=' + encodeURIComponent(mw.config.get('wgPageName'));
if (mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId') ||
mw.util.getParamValue('oldid') !== null) {
url += '&oldid=' + encodeURIComponent(mw.config.get('wgRevisionId'));
}
mw.util.addPortletLink(
'p-tb',
url,
'Copyvio check',
't-copyvio-check',
'Check this page for copyright violations'
);
});