3 ms·
This one transforms the links rather than opening them automatically. For pages with a lot of pdf links. javascript:(function(){dl=document.links;for(i=0;i
by Chramard 17y ago
This one transforms the links rather than opening them automatically. For pages with a lot of pdf links.
javascript:(function(){dl=document.links;for(i=0;i<dl.length;++i){if(dl[i].href.substr(-4)==".pdf"){dl[i].href="http://docs.google.com/gview?embedded=true&url=+dl[i].href;}}})()
- roshanr 17y agoFixed a missing quote and added void(0) at the end: javascript:dl=document.links;for(i=0;i<dl.length;++i){if(dl[i].href.substr(-4)==".pdf"){dl[i].href="http://docs.google.com/gview?embedded=true&url="+dl[i].href;}}void(0);
- Corophazard 17y agoWithout the lambda, you run the risk of overwriting dl in the global scope, which could cause another script to misbehave.