サイト外リンクQRコーダー

    @@ -6,24 +6,22 @@ * @require */ -function(){ - var t=document.createElement('div'); - t.id='qrbox'; - document.getElementsByTagName('body')[0].appendChild(t); - t.style.cssText='position:fixed;top:5px;left:5px;background:#FFF;padding:5px;border:solid 1px #36C;width:150px;'; - var a=document.getElementsByTagName('a'); - for(var i=0,n=a.length;i<n;i++){ - if(a[i].href.match(/^https?/) && !a[i].href.match(new RegExp(location.hostname))){ - (function(num){ - a[num].onmouseover=function(){ - t.innerHTML=[a[num].innerHTML, - '<br/>', - a[num].href, - '<br/><img src="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=' - ,a[num].href, - '">'].join(''); - } - })(i); - } +var t=document.createElement('div'); +t.id='qrbox'; +document.getElementsByTagName('body')[0].appendChild(t); +t.style.cssText='position:fixed;top:5px;left:5px;background:#FFF;padding:5px;border:solid 1px #36C;width:150px;'; +var a=document.getElementsByTagName('a'); +for(var i=0,n=a.length;i<n;i++){ + if(a[i].href.match(/^https?/) && !a[i].href.match(new RegExp(location.hostname))){ + (function(num){ + a[num].onmouseover=function(){ + t.innerHTML=[a[num].innerHTML, + '<br/>', + a[num].href, + '<br/><img src="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=' + ,a[num].href, + '">'].join(''); + } + })(i); } -} +}
  • /*
     * @title サイト外リンクQRコーダー
     * @description サイト外リンクをマウスオーバーするとQRコードを表示するよ
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    var t=document.createElement('div');
    t.id='qrbox';
    document.getElementsByTagName('body')[0].appendChild(t);
    t.style.cssText='position:fixed;top:5px;left:5px;background:#FFF;padding:5px;border:solid 1px #36C;width:150px;';
    var a=document.getElementsByTagName('a');
    for(var i=0,n=a.length;i<n;i++){
        if(a[i].href.match(/^https?/) && !a[i].href.match(new RegExp(location.hostname))){
            (function(num){
                a[num].onmouseover=function(){
                    t.innerHTML=[a[num].innerHTML,
                                '<br/>',
                                a[num].href,
                                '<br/><img src="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl='
                                ,a[num].href,
                                '">'].join('');
                }
            })(i);
        }
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2010/05/18 00:05:29 - 2010-05-18
  2. 2010/05/17 23:17:10 - 2010-05-17
  3. 2010/05/17 23:13:03 - 2010-05-17
  4. 2010/05/17 23:09:16 - 2010-05-17