User:Djmspringcreek

From Wikipedia, the free encyclopedia

var topaz = new Object(); topaz.latestversion = {

 statuschanger:    20061108,
 editcountutil:    20061104,
 enhanceduserpage: 20061107

};

topaz.init = new Object(); topaz.init.oldonload = window.onload; window.onload = function() {

 if (typeof topaz.init.oldonload == "function") topaz.init.oldonload();
 var outdated = [];
 var highestversion = 0;
 var versionoverride = topaz.util.cookie.get("topaz.init.versionoverride");
 for (mod in topaz.latestversion) {
   if (topaz[mod]) {
     if (!topaz[mod].version || topaz[mod].version < topaz.latestversion[mod]) {
       if (!versionoverride || topaz.latestversion[mod] > versionoverride) {
         outdated.push({
           mod:    mod,
           latest: topaz.latestversion[mod],
           cur:    (topaz[mod].version?topaz[mod].version:0)
         });
       }
     }
     if (topaz.latestversion[mod] > highestversion) {
       highestversion = topaz.latestversion[mod];
     }
   }
 }
 if (outdated.length==0) {return}

var noticemessage = 'You seem to be using outdated versions of Topaz\'s Wikiscripts. While you may opt to <a href="javascript:void(0);" onclick="javascript:topaz.util.cookie.set(\'topaz.init.versionoverride\','+highestversion+');topaz.init.noticediv.style.display=\'none\';">hide this message</a> until the next major update (or until you clear your cookies), you should strongly consider <a href="http://en.wikipedia.org/wiki/User:Topaz/Wikiscripts">updating them</a> to take advantage of the new features and bug fixes. In particular, the following scripts could use updating:

  • '; for(var i=0; i<outdated.length; i++) { noticemessage += "
  • " + outdated[i].mod + " version " + outdated[i].cur + " (latest is version " + outdated[i].latest + ")
  • ";
     }
    
    noticemessage += "

";

 with(topaz.init.noticediv = topaz.util.add(topaz.util.getobj("contentSub"), "div")) {
   innerHTML = noticemessage;
   style.color = "#666666";
   style.backgroundColor = "#eeeeee";
   style.border = "1px solid #cccccc";
   style.margin = "5px";
   style.padding = "2px";
 }
 // todo: hide button

}; topaz.util = { getobj:function(id) {

 return document.getElementById ?
            document.getElementById(id) :
            document.all[id];

}, time:function() {

 return((new Date()).getTime()/1000);

}, add:function(parent, tag, attr) {

 var el = document.createElement(tag);
 if (attr) {
   for (key in attr) {
     el[key] = attr[key];
   }
 }
 return parent.appendChild(el);

}, fullescape:function(text) {

 return escape(text).replace(/\+/g,"%2B");

}, mousebtnmap:{

 ns:[null,1,3,2],
 ie:[null,1,2,null,3]

}, xmlhttpreq:function() {

 if (window.XMLHttpRequest) {
   xmlhttpobj = new XMLHttpRequest()
 } else {
   try {
     xmlhttpobj = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
     try {
       xmlhttpobj = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (e) {
       xmlhttpobj = null;
     }
   }
 }
 return xmlhttpobj;

},

cookie:{

 noexpire:(function(){
   var d = new Date();
   d.setTime(d.getTime()+(365*24*60*60*1000));
   return d.toGMTString();
 })(),

 expire:(function(){
   var d = new Date();
   d.setTime(d.getTime()-1);
   return d.toGMTString();
 })(),

 get:function(name) {
   var cl = document.cookie.split(/;\s*/);
   for (var i=0; i<cl.length; i++) {
     var curc = cl[i].split(/\=/);
     if (curc[0] == name) {
       return(curc[1]);
     }
   }
   return null;
 },

 set:function(name, value) {
   document.cookie = name + "=" + escape(value) +
       "; expires=" + topaz.util.cookie.noexpire +
       "; path=/";
 },

 del:function(name) {
   document.cookie = name+"=; expires="+topaz.util.coookie.expire+"; path=/";
 }

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

};