// ==UserScript==
// @name         show imageURL
// @include       http://*.tumblr.com/*
// @include       http://www.tumblr.com/show/*
// @include       http://www.tumblr.com/dashboard
// ==/UserScript==

(function(){
 function image(a){
   for(var i in a){
     if(String(a[i]).match(/\.(jpe?g|png|gif)$/i)){
       l=a[i];
       o=l.appendChild(document.createElement('img'));

       //画像をそのまま表示する場合はこれ
       o.src=l.href;
       
       with(o.style)width='400px',display='block',padding='3px',background='#fff';
       l.parentNode.replaceChild(o,l);
     }
   }
 }
 
 function setAutoPagerEvent(){
   var scrollHeight = document.documentElement.scrollHeight;
   document.addEventListener("scroll",
                             function(e){
                               if(document.documentElement.scrollHeight - scrollHeight > 100){
                                 scrollHeight = document.documentElement.scrollHeight;
                                 try{greasedLightbox.unload();}catch(ex){}
                                 image(document.getElementsByTagName('a'));
                               }
   },false);
 }
 setAutoPagerEvent();
 image(document.getElementsByTagName('a'));

})()
