Jump to content

User:Ruud Koot/developer.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
 importScript( "User:Ruud Koot/scripts/common.js" );
 importScript( "User:Ruud Koot/scripts/dominspector.js" );
 
 addOnloadHook( addPurgeTool );
 addOnloadHook( addRawTextTool );
 addOnloadHook( addValidatorTool );
 addOnloadHook( addDOMInspectionTool );
 addOnloadHook( addCookieInspectionTool );
 
 function addPurgeTool( ) {
     addLinkToToolbox( "Purge cache", "t-purge", mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=" + wgPageName + "&action=purge" );
 }
 
 function addRawTextTool( ) {
     addLinkToToolbox( "Display raw text", "t-rawtext", mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=" + wgPageName + "&action=raw" );
 }

 function addValidatorTool( ) {
     addLinkToToolbox( "Validate HTML", "t-validate", "http://validator.w3.org/check?uri=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHungary&charset=%28detect+automatically%29&doctype=Inline&verbose=1" );
 }

 function addDOMInspectionTool( ) {
     addItemToToolbox( "Inspect DOM", "t-inspectdom", "inspectDOM" );
 }

 function addCookieInspectionTool( ) {
     addItemToToolbox( "Inspect cookie", "t-inspectcookie", "inspectCookie" );
 }

 function inspectCookie( ) {
     alert( document.cookie );
 }