User:MalwareSmarts/monobook.js

From wikishia

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
importScript('User:AzaToth/twinkle.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlytag.js');
importScript('User:Ioeth/friendlyshared.js');
importScript('User:Ioeth/friendlywelcome.js');
importScript('User:AzaToth/salt.js');
importScript('[[User:Ioeth/friendly.js]]');
importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Misza13/statusChanger.js');
importScript('User:Misza13/viewSource.js');
importScript("User:Lupin/recent2.js");
importScript('User:Cream/newpages.js');
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
// Helper tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
importScript('User:AzaToth/twinkle.js');
 
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " using [[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
        protectionSummaryAd             :       " using [[WP:TWINKLE|TW]]",
        watchSpeedyPages                :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ 'agf', 'norm', 'vand', 'torev' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        watchWarnings                   :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       false,
        markProdPagesAsMinor            :       true,
        confirmUsernameToAIV            :       true,
        toolboxButtons                  :       [ ]
};
 
 
//<pre><nowiki>
function countedit() {
  countuser = wgTitle.split( '/' )[0];
  if( wgNamespaceNumber == '-1' && wgTitle == 'Contributions' )
    countuser = document.getElementById( 'contentSub' ).getElementsByTagName( 'a' )[0].getAttribute('title').split(':')[1];
  alert("Please remember that Editcountitis can be fatal and that WikiProject \n User Scripts can not be held responsible :p");
  location.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + countuser + '&site=en.wikipedia.org'
}
 
function addcountedit() { 
  if( wgNamespaceNumber == '2' || wgNamespaceNumber == '3' ) { 
  addPortletLink('p-cactions', 'javascript:countedit()', "edit count"); } 
  if( wgNamespaceNumber == '-1' && wgTitle == 'Contributions' ) {
  addPortletLink('p-cactions', 'javascript:countedit()', "edit count"); }
 
}
 
addOnloadHook(addcountedit);
 
addOnloadHook(function() {
  //add to tb: {{fullurl:Wikipedia:Articles for deletion/Log/{{CURRENTYEAR}}_{{CURRENTMONTHNAME}}_{{CURRENTDAY}}|action=edit}}
  var now = new Date(); var url = '';
  var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  url += wgServer + wgScript + '?title=Wikipedia:Articles_for_deletion/Log/';
  url += now.getUTCFullYear() + '_' + mn[now.getUTCMonth()] + '_' + now.getUTCDate();
  addPortletLink('p-tb', url, 'AFD/today', 'ca-afd', 'AFD for today');
})
 
//</nowiki></pre>
 
if(wgNamespaceNumber==2||wgNamespaceNumber==3) addOnloadHook(function() {
  var n = wgTitle;
  if(n.indexOf('/')!=-1)  n = n.substring(0,wgTitle.indexOf('/'))
  addPortletLink('p-tb', wgScript + '?title=Special:Listusers&username=' + n,'User Search','t-usersearch','Special:Listusers&username=' + n);
})
 
importScript('User:ais523/editcount.js'); //[[User:ais523/editcount.js]]
 
//this helps automate AfD closing by adding a 'close' tab to AfD debates
//written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]
 
function autoafd_result()
{
  var close = prompt("Result of debate?")
  var f = document.editform, t = f.wpTextbox1;
  t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0');
  t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "ab" + "}}";
  f.wpSummary.value = "Closing debate; result was " + close;
}
 
function autoafd_relist()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
  f.wpSummary.value = "Relisting debate";
}
 
