]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tpl/linklist.html
Merge remote-tracking branch 'ArthurHoaro/daily-date' into next
[github/shaarli/Shaarli.git] / tpl / linklist.html
index acb4bab062a272ea926b59be8d9162595d34d082..47e67e71effd6e96ac8e93984c5c205ac532bb65 100644 (file)
@@ -1,12 +1,21 @@
 <!DOCTYPE html>
 <html>
-<head>{include="includes"}</head>
+<head>
+    <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" />
+    {include="includes"}
+</head>
 <body>
 <div id="pageheader">
     {include="page.header"}
-    <div id="headerform" style="width:100%; white-space:nowrap;">
-        <form method="GET" class="searchform" name="searchform" style="display:inline;"><input type="text" id="searchform_value" name="searchterm" style="width:30%" value=""> <input type="submit" value="Search" class="bigbutton"></form>
-        <form method="GET" class="tagfilter" name="tagfilter" style="display:inline;margin-left:24px;"><input type="text" name="searchtags" id="tagfilter_value" style="width:10%" value=""> <input type="submit" value="Filter by tag" class="bigbutton"></form>
+    <div id="headerform" class="search">
+        <form method="GET" class="searchform" name="searchform"><input type="text" id="searchform_value" name="searchterm" placeholder="Search text" value=""> <input type="submit" value="Search" class="bigbutton"></form>
+        <form method="GET" class="tagfilter" name="tagfilter">
+            <input type="text" name="searchtags" id="tagfilter_value" placeholder="Filter by tag" value="" list="tagsList" autocomplete="off" class="awesomplete" data-minChars="1">
+            <datalist id="tagsList">
+                {loop="$tags"}<option>{$key}</option>{/loop}
+            </datalist>
+            <input type="submit" value="Search" class="bigbutton">
+        </form>
     </div>
 </div>
 
         {if="$search_type=='tags'"}
             <div id="searchcriteria">{$result_count} results for tags <i>
             {loop="search_crits"}
-                <span class="linktag" title="Remove tag"><a href="?removetag={$value|htmlspecialchars}">{$value|htmlspecialchars} <span style="border-left:1px solid #aaa; padding-left:5px; color:#6767A7;">x</span></a></span>
+                <span class="linktag" title="Remove tag"><a href="?removetag={$value|htmlspecialchars}">{$value|htmlspecialchars} <span class="remove">x</span></a></span>
             {/loop}</i></div>
         {/if}
     {/if}
     <ul>
         {loop="links"}
         <li{if="$value.class"} class="{$value.class}"{/if}>
-            <a name="{$value.linkdate|smallHash}" id="{$value.linkdate|smallHash}"></a>
+            <a id="{$value.linkdate|smallHash}"></a>
             <div class="thumbnail">{$value.url|thumbnail}</div>
             <div class="linkcontainer">
                 {if="isLoggedIn()"}
                 {/if}
                 <span class="linktitle"><a href="{$redirector}{$value.url|htmlspecialchars}">{$value.title|htmlspecialchars}</a></span>
                 <br>
-                {if="$value.description"}<div class="linkdescription"{if="$search_type=='permalink'"} style="max-height:none !important;"{/if}>{$value.description}</div>{/if}
+                {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if}
                 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
-                    <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
+                    <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{function="strftime('%c', $value.timestamp)"} - permalink</a> - </span>
                 {else}
                     <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
                 {/if}
                 {if="$GLOBALS['config']['ARCHIVE_ORG']"}
                 <span class="linkarchive"><a href="https://web.archive.org/web/{$value.url|htmlspecialchars}">archive</a> - </span>
                 {/if}
-                <div style="position:relative;display:inline;"><a href="http://qrfree.kaywa.com/?l=1&s=8&d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}" 
-                    onclick="showQrCode(this); return false;" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> - 
-                <span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br>
+                <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}"
+                    onclick="return showQrCode(this);" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}">
+                   <img src="images/qrcode.png#" alt="QR-Code" title="{function="strftime('%c', $value.timestamp)"}"></a></div> -
+                <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br>
                 {if="$value.tags"}
                     <div class="linktaglist">
                     {loop="value.taglist"}<span class="linktag" title="Add tag"><a href="?addtag={$value|urlencode}">{$value|htmlspecialchars}</a></span> {/loop}
 
 </div>
 
-    {include="page.footer"} 
+    {include="page.footer"}
 
-<script language="JavaScript">
+<script>
 // Remove any displayed QR-Code
 function remove_qrcode()
-{ 
+{
     var elem = document.getElementById("permalinkQrcode");
     if (elem) elem.parentNode.removeChild(elem);
     return false;
 }
 
+function isCanvasSupported(){
+    var elem = document.createElement('canvas');
+    return !!(elem.getContext && elem.getContext('2d'));
+}
+
 // Show the QR-Code of a permalink (when the QR-Code icon is clicked).
-function showQrCode(caller,loading=false)
-{ 
+function showQrCode(caller,loading)
+{
+    if( !isCanvasSupported() ) return true;
+
     // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked:
     if (typeof(qr)=='undefined') // Load qr.js only if not present.
     {
+        loading = typeof loading !== 'undefined' ? loading : false;
         if (!loading)  // If javascript lib is still loading, do not append script to body.
         {
             var element = document.createElement("script");
-            element.src = "inc/qr.min.js";
+            element.src = "inc/qr-1.1.3.min.js";
             document.body.appendChild(element);
         }
         setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds.
@@ -97,18 +115,18 @@ function showQrCode(caller,loading=false)
 
     // Remove previous qrcode if present.
     remove_qrcode();
-    
+
     // Build the div which contains the QR-Code:
     var element = document.createElement('div');
     element.id="permalinkQrcode";
-       // Make QR-Code div commit sepuku when clicked:
-    if ( element.attachEvent ){ element.attachEvent('onclick', 'this.parentNode.removeChild(this);' ); } // Damn IE
-    else { element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); }
-    
+
+    // Make QR-Code div commit sepuku when clicked:
+    element.addEventListener('click', remove_qrcode ); // Works on every canvas supported browser
+
     // Build the QR-Code:
-    var image = qr.image({size: 8,value: caller.dataset.permalink});
+    var image = qr.image({size: 8,value: caller.getAttribute('data-permalink')});
     if (image)
-    { 
+    {
         element.appendChild(image);
         element.innerHTML+= "<br>Click to close";
         caller.parentNode.appendChild(element);
@@ -120,5 +138,6 @@ function showQrCode(caller,loading=false)
     return false;
 }
 </script>
+<script src="inc/awesomplete.min.js#"></script>
 </body>
 </html>