ゼロと無限の間に

フリーでオープンソースなJavaScriptとかPHPとか。

ユーザ用ツール

サイト用ツール


javascript:qr-this-greasemonkey

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
javascript:qr-this-greasemonkey [2009/01/03 00:41] dgbadminjavascript:qr-this-greasemonkey [2009/07/04 22:47] – 0.2.1 URLエンコードの不具合を修正 dgbadmin
行 7: 行 7:
  
 今回MozOpacityなんてのを初めて使った。半透明だとQRコードを読み取りにくかったりするのかな? 今回MozOpacityなんてのを初めて使った。半透明だとQRコードを読み取りにくかったりするのかな?
 +
 +バージョン0.2.0からは、**Mobile Link Discovery**が指定されているページの場合は指定された携帯向けのURLをQRコード化するようにした。8-)
  
 それから、QRコードは(株)デンソーウェーブの登録商標ですよ。 それから、QRコードは(株)デンソーウェーブの登録商標ですよ。
行 22: 行 24:
 <code javascript> <code javascript>
 // ==UserScript== // ==UserScript==
-// @name           QR This! +// @name        QR This! 
-// @namespace      http://0-oo.net/ +// @namespace   http://0-oo.net/ 
-// @description    Show a 2D bar code of the url of the page that you see. +// @description Show a 2D bar code of the url of the page that you see. 
-// @include        http://* +// @version     0.2.1 
-// @include        https://*+// @include     http://* 
 +// @include     https://*
 // ==/UserScript== // ==/UserScript==
 +//
 +// http://0-oo.net/sbox/javascript/qr-this-greasemonkey
 +// ( The MIT License )
 +//
 (function(){ (function(){
-    var src = "http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl="; +    var api = "http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl="; 
-    src +encodeURI(document.URL); +     
- +    var caption = ""; 
-    var qr = document.createElement('img'); +    var url = document.URL
-    qr.src = src;+     
 +    //Search "Mobile Link Discovery" 
 +    var links = document.getElementsByTagName("link"); 
 +    for (var i = 0, len = links.length; i < len; i++) { 
 +        var link = links[i]; 
 +        if (link.rel == "alternate" && link.media == "handheld") { 
 +            caption = "Mobile Link<br />" 
 +            url = link.href; 
 +            break; 
 +        } 
 +    } 
 +     
 +    var qr = document.createElement("img"); 
 +    qr.src = api + encodeURIComponent(url);
          
-    qr.style.position = "fixed"; +    var div = document.createElement("div"); 
-    qr.style.right = 0; +    div.style.position = "fixed"; 
-    qr.style.bottom = 0; +    div.style.right = 0; 
-    qr.style.MozOpacity = 0.75; +    div.style.bottom = 0; 
-    qr.style.zIndex = 100;+    div.style.MozOpacity = 0.75; 
 +    div.style.zIndex = 100;
          
-    document.body.appendChild(qr);+    if (caption) { 
 +        div.innerHTML = caption; 
 +    } 
 +    div.appendChild(qr); 
 +    document.body.appendChild(div);
 })(); })();
 </code> </code>
  
javascript/qr-this-greasemonkey.txt · 最終更新: 2009/11/30 00:32 by dgbadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki