slitaz-forge diff mirror/floppies/mkindex.sh @ rev 568
chub, doc, forum, floppies, mirror-info, pkgs, pro, tank: on demand qrcode script load
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jun 22 18:37:40 2014 +0200 (2014-06-22) |
parents | 975c7646282c |
children | ba908ef4f9ff |
line diff
1.1 --- a/mirror/floppies/mkindex.sh Wed Jul 17 12:14:32 2013 +0200 1.2 +++ b/mirror/floppies/mkindex.sh Sun Jun 22 18:37:40 2014 +0200 1.3 @@ -248,14 +248,25 @@ 1.4 <a href="http://validator.w3.org/check?uri=referer"><img src="static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a> 1.5 </p> 1.6 <p> 1.7 - <img src="#" id="qrcodeimg" alt="#" width="60" height="60" 1.8 + <script type="text/javascript"> 1.9 + function QRCodePNG(str, obj) { 1.10 + try { 1.11 + return QRCode.generatePNG(str, {ecclevel: 'H'}); 1.12 + } 1.13 + catch (any) { 1.14 + var element = document.createElement("script"); 1.15 + element.src = "static/qrcode.js"; 1.16 + element.type ="text/javascript"; 1.17 + element.onload = function() { 1.18 + obj.src = QRCode.generatePNG(str, {ecclevel: 'H'}); 1.19 + }; 1.20 + document.body.appendChild(element); 1.21 + } 1.22 + } 1.23 + </script> 1.24 + <img src="static/qr.png" alt="#" 1.25 onmouseover= "this.title = location.href" 1.26 - onclick= "this.width = this.height = 300;" /> 1.27 - <script type="text/javascript" src="static/qrcode.js"></script> 1.28 - <script type="text/javascript"> 1.29 - document.getElementById('qrcodeimg').src = 1.30 - QRCode.generatePNG(location.href, {ecclevel: 'H'}); 1.31 - </script> 1.32 + onclick="this.src = QRCodePNG(location.href, this)" /> 1.33 </p> 1.34 </div> 1.35