MediaWiki:Common.js
From DominionStrategy Wiki
Note: After saving, 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)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
/* Any JavaScript here will be loaded for all users on every page load. */ // ADDING PORTLET LINKS function add_portlet_links(){ var PortletLinks = { /* PortletLinks[ string linkID ] = Array( boolean left, // true if added on the left-side, false if right string label, string tooltip, string href, string accesskey, integer position // insert position, counting from left ) */ "ca-new-section":[false,"New Section","Add a new section","?action=edit§ion=new","+",3] } /* Add a portlet link to page PARAMS regexp/string page: RegExp or exact match string of page titles to add portlet link string id : linkID of the added portlet link */ function add(page,id){ if(typeof page == "string"){ if(wgPageName != page) return false }else if(!page.test(wgPageName)) return false var link = PortletLinks[id] if(!link) return false var vector = link[0] ? 'p-namespaces' : 'p-views' return mw.util.addPortletLink( vector , link[3] , link[1] , id , link[2] , link[4] , $('#'+vector+' li')[link[5]-1] ) } // Register adding portlets add('DominionStrategy_Wiki:Council_Room','ca-new-section') } $(document).ready( add_portlet_links )