User:Galil/gwiki-tools.js

/* == GuildWiki tools == This script is used together with Greasemonkey to enhance GuildWiki's  (gw.gamewikis.org) functionality. For more information, please see: http://gw.gamewikis.org/wiki/User:Galil/GWiki-tools Note: This code will NOT display correctly if viewed through the wiki. If you would like to see the code, please visit: http://gw.gamewikis.org/wiki?title=User:Galil/gwiki-tools.js&action=raw&ctype=text/plain Original author: Johan Sköld (aka User:Galil) johan.skold@gmail.com */ var IMG_HeaderLoading = "data:image/gif;base64,R0lGODlhDAAMAPcaAHl5d66urMXFw3l5dpSUk5WVlKOjoq+vrsbGw6Sko7u7uaWlpbm5t3h4doiIhtLSz4aGhJaWlsbGxNHRzrCwr5SUkqKiobq6uNHRz4eHhf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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GQy4YEFhOMGVIjozRtDZlomNhwXjgVDJ5oINSRRzoRDNpm+MCz30qEURYmcKKyx4QREL5WYKOSwLiIUSGYUnlMXJuIgPGcQRlnnIWIXf3wUdghBsR+eNQnVydMHscofNArTqVD5MImhfQrzqZAHUc2eJAvjxYjhUMkeLg1hyEC8MMkbOkUazrhRY6GTMnT4Ooyxg0cNKQan7DvzhkjEGfeKDMlxI8gQH/u4qAkzpOM/FzuOSLGixYuXKTyME1RCA8YMe9Kza9/Ovbt3gwEBACH5BAUGAP8ALAAAAAAgACAAAAj6AP8JHEiwoMGDCBMqXMiwocOHECNK/FeDgoFmBJS9+CdlosAZ0aAdiMYswz9iER6RmfhNgYWD9yhlAlQEYjYGCrfwm0QoiENy2mIwBBPJX0MUEFI4bPOoCsNuER4uIeQnisIZ4FBA/JLIiEJ24yI6MeRFITlyEvmcMXsh4pc4/GAktJDBTcQ3ZhRqUBeRSr8sCk20qweRCJ6aCYOAcAdxS5wjC9nFs+dw35spDPGRINHwyZg0PxqmWHECiUIkWNCEdniC3gu5B4FkCcMj4uscNGLU1ueDB5MtVXR4PDHDR759SJo8OXLPI8EdLFzEeLHaufXr2LNr3z4wIAA7"; var IMG_MessageIcon = "http://gw.gamewikis.org/images/7/7a/Messagebox_info.png"; var xmlhttp = new XMLHttpRequest; var loc = location.href; var tempImg; // Helper functions function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r;  } } function html_specialchar_decode(inp) { var outp = inp.replace(/&quot;/i, '"');  outp = outp.replace(/&lt;/i, '<');   outp = outp.replace(/&gt;/i, '>');   outp = outp.replace(/&amp;/i, '&');   return outp; } function popup (name, addr, style) {   window.open(addr, name,style); } // Full Size Image functions function fullSizeImage {   var fsImage = document.evaluate("//div[@class='fullImageLink' and @id='file']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;   if (fsImage) {     if (fsImage.childNodes[0].nodeName.toUpperCase == 'A') {       return fsImage;     } else {       return null;     }   } else {     return null;     } } function fsImage_Click {   var fsImage = document.getElementById('fsImage_gwikitools');   if (fsImage) {     if (fsImage.getAttribute('zoomed') == 'false') {       var loadingOverlay = document.getElementById('loadingOverlay_gwikitools');       loadingOverlay.style.display = ''; fsImage.setAttribute('old_img', fsImage.childNodes[0].getAttribute('src')); fsImage.setAttribute('old_width', fsImage.childNodes[0].offsetWidth); fsImage.setAttribute('old_height', fsImage.childNodes[0].offsetHeight); fsImage.setAttribute('zoomed', 'true'); tempImg = document.createElement('img'); addEvent(tempImg,'load',fsImage_Load,true); tempImg.setAttribute('src', fsImage.getAttribute('image_addr')); } else { fsImage.childNodes[0].setAttribute('src', fsImage.getAttribute('old_img')); fsImage.childNodes[0].style.width = fsImage.getAttribute('old_width') + 'px'; fsImage.childNodes[0].style.height = fsImage.getAttribute('old_height') + 'px'; fsImage.setAttribute('zoomed', 'false'); document.getElementById('loadingOverlay_gwikitools').style.display = 'none'; }  } } function fsImage_Load { var fsImage = document.getElementById('fsImage_gwikitools'); if (fsImage) { if (fsImage.getAttribute('zoomed') == 'true') { document.getElementById('loadingOverlay_gwikitools').style.display = 'none'; fsImage.childNodes[0].style.width = fsImage.getAttribute('image_width') + 'px'; fsImage.childNodes[0].style.height = fsImage.getAttribute('image_height') + 'px'; fsImage.childNodes[0].setAttribute('src', tempImg.getAttribute('src')); }  } } // Faster Watchpage adding functions function ToggleWatch(url) { xmlhttp.open('HEAD', url, true); xmlhttp.onreadystatechange = function { var watchLink = document.getElementById('watchLink_gwikitools'); if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { if (watchLink.getAttribute('action') == 'add') { var watchUrl = watchLink.getAttribute('url').replace(/&action=watch$/i, '&action=unwatch'); watchLink.childNodes[1].nodeValue = 'Unwatch'; watchLink.parentNode.setAttribute('id', 'ca-unwatch'); watchLink.setAttribute('action', 'remove'); watchLink.setAttribute('title', 'Remove this page from your watchlist [alt-w]'); } else { var watchUrl = watchLink.getAttribute('url').replace(/&action=unwatch$/i, '&action=watch'); watchLink.childNodes[1].nodeValue = 'Watch'; watchLink.parentNode.setAttribute('id', 'ca-watch'); watchLink.setAttribute('action', 'add'); watchLink.setAttribute('title', 'Add this page to your watchlist [alt-w]'); }        watchLink.setAttribute('backup-caption', watchLink.childNodes[1].nodeValue); watchLink.setAttribute('url', html_specialchar_decode(watchUrl)); document.getElementById('loadingImg_gwikitools').style.display = 'none'; } else { if (error) { if (watchLink.getAttribute('action') == 'add') var watchAction = 'adding'; else var watchAction = 'removing'; if (confirm('An error occured while '+watchAction+' this page to your watchlist.\n\nWould you like to visit the page manually instead?')) { location.href = watchLink.getAttribute('url'); } else { watchLink.childNodes[1].nodeValue = watchLink.getAttribute('backup-caption'); document.getElementById('loadingImg_gwikitools').style.display = 'none'; }        }       }     }   }   xmlhttp.send(null); } function watchLink_Click { var watchLink = document.getElementById('watchLink_gwikitools'); if (watchLink.getAttribute('url').length > 0) { watchLink.setAttribute('backup-caption', watchLink.childNodes[1].nodeValue); if (watchLink.getAttribute('action') == 'add') watchLink.childNodes[1].nodeValue = ' Adding'; else if (watchLink.getAttribute('action') == 'remove') watchLink.childNodes[1].nodeValue = ' Removing'; document.getElementById('loadingImg_gwikitools').style.display = ''; ToggleWatch(watchLink.getAttribute('url')); } } // Del.icio.us functions function deliciousLink_Click { popup('delicious', 'http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(loc)+'&title='+encodeURIComponent(document.title), 'toolbar=no,width=700,height=400'); return false; } //=================================================// // Main work //=================================================// //Image Scaling if (loc.match(/Image:.+?\..{3,4}$/i)) { var fsImage = fullSizeImage; if (fsImage) { if (fsImage.childNodes.length == 4) { addEvent(fsImage.childNodes[0],'click',fsImage_Click,true); addEvent(fsImage.childNodes[3],'click',fsImage_Click,true); var imagesize = fsImage.childNodes[3].childNodes[0].nodeValue.match(/([0-9]+)x([0-9]+)/); fsImage.childNodes[0].setAttribute('id', 'fsImage_gwikitools'); fsImage.childNodes[0].setAttribute('zoomed', 'false'); fsImage.childNodes[0].setAttribute('image_addr', fsImage.childNodes[0].href); fsImage.childNodes[0].setAttribute('image_width', imagesize[1]); fsImage.childNodes[0].setAttribute('image_height', imagesize[2]); fsImage.childNodes[0].href='javascript:void'; fsImage.childNodes[3].href='javascript:void'; fsImage.childNodes[3].childNodes[0].nodeValue = fsImage.childNodes[3].childNodes[0].nodeValue.replace(/Download high resolution version/, 'Click to display this image in fullsize'); // Loading overlay var loadingOverlay = document.createElement('div'); loadingOverlay.style.backgroundColor = '#0b0b0b'; loadingOverlay.style.display = 'none'; loadingOverlay.style.position = 'absolute'; loadingOverlay.style.textAlign = 'center'; loadingOverlay.style.zIndex = 2; loadingOverlay.style.MozOpacity = 0.75; loadingOverlay.style.top = fsImage.childNodes[0].childNodes[0].offsetTop + 'px'; loadingOverlay.style.left = fsImage.childNodes[0].childNodes[0].offsetLeft + 'px'; loadingOverlay.style.width = fsImage.childNodes[0].childNodes[0].offsetWidth + 'px'; loadingOverlay.style.height = fsImage.childNodes[0].childNodes[0].offsetHeight + 'px'; var loadingOverlayImage = document.createElement('img'); loadingOverlayImage.setAttribute('src', IMG_ImageLoading); loadingOverlayImage.style.position = 'relative'; loadingOverlayImage.style.top = ((fsImage.childNodes[0].childNodes[0].offsetHeight / 2) - 16) + 'px'; loadingOverlay.appendChild(loadingOverlayImage); loadingOverlay.setAttribute('id', 'loadingOverlay_gwikitools'); addEvent(loadingOverlay,'click',fsImage_Click,true); addEvent(loadingOverlayImage,'click',fsImage_Click,true); fsImage.appendChild(loadingOverlay); }  } } // Faster Watchpage adding var watchLink = document.evaluate("//li[@id='ca-watch' or @id='ca-unwatch']/a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (watchLink) { if (watchLink.parentNode.getAttribute('id') == 'ca-watch') watchLink.setAttribute('action', 'add'); else watchLink.setAttribute('action', 'remove'); watchLink.setAttribute('url', watchLink.href); watchLink.setAttribute('id', 'watchLink_gwikitools') var loadingImg = document.createElement('img'); loadingImg.setAttribute('id', 'loadingImg_gwikitools'); loadingImg.setAttribute('src', IMG_HeaderLoading); loadingImg.style.display = 'none'; watchLink.insertBefore(loadingImg, watchLink.childNodes[0]); addEvent(watchLink,'click',watchLink_Click,true); watchLink.href = 'javascript:void'; } // External links in new window var eLinks = document.evaluate("//a[@class='external text']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < eLinks.snapshotLength; i++) eLinks.snapshotItem(i).target = '_blank'; // Del.icio.us var ulItems = document.evaluate("//div[@id='p-cactions' and @class='portlet']/ul", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (ulItems) { var deliciousListItem = document.createElement('li'); deliciousListItem.setAttribute('id', 'ca-delicious'); var deliciousLink = document.createElement('a'); deliciousLink.setAttribute('href', 'javascript:void'); deliciousLink.style.cursor = 'pointer'; deliciousLink.innerHTML = 'del.icio.us'; deliciousListItem.appendChild(deliciousLink); ulItems.appendChild(deliciousListItem); addEvent(deliciousLink,'click',deliciousLink_Click,true); } /* */