User:PresN/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// [[User:Outriggr/metadatatest.js]]      
 importScript('User:Outriggr/metadatatest.js');
 assessmentMyTemplateCode = ["{{Cvgproj|class=|importance=}}", "{{Vgproj|class=|importance=}}"];
 assessmentDefaultProject = "Vgproj";
 
//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); }
 
//saving tab
addOnloadHook(addsaveaction);
function addsaveaction() {
 if(document.title.indexOf('Editing ') == 0) addPortletLink('p-cactions','javascript:document.getElementById("wpSave").click();','save','Save');
}
 
//AddLiLink
function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}
 
//AddTab
function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key)
};
 
// From code by [[User:Raylu|raylu]]
//
//
// This script adds a "VG Deletion" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.
 
function doVgdeletion() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '{' + '{' + 'subst' + ':' + 'VG' + ' ' + 'deletion' + '}' + '}';
  document.editform.wpSummary.value = 'Now a VG deletion.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
function addVgdeletion() {
  addTab("javascript:doVgdeletion()", "vgdeletion", "ca-vgdeletion", "VG Deletion", "");
  akeytt();
}
 
addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addVgdeletion);
  }
});
 
//Tag article as a VG proj page, no class or importance
 
function doVgproj() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '{' + '{' + 'vgproj' + '}' + '}';
  document.editform.wpSummary.value = 'Part of the Video Games Wikiproject';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
function addVgproj() {
  addTab("javascript:doVgproj()", "vgproj", "ca-vgproj", "VG Project", "");
  akeytt();
}
 
addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addVgproj);
  }
});
 
//Tag article as a VG proj stub page, no importance rating
 
function doVgstub() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '{' + '{' + 'vgproj' + '|' + 'class' + '=' + 'Stub' + '|' + 'importance' + '=' + '}' + '}';
  document.editform.wpSummary.value = 'Tagged as a stub-class article of the Video Games Wikiproject';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
function addVgstub() {
  addTab("javascript:doVgstub()", "vgstub", "ca-vgstub", "VG Project Stub", "");
  akeytt();
}
 
addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addVgstub);
  }
});
 
//Tag article as a VG proj start page, no importance rating
 
function doVgstart() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '{' + '{' + 'vgproj' + '|' + 'class' + '=' + 'Start' + '|' + 'importance' + '=' + '}' + '}';
  document.editform.wpSummary.value = 'Tagged as a start-class article of the Video Games Wikiproject';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
function addVgstart() {
  addTab("javascript:doVgstart()", "vgstart", "ca-vgstart", "VG Project Start", "");
  akeytt();
}
 
addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addVgstart);
  }
});
 
//Tell user to join VGproj
 
function doVgjoin() {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '==New Video Game Article==' +'\n\n' + 'Hey!  I saw that you created a new video game related article- consider joining the ' + '[' + '[' + 'Wikipedia:WikiProject_Video_games' + '|' + 'Video Games WikiProject' + ']' + ']' + '!  I have added your article to the list of ' + '[' + '[' + 'Wikipedia:WikiProject Video games#New articles' + '|' + 'new articles' + ']' + ']' + ', and attributed it to you.  --' + '~' + '~' + '~' + '~';
  document.editform.wpSummary.value = '==New Video Game Article==';
  document.editform.wpMinoredit.checked = false;
  document.editform.submit();
}
 
function addVgjoin() {
  addTab("javascript:doVgjoin()", "vgjoin", "ca-vgjoin", "VG Project Join", "");
  akeytt();
}
 
addOnloadHook(function() {
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addVgjoin);
  }
});