Handle better when server side rendering is enabled. re #82

This commit is contained in:
Sébastien Lucas 2013-09-05 08:41:40 +02:00
parent fa4ffb47e7
commit 9d117220c4
5 changed files with 19 additions and 8 deletions

View file

@ -751,11 +751,12 @@ class PageCustomize extends Page
array_push ($this->entryArray, new Entry (localize ("customize.style"), "",
$content, "text",
array ()));
if (!useServerSideRendering ()) {
$content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $use_fancybox . ' />';
array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "",
$content, "text",
array ()));
}
$content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption ("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />';
array_push ($this->entryArray, new Entry (localize ("customize.paging"), "",
$content, "text",

View file

@ -631,6 +631,7 @@ function getJson ($complete = false) {
"config" => array (
"use_fancyapps" => $config ["cops_use_fancyapps"],
"max_item_per_page" => $config['cops_max_item_per_page'],
"server_side_rendering" => useServerSideRendering (),
"html_tag_filter" => $config['cops_html_tag_filter']));
if ($config['cops_thumbnail_handling'] == "1") {
$out ["const"]["url"]["thumbnailUrl"] = $out ["const"]["url"]["coverUrl"];

View file

@ -42,13 +42,16 @@
<link rel="apple-touch-icon" sizes="144x144" href="./icons/icon144.png" />
<title>COPS</title>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jQuery/jquery-1.10.2.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jquery-cookie/jquery.cookies.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
<?php if (!useServerSideRendering ()) { ?>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/Magnific-Popup/jquery.magnific-popup.min.js") ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/Magnific-Popup/magnific-popup.css") ?>" media="screen" />
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/doT/doT.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/lru/lru.js") ?>"></script>
<?php } ?>
<script type="text/javascript" src="<?php echo getUrlWithVersion("util.js") ?>"></script>
<link rel="related" href="<?php echo $config['cops_full_url'] ?>feed.php" type="application/atom+xml;profile=opds-catalog" title="<?php echo $config['cops_title_default']; ?>" />
<link rel="icon" type="image/vnd.microsoft.icon" href="<?php echo $config['cops_icon']; ?>" />

View file

@ -2,11 +2,13 @@
<a class="headleft" href="{{=it.homeurl}}">
<div title="{{=it.const.i18n.homeAlt}}" class="hicon hicon64"><i class="icon-home"></i></div>
</a>
{{? it.const.config.server_side_rendering == 0}}
<div title="Settings and menu" class="hicon hicon64 headright"><i class="icon-cog" id="searchImage"></i></div>
{{?}}
<div class="headcenter">
<h1>{{=it.title}}</h1>
</div>
<div id="tool" style="display: none">
<div id="tool" {{? it.const.config.server_side_rendering == 0}}style="display: none"{{?}}>
<div style="float: left; width: 50%">
<form id="searchForm" action="index.php" method="get">
<div style="float: right">
@ -24,6 +26,7 @@
</div>
</form>
</div>
{{? it.const.config.server_side_rendering == 0}}
<div id="sortForm" style="float: right; width: 45%; display: none">
<div style="float: right">
<div title="{{=it.const.i18n.sortAlt}}" id="sort" class="hicon hicon32"><i class="icon-sort"></i></div>
@ -45,5 +48,6 @@
<ul>
</ul>
</div>
{{?}}
</div>
</header>

View file

@ -4,7 +4,9 @@
var templatePage, templateBookDetail, templateMain, currentData, before, filterList;
var cache = new LRUCache(30);
if (typeof LRUCache!='undefined') {
var cache = new LRUCache(30);
}
var DEBUG = false;
var isPushStateEnabled = window.history && window.history.pushState && window.history.replaceState &&