User:Fish bowl/global.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// [[w:Wikipedia:Wikipediholic]]
if (0) {
___location = "//" + ___location.host + "/w/index.php" +
"?title=Special:Userlogout&returnto=Main_Page";
qawsedrftgyhujikolp;
}
mw.loader.load('//en.wiktionary.org/w/index.php?title=User%3ADixtosa%2FAjaxEdit.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wiktionary.org/w/index.php?title=User%3ADixtosa%2FWhoDidThat.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:GoogleOCR.js&action=raw&ctype=text/javascript');
$(".Latn:lang(ja)").removeClass('Latn').removeAttr('lang');
$("[lang*=-Latn]").removeAttr('lang');
// Why is OOjs so fucking ugly in Monobook
/*
$('[class*="oo-ui"], [class*="ooui"]').each(function(i) {
$(this).attr('class', $(this).attr('class').replace(/oo-?ui[^ ]+/g, ''));
});
mw.util.addCSS('#wpSummary{width:100%}.editCheckboxes *{display:inline}');
*/
// https://zh.moegirl.org/User:%E5%A6%B9%E7%A9%BA%E9%85%B1/Wikiplus
// mw.loader.load('https://wikiplus-app.smartgslb.com/Main.min.js');
localStorage.setItem('Wikiplus_Settings', JSON.stringify({
"defaultSummary": "function(w){return (w.sectionName && '/*' + w.sectionName + '*/ ' || ' ') }",
}));
localStorage.setItem('Wikiplus_Installed', true);
localStorage.setItem('Wikiplus_SendStatistics', false);
// https://meta.wikimedia.org/wiki/TemplateScript
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
pathoschild.TemplateScript.add({
name: '【wt】ja-readings',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('ja-readings') === -1 ? false : true),
script: function(editor) {
editor
.replace(/(\*? ?)\{\{ja-readings/g, '{{su' + 'bst:#invoke:User:Suzukaze-c/02|test_13')
.appendEditSummary('{{ja-readings}} update')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】ja-r',
script: function(editor) {
editor
.replace(/({{ja-l)(\|[^|}]+)(\|[^|}]+)?(\|[^|}]+)?(\|[^|}]+)?}}/g, '{{ja-r$2$3$5}}')
.replace(/({{[lm][|/]ja\||\[\[)([々あ-龥]+)(}}|\]\]) \([^あ-ー()]*([あ-ー]+)[^あ-ー()]*\)/g, '{{ja-r|$2|$4}}')
.replace(/({{[lm][|/]ja\|)/g, '{{su' + 'bst:#invoke:User:Suzukaze-c/02|r|')
.replace(/(\[\[)([々あ-龥]+)(\]\])/g, '{{su' + 'bst:#invoke:User:Suzukaze-c/02|r|$2}}')
.appendEditSummary('use {{ja-r}}')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】decl=i',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('decl') === -1 ? false : true),
script: function(editor) {
editor
.prepend('{{su' + 'bst:#invoke:User:Suzukaze-c/02|test_7|1=')
.append('}}')
.appendEditSummary('decl→infl')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】ja-noun tr=',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('ja-noun') === -1 ? false : true),
script: function(editor) {
editor
.replace(/({{ja-noun[^}]*)(\|tr=[^|}]+)/g, '$1')
.appendEditSummary('{{ja-noun}} does not have a |tr= parameter')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】unified zh',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('===Hanzi===') === -1 ? false : true),
script: function(editor) {
window.open('http://www.guoxuedashi.com/zidian/' + mw.config.get('wgPageName').codePointAt(0).toString(16) + '.html');
window.open('https://cjjc.weblio.jp/content/' + mw.config.get('wgPageName'));
editor
.replace(/(----[\s]+)==(Cantonese|Mandarin)==((?!----)[\S\s])*/g, '')
.replace(/(Han ref.+)/g, '$1' + '\n\n----\n\n' + '{{su' + 'bst:#invoke:User:Suzukaze-c/02|newhz}}')
.appendEditSummary('unified Chinese')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】ko-l',
script: function(editor) {
editor
.replace(/([가-힣]*)({{l\|ko\||\[\[)([가-힣 ]+)(}}|\]\])([가-힣]*) \(([㐀-鿕\[\]-]*)[^)]*\) ?([^\n]+)?/g, function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) { /* console.log('a',a,'b',b,'c',c,'d',d,'e',e,'f',f,'g',g,'h',h,'i',i,'j',j,'k',k,'l',l,'m',m,'n',n,'o',o,'p',p); */ return '{{ko-l|' + b + d + f + (g ? '|' + g.replace(/[\[\]]/g, '').replace(/-/g, '▼') : '') + '}}' + (h ? ': ' + h : ''); } )
.replace(/{{l\|ko\|/g, '{{ko-l|')
.replace(/\(''([^\)]+)''\)/g, '{{q|$1}}')
.replace(/:( )({{q\|[^\}]+}}\n)/g, '$1$2')
.appendEditSummary('{{ko-l}} cleanup')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】vi hz',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('==Vietnamese==') === -1 ? false : true),
script: function(editor) {
editor
.replace(/==Vietnamese==\n\n===Han character===\n'''([㐀-鿕])''' \(([ -あ]+)\)/g, '==Vietnamese==\n\n===Han character===\n{{vi-hantu|$2|rs=〓99}}')
.appendEditSummary('Vietnamese character format')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【wt】ja cite fmt',
enabled: (document.getElementById('wpTextbox1').innerHTML.indexOf('{{citation|') === -1 ? false : true),
script: function(editor) {
editor
.replace(/{{citation\|(.+)\|lang=ja}}/g, '{{citation|lang=ja}}')
.replace(/(\* '''.+''', )(.+)(, )(.+): */g, '$1{{l|ja||$2}}$3{{l|ja||$4}}:')
.replace(/(\*: )(.+)/g, '$1{{l|ja||$2}}')
.appendEditSummary('language tagging')
.clickDiff();
}
});
pathoschild.TemplateScript.add({
name: '【ws】粵音指南',
forNamespaces: 'page',
enabled: (mw.config.get('wgPageName').indexOf('Yue_yin_zhi_nan') === -1 ? false : true),
script: function(editor) {
editor
.prepend('{{縱書框|\n')
.append('}}')
.replace(/([、])/g, '{{縱書標點|$1}}')
.replace(/「([^」]+)」/g, '{{縱書專名號|$1}}')
.replace(/ /g, ' ')
.appendEditSummary('format');
}
});
pathoschild.TemplateScript.add({
name: '【ws】teo',
forNamespaces: 'page',
enabled: (mw.config.get('wgPageName').indexOf('pronouncing_and_defining_dictionary_of_the_Swatow_dialect') === -1 ? false : true),
script: function(editor) {
editor
.replace(/o`/g, 'QOO')
.replace(/u`/g, 'QUU')
.replace(/n`/g, 'QNN')
.replace(/\n([a-z]+?)\n/g, '\n{{center|— $1 —}}\n')
.replace(/<hr>/g, '<noinclude>{{multicol-break}}</noinclude>')
.replace(/\[(.+?)\]/g, function(a, b) { return '{{swatow entry|〓|' + b.replace(/[|.]/, '|') + '}}'; })
.replace(/([a-z])2/g, '$1́')
.replace(/([a-z])3/g, '$1̀')
.replace(/([a-z])5/g, '$1̂')
.replace(/([a-z])6/g, '$1̆')
.replace(/([a-z])7/g, '$1̄')
.replace(/QOO/g, 'o̤')
.replace(/QUU/g, 'ṳ')
.replace(/QNN/g, 'ⁿ')
.appendEditSummary('format');
}
});
});