User:Ruslik0/BrokenURLs.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.
/* Configuration variables */
 var PortletLinkName='Broken urls'; //Portlet text
 var PortletLinkTip='Get all broken URLs in stylesheets'; //Portlet popup comment
 var urlsViewConfig='';
 var PreviewWinName='List of broken URLs in '; 
/* End of configuration variables */

   /* Adding a portlet link after the page is ready */
   $(document).ready(function() {
        if($.inArray(mw.util.getParamValue('action'),['edit', 'submit']) == -1)
       { 
          URlink=mw.util.addPortletLink('p-cactions','#',PortletLinkName,'ca-urls',PortletLinkTip);
          $(URlink).click(CollectPages);
       } 

   })
   
 function  CollectPages () {
    var url=mw.config.get('wgServer')+ mw.config.get('wgScriptPath')+'/index.php?';
    $.get(url, {
               title: 'MediaWiki:Common.css',
               action: 'raw'
            },
     ProcessPage);
 }

 function ProcessPage (rawcss) { 
  tt=window.open();
  tt.document.write(rawcss);
  tt.document.close(); 

 }