Jump to content

User:SigmaEpsilon/monobook.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.
$( function (){
    var edit_tab = document.getElementById('ca-edit');
    var talk_tab = document.getElementById('ca-talk');
    var x = document.getElementById('ca-history');
    var cat_div = document.getElementById('mw-normal-catlinks');
    
    cat_div.innerHTML = cat_div.innerHTML.replace(/\|/g,'•');
    if (edit_tab) edit_tab.firstChild.innerHTML = 'edit';
    if (talk_tab) talk_tab.firstChild.innerHTML = 'talk';
    if(!x) return;
    if(x.children) x = x.children[0].href;
    else x = x.childNodes[0].href;
    mw.util.addPortletLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0);
});


// 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&dontcountme=s"></script>');
var wikEdLoadRegExTypoFix = true;



//Please leave the following line
//[[user:Where/usertabs]]
 
$(function() {
   if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
      return;
   }
   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {
      username_a = document.URL.match(/:.*:(.*)/);
      username=username_a[1];
      mw.util.addPortletLink('p-cactions',"http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "Show this user's contributions", "");
      mw.util.addPortletLink('p-cactions',"http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + username + "&site=en.wikipedia.org", "edit count", "ca-kate", "Show edit count for this user", "");
   }
});



// From [[Wikipedia:WikiProject User_scripts/Scripts/Show_last_diff]], revision 67477415

//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510

// addLastDiff
$(function () {
    if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) {
z=document.getElementById("content").childNodes;
for (var n=0;n<z.length;n++) { 
  if (z[n].className=="firstHeading") {
var pname=z[n].textContent ? z[n].textContent : z[n].innerText;
  }
}
mw.util.addPortletLink('p-cactions',"http://en.wikipedia.org/w/index.php?title=" + pname + "&diff=cur&oldid=prev", 'last', 'ca-last',"Show most recent diff");
}
});



// 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() {
    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(" - "));
       mw.util.addPortletLink('p-cactions',"/w/index.php?title="+thetitle+"&action=history&gotosince=true", "since", "ca-since", "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);
}

$(addSinceTab);



// 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
$(function () {
// if this is preview page or generated page, stop
  if (window.location.href.indexOf("/wiki/Special:") != -1) return;


  if(document.getElementById("wikiPreview")) return;

  // if this is a revision history, stop
  if(document.getElementById("histlegend ")) return;

  // if this is a diff page, stop
  if(document.getElementById("difference ")) return;

  // if this is a watchlist, stop
  if(document.getElementById("watchdetails")) return;

  // if this is the main page, stop
  if(document.getElementById("mainpage")) 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 */ ";
  }
});



// Import [[User:Lupin/popups.js]]

document.write('<script type="text/javascript" src="http://en.wikipedia.org/w' + 
               '/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript"></script>'); 
  popupFixDabs = true;
  imagePopupsForImages = false;

// jncsp-end