aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-01-08 15:09:46 +0100
committerArthurHoaro <arthur@hoa.ro>2015-01-09 09:47:48 +0100
commitfe16b01edb80ac2f2212125fadba8358dff91b95 (patch)
treec19fbb34904a1c5148202d01fa723d29b0e1557d /tpl
parenta2d5ef2127881561bf359390fac2d8d336a37335 (diff)
downloadShaarli-fe16b01edb80ac2f2212125fadba8358dff91b95.tar.gz
Shaarli-fe16b01edb80ac2f2212125fadba8358dff91b95.tar.zst
Shaarli-fe16b01edb80ac2f2212125fadba8358dff91b95.zip
* removed the language attribute on the script element since it is obsolete and we can safely omit it.
* make QRCode JS works with IE : * behave as a normal link if canvas aren't supported (<=IE8) * default parameter values in JS aren't widely supported (see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters ), use this method instead: http://stackoverflow.com/a/148918/1484919 * dataset isn't supported in IE9 use getAttribute instead * addEventListener works with IE9+ and other browsers
Diffstat (limited to 'tpl')
-rw-r--r--tpl/changetag.html4
-rw-r--r--tpl/editlink.html2
-rw-r--r--tpl/linklist.html20
3 files changed, 17 insertions, 9 deletions
diff --git a/tpl/changetag.html b/tpl/changetag.html
index 79fea9a9..fdfb0b37 100644
--- a/tpl/changetag.html
+++ b/tpl/changetag.html
@@ -12,11 +12,11 @@
12 <input type="text" name="totag" id="totag"> 12 <input type="text" name="totag" id="totag">
13 <input type="submit" name="renametag" value="Rename tag" class="bigbutton"> 13 <input type="submit" name="renametag" value="Rename tag" class="bigbutton">
14 &nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();"><br>(Case sensitive)</form> 14 &nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();"><br>(Case sensitive)</form>
15<script language="JavaScript">function confirmDeleteTag() { var agree=confirm("Are you sure you want to delete this tag from all links ?"); if (agree) return true ; else return false ; }</script> 15<script>function confirmDeleteTag() { var agree=confirm("Are you sure you want to delete this tag from all links ?"); if (agree) return true ; else return false ; }</script>
16</div> 16</div>
17{include="page.footer"} 17{include="page.footer"}
18{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} 18{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
19<script language="JavaScript"> 19<script>
20$(document).ready(function() 20$(document).ready(function()
21{ 21{
22 $('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1}); 22 $('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
diff --git a/tpl/editlink.html b/tpl/editlink.html
index 454dfff4..047e7f0d 100644
--- a/tpl/editlink.html
+++ b/tpl/editlink.html
@@ -33,7 +33,7 @@
33</div> 33</div>
34{include="page.footer"} 34{include="page.footer"}
35{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} 35{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
36<script language="JavaScript"> 36<script>
37$(document).ready(function() 37$(document).ready(function()
38{ 38{
39 $('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1}); 39 $('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
diff --git a/tpl/linklist.html b/tpl/linklist.html
index 42a75a1a..d5bfadf8 100644
--- a/tpl/linklist.html
+++ b/tpl/linklist.html
@@ -52,7 +52,7 @@
52 <span class="linkarchive"><a href="https://web.archive.org/web/{$value.url|htmlspecialchars}">archive</a> - </span> 52 <span class="linkarchive"><a href="https://web.archive.org/web/{$value.url|htmlspecialchars}">archive</a> - </span>
53 {/if} 53 {/if}
54 <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}" 54 <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}"
55 onclick="showQrCode(this); return false;" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"><img src="images/qrcode.png#" title="QR-Code" alt="QR-Code"></a></div> - 55 onclick="return showQrCode(this);" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"><img src="images/qrcode.png#" title="QR-Code"></a></div> -
56 <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br> 56 <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br>
57 {if="$value.tags"} 57 {if="$value.tags"}
58 <div class="linktaglist"> 58 <div class="linktaglist">
@@ -79,12 +79,20 @@ function remove_qrcode()
79 return false; 79 return false;
80} 80}
81 81
82function isCanvasSupported(){
83 var elem = document.createElement('canvas');
84 return !!(elem.getContext && elem.getContext('2d'));
85}
86
82// Show the QR-Code of a permalink (when the QR-Code icon is clicked). 87// Show the QR-Code of a permalink (when the QR-Code icon is clicked).
83function showQrCode(caller,loading=false) 88function showQrCode(caller,loading)
84{ 89{
90 if( !isCanvasSupported() ) return true;
91
85 // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked: 92 // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked:
86 if (typeof(qr)=='undefined') // Load qr.js only if not present. 93 if (typeof(qr)=='undefined') // Load qr.js only if not present.
87 { 94 {
95 loading = typeof loading !== 'undefined' ? loading : false;
88 if (!loading) // If javascript lib is still loading, do not append script to body. 96 if (!loading) // If javascript lib is still loading, do not append script to body.
89 { 97 {
90 var element = document.createElement("script"); 98 var element = document.createElement("script");
@@ -101,12 +109,12 @@ function showQrCode(caller,loading=false)
101 // Build the div which contains the QR-Code: 109 // Build the div which contains the QR-Code:
102 var element = document.createElement('div'); 110 var element = document.createElement('div');
103 element.id="permalinkQrcode"; 111 element.id="permalinkQrcode";
104 // Make QR-Code div commit sepuku when clicked: 112
105 if ( element.attachEvent ){ element.attachEvent('onclick', 'this.parentNode.removeChild(this);' ); } // Damn IE 113 // Make QR-Code div commit sepuku when clicked:
106 else { element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); } 114 element.addEventListener('click', remove_qrcode ); // Works on every canvas supported browser
107 115
108 // Build the QR-Code: 116 // Build the QR-Code:
109 var image = qr.image({size: 8,value: caller.dataset.permalink}); 117 var image = qr.image({size: 8,value: caller.getAttribute('data-permalink')});
110 if (image) 118 if (image)
111 { 119 {
112 element.appendChild(image); 120 element.appendChild(image);