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":75,"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': '{{metacat|topic-cat=',
                  'post': '}}'
                }
              },
              'label': 'Meta'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{metacat|topic-cat=',
                  'post': '|country of origin}}'
                }
              },
              'label': 'Meta CoO'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{metacat|topic-cat=',
                  'post': '|country of service}}'
                }
              },
              'label': 'Meta CoS'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{metacat|topic-cat=',
                  'post': '|operator}}'
                }
              },
              'label': 'Meta Op'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft class|function=',
                  'peri': '',
                  'post': '|lifttype=|engines=|enginetype=|engineloc=|props=|proptype=|sortkey=|metatopic=}}'
                }
              },
              'label': 'AC Class'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft of operator|',
                  'post': '}}'
                }
              },
              'label': 'AC of Op'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft in country service|',
                  'post': '}}'
                }
              },
              'label': 'AC iCS'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft in country service|',
                  'post': '|meta=operator}}'
                }
              },
              'label': 'AC iCS by Op'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft of country|ac=',
                  'post': '}}'
                }
              },
              'label': 'AC oC'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft in country service|ac=',
                  'post': '|}}'
                }
              },
              'label': 'AC Type iCS'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{aircraft numbered|',
                  'post': '}}'
                }
              },
              'label': 'AC Numd'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '[[Category:Aircraft by registration]]',
                }
              },
              'label': 'AC by Reg'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '{{category redirect|',
                  'post': '}}'
                }
              },
              'label': 'Cat RD'
            },
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '-->{{#if:',
                  'post': '<!--Y -->|<!--N -->|<!--E -->}}<!--'
                }
              },
              'label': 'IF'
            }
          ]
        },
      }
    }
  }
} );
/* 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 );
		}
	} );
}

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