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.)
This commit is contained in:
parent
58046a19ae
commit
858c5c2b43
6 changed files with 36 additions and 13 deletions
|
@ -8,10 +8,19 @@
|
|||
<form method="POST" action="" name="configform" id="configform">
|
||||
<input type="hidden" name="token" value="{$token}">
|
||||
<table border="0" cellpadding="20">
|
||||
<tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr>
|
||||
<tr><td valign="top"><b>Timezone:</b></td><td>{$timezone_form}</td></tr>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr>
|
||||
|
||||
<tr><td valign="top"><b>Timezone:</b></td><td valign="top">{$timezone_form}</td></tr>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<tr><td valign="top"><b>Features:</b></td><td>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<tr><td></td><td align="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
|
||||
<link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" />
|
||||
{if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if}
|
||||
<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>
|
||||
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
{else}
|
||||
<span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
|
||||
{/if}
|
||||
<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> -
|
||||
<div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200"
|
||||
{if="empty($GLOBALS['disablejquery'])"}onclick="return false;"{/if} class="qrcode"><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>
|
||||
{if="$value.tags"}
|
||||
<div class="linktaglist">
|
||||
|
@ -65,6 +66,7 @@
|
|||
</div>
|
||||
|
||||
{include="page.footer"}
|
||||
{if="empty($GLOBALS['disablejquery'])"}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('a.qrcode').click(function(){
|
||||
|
@ -75,5 +77,6 @@ $(document).ready(function() {
|
|||
});
|
||||
function hide_qrcode() { $('div.qrcode').remove(); }
|
||||
</script>
|
||||
{/if}
|
||||
</body>
|
||||
</html>
|
|
@ -8,7 +8,7 @@
|
|||
<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>
|
||||
{/if}
|
||||
|
||||
{if="$GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()"}
|
||||
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
|
||||
<script language="JavaScript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>{include="includes"}
|
||||
<script src="inc/jquery.lazyload.min.js#"></script>
|
||||
{if="empty($GLOBALS['disablejquery'])"}
|
||||
<script src="inc/jquery.lazyload.min.js#"></script>
|
||||
{/if}
|
||||
</head>
|
||||
<body>
|
||||
<div id="pageheader">{include="page.header"}</div>
|
||||
|
@ -16,9 +18,11 @@
|
|||
</center>
|
||||
{include="page.footer"}
|
||||
</body>
|
||||
{if="empty($GLOBALS['disablejquery'])"}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("img.lazyimage").show().lazyload();
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue