User:Mwilso24/vector.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Mwilso24 (talk | contribs) at 23:39, 15 May 2011 (Correct / Disable JS). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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




//////////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");