diff options
author | Sebastien SAUVAGE <sebsauvage@sebsauvage.net> | 2013-03-01 22:21:10 +0100 |
---|---|---|
committer | Sebastien SAUVAGE <sebsauvage@sebsauvage.net> | 2013-03-01 22:21:10 +0100 |
commit | 858c5c2b43ce16f6d4b388725ef2d7a95e4a1986 (patch) | |
tree | a5d4f24761bd768ea44118803162907f814c3980 /tpl | |
parent | 58046a19ae3e8cba4b4dbef783bd3caed2f6e881 (diff) | |
download | Shaarli-858c5c2b43ce16f6d4b388725ef2d7a95e4a1986.tar.gz Shaarli-858c5c2b43ce16f6d4b388725ef2d7a95e4a1986.tar.zst Shaarli-858c5c2b43ce16f6d4b388725ef2d7a95e4a1986.zip |
Added option to disable jQuery and heavy javascript
Shaarli uses light Javascript in its normal operation, and some jQuery
for some features (autocomplete in tags, QR-Code popup...).
jQuery can be slow on small computers. An option has been added in
configuration screen to disable javascript features which are hard on
CPU.
(Note that the Picture Wall is awfully heavy *without* jQuery.)
(Side note: A *LOT* of users want Shaarli to work without javasript at
all, if possible. That's why I try to use as few javascript as possible:
It keeps Shaarli pages fast.)
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/configure.html | 17 | ||||
-rw-r--r-- | tpl/includes.html | 2 | ||||
-rw-r--r-- | tpl/linklist.html | 5 | ||||
-rw-r--r-- | tpl/page.footer.html | 2 | ||||
-rw-r--r-- | tpl/picwall.html | 6 |
5 files changed, 24 insertions, 8 deletions
diff --git a/tpl/configure.html b/tpl/configure.html index 00c41f28..1beba59c 100644 --- a/tpl/configure.html +++ b/tpl/configure.html | |||
@@ -8,10 +8,19 @@ | |||
8 | <form method="POST" action="" name="configform" id="configform"> | 8 | <form method="POST" action="" name="configform" id="configform"> |
9 | <input type="hidden" name="token" value="{$token}"> | 9 | <input type="hidden" name="token" value="{$token}"> |
10 | <table border="0" cellpadding="20"> | 10 | <table border="0" cellpadding="20"> |
11 | <tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr> | 11 | |
12 | <tr><td valign="top"><b>Timezone:</b></td><td>{$timezone_form}</td></tr> | 12 | <tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr> |
13 | <tr><td valign="top"><b>Redirector</b></td><td><input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)</td></tr> | 13 | |
14 | <tr> <td valign="top">Security:</td> <td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection"> Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr> | 14 | <tr><td valign="top"><b>Timezone:</b></td><td valign="top">{$timezone_form}</td></tr> |
15 | |||
16 | <tr><td valign="top"><b>Redirector</b></td><td><input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)</td></tr> | ||
17 | |||
18 | <tr><td valign="top"><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection"> Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr> | ||
19 | |||
20 | <tr><td valign="top"><b>Features:</b></td><td> | ||
21 | <input type="checkbox" name="disablejquery" id="disablejquery" {if="!empty($GLOBALS['disablejquery'])"}checked{/if}><label for="disablejquery"> Disable jQuery and all heavy javascript (for example: Autocomplete in tags. Useful for slow computers.)</label> | ||
22 | </tr> | ||
23 | |||
15 | <tr><td></td><td align="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr> | 24 | <tr><td></td><td align="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr> |
16 | </table> | 25 | </table> |
17 | </form> | 26 | </form> |
diff --git a/tpl/includes.html b/tpl/includes.html index 5319f452..e0ad00d5 100644 --- a/tpl/includes.html +++ b/tpl/includes.html | |||
@@ -7,4 +7,4 @@ | |||
7 | <link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> | 7 | <link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> |
8 | <link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" /> | 8 | <link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" /> |
9 | {if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if} | 9 | {if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if} |
10 | <script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script> | 10 | {if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if} |
diff --git a/tpl/linklist.html b/tpl/linklist.html index 45bd478f..3a703512 100644 --- a/tpl/linklist.html +++ b/tpl/linklist.html | |||
@@ -48,7 +48,8 @@ | |||
48 | {else} | 48 | {else} |
49 | <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span> | 49 | <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span> |
50 | {/if} | 50 | {/if} |
51 | <div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200" onclick="return false;" class="qrcode"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> - | 51 | <div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200" |
52 | {if="empty($GLOBALS['disablejquery'])"}onclick="return false;"{/if} class="qrcode"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> - | ||
52 | <span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br> | 53 | <span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br> |
53 | {if="$value.tags"} | 54 | {if="$value.tags"} |
54 | <div class="linktaglist"> | 55 | <div class="linktaglist"> |
@@ -65,6 +66,7 @@ | |||
65 | </div> | 66 | </div> |
66 | 67 | ||
67 | {include="page.footer"} | 68 | {include="page.footer"} |
69 | {if="empty($GLOBALS['disablejquery'])"} | ||
68 | <script> | 70 | <script> |
69 | $(document).ready(function() { | 71 | $(document).ready(function() { |
70 | $('a.qrcode').click(function(){ | 72 | $('a.qrcode').click(function(){ |
@@ -75,5 +77,6 @@ $(document).ready(function() { | |||
75 | }); | 77 | }); |
76 | function hide_qrcode() { $('div.qrcode').remove(); } | 78 | function hide_qrcode() { $('div.qrcode').remove(); } |
77 | </script> | 79 | </script> |
80 | {/if} | ||
78 | </body> | 81 | </body> |
79 | </html> \ No newline at end of file | 82 | </html> \ No newline at end of file |
diff --git a/tpl/page.footer.html b/tpl/page.footer.html index 7fe15017..13b566ae 100644 --- a/tpl/page.footer.html +++ b/tpl/page.footer.html | |||
@@ -8,7 +8,7 @@ | |||
8 | <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> | 8 | <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> |
9 | {/if} | 9 | {/if} |
10 | 10 | ||
11 | {if="$GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()"} | 11 | {if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} |
12 | <script language="JavaScript"> | 12 | <script language="JavaScript"> |
13 | $(document).ready(function() | 13 | $(document).ready(function() |
14 | { | 14 | { |
diff --git a/tpl/picwall.html b/tpl/picwall.html index 2083a629..8f8e0a0e 100644 --- a/tpl/picwall.html +++ b/tpl/picwall.html | |||
@@ -1,7 +1,9 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head>{include="includes"} | 3 | <head>{include="includes"} |
4 | <script src="inc/jquery.lazyload.min.js#"></script> | 4 | {if="empty($GLOBALS['disablejquery'])"} |
5 | <script src="inc/jquery.lazyload.min.js#"></script> | ||
6 | {/if} | ||
5 | </head> | 7 | </head> |
6 | <body> | 8 | <body> |
7 | <div id="pageheader">{include="page.header"}</div> | 9 | <div id="pageheader">{include="page.header"}</div> |
@@ -16,9 +18,11 @@ | |||
16 | </center> | 18 | </center> |
17 | {include="page.footer"} | 19 | {include="page.footer"} |
18 | </body> | 20 | </body> |
21 | {if="empty($GLOBALS['disablejquery'])"} | ||
19 | <script> | 22 | <script> |
20 | $(document).ready(function() { | 23 | $(document).ready(function() { |
21 | $("img.lazyimage").show().lazyload(); | 24 | $("img.lazyimage").show().lazyload(); |
22 | }); | 25 | }); |
23 | </script> | 26 | </script> |
27 | {/if} | ||
24 | </html> \ No newline at end of file | 28 | </html> \ No newline at end of file |