aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-03-06 21:29:56 +0100
committerArthurHoaro <arthur@hoa.ro>2015-03-12 20:27:16 +0100
commitbdd1715b249561ed919e4f03a06aec1f4c327335 (patch)
treeeb21225e95b1fd849a8404c7bfe9bff6f970a8cb /tpl
parent3a10fa0e3f0d0978dc359d1407b93fe425f44b25 (diff)
downloadShaarli-bdd1715b249561ed919e4f03a06aec1f4c327335.tar.gz
Shaarli-bdd1715b249561ed919e4f03a06aec1f4c327335.tar.zst
Shaarli-bdd1715b249561ed919e4f03a06aec1f4c327335.zip
Use awesomplete as autocomplete lib and remove jQuery - shaarli/Shaarli#148
* Add awesomplete dependancy (source + min + CSS) * Remove jQuery and jQuery-UI dependancy * Few CSS ajustements * Use tags complete list as RainTPL var (and display it as HTML) * Remove "disable jQuery" feature * Remove tag list web service
Diffstat (limited to 'tpl')
-rw-r--r--tpl/changetag.html35
-rw-r--r--tpl/configure.html3
-rw-r--r--tpl/editlink.html30
3 files changed, 41 insertions, 27 deletions
diff --git a/tpl/changetag.html b/tpl/changetag.html
index fdfb0b37..13cc5cf1 100644
--- a/tpl/changetag.html
+++ b/tpl/changetag.html
@@ -1,27 +1,34 @@
1<!DOCTYPE html> 1<!DOCTYPE html>
2<html> 2<html>
3<head>{include="includes"} 3<head>{include="includes"}
4{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if} 4 <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" />
5 <script src="inc/awesomplete.min.js#"></script>
5</head> 6</head>
6<body onload="document.changetag.fromtag.focus();"> 7<body onload="document.changetag.fromtag.focus();">
7<div id="pageheader"> 8<div id="pageheader">
8 {include="page.header"} 9 {include="page.header"}
9 <form method="POST" action="" name="changetag" id="changetag"> 10 <form method="POST" action="" name="changetag" id="changetag">
10 <input type="hidden" name="token" value="{$token}"> 11 <input type="hidden" name="token" value="{$token}">
11 Tag: <input type="text" name="fromtag" id="fromtag"> 12 <div>
12 <input type="text" name="totag" id="totag"> 13 <label for="fromtag">Tag:</label>
13 <input type="submit" name="renametag" value="Rename tag" class="bigbutton"> 14 </div>
14 &nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();"><br>(Case sensitive)</form> 15 <div>
16 <input type="text" name="fromtag" id="fromtag" list="tagsList" autocomplete="off" class="awesomplete" data-minChars="1" />
17 <datalist id="tagsList">
18 {loop="$tags"}<option>{$key}</option>{/loop}
19 </datalist>
20 </div>
21
22 <div>
23 <input type="text" name="totag" id="totag">
24 <input type="submit" name="renametag" value="Rename tag" class="bigbutton">
25 &nbsp;&nbsp;or&nbsp; <input type="submit" name="deletetag" value="Delete tag" class="bigbutton" onClick="return confirmDeleteTag();">
26 </div>
27 </form>
28 <div class="clear white">(Case sensitive)</div>
29</div>
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> 30<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> 31</div>
17{include="page.footer"} 32{include="page.footer"}
18{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
19<script>
20$(document).ready(function()
21{
22 $('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
23});
24</script>
25{/if}
26</body> 33</body>
27</html> 34</html>
diff --git a/tpl/configure.html b/tpl/configure.html
index 887be327..373d0690 100644
--- a/tpl/configure.html
+++ b/tpl/configure.html
@@ -18,9 +18,6 @@
18 18
19 <tr><td><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr> 19 <tr><td><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr>
20 20
21 <tr><td><b>Features:</b></td><td>
22 <input type="checkbox" name="disablejquery" id="disablejquery" {if="!empty($GLOBALS['disablejquery'])"}checked{/if}><label for="disablejquery">&nbsp;Disable jQuery and all heavy JavaScript (for example: Autocomplete in tags. Useful for slow computers.)</label>
23 </td></tr>
24 <tr><td valign="top"><b>New link:</b></td><td> 21 <tr><td valign="top"><b>New link:</b></td><td>
25 <input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="!empty($GLOBALS['privateLinkByDefault'])"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new links are private by default</label></td> 22 <input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="!empty($GLOBALS['privateLinkByDefault'])"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new links are private by default</label></td>
26 </tr> 23 </tr>
diff --git a/tpl/editlink.html b/tpl/editlink.html
index ecab443d..b737b990 100644
--- a/tpl/editlink.html
+++ b/tpl/editlink.html
@@ -1,7 +1,8 @@
1<!DOCTYPE html> 1<!DOCTYPE html>
2<html> 2<html>
3<head>{include="includes"} 3<head>{include="includes"}
4{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery-1.11.2.min.js#"></script><script src="inc/jquery-ui-1.11.2.min.js#"></script>{/if} 4 <link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" />
5 <script src="inc/awesomplete.min.js#"></script>
5</head> 6</head>
6<body 7<body
7{if="$link.title==''"}onload="document.linkform.lf_title.focus();" 8{if="$link.title==''"}onload="document.linkform.lf_title.focus();"
@@ -12,10 +13,12 @@
12 <div id="editlinkform"> 13 <div id="editlinkform">
13 <form method="post" name="linkform"> 14 <form method="post" name="linkform">
14 <input type="hidden" name="lf_linkdate" value="{$link.linkdate}"> 15 <input type="hidden" name="lf_linkdate" value="{$link.linkdate}">
15 <i>URL</i><br><input type="text" name="lf_url" value="{$link.url|htmlspecialchars}" class="lf_input"><br> 16 <label for="lf_url"><i>URL</i></label><br><input type="text" name="lf_url" id="lf_url" value="{$link.url|htmlspecialchars}" class="lf_input"><br>
16 <i>Title</i><br><input type="text" name="lf_title" value="{$link.title|htmlspecialchars}" class="lf_input"><br> 17 <label for="lf_title"><i>Title</i></label><br><input type="text" name="lf_title" id="lf_title" value="{$link.title|htmlspecialchars}" class="lf_input"><br>
17 <i>Description</i><br><textarea name="lf_description" rows="4" cols="25">{$link.description|htmlspecialchars}</textarea><br> 18 <label for="lf_description"><i>Description</i></label><br><textarea name="lf_description" id="lf_description" rows="4" cols="25">{$link.description|htmlspecialchars}</textarea><br>
18 <i>Tags</i><br><input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}" class="lf_input"><br> 19 <label for="lf_tags"><i>Tags</i></label><br>
20 <input type="text" id="lf_tags" name="lf_tags" id="lf_tags" value="{$link.tags|htmlspecialchars}" class="lf_input"
21 data-list="{loop="$tags"}{$key}, {/loop}" data-multiple autocomplete="off" ><br>
19 {if="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"} 22 {if="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}
20 <input type="checkbox" checked="checked" name="lf_private" id="lf_private"> 23 <input type="checkbox" checked="checked" name="lf_private" id="lf_private">
21 &nbsp;<label for="lf_private"><i>Private</i></label><br> 24 &nbsp;<label for="lf_private"><i>Private</i></label><br>
@@ -32,12 +35,19 @@
32 </div> 35 </div>
33</div> 36</div>
34{include="page.footer"} 37{include="page.footer"}
35{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} 38{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn())"}
36<script> 39<script>
37$(document).ready(function() 40 $ = Awesomplete.$;
38{ 41 new Awesomplete($('input[data-multiple]'), {
39 $('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1}); 42 filter: function(text, input) {
40}); 43 return Awesomplete.FILTER_CONTAINS(text, input.match(/[^ ]*$/)[0]);
44 },
45 replace: function(text) {
46 var before = this.input.value.match(/^.+ \s*|/)[0];
47 this.input.value = before + text + " ";
48 },
49 minChars: 1
50 });
41</script> 51</script>
42{/if} 52{/if}
43</body> 53</body>