Jump to content

User:Peter Karlsen/vector.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:Peter Karlsen/recent2.js');
importScript('User:Gracenotes/rollback.js');
importScript('User:AzaToth/twinkle.js');
importScript('User:Mr.Z-man/closeAFD.js');
if( typeof( TwinkleConfig ) == 'undefined' ) TwinkleConfig = {};
TwinkleConfig.openTalkPageOnAutoRevert                  =       true;
TwinkleConfig.watchRevertedPages                        =       [];
TwinkleConfig.watchSpeedyPages                          =       [];
TwinkleConfig.watchWarnings                             =       false;
TwinkleConfig.showRollbackLinks                         =       [];
function warnVandal()
{
  if( document.URL.indexOf("&action=roll") > 0)
  {
    vandalsTalkPageInitialIndex = document.URL.indexOf("from") + 5;
    vandalsTalkPageCharacterCount = document.URL.indexOf("&token") - document.URL.indexOf("from") - 5;
    vandalsName = document.URL.substr(vandalsTalkPageInitialIndex, vandalsTalkPageCharacterCount);
    while(vandalsName.indexOf('+') >= 0)
    {
      vandalsName = vandalsName.replace('+', '_');
    }
    vandalsTalkPage = "User_talk:" + vandalsName;
    nameOfVandalizedPage = wgPageName;
    while(nameOfVandalizedPage.indexOf('_') >= 0)
    {
      nameOfVandalizedPage = nameOfVandalizedPage.replace('_', ' ')
    }
    setTimeout("window.open(\"" + mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + vandalsTalkPage + "&action=edit&preview=yes&vanarticle=" + nameOfVandalizedPage + "&type=vand&count=1" + "\", \'twinklewarnwindow\', \'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800\')", 3000 );
  }
}
$(warnVandal);