function autoafd_keep()
{
  var date = prompt("Nomination was made when?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article survived AfD";
}
 
function autoafd_no_consensus()
{
  var date = prompt("Nomination was made when?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article survived AfD with no consensus";
}
 
function autoafd_redirect()
{
  var date = prompt("Nomination was made when?")
  var redirect = prompt("Redirect to?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";
}
 
function autoafd_merge()
{
  var date = prompt("Nomination was made when?")
  var redirect = prompt("Merge and redirect to?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD";
}
 
function autoafd_other()
{
  var date = prompt("Nomination was made when?")
  var result = prompt("Result was?")
  var votepage = prompt("Vote page is? (Enter 'd' for default.)")
  var f = document.editform, t = f.wpTextbox1;
 
    // If default votepage...
    if (votepage=="d")
      {
        var temp = document.editform.action.split("/w/index.php?title=");
        var temp = temp[1].split("&action=submit");
        var temp = temp[0].substring(5);
        var votepage = temp;
      }
 
  t.value = "{{" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
  f.wpSummary.value = "AfDed; result was " + result;
}
 
function autoafd_add_afd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
    {
      addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
      addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
    }
  if (document.title.indexOf("Editing Talk:") != -1)
    {
      addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep");
      addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
      addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
      addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge");
      addPortletLink('p-cactions', 'javascript:autoafd_other()', "other");
    }
}
 
addOnloadHook(autoafd_add_afd_tabs);
 
//end AfD closing script
 
//
 
importScript('User:Gracenotes/rollback.js');



importScript('User:TheFearow/qstring.js');
 
addOnloadHook(doAddQuickPreview);
 
function doAddQuickPreview() {
if ((wgAction != "edit") && (wgAction != "submit")) return;
var qbutton = document.getElementById("wpPreview").cloneNode(false);
qbutton.value = "Quick preview";
qbutton.type="button";
qbutton.tabindex="6"; 
qbutton.accessKey="g";
qbutton.id="dlQuickPreview";
qbutton.title="Preview your changes";
qbutton.addEventListener("click", doQuickPreview, false); 
document.getElementById("wpPreview").parentNode.insertBefore(qbutton,document.getElementById("wpDiff"));
}
 
 
function doQuickPreview() {
var bt = document.getElementById("dlQuickPreview");
document.getElementById("contentSub").innerHTML = "Getting preview";
bt.value="Getting preview";
bt.disabled=true;
var form = document.editform;
var postData = {
'wpMinoredit': form.wpMinoredit.checked, 
'wpWatchthis': form.wpWatchthis.checked,
'wpStarttime': form.wpStarttime.value,
'wpEdittime': form.wpEdittime.value,
'wpAutoSummary': form.wpAutoSummary.value,
'wpEditToken': form.wpEditToken.value,
'wpSummary': "Quick preview",
'wpTextbox1': document.editform.wpTextbox1.value  
};
 
var addr = document.URL;
addr = addr.replace("&action=edit", "&action=submit");
addr += "&wpPreview=true&live=true";
 
var qwxmlhttp = sajax_init_object(null);
qwxmlhttp.overrideMimeType('text/xml');
qwxmlhttp.open( 'POST' , addr, true);
qwxmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
qwxmlhttp.onload = function() { 
document.getElementById("wikiPreview").innerHTML =   unescape(qwxmlhttp.responseText.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&").replace(/&quot;/g,'"'));
bt.disabled=false;
bt.value = "Quick preview";
document.getElementById("contentSub").innerHTML = "";
}
qwxmlhttp.send(QueryString.create(postData));
}



//This script ([[User:ais523/highlightmyname2.js]]) highlights all instances of the
//logged-in user's username on pages by giving them a bright red background. It only
//checks bodyContent, not titles or sidebars, and doesn't change edit windows or
//Special:Preferences.
 
//<nowiki><pre>
function highlightmyname(n,p) //node, parent node
{
while(n!=null)
{
if(n.nodeType==3) //text node
{
if(n.data.toLowerCase().indexOf(wgUserName.toLowerCase())!=-1)
{
var ix=n.data.toLowerCase().indexOf(wgUserName.toLowerCase());
var t1=ix?document.createTextNode(n.data.substr(0,ix)):null;
var t2=document.createTextNode(n.data.substr(ix,wgUserName.length));
var t3=ix+wgUserName.length==n.data.length?null:
document.createTextNode(n.data.substr(ix+wgUserName.length));
var s1=document.createElement("SPAN");
s1.style.backgroundColor="#FF0000";
s1.appendChild(t2);
var s2=document.createElement("SPAN");
if(t1!=null) s2.appendChild(t1);
s2.appendChild(s1);
if(t3!=null) s2.appendChild(t3);
p.replaceChild(s2,n);
if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes
n=s2.nextSibling;
}
else
n=n.nextSibling;
}
else
{
if(n.firstChild!=null) highlightmyname(n.firstChild,n);
n=n.nextSibling;
}
}
}
 
addOnloadHook(function() {
if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&&
location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&&
location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&&
location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")
highlightmyname(document.getElementById('bodyContent').firstChild,
document.getElementById('bodyContent'));
});
//</pre></nowiki>
//[[Category:Wikipedia scripts]]