QRコードを表示(選択テキスト)

    @@ -4,7 +4,6 @@ * @include http://* * @require jQuery * @license MIT License - * @javascript_url */ (function(){
  • /*
     * @title QRコードを表示(選択テキスト)
     * @description Folk後、はてなは文字化けするのでgooglechartAPIに。めんどうだったのでjQueryインクルード。テキストを入力するかテキストを選択するかすればそのテキストを、そうでなければ現在のURLをQRコードにします。
     * @include http://*
     * @require jQuery
     * @license MIT License
     */
    
    (function(){
      var div = $(document.createElement('div'))
      var img = $(document.createElement('img'))
      var qrURL = encodeURIComponent(prompt('text','')||document.getSelection().toString()||location.href);
      img
        .attr('src',
      'https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl='+qrURL)
        .css({
          'display':'block',
          'margin':'50px auto'
        });
      div
        .append(img)
        .click(function(){$(this).hide()})
        .css({
          'position':'absolute',
          'z-index':'9999',
          'backgroundColor':'#000',
          'width':'100%',
          'height':'100%'
        });
      $('body').prepend(div);
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/01/15 15:59:21 - 2014-01-15
  2. 2014/01/15 15:57:53 - 2014-01-15
  3. 2012/12/25 20:18:34 - 2012-12-25
  4. 2012/11/19 19:00:34 - 2012-11-19
  5. 2012/10/12 16:52:46 - 2012-10-12
  6. 2012/10/12 16:52:08 - 2012-10-12
  7. 2012/10/12 16:42:11 - 2012-10-12
  8. 2012/10/12 16:31:00 - 2012-10-12