website diff lib/html/footer.pt.html @ rev 1229

on demand qrcode script load
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 22 13:23:01 2014 +0200 (2014-06-22)
parents ad7ceb04a686
children 0b25644d74b8
line diff
     1.1 --- a/lib/html/footer.pt.html	Sun May 04 22:57:56 2014 -0300
     1.2 +++ b/lib/html/footer.pt.html	Sun Jun 22 13:23:01 2014 +0200
     1.3 @@ -1,6 +1,21 @@
     1.4  <!-- Footer -->
     1.5  
     1.6 -<script type="text/javascript" src="/lib/js/qrcode.js"></script>
     1.7 +<script type="text/javascript">
     1.8 +	function QRCodePNG(str, obj) {
     1.9 +		try {
    1.10 +			return QRCode.generatePNG(str, {ecclevel: 'H'});
    1.11 +		}
    1.12 +		catch (any) {
    1.13 +			var element = document.createElement("script");
    1.14 +			element.src = "/lib/js/qrcode.js";
    1.15 +			element.type ="text/javascript";
    1.16 +			element.onload = function() {
    1.17 +				obj.src = QRCode.generatePNG(str, {ecclevel: 'H'});
    1.18 +			};
    1.19 +			document.body.appendChild(element);
    1.20 +		}
    1.21 +	}	
    1.22 +</script>
    1.23  
    1.24  <div id="footer">
    1.25  	Copyright &copy; <span class="year"></span>
    1.26 @@ -13,7 +28,7 @@
    1.27  	<a href="http://hg.slitaz.org/">Hg</a>
    1.28  	<p>
    1.29  		<img src="/images/qr.png" alt="SliTaz @" onmouseover="this.title = location.href"
    1.30 -		 onclick="this.src = QRCode.generatePNG(location.href, {ecclevel: 'H'})" />
    1.31 +		 onclick="this.src = QRCodePNG(location.href, this)" />
    1.32  		<a href="http://twitter.com/slitaz">Twitter</a>
    1.33  		<a href="http://www.facebook.com/slitaz">Facebook</a>
    1.34  		<a href="http://distrowatch.com/table.php?distribution=slitaz&amp;language=PT">Distrowatch</a>