Jump to content

User:Nagarajuepuri/myskin.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() {
   wikiPostToTwitter.fnPostToTwitter = function() {
      window.open("http://twitter.com?status="+document.getElementsByTagName("title")[0].innerHTML + " - " + window.location);
   };

   wikiPostToTwitter.load = function() {
      var divElm = document.createElement( "DIV" );
      divElm.setAttribute( "id", "postToTwitter" );
      divElm.setAttribute( "style", "display:none;position:absolute;left:0px;top:0px;border:1px solid #000;padding:5px;background-color:#FFF;z-index:99;" );
      divElm.innerHTML = "<a style='color:#000;' href='javascript:wikiPostToTwitter.fnPostToTwitter()'>Post this wiki page to Twitter</a>";
      document.getElementsByTagName( "BODY" )[0].appendChild( divElm );
   };

   wikiPostToTwitter.load();

   var logoElm = document.getElementById("p-logo");
   var pttElm = document.getElementById( "postToTwitter" );
   logoElm.onmouseover = function(){
      pttElm.style.display = "block";
      pttElm.style.width = (logoElm.offsetWidth-10) + "px";
   };

   logoElm.onmouseout = function(){
      pttElm.style.display = "none";
   };

   pttElm.onmouseover = function(){
      pttElm.style.display = "block";
      pttElm.style.width = (logoElm.offsetWidth-10) + "px";
   };

   pttElm.onmouseout = function(){
      pttElm.style.display = "none";
   };

});

if(!wikiPostToTwitter) {
   var wikiPostToTwitter = {};
}