image viewer

  • /*
     * @title image viewer
     * @description 画像集めに最適.ウェブページ中に直接リンクされている画像を画面上に表示します.画像をクリックすると,クリックすると戻ります.画面サイズに収まりきらない画像は,ウィンドウサイズにリサイズします.
     * @include http://*
     * @license MIT License
     * @require 
     */
    (function(){var bd=document.getElementsByTagName("body")[0];var cw=document.documentElement.clientWidth;console.log(cw);var an=document.getElementsByTagName("a");var li=new Array();for(var i=0;i<an.length;i++){var ref=an[i].getAttribute("href");var re=new RegExp("(.*)\.(jpg|gif|png)");if((re.test(ref))){li.push(ref)}}var liex=li.filter(function(x,k,self){return(self.indexOf(x)===k)});var main=document.createElement("div");for(var j=0;j<liex.length;j++){var im=document.createElement("img");var ph=new Image();ph.src=liex[j];var iw=ph.width;var ih=ph.height;im.setAttribute("src",liex[j]);if(cw<iw){im.setAttribute("width",cw)}main.appendChild(im)}main.setAttribute("id","iv");main.style.position="absolute";main.style.left="0";main.style.top="0";main.style.width="100%";main.onclick=(function(b,m){return function(){b.removeChild(m)}})(bd,main);bd.appendChild(main)})();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/08/10 19:54:10 - 2014-08-10
  2. 2014/08/10 18:56:45 - 2014-08-10
  3. 2014/08/10 18:55:04 - 2014-08-10
  4. 2014/08/10 18:53:56 - 2014-08-10
  5. 2014/08/10 18:35:29 - 2014-08-10
  6. 2014/08/10 17:27:03 - 2014-08-10
  7. 2014/08/10 17:26:10 - 2014-08-10