User:MarMi wiki/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin can be added at User:MarMi wiki/common.css. |
console.log('common start');
var veAutoLoaded;
mw.hook('ve.activationComplete').add(function () {
mw.notify('ve.activationComplete');
var surface = ve.init.target.getSurface();
if ( surface.getMode() === 'visual' ) {
//[[:pl:User:Nux/veAutocorrect.js]]
if (!veAutoLoaded)
{
mw.notify('import veAutocorrect');
importScript(':pl:User:Nux/veAutocorrect.js');
veAutoLoaded = true;
mw.hook('userjs.veNuxAutocorrect').add(function (nac, helpers) {
mw.notify('userjs.veNuxAutocorrect');
const p = helpers.p;
const h2 = helpers.h2;
const tpl = helpers.tpl;
const date = new Date();
const my = date.toLocaleString('default', { month: 'long', year: 'numeric' });
// '{p' -> {{Page needed}}
nac.add({
from: '{p',
to: tpl({target: {href: 'Template:Page needed',wt: 'page needed'},params: {'date': {wt: my}}})
});
// '=e' -> =el + wypunktowanie
nac.add({
from: p('=e'),
to: [
h2('External links', true),
p('*')
].flat()
});
// '=n' -> =n + {{Notelist}}
nac.add({
from: p('=n'),
to: [
h2('Notes', true), //skipParagraph - bez odstępu po sekcji
tpl({
target: {
href: 'Template:NoteFoot',
wt: 'noteFoot'
}
}, true), //true=blok - kursor po Uwagi, inaczej kursor przed szablonem (i nie da się wstawiać po nim p)
].flat()
});
// '{c' -> {{Clarify}}
/*nac.add({
from: '{c',
to: tpl({target: {href: 'Template:Clarify',wt: 'clarify'},params: {'date': {wt: ym}}})
});
// '{du' -> {{Dubious}}
nac.add({
from: '{du',
to: tpl({target: {href: 'Template:Dubious',wt: 'dubious'},params: {'date': {wt: ym}}})
});
// '{de' -> {{Dead link}}
nac.add({
from: '{de',
to: tpl({target: {href: 'Template:Dead link',wt: 'dead link'},params: {'date': {wt: ym}}})
});
// '{f' -> {{Fact}}
nac.add({
from: '{f',
to: tpl({target: {href: 'Template:Fact',wt: 'fact'},params: {'date': {wt: ym}}})
});
// '{w' -> {{When}}
nac.add({
from: '{w',
to: tpl({target: {href: 'Template:When',wt: 'when'},params: {'date': {wt: ym}}})
});*/
// <nowiki>
// '{we' -> {{Według kogo}}
/*nac.add({
from: '{we',
to: tpl({target: {href: 'Szablon:Według kogo',wt: 'według kogo'},params: {'data': {wt: ym}}})
});
// '{o' -> {{Odn}}
nac.add({
from: '{o',
to: tpl({target: {href: 'Szablon:Odn',wt: 'odn'}})
});
// '{n' -> {{Nie w źródle}}
nac.add({
from: '{n',
to: tpl({target: {href: 'Szablon:Nie w źródle',wt: 'nie w źródle'},params: {'data': {wt: ym}}})
});
// '{l' -> {{Link-interwiki}}
nac.add({
from: '{l',
to: tpl({target: {href: 'Szablon:Link-interwiki',wt: 'link-interwiki'}})
});
// '{kt' -> {{Kto}}
nac.add({
from: '{kt',
to: tpl({target: {href: 'Szablon:Kto',wt: 'kto'},params: {'data': {wt: ym}}})
});
// '{f' -> {{fakt}}
nac.add({
from: '{f',
to: tpl({target: {href: 'Szablon:Fakt',wt: 'fakt'},params: {'data': {wt: ym}}})
});
// '{c' -> {{Czy to ważne}}
nac.add({
from: '{c',
to: tpl({target: {href: 'Szablon:Czy to ważne',wt: 'czy to ważne'},params: {'data': {wt: ym}}})
});
*/
// </nowiki>
});
}
}
});
//mw.loader.load('https://commons.wikimedia.org/w/index.php?title=User:Jack_who_built_the_house/convenientDiscussions.js&action=raw&ctype=text/javascript');
// initialize the array - only do this once
/*window.extraPopupFilters = [];
// define the function
function popupFilterPowerOf10 (wikiText) {
if (/10^\d+/.test(wikiText)) return '10<sup>'+/10^(\d+)/.exec(wikiText)[1]+'<sup>';
else return '';
}
*/
// add the function to the array (you can repeat this for lots of functions)
//extraPopupFilters.push(popupFilterPowerOf10);
// install [[:Wikipedia:User:Cacycle/wikEd]] in-browser text editor
/*(function ()
{
var script = document.createElement('script'); //Wikipedysta:MarMi_wiki/wikiEd.js
script.src = 'https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript';
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
}
) ();
*/
// var wikEdConfig = {};
//wikEdConfig.languageDefault = 'pl';
// install the English translation for [[en:User:Cacycle/wikEd]]
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Konradek/wikEd_international_pl.js'
//+ '&action=raw&ctype=text/javascript');
//var wikEdConfig = {};
//wikEdConfig.loadTranslation = false;
console.log('common end');