Fix JS problem on IE < 9.0. fix #89

This commit is contained in:
Sébastien Lucas 2013-09-06 09:18:41 +02:00
parent 3e80fe8c3b
commit 5a87d62ee8
6 changed files with 39 additions and 38 deletions

View file

@ -604,7 +604,7 @@ function getJson ($complete = false) {
$out ["currentPage"] = $currentPage->n;
}
if (!is_null (getURLParam ("complete")) || $complete) {
$out ["const"] = array ("version" => VERSION, "i18n" => array (
$out ["c"] = array ("version" => VERSION, "i18n" => array (
"coverAlt" => localize("i18n.coversection"),
"authorsTitle" => localize("authors.title"),
"bookwordTitle" => localize("bookword.title"),
@ -634,9 +634,9 @@ function getJson ($complete = false) {
"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"];
$out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
} else if (!empty ($config['cops_thumbnail_handling'])) {
$out ["const"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
$out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
}
}

View file

@ -2,7 +2,7 @@
<span class="cover">
{{? it.book.hasCover == 1}}
<a href="{{=it.book.coverurl}}">
<img src="{{=it.book.thumbnailurl}}" alt="{{=it.const.i18n.coverAlt}}" />
<img src="{{=it.book.thumbnailurl}}" alt="{{=it.c.i18n.coverAlt}}" />
</a>
{{?}}
</span>
@ -15,16 +15,16 @@
<br />
{{~}}
</h2>
<h1><a title="{{=it.const.i18n.permalinkAlt}}" rel="bookmark" href="{{=str_format (it.const.url.detailUrl, it.book.id, it.databaseId)}}"><i class="icon-link"></i></a>{{=htmlspecialchars (it.title)}}</h1>
<h1><a title="{{=it.c.i18n.permalinkAlt}}" rel="bookmark" href="{{=str_format (it.c.url.detailUrl, it.book.id, it.databaseId)}}"><i class="icon-link"></i></a>{{=htmlspecialchars (it.title)}}</h1>
<p class="popupless">
<h3>{{=it.const.i18n.authorsTitle}}: </h3>
<h3>{{=it.c.i18n.authorsTitle}}: </h3>
{{~it.book.authors:author:i}}
{{? i > 0}}, {{?}}<a href="{{=author.url}}">{{=htmlspecialchars (author.name)}}</a>
{{~}}
</p>
{{? it.book.tagsName != ""}}
<p class="popupless">
<h3>{{=it.const.i18n.tagsTitle}}: </h3>
<h3>{{=it.c.i18n.tagsTitle}}: </h3>
{{~it.book.tags:tag:i}}
{{? i > 0}}, {{?}}<a href="{{=tag.url}}">{{=htmlspecialchars (tag.name)}}</a>
{{~}}
@ -32,22 +32,22 @@
{{?}}
{{? it.book.seriesName != ""}}
<p class="popupless">
<h3><a href="{{=it.book.seriesurl}}">{{=it.const.i18n.seriesTitle}}</a> : </h3>{{=htmlspecialchars (it.book.seriesCompleteName)}}
<h3><a href="{{=it.book.seriesurl}}">{{=it.c.i18n.seriesTitle}}</a> : </h3>{{=htmlspecialchars (it.book.seriesCompleteName)}}
</p>
{{?}}
{{? it.book.pubDate != ""}}
<p class="popupless">
<h3>{{=it.const.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}}
<h3>{{=it.c.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}}
</p>
{{?}}
{{? it.book.languagesName != ""}}
<p class="popupless">
<h3>{{=it.const.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}}
<h3>{{=it.c.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}}
</p>
{{?}}
{{? it.book.content != ""}}
<br />
<h4>{{=it.const.i18n.contentTitle}}</h4>
<h4>{{=it.c.i18n.contentTitle}}</h4>
<div>{{=it.book.content}}</div>
{{?}}
</article>

View file

@ -1,15 +1,15 @@
<footer>
<div class="footleft">
<a href="index.php?page=19"><div title="{{=it.const.i18n.customizeTitle}}" class="hicon hicon32"><i class="icon-wrench"></i></div></a>
<a href="index.php?page=19"><div title="{{=it.c.i18n.customizeTitle}}" class="hicon hicon32"><i class="icon-wrench"></i></div></a>
</div>
<div class="footright">
<a class="fancyabout" href="{{=it.abouturl}}"><div title="{{=it.const.i18n.aboutTitle}}" class="hicon hicon32"><i class="icon-info-sign"></i></div></a>
<a class="fancyabout" href="{{=it.abouturl}}"><div title="{{=it.c.i18n.aboutTitle}}" class="hicon hicon32"><i class="icon-info-sign"></i></div></a>
</div>
{{? it.isPaginated == 1}}
<div class="footcenter">
{{? it.prevLink != ""}}<a id="prevLink" href="{{=it.prevLink}}" ><div title="{{=it.const.i18n.previousAlt}}" class="hicon hicon32"><i class="icon-angle-left"></i></div></a>{{?}}
{{? it.prevLink != ""}}<a id="prevLink" href="{{=it.prevLink}}" ><div title="{{=it.c.i18n.previousAlt}}" class="hicon hicon32"><i class="icon-angle-left"></i></div></a>{{?}}
<p> {{=it.currentPage}} / {{=it.maxPage}} </p>
{{? it.nextLink != ""}}<a id="nextLink" href="{{=it.nextLink}}" ><div title="{{=it.const.i18n.nextAlt}}" class="hicon hicon32"><i class="icon-angle-right"></i></div></a>{{?}}
{{? it.nextLink != ""}}<a id="nextLink" href="{{=it.nextLink}}" ><div title="{{=it.c.i18n.nextAlt}}" class="hicon hicon32"><i class="icon-angle-right"></i></div></a>{{?}}
</div>
{{?}}
</footer>

View file

@ -1,18 +1,18 @@
<header>
<a class="headleft" href="{{=it.homeurl}}">
<div title="{{=it.const.i18n.homeAlt}}" class="hicon hicon64"><i class="icon-home"></i></div>
<div title="{{=it.c.i18n.homeAlt}}" class="hicon hicon64"><i class="icon-home"></i></div>
</a>
{{? it.const.config.server_side_rendering == 0}}
{{? it.c.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" {{? it.const.config.server_side_rendering == 0}}style="display: none"{{?}}>
<div id="tool" {{? it.c.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">
<button title="{{=it.const.i18n.searchAlt}}" type="submit" class="hicon hicon32 submit">
<button title="{{=it.c.i18n.searchAlt}}" type="submit" class="hicon hicon32 submit">
<i class="icon-search"></i>
</button>
</div>
@ -26,21 +26,21 @@
</div>
</form>
</div>
{{? it.const.config.server_side_rendering == 0}}
{{? it.c.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>
<div title="{{=it.c.i18n.sortAlt}}" id="sort" class="hicon hicon32"><i class="icon-sort"></i></div>
</div>
<div class="stop">
<select id="sortchoice">
<option value="st">{{=it.const.i18n.bookwordTitle}}</option>
<option value="sa">{{=it.const.i18n.authorsTitle}}</option>
<option value="ss">{{=it.const.i18n.seriesTitle}}</option>
<option value="sp">{{=it.const.i18n.pubdateTitle}}</option>
<option value="st">{{=it.c.i18n.bookwordTitle}}</option>
<option value="sa">{{=it.c.i18n.authorsTitle}}</option>
<option value="ss">{{=it.c.i18n.seriesTitle}}</option>
<option value="sp">{{=it.c.i18n.pubdateTitle}}</option>
</select>
<select id="sortorder">
<option value="asc">{{=it.const.i18n.sortorderAsc}}</option>
<option value="desc">{{=it.const.i18n.sortorderDesc}}</option>
<option value="asc">{{=it.c.i18n.sortorderAsc}}</option>
<option value="desc">{{=it.c.i18n.sortorderDesc}}</option>
</select>
</div>
</div>

View file

@ -20,8 +20,8 @@
<article class="books">
<span class="cover">
{{? entry.book.hasCover == 1}}
<a class="fancycover" href="{{=str_format (it.const.url.coverUrl, entry.book.id, it.databaseId)}}">
<img src="{{=str_format (it.const.url.thumbnailUrl, entry.book.id, it.databaseId)}}" alt="{{=it.const.i18n.coverAlt}}" />
<a class="fancycover" href="{{=str_format (it.c.url.coverUrl, entry.book.id, it.databaseId)}}">
<img src="{{=str_format (it.c.url.thumbnailUrl, entry.book.id, it.databaseId)}}" alt="{{=it.c.i18n.coverAlt}}" />
</a>
{{?}}
</span>
@ -30,15 +30,15 @@
<a href="{{=data.url}}">{{=data.name}}</a><br />
{{~}}
</h2>
<a class="fancydetail" href="{{=str_format (it.const.url.detailUrl, entry.book.id, it.databaseId)}}">
<a class="fancydetail" href="{{=str_format (it.c.url.detailUrl, entry.book.id, it.databaseId)}}">
<div class="fullclickpopup">
<h2><span class="st">{{=htmlspecialchars (entry.title)}}</span>
{{? entry.book.pubDate != ""}}<span class="sp">({{=entry.book.pubDate}})</span>{{?}}
{{? entry.book.rating != ""}}<span class="sr">{{=entry.book.rating}}</span>{{?}}
</h2>
<h4>{{=it.const.i18n.authorsTitle}} : </h4><span class="sa">{{=htmlspecialchars (entry.book.authorsName)}}</span><br />
{{? entry.book.tagsName != ""}}<h4>{{=it.const.i18n.tagsTitle}} : </h4><span class="se">{{=htmlspecialchars (entry.book.tagsName)}}</span><br />{{?}}
{{? entry.book.seriesName != ""}}<h4>{{=it.const.i18n.seriesTitle}} : </h4><span class="ss">{{=htmlspecialchars (entry.book.seriesName)}} ({{=entry.book.seriesIndex}})</span><br />{{?}}
<h4>{{=it.c.i18n.authorsTitle}} : </h4><span class="sa">{{=htmlspecialchars (entry.book.authorsName)}}</span><br />
{{? entry.book.tagsName != ""}}<h4>{{=it.c.i18n.tagsTitle}} : </h4><span class="se">{{=htmlspecialchars (entry.book.tagsName)}}</span><br />{{?}}
{{? entry.book.seriesName != ""}}<h4>{{=it.c.i18n.seriesTitle}} : </h4><span class="ss">{{=htmlspecialchars (entry.book.seriesName)}} ({{=entry.book.seriesIndex}})</span><br />{{?}}
</div></a>
</article>
{{?}}

11
util.js
View file

@ -60,7 +60,7 @@ function retourMail(data, textStatus, jqXHR ) {
function sendToMailAddress (component, dataid) {
var email = $.cookie ('email');
if (!$.cookie ('email')) {
email = window.prompt (currentData.const.i18n.customizeEmail, "");
email = window.prompt (currentData.c.i18n.customizeEmail, "");
$.cookie ('email', email, { expires: 365 });
}
var url = 'sendtomail.php';
@ -87,8 +87,8 @@ function isDefined(x) {
function getCurrentOption (option) {
if (!$.cookie (option)) {
if (currentData && currentData.const && currentData.const.config && currentData.const.config [option]) {
return currentData.const.config [option];
if (currentData && currentData.c && currentData.c.config && currentData.c.config [option]) {
return currentData.c.config [option];
}
}
return $.cookie (option);
@ -218,6 +218,7 @@ function handleFilterEvents () {
*/
function navigateTo (url) {
$("h1").append (" <i class='icon-spinner icon-spin'></i>");
before = new Date ();
var jsonurl = url.replace ("index", "getJSON");
var cachedData = cache.get (jsonurl);
@ -236,7 +237,7 @@ function navigateTo (url) {
function updatePage (data) {
var result;
filterList = {};
data ["const"] = currentData ["const"];
data ["c"] = currentData ["c"];
if (false && $("section").length && currentData.isPaginated === 0 && data.isPaginated === 0) {
// Partial update (for now disabled)
debug_log ("Partial update");
@ -322,7 +323,7 @@ function link_Clicked (event) {
before = new Date ();
var jsonurl = url.replace ("index", "getJSON");
$.getJSON(jsonurl, function(data) {
data ["const"] = currentData ["const"];
data ["c"] = currentData ["c"];
var detail = "";
if (data.page === "16") {
detail = data.fullhtml;