]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - tpl/linklist.html
Merge pull request #93 from ArthurHoaro/scripttag
[github/shaarli/Shaarli.git] / tpl / linklist.html
1 <!DOCTYPE html>
2 <html>
3 <head>{include="includes"}</head>
4 <body>
5 <div id="pageheader">
6 {include="page.header"}
7 <div id="headerform" class="search">
8 <form method="GET" class="searchform" name="searchform"><input type="text" id="searchform_value" name="searchterm" value=""> <input type="submit" value="Search" class="bigbutton"></form>
9 <form method="GET" class="tagfilter" name="tagfilter"><input type="text" name="searchtags" id="tagfilter_value" value=""> <input type="submit" value="Filter by tag" class="bigbutton"></form>
10 </div>
11 </div>
12
13 <div id="linklist">
14
15 {include="linklist.paging"}
16
17 {if="count($links)==0"}
18 <div id="searchcriteria">Nothing found.</i></div>
19 {else}
20 {if="$search_type=='fulltext'"}
21 <div id="searchcriteria">{$result_count} results for <i>{$search_crits}</i></div>
22 {/if}
23 {if="$search_type=='tags'"}
24 <div id="searchcriteria">{$result_count} results for tags <i>
25 {loop="search_crits"}
26 <span class="linktag" title="Remove tag"><a href="?removetag={$value|htmlspecialchars}">{$value|htmlspecialchars} <span class="remove">x</span></a></span>
27 {/loop}</i></div>
28 {/if}
29 {/if}
30 <ul>
31 {loop="links"}
32 <li{if="$value.class"} class="{$value.class}"{/if}>
33 <a id="{$value.linkdate|smallHash}"></a>
34 <div class="thumbnail">{$value.url|thumbnail}</div>
35 <div class="linkcontainer">
36 {if="isLoggedIn()"}
37 <div class="linkeditbuttons">
38 <form method="GET" class="buttoneditform"><input type="hidden" name="edit_link" value="{$value.linkdate}"><input type="image" alt="Edit" src="images/edit_icon.png#" title="Edit" class="button_edit"></form><br>
39 <form method="POST" class="buttoneditform"><input type="hidden" name="lf_linkdate" value="{$value.linkdate}">
40 <input type="hidden" name="token" value="{$token}"><input type="hidden" name="delete_link"><input type="image" alt="Delete" src="images/delete_icon.png#" title="Delete" class="button_delete" onClick="return confirmDeleteLink();"></form>
41 </div>
42 {/if}
43 <span class="linktitle"><a href="{$redirector}{$value.url|htmlspecialchars}">{$value.title|htmlspecialchars}</a></span>
44 <br>
45 {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if}
46 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
47 <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
48 {else}
49 <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
50 {/if}
51 {if="$GLOBALS['config']['ARCHIVE_ORG']"}
52 <span class="linkarchive"><a href="https://web.archive.org/web/{$value.url|htmlspecialchars}">archive</a> - </span>
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}"
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>
57 {if="$value.tags"}
58 <div class="linktaglist">
59 {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value|htmlspecialchars}</a></span> {/loop}
60 </div>
61 {/if}
62 </div>
63 </li>
64 {/loop}
65 </ul>
66
67 {include="linklist.paging"}
68
69 </div>
70
71 {include="page.footer"}
72
73 <script>
74 // Remove any displayed QR-Code
75 function remove_qrcode()
76 {
77 var elem = document.getElementById("permalinkQrcode");
78 if (elem) elem.parentNode.removeChild(elem);
79 return false;
80 }
81
82 function isCanvasSupported(){
83 var elem = document.createElement('canvas');
84 return !!(elem.getContext && elem.getContext('2d'));
85 }
86
87 // Show the QR-Code of a permalink (when the QR-Code icon is clicked).
88 function showQrCode(caller,loading)
89 {
90 if( !isCanvasSupported() ) return true;
91
92 // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked:
93 if (typeof(qr)=='undefined') // Load qr.js only if not present.
94 {
95 loading = typeof loading !== 'undefined' ? loading : false;
96 if (!loading) // If javascript lib is still loading, do not append script to body.
97 {
98 var element = document.createElement("script");
99 element.src = "inc/qr.min.js";
100 document.body.appendChild(element);
101 }
102 setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds.
103 return false;
104 }
105
106 // Remove previous qrcode if present.
107 remove_qrcode();
108
109 // Build the div which contains the QR-Code:
110 var element = document.createElement('div');
111 element.id="permalinkQrcode";
112
113 // Make QR-Code div commit sepuku when clicked:
114 element.addEventListener('click', remove_qrcode ); // Works on every canvas supported browser
115
116 // Build the QR-Code:
117 var image = qr.image({size: 8,value: caller.getAttribute('data-permalink')});
118 if (image)
119 {
120 element.appendChild(image);
121 element.innerHTML+= "<br>Click to close";
122 caller.parentNode.appendChild(element);
123 }
124 else
125 {
126 element.innerHTML="Your browser does not seem to be HTML5 compatible.";
127 }
128 return false;
129 }
130 </script>
131 </body>
132 </html>