Skip to content

Instantly share code, notes, and snippets.

@nariyu
Last active August 26, 2017 17:12
Show Gist options
  • Save nariyu/61fee675aa6beb900753b9ceddb76b8f to your computer and use it in GitHub Desktop.
Save nariyu/61fee675aa6beb900753b9ceddb76b8f to your computer and use it in GitHub Desktop.
google画像検索の結果画面で実行するとスライドショーになるbookmarklet
b=document.body;a=b.querySelectorAll('a.rg_l');a=Array.prototype.slice.apply(a);c=document.createElement('div');s=c.style;s.position='fixed';s.zIndex=1000;s.top=s.left=0;s.width=s.height='100%';s.background='rgba(0,0,0,.8)';s.opacity=0;s.transition='opacity 1s linear 0s';b.appendChild(c);setTimeout(function(){s.opacity=1},10);l=[];a.forEach(function(i){m=i.href.match(/imgurl=(https?.+?\.(jpe?g|png|gif))/i);if(!m)return;l.push(decodeURIComponent(m[1]))});n=function(u,i,s){u=l.shift();i=new Image;s=i.style;i.onload=function(){s.width='auto';s.height='70%';s.opacity='1';l.push(u);setTimeout(function(){s.opacity='0';setTimeout(function(){c.removeChild(i)},500)},2800,i);setTimeout(n,3000)};i.onerror=function(){c.removeChild(i);n()};i.src=u;s.position='absolute';s.top=s.left='50%';s.boxShadow='0 0 30px #000';s.opacity='0';s.transform='translate(-50%,-50%)';s.transition='opacity 0.5s linear 0s';c.appendChild(i)};setTimeout(n,1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment