QRコード表示 w/Google Mobilizer

    
      
  • /*
     * @title QRコード表示 w/Google Mobilizer
     * @description 現在見ているページのQRコードをオーバーレイで表示します。
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    
    ;(function(_d){
      var
        ID = "bookmarklet-qr-overlay",
        qr = "http://chart.apis.google.com/chart?chs=250x250&cht=qr&chl="+_d,
        w = document.getElementById(ID);
    
      if(w) { w.style.display = "block"; return; }
    
      function div(p,id,s,o) {
        var e = document.createElement("div");
        if(id) e.id = id;
        p.appendChild(e);
        for(var i in o) e.setAttribute(i,o[i]);
        var style = [];
        for(var i in s) style.push(i,":",s[i],";");
        e.setAttribute("style",style.join(""));
        return e;
      }
      
      w = div(document.body,ID,{
        position : "fixed",
        top:0, left:0,
        width:"100%", height:"100%",
        "z-index":10000
      },{
        onmousedown : "this.style.display = 'none';"
      });
    
      div(w,null,{
        position : "absolute",
        top:0, left:0,
        width:"100%", height:"100%",
        background:"#fff",
        opacity:0.8
      },{});
    
      div(w,null,{
        position : "absolute",
        top:0, left:0,
        width:"100%", height:"100%",
        background:"url('"+qr+"') no-repeat center center"
      },{});
    
    })(encodeURIComponent("http://www.google.com/gwt/x?u="+encodeURIComponent(document.location.href)));
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2010/05/18 08:47:16 - 2010-05-18