User:Joshbaumgartner/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<nowiki>

//catALot///////////////////////////////////////
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"disambig_category":"Disambiguation","redir_category":"Category redirects","watchlist":"preferences","minor":false,"editpages":true,"docleanup":false,"subcatcount":196,"uncat":true,"button":true};
////////////////////////////////////catALotEnd//

//HotCat////////////////////////////////////////
//(function(){function setShortCuts(){if (!window.HotCat.addShortcuts) return; window.HotCat.addShortcuts({
 // Shortcut : Replacement, both inside single quotes. If the replacement shall contain a single quote, write it as \'
//  'ac':'aircraft',
////  'bch':'Beechcraft',
//  'f16':'F-16 Fighting Falcon',
//' ':""});} if (window.HotCat && window.HotCat.runWhenReady) window.HotCat.runWhenReady(setShortCuts); else $('body').on('hotcatSetupCompleted',setShortCuts);})();

var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
  'sections': {
    'snippets': {
      'type': 'booklet',
      'label': 'Useful Snippets',
      'pages': {
        'section-templates': {
          'label': 'Templates',
          'layout': 'characters',
          'characters': [
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Wikidata Infobox}}' } }, 'label': 'WIB' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{', 'post': '}}' } }, 'label': '{{}}' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': ' • ' } }, 'label': 'dot' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category talk cfd|1=', 'post': '}}' } }, 'label': 'CfD Talk' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category redirect|', 'post': '}}' } }, 'label': 'Cat RD' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation 2|pre1=', 'post': '}}' } }, 'label': 'CN2' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|index|', 'post': '}}' } }, 'label': 'CNInd' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|activity|', 'post': '}}' } }, 'label': 'CNAct' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|appearance|', 'post': '}}' } }, 'label': 'CNApp' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|color|', 'post': '}}' } }, 'label': 'CNCol' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|media|', 'post': '}}' } }, 'label': 'CNMed' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|people|', 'post': '}}' } }, 'label': 'CNPeo' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|posture|', 'post': '}}' } }, 'label': 'CNPos' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|works|', 'post': '}}' } }, 'label': 'CNWrk' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|',  'post': '}}' } }, 'label': 'T of C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|',  'post': '}}' } }, 'label': 'T in C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|',  'post': '}}' } }, 'label': 'T from C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{SD|C2}}' } }, 'label': 'SD:C2' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{speedy delete|', 'post': '}}' } }, 'label': 'Speedy' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{MetaCat|topic-cat=', 'post': '}}' } }, 'label': 'Meta' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category by year|',  'post': '|}}' } }, 'label': 'CbY' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '(reference: [', 'post': ']' } }, 'label': 'Reference Note' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '-->{{#if:', 'post': '<!--Y -->|<!--N -->|<!--E -->}}<!--' } }, 'label': 'IF' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{DEFAULTSORT:', 'post': '}}' } }, 'label': 'DefSort' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '-->{{#if:{{{debug|}}}|{{mbox|text=', 'post': '}}|}}<!--', } }, 'label': 'Debug' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '<includeonly><!--', 'post': '--></includeonly><noinclude></noinclude>', } }, 'label': 'Template Start' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{groups||', 'post': '}}' } }, 'label': 'Grp Qty' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{legend|#FFFFFF|<b>Total:  ', 'post': '  seats</b>}}' } }, 'label': 'LegendST' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{number cat|nt=nom|nomi=bus routes|n=', 'post': '}}' } }, 'label': 'Bus Rte' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{number cat|', 'post': '}}' } }, 'label': 'NCAT' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{tram fleet number|', 'post': '}}' } }, 'label': 'Tram fleet' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '__HIDDENCAT__{{unidentified category|||', 'post': '}}{{global maintenance category}}{{Empty category}}', } }, 'label': 'UI Cat' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|index| ', 'post': ' }}' } }, 'label': 'CNI' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{year books from country}}', 'post': '' } }, 'label': 'YBBC' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{intersection category| ', 'post': ' }}' } }, 'label': 'Xsection' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{global maintenance category}}', 'post': '' } }, 'label': 'GMC' },
          ]
        },
        'section-country': {
          'label': 'Country',
          'layout': 'characters',
          'characters': [
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Wikidata Infobox}}' } }, 'label': 'WIB' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{MetaCat|topic-cat=', 'post': '}}' } }, 'label': 'Meta' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category navigation|index| ', 'post': ' }}' } }, 'label': 'CNI' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category redirect| ', 'post': ' }}' } }, 'label': 'CRD' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{country category', 'post': '}}' } }, 'label': 'Country' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country| ',  'post': ' }}' } }, 'label': 'T of C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country| ',  'post': ' }}' } }, 'label': 'T in C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country| ',  'post': ' }}' } }, 'label': 'T from C' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|academia',  'post': '}}' } }, 'label': 'Acadma' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|academic disciplines',  'post': '}}' } }, 'label': 'AcaDis' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|academic institutions',  'post': '}}' } }, 'label': 'AcaIns' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|activities',  'post': '}}' } }, 'label': 'Actvts' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|aircraft',  'post': '}}' } }, 'label': 'ACfr' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|aircraft',  'post': '}}' } }, 'label': 'ACin' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|aircraft',  'post': '}}' } }, 'label': 'ACof' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|anthropology',  'post': '}}' } }, 'label': 'Antlgy' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|archaeology',  'post': '}}' } }, 'label': 'Arclgy' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|aviation',  'post': '}}' } }, 'label': 'Avi' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|biology',  'post': '}}' } }, 'label': 'Biolgy' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|buildings',  'post': '}}' } }, 'label': 'Bldg' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|chemistry',  'post': '}}' } }, 'label': 'Chm' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|concepts',  'post': '}}' } }, 'label': 'Concep' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|culture',  'post': '}}' } }, 'label': 'Cultur' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|devices',  'post': '}}' } }, 'label': 'Dev in' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|devices',  'post': '}}' } }, 'label': 'Dev of' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|earth sciences',  'post': '}}' } }, 'label': 'EarSci' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|education',  'post': '}}' } }, 'label': 'Edu' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|educational institutions',  'post': '}}' } }, 'label': 'EduIns' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|educational organizations',  'post': '}}' } }, 'label': 'EduOrg' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|election apportionment diagrams',  'post': '}}' } }, 'label': 'ElApDi' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|engineering',  'post': '}}' } }, 'label': 'Engnrg' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|equipment',  'post': '}}' } }, 'label': 'Eqptmt' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|forestry',  'post': '}}' } }, 'label': 'Frstry' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|geology',  'post': '}}' } }, 'label': 'Geolgy' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|government',  'post': '}}' } }, 'label': 'Gov' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|helicopters',  'post': '}}' } }, 'label': 'HCfrom' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|helicopters',  'post': '}}' } }, 'label': 'HCin' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|helicopters',  'post': '}}' } }, 'label': 'HCof' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|higher education',  'post': '}}' } }, 'label': 'HiEd' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|hydrology',  'post': '}}' } }, 'label': 'Hydrlg' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|industry|place=side',  'post': '}}' } }, 'label': 'Ind' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|information',  'post': '}}' } }, 'label': 'Inform' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|information technology',  'post': '}}' } }, 'label': 'InfTec' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|infrastructure',  'post': '}}' } }, 'label': 'Infstr' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|institutes',  'post': '}}' } }, 'label': 'Insute' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|institutions',  'post': '}}' } }, 'label': 'Instns' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|inventions',  'post': '}}' } }, 'label': 'Invtns' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|life',  'post': '}}' } }, 'label': 'Life' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|mathematics',  'post': '}}' } }, 'label': 'Math' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|machines',  'post': '}}' } }, 'label': 'Machin' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|manufactured objects',  'post': '}}' } }, 'label': 'MfrObj' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|manufacturing',  'post': '}}' } }, 'label': 'Mfg' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|measurement',  'post': '}}' } }, 'label': 'Msr' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|military',  'post': '}}' } }, 'label': 'Mil' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|military equipment',  'post': '}}' } }, 'label': 'MilEqp' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|military vehicles',  'post': '}}' } }, 'label': 'MilVeh' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|natural sciences',  'post': '}}' } }, 'label': 'NatSci' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|nature',  'post': '}}' } }, 'label': 'Nature' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|observation',  'post': '}}' } }, 'label': 'Observ' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|organisms',  'post': '}}' } }, 'label': 'Orgsms' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|organizations',  'post': '}}' } }, 'label': 'Orgztn' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|panoramas',  'post': '}}' } }, 'label': 'Panora' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|physicians',  'post': '}}' } }, 'label': 'Physcn' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|places',  'post': '}}' } }, 'label': 'Places' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|research',  'post': '}}' } }, 'label': 'Resrch' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|research and development',  'post': '}}' } }, 'label': 'R&D' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|satellites',  'post': '}}' } }, 'label': 'Satlts' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic from country|scholars',  'post': '}}' } }, 'label': 'Scholr' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|science',  'post': '}}' } }, 'label': 'Sci' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|science buildings',  'post': '}}' } }, 'label': 'SciBld' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|society',  'post': '}}' } }, 'label': 'Soc' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|statistics',  'post': '}}' } }, 'label': 'Stat' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|structures',  'post': '}}' } }, 'label': 'Struct' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|subdivisions',  'post': '}}' } }, 'label': 'SubDiv' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|symbols',  'post': '}}' } }, 'label': 'Sym' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|techniques',  'post': '}}' } }, 'label': 'Tcq' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|technology',  'post': '}}' } }, 'label': 'Tch' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|technology events',  'post': '}}' } }, 'label': 'TchEvt' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|telecommunications',  'post': '}}' } }, 'label': 'TelCom' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|telephony',  'post': '}}' } }, 'label': 'TelPny' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|transport',  'post': '}}' } }, 'label': 'Tpt' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|views',  'post': '}}' } }, 'label': 'View' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|volcanism',  'post': '}}' } }, 'label': 'Volism' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|volcanology',  'post': '}}' } }, 'label': 'Vology' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic of country|weather',  'post': '}}' } }, 'label': 'Wthr' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{topic in country|wildlife',  'post': '}}' } }, 'label': 'Wldlf' },
          ]
        },
        'section-cfd': {
          'label': 'Discussions',
          'layout': 'characters',
          'characters': [
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{', 'post': '}}' } }, 'label': '{{}}' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{category talk cfd|1=', 'post': '}}' } }, 'label': 'CfD Talk' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Subcat move request|format= ', 'post': ' }}' } }, 'label': 'Issue Note' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2016/12/Category:History of Czechia}}{{Commons:Categories for discussion/2020/02/Category:Products of the Czech Republic}}{{Commons:Categories for discussion/2022/02/Category:Czech Republic}}', 'post': '' } }, 'label': 'Czechia' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2017/11/Category:Groups by size}}', 'post': '{{Commons:Categories for discussion/2019/10/Category:Groups}}' } }, 'label': 'Groups' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2019/12/Category:Male humans}}', 'post': '' } }, 'label': 'Humans' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2018/02/Category:Panoramics}}{{Commons:Categories for discussion/2022/12/Category:Panoramics by country}}', 'post': '' } }, 'label': 'Panoramas' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2015/07/Category:Science and technology}}', 'post': '' } }, 'label': 'S&T' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{Commons:Categories for discussion/2016/10/Category:Universities and colleges by country}}', 'post': '' } }, 'label': 'U&C' },
          ]
        },
        'section-num': {
          'label': 'Numbers',
          'layout': 'characters',
          'characters': [
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{groups||', 'post': '}}' } }, 'label': 'Grp Qty' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{number cat|nt=nom|nomi=bus routes|n=', 'post': '}}' } }, 'label': 'Bus Rte' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{number cat|', 'post': '}}' } }, 'label': 'NCAT' },
            { 'action': { 'type': 'encapsulate', 'options': { 'pre': '{{tram fleet number|', 'post': '}}' } }, 'label': 'Tram fleet' }
          ]
        }
      }
    }
  }
} );
/* Your code goes here */
};

/* 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 );
		}
	} );
}

//Deepcat
mw.loader.load( "https://de.wikipedia.org/w/index.php?title=MediaWiki:Gadget-DeepCat.js&action=raw&ctype=text/javascript" );

//importScript( 'MediaWiki:Commander.js ');
//</nowiki>