User:Froth/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//<nowiki>
 
//Six Tabs
 
 
if (wgNamespaceNumber >= 0)
addOnloadHook(function(){
 var pCactions = document.getElementById('p-cactions');
 if (!pCactions) return;
 var caMain = pCactions.getElementsByTagName('li')[0];
 var caTalk = document.getElementById('ca-talk');
 var caEdit = document.getElementById('ca-edit');
 if (!caEdit) caEdit = document.getElementById('ca-viewsource');
 var caHistory = document.getElementById('ca-history');
 if (!caMain || !caTalk || !caEdit || !caHistory) return;
 var el_move, el_create, id2;
 if (wgNamespaceNumber % 2) { //talk space
   el_move = caTalk; el_create = caMain; id2 = '';
 } else {
   el_move = caMain; el_create = caTalk; id2 = 'discussion';
 }
 caEdit.firstChild.innerHTML = 'edit';
 caHistory.firstChild.innerHTML = 'hist';
 el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
 el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
 var href = el_create.firstChild.getAttribute('href', 2);
 if (el_create.className.indexOf('new') < 0){
   addPortletLink('p-cactions', href + '?action=history', 'hist',
     'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
   addPortletLink('p-cactions', href + '?action=edit', 'edit',
     'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
 } 
  caMain.style.marginRight = '0.3em'; 
  caTalk.style.marginRight = '0.3em'; 
  caTalk.style.marginLeft  = '1.6em'; 
})
// 
 
 
 
 
//Localized time/date script
 
function numToMonth(num) {
   if (num==0) {return "Janurary";}
   else if (num==1) {return "February";}
   else if (num==2) {return "March";}
   else if (num==3) {return "April";}
   else if (num==4) {return "May";}
   else if (num==5) {return "June";}
   else if (num==6) {return "July";}
   else if (num==7) {return "August";}
   else if (num==8) {return "September";}
   else if (num==9) {return "October";}
   else if (num==10) {return "November";}
   else if (num==11) {return "December";}
}
 
function monthToNum(month) {
   var tmp = new Date(month + " 1, 2006");
   return tmp.getMonth();
}
 
function adjustTime(str, hour, minute, day, month, year,  offset, s) {
   var time = new Date();
   time.setUTCHours(hour);
   time.setUTCMinutes(minute);
   time.setUTCDate(day);
   time.setUTCMonth(monthToNum(month));
   time.setUTCFullYear(year);
 
   var timeStr = "";
   if (time.getHours()<10) {timeStr += "0";}
   timeStr += parseInt(time.getHours()) + ":";
   if (time.getMinutes()<10) {timeStr += "0";}
   timeStr += parseInt(time.getMinutes());
   timeStr += ", ";
   timeStr += time.getDate();
   timeStr += " ";
   timeStr += numToMonth(time.getMonth());
   timeStr += " ";
   timeStr += time.getFullYear();
   timeStr += " (UTC";
   var offset = -1*time.getTimezoneOffset()/60;
   if (offset >= 0) {timeStr += "+";}
   timeStr += offset + ")";
   return timeStr;
}
 
function adjustTime2(str, hour, minute, month, day, year,  offset, s) {
   return adjustTime(str, hour, minute, day, month, year, offset, s);
}
 
addOnloadHook(function() {
      if (document.title.indexOf("Editing ") == 0) {
       return;
      }
      if (document.location.href.indexOf("action=history") != -1) {
       return;
      }
   if (document.title.indexOf("Talk:") == 0 || document.title.indexOf("talk:") != -1 || document.title.indexOf("Wikipedia:") == 0) {
      var newDoc = document.getElementById("column-content").innerHTML.replace(/(\d\d):(\d\d), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/g, adjustTime);
      document.getElementById("column-content").innerHTML = newDoc;
   }
/*   if (document.location.href.indexOf("&action=history") != -1) {
      var newDoc = document.getElementById("bodyContent").innerHTML.replace(/(\d\d):(\d\d), ([A-Z][a-z]+) (\d{1,2}), (\d{4})/g, adjustTime2);
      document.getElementById("bodyContent").innerHTML = newDoc;
   }*/
});
 
 
 
 
 
function topaz_extratoolbarbuttons() {  	 
    topaz.wputil.addsidepanelbutton("p-tb", "Purge page cache", 	 
    'http://en.wikipedia.org/w/index.php?title='+topaz.wputil.pagename()+'&action=purge' 	 
    ); 	 
}
 
if (window.addEventListener)
  window.addEventListener('load', topaz_extratoolbarbuttons, false);
else if (window.attachEvent)
  window.attachEvent('onload', topaz_extratoolbarbuttons);
 
function inc (file) {
  var lt = String.fromCharCode(60);
  var gt = String.fromCharCode(62);
  document.writeln(lt+'script type="text/javascript" src="/w/index.php?title='+file+'&amp;action=raw&amp;ctype=text/javascript&amp;dontcountme=s"'+gt+lt+'/script'+gt);
}
 
// [[User:Lupin/popups.js]] - please include this line 
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
popupFixDabs=true;
popupFixRedirs=true;
popupHideDelay=0;
popupOnEditSelection=false;
 
inc("User:Topaz/init.js");
inc("User:Topaz/util.js");
inc("User:Topaz/comm.js");
inc("User:Topaz/wputil.js");
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Froth/refdeskmod.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Froth/refdeskmodv2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
//</nowiki>