diff options
Diffstat (limited to 'tpl/linklist.html')
-rw-r--r-- | tpl/linklist.html | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/tpl/linklist.html b/tpl/linklist.html index 58d5867e..c8dfd122 100644 --- a/tpl/linklist.html +++ b/tpl/linklist.html | |||
@@ -30,7 +30,7 @@ | |||
30 | <ul> | 30 | <ul> |
31 | {loop="links"} | 31 | {loop="links"} |
32 | <li{if="$value.class"} class="{$value.class}"{/if}> | 32 | <li{if="$value.class"} class="{$value.class}"{/if}> |
33 | <a name="{$value.linkdate|smallHash}" id="{$value.linkdate|smallHash}"></a> | 33 | <a id="{$value.linkdate|smallHash}"></a> |
34 | <div class="thumbnail">{$value.url|thumbnail}</div> | 34 | <div class="thumbnail">{$value.url|thumbnail}</div> |
35 | <div class="linkcontainer"> | 35 | <div class="linkcontainer"> |
36 | {if="isLoggedIn()"} | 36 | {if="isLoggedIn()"} |
@@ -51,9 +51,10 @@ | |||
51 | {if="$GLOBALS['config']['ARCHIVE_ORG']"} | 51 | {if="$GLOBALS['config']['ARCHIVE_ORG']"} |
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&s=8&d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}" | 54 | <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&s=8&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"></a></div> - | 55 | onclick="return showQrCode(this);" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"> |
56 | <a href={$value.url|htmlspecialchars}><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br> | 56 | <img src="images/qrcode.png#" alt="QR-Code" title="{$value.localdate|htmlspecialchars}"></a></div> - |
57 | <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br> | ||
57 | {if="$value.tags"} | 58 | {if="$value.tags"} |
58 | <div class="linktaglist"> | 59 | <div class="linktaglist"> |
59 | {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value|htmlspecialchars}</a></span> {/loop} | 60 | {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value|htmlspecialchars}</a></span> {/loop} |
@@ -70,7 +71,7 @@ | |||
70 | 71 | ||
71 | {include="page.footer"} | 72 | {include="page.footer"} |
72 | 73 | ||
73 | <script language="JavaScript"> | 74 | <script> |
74 | // Remove any displayed QR-Code | 75 | // Remove any displayed QR-Code |
75 | function remove_qrcode() | 76 | function remove_qrcode() |
76 | { | 77 | { |
@@ -79,12 +80,20 @@ function remove_qrcode() | |||
79 | return false; | 80 | return false; |
80 | } | 81 | } |
81 | 82 | ||
83 | function isCanvasSupported(){ | ||
84 | var elem = document.createElement('canvas'); | ||
85 | return !!(elem.getContext && elem.getContext('2d')); | ||
86 | } | ||
87 | |||
82 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). | 88 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). |
83 | function showQrCode(caller,loading=false) | 89 | function showQrCode(caller,loading) |
84 | { | 90 | { |
91 | if( !isCanvasSupported() ) return true; | ||
92 | |||
85 | // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked: | 93 | // 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. | 94 | if (typeof(qr)=='undefined') // Load qr.js only if not present. |
87 | { | 95 | { |
96 | loading = typeof loading !== 'undefined' ? loading : false; | ||
88 | if (!loading) // If javascript lib is still loading, do not append script to body. | 97 | if (!loading) // If javascript lib is still loading, do not append script to body. |
89 | { | 98 | { |
90 | var element = document.createElement("script"); | 99 | var element = document.createElement("script"); |
@@ -101,12 +110,12 @@ function showQrCode(caller,loading=false) | |||
101 | // Build the div which contains the QR-Code: | 110 | // Build the div which contains the QR-Code: |
102 | var element = document.createElement('div'); | 111 | var element = document.createElement('div'); |
103 | element.id="permalinkQrcode"; | 112 | element.id="permalinkQrcode"; |
104 | // Make QR-Code div commit sepuku when clicked: | 113 | |
105 | if ( element.attachEvent ){ element.attachEvent('onclick', 'this.parentNode.removeChild(this);' ); } // Damn IE | 114 | // Make QR-Code div commit sepuku when clicked: |
106 | else { element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); } | 115 | element.addEventListener('click', remove_qrcode ); // Works on every canvas supported browser |
107 | 116 | ||
108 | // Build the QR-Code: | 117 | // Build the QR-Code: |
109 | var image = qr.image({size: 8,value: caller.dataset.permalink}); | 118 | var image = qr.image({size: 8,value: caller.getAttribute('data-permalink')}); |
110 | if (image) | 119 | if (image) |
111 | { | 120 | { |
112 | element.appendChild(image); | 121 | element.appendChild(image); |