QRコードを表示

  • /*
     * @title QRコードを表示
     * @description 起動すると現在のURLがデフォルトで入力状態のプロンプトが起動してOKでQRコード表示、URLを指定してQR作成も可能。QRコードをクリックすると消えます。
     * @include http://*
     * @license MIT License
     * @javascript_url
     */
    (function () {
      var im,u;
      if (u = prompt('please input url!', location.href)) {
        im = document.createElement('img');
        im.src = '//chart.googleapis.com/chart?chs=300x300&cht=qr&chl=' + encodeURIComponent(u);
        im.title = u;
        im.style.cssText = 'position:fixed;top:0;left:0;z-index:2147483647;';
        im.onclick = function () {
          this.parentNode.removeChild(this);
        };
        document.body.appendChild(im);
      }
    }) ();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/04/01 08:48:35 - 2017-04-01
  2. 2017/03/31 15:36:30 - 2017-03-31