Jump to content

User:WarFox/editcountutil.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
/*
Doesn't work in IE; window.onclick doesn't fire for right clicks.
*/
 
topaz.editcountutil = new Object();
topaz.editcountutil.version = 20061104;
 
/* configuration */
// this is the page to go to instead when User: or User_talk: links are double-clicked.  the
// username will be appended; therefore, the username variable should be last in the query string.
// If you keep this default value, you will also need to install Interiot's javascript edit
// counter (User:Interiot/Tool2).
topaz.editcountutil.toolurl = "http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username=";
/* end configuration */
 
topaz.editcountutil.oldonclick = document.onclick;
document.onclick = function(e) {
  if (typeof topaz.editcountutil.oldonclick == "function") topaz.editcountutil.oldonclick();
  var b = e ? topaz.util.mousebtnmap.ns[e.which] : topaz.util.mousebtnmap.ie[event.button];
  if (b != 2) return;
  var realtarg = e ? e.target : event.srcElement;
  var username;
  if (realtarg.nodeName.toLowerCase() != "a") realtarg = realtarg.parentNode;
  if (realtarg.nodeName.toLowerCase() == "a") {
    var a = realtarg.href.split("/wiki/User:");
    if (!a[1]) {a = realtarg.href.split("/wiki/User_talk:");}
    if (a[1]) {
      var b = a[1].split("/");
      username = b[0];
    } 
  }
  if (username) {
    location.href = topaz.editcountutil.toolurl + username;
    return false;
  }
};