aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/linklist.html
blob: c8dfd12292e15aee31f851e08a36078ec0bfb5bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>{include="includes"}</head>
<body>
<div id="pageheader">
    {include="page.header"}
    <div id="headerform" class="search">
        <form method="GET" class="searchform" name="searchform"><input type="text" id="searchform_value" name="searchterm" value=""> <input type="submit" value="Search" class="bigbutton"></form>
        <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>
    </div>
</div>

<div id="linklist">

    {include="linklist.paging"}

    {if="count($links)==0"}
        <div id="searchcriteria">Nothing found.</i></div>
    {else}
        {if="$search_type=='fulltext'"}
            <div id="searchcriteria">{$result_count} results for <i>{$search_crits}</i></div>
        {/if}
        {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 class="remove">x</span></a></span>
            {/loop}</i></div>
        {/if}
    {/if}
    <ul>
        {loop="links"}
        <li{if="$value.class"} class="{$value.class}"{/if}>
            <a id="{$value.linkdate|smallHash}"></a>
            <div class="thumbnail">{$value.url|thumbnail}</div>
            <div class="linkcontainer">
                {if="isLoggedIn()"}
                    <div class="linkeditbuttons">
                        <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>
                        <form method="POST" class="buttoneditform"><input type="hidden" name="lf_linkdate" value="{$value.linkdate}">
                        <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>
                    </div>
                {/if}
                <span class="linktitle"><a href="{$redirector}{$value.url|htmlspecialchars}">{$value.title|htmlspecialchars}</a></span>
                <br>
                {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>
                {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 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="{$value.localdate|htmlspecialchars}"></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>
                {/if}
            </div>
        </li>
    {/loop}
    </ul>

    {include="linklist.paging"}

</div>

    {include="page.footer"}

<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)
{
    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-1.1.3.min.js";
            document.body.appendChild(element);
        }
        setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds.
        return 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:
    element.addEventListener('click', remove_qrcode ); // Works on every canvas supported browser

    // Build the QR-Code:
    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);
    }
    else
    {
        element.innerHTML="Your browser does not seem to be HTML5 compatible.";
    }
    return false;
}
</script>
</body>
</html>