User:Mwilso24/vector.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Mwilso24 (talk | contribs) at 12:03, 12 May 2010 (Copied content from Monobook.js). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
// jncsp-start The section below (up to jncsp-end) is maintained by [[Wikipedia:WikiProject_User_scripts/User-script_manager]]
// jncsp-config addTab_ee editTop addSinceTab addLastDiff addQwikify addCleanup fixLowercaseProblem

if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager") 
   document.write('<script type="text/javascript" src="http://en.wikipedia.org/w' + 
                  '/index.php?title=User:Jitse_Niesen/Client-side_preferences/Main.js&action=raw&ctype=text/javascript"></script>'); 

// From [[Wikipedia:WikiProject User_scripts/Scripts/Fix_lowercase_first_letter_problem]], revision 84530466

// Fix wikipedia's lowercase first letter problem
// Fix the lowercase first letter problem by changing the page title to the correct one and hiding the template.
// by pile0nades
addOnloadHook(function (){


try {
  var ch = get("//div[@id='bodyContent']/dl/dd/span[@class='plainlinks']/i[contains(.,'initial letter is capitalized')]/b").snapshotItem(0);
  var correction = ch.innerHTML;
  var articleTitle = get("//div[@id='content']/h1[@class='firstHeading']").snapshotItem(0);
  var template = ch.parentNode.parentNode.parentNode;

  // check if the original and correct versions match
  // this avoids acting on non-"real" uses of the template
  if(articleTitle.innerHTML.toLowerCase() == correction.toLowerCase()) {
    // Correct the page title
    document.title = document.title.replace(articleTitle.innerHTML, correction);
  
    // Correct the article title
    articleTitle.innerHTML = correction;
  
    // Remove template
    template.style.display = "none";
  }
}
catch(e){}

function get(query, context) {
  return document.evaluate(
    query,
    document,
    null,
    XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
    context
  );
}
});



// From [[Wikipedia:WikiProject User_scripts/Scripts/Edit_Top]], revision 87854342

// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades


// Add an [edit] link to pages
addOnloadHook(function () {
// if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a revision history, stop
  if(document.getElementById("histlegend ") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a diff page, stop
  if(document.getElementById("difference ") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a watchlist, stop
  if(document.getElementById("watchdetails") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is the main page, stop
  if(document.getElementById("mainpage") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:0px;margin-top:47px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit</a>]</div>';

  // insert divContainer into the DOM below the h1
  if(window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
});



// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_LI_link]], revision 73544143


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;
}



// From [[Wikipedia:WikiProject User_scripts/Scripts/Changes_since_I_last_edited]], revision 60911506


//From  http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510
function addSinceTab() {
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
       do_since_I_last_edited()
    }
    else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) {
       var thetitle=document.title.slice(0, String(document.title).indexOf(" - "));
       var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'Changes', '');
       l.lastChild.title="Changes since I last edited";
    }
}
function do_since_I_last_edited() {
        var csub=document.getElementById("contentSub");
        var msg=document.createElement("p");
        msg.appendChild(document.createTextNode
                        ("Parsing history... please wait..."));
        msg.className="error";
        csub.insertBefore(msg, csub.firstChild)

        var username=document.getElementById("pt-userpage").textContent;
        var hists=document.getElementById("pagehistory").getElementsByTagName('li');
        for (n=0;n<hists.length;n++) {
            if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) {
                document.location=hists[n].childNodes[1].href; 
                return;
            }
        }

        msg.replaceChild(document.createTextNode
                         ("You have not edited this page! (recently)"),
                         msg.firstChild);
}

addOnloadHook(addSinceTab);



// From [[Wikipedia:WikiProject User_scripts/Scripts/Add_tab]], revision 73544604

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 [[Wikipedia:WikiProject User_scripts/Scripts/CleanupTab.js]], revision 47809636

// CleanupTab.js
//
// This script adds a "cleanup" tab to the top of article pages
// when in edit mode. It is disabled for the User namespace.

function doCleanup() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Cleanup-date|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for cleanup.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addCleanup() {
  addTab("javascript:doCleanup()", "clean", "ca-cleanup", "Mark for cleanup", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addCleanup);
  }
});

// From [[Wikipedia:WikiProject User_scripts/Scripts/Quick_wikify]], revision 56374346

// &lt;nowiki&gt;If you are editing a page, click the wikify button on your tab bar to add "{{Wikify-date|August 2007}}" to the top, set "Marked for wikification." as the edit summary, mark it as a minor edit, and submit.&lt;/nowiki&gt;

function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify-date|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addQwikify() {
  addTab("javascript:doQwikify()", "wiki", "ca-wikify", "Mark for wikification", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addQwikify);
  }
});

//Own addition: expand

function doQexpand() {
  document.editform.wpTextbox1.value = '{' + '{' + 'expand}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for expansion.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

function addQexpand() {
  addTab("javascript:doQexpand()", "expand", "ca-expand", "Mark for expansion", "");
  akeytt();
}

addOnloadHook(function() {
  if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) {
     return;
  }
  if (document.title.indexOf("Editing ") != -1) {
  addOnloadHook(addQexpand);
  }
});



// jncsp-end

importScript('User:AzaToth/twinkle.js');
 


// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

importScript('User:Voice_of_All/Addtabs/monobook.js');

//////////STATUS CHANGER
addOnloadHook(function(){
  var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var linkprefix = "http://en.wikipedia.org/w/index.php?title=User:";
  var contribs = document.getElementById( 'pt-mycontris' );
  //Add the links
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=vandalism", "FV", "pt-status-vandalism", "I'm fighting vandalism!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "");
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+user+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status: "+status;
  document.getElementById('wpMinoredit').checked = 'checked';
  //Submit it!
  document.getElementById('editform').submit();
});



importScript("User:Lupin/recent2.js");

// [[User:Zocky/AutoComplete.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/AutoComplete.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');


//
addOnloadHook(function() {
  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     var username = encodeURIComponent( wgTitle );
     addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "contribs", "ca-contrib", "User contributions");
     addPortletLink("p-cactions", "http://toolserver.org/~soxred93/count/index.php?name=" + username + "&lang=en&wiki=wikipedia", "count", "ca-editcount", "Edit count from Soxred's Tool");
     addPortletLink("p-cactions", "http://www.math.ucla.edu/~aoleg/wp/rfa/edit_summary.cgi?user=" + username + "&site=en.wikipedia.org", "Summary", "ca-summary", "Edit Summary");
  }
});
//

importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:S/tags.js');
show_cwli=true;

importScript("User:Mwilso24/public/ticker.js");
importScript("User:Mwilso24/public/pagecss.js");


importScript('User:Mr.Z-man/refbuttons.js');

importScript('User:Ale_jrb/Scripts/igloo.js'); // User:Ale_jrb/Scripts/igloo

// importScript('User:Ioeth/friendly.js');

importScript("User:Blue-Haired_Lawyer/footnote_popups.js");