Skip to content

Commit 246e9b4

Browse files
committed
Removed jQuery from almost all pages
jQuery has been removed from all pages, except those who really require it (like autocomplete in link edition). Immediate gain: All pages weight 286 kb LESS ! \o/ Highlighting in search results has also been temporarly removed (and will be re-implemented).
1 parent af77b2f commit 246e9b4

7 files changed

+25
-134
lines changed

inc/jquery.highlight.js

-108
This file was deleted.

tpl/changetag.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>{include="includes"}</head>
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}
5+
</head>
46
<body onload="document.changetag.fromtag.focus();">
57
<div id="pageheader">
68
{include="page.header"}
@@ -12,5 +14,13 @@
1214
<script language="JavaScript">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>
1315
</div>
1416
{include="page.footer"}
17+
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
18+
<script language="JavaScript">
19+
$(document).ready(function()
20+
{
21+
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
22+
});
23+
</script>
24+
{/if}
1525
</body>
1626
</html>

tpl/editlink.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>{include="includes"}</head>
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}
5+
</head>
46
<body
57
{if condition="$link.title==''"}onload="document.linkform.lf_title.focus();"
68
{elseif condition="$link.description==''"}onload="document.linkform.lf_description.focus();"
@@ -30,5 +32,13 @@
3032
</div>
3133
</div>
3234
{include="page.footer"}
35+
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
36+
<script language="JavaScript">
37+
$(document).ready(function()
38+
{
39+
$('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
40+
});
41+
</script>
42+
{/if}
3343
</body>
3444
</html>

tpl/includes.html

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
88
<link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" />
99
{if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if}
10-
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}

tpl/linklist.html

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
{include="page.footer"}
6969

7070
<script language="JavaScript">
71-
7271
// Remove any displayed QR-Code
7372
function remove_qrcode()
7473
{

tpl/page.footer.html

-21
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,3 @@
77
{if="isLoggedIn()"}
88
<script language="JavaScript">function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script>
99
{/if}
10-
11-
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
12-
<script language="JavaScript">
13-
$(document).ready(function()
14-
{
15-
$('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
16-
$('#searchtags').autocomplete({source:'{$source}?ws=tags',minLength:1});
17-
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
18-
});
19-
</script>
20-
{/if}
21-
22-
{if="empty($GLOBALS['disablejquery']) && isset($_GET['searchterm'])"}
23-
<script src="inc/jquery.highlight.js#"></script>
24-
<script language="JavaScript">
25-
$(document).ready(function()
26-
{
27-
$('#linklist li').highlight("{$search_crits}");
28-
});
29-
</script>
30-
{/if}

tpl/picwall.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<html>
33
<head>{include="includes"}
44
{if="empty($GLOBALS['disablejquery'])"}
5-
<script src="inc/jquery.lazyload.min.js#"></script>
5+
<script src="inc/jquery.min.js#"></script>
6+
<script src="inc/jquery-ui.min.js#"></script>
7+
<script src="inc/jquery.lazyload.min.js#"></script>
68
{/if}
79
</head>
810
<body>

0 commit comments

Comments
 (0)