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; $out ["currentPage"] = $currentPage->n;
} }
if (!is_null (getURLParam ("complete")) || $complete) { if (!is_null (getURLParam ("complete")) || $complete) {
$out ["const"] = array ("version" => VERSION, "i18n" => array ( $out ["c"] = array ("version" => VERSION, "i18n" => array (
"coverAlt" => localize("i18n.coversection"), "coverAlt" => localize("i18n.coversection"),
"authorsTitle" => localize("authors.title"), "authorsTitle" => localize("authors.title"),
"bookwordTitle" => localize("bookword.title"), "bookwordTitle" => localize("bookword.title"),
@ -634,9 +634,9 @@ function getJson ($complete = false) {
"server_side_rendering" => useServerSideRendering (), "server_side_rendering" => useServerSideRendering (),
"html_tag_filter" => $config['cops_html_tag_filter'])); "html_tag_filter" => $config['cops_html_tag_filter']));
if ($config['cops_thumbnail_handling'] == "1") { 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'])) { } 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"> <span class="cover">
{{? it.book.hasCover == 1}} {{? it.book.hasCover == 1}}
<a href="{{=it.book.coverurl}}"> <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> </a>
{{?}} {{?}}
</span> </span>
@ -15,16 +15,16 @@
<br /> <br />
{{~}} {{~}}
</h2> </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"> <p class="popupless">
<h3>{{=it.const.i18n.authorsTitle}}: </h3> <h3>{{=it.c.i18n.authorsTitle}}: </h3>
{{~it.book.authors:author:i}} {{~it.book.authors:author:i}}
{{? i > 0}}, {{?}}<a href="{{=author.url}}">{{=htmlspecialchars (author.name)}}</a> {{? i > 0}}, {{?}}<a href="{{=author.url}}">{{=htmlspecialchars (author.name)}}</a>
{{~}} {{~}}
</p> </p>
{{? it.book.tagsName != ""}} {{? it.book.tagsName != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.const.i18n.tagsTitle}}: </h3> <h3>{{=it.c.i18n.tagsTitle}}: </h3>
{{~it.book.tags:tag:i}} {{~it.book.tags:tag:i}}
{{? i > 0}}, {{?}}<a href="{{=tag.url}}">{{=htmlspecialchars (tag.name)}}</a> {{? i > 0}}, {{?}}<a href="{{=tag.url}}">{{=htmlspecialchars (tag.name)}}</a>
{{~}} {{~}}
@ -32,22 +32,22 @@
{{?}} {{?}}
{{? it.book.seriesName != ""}} {{? it.book.seriesName != ""}}
<p class="popupless"> <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> </p>
{{?}} {{?}}
{{? it.book.pubDate != ""}} {{? it.book.pubDate != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.const.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}} <h3>{{=it.c.i18n.pubdateTitle}}: </h3>{{=it.book.pubDate}}
</p> </p>
{{?}} {{?}}
{{? it.book.languagesName != ""}} {{? it.book.languagesName != ""}}
<p class="popupless"> <p class="popupless">
<h3>{{=it.const.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}} <h3>{{=it.c.i18n.languagesTitle}}: </h3>{{=it.book.languagesName}}
</p> </p>
{{?}} {{?}}
{{? it.book.content != ""}} {{? it.book.content != ""}}
<br /> <br />
<h4>{{=it.const.i18n.contentTitle}}</h4> <h4>{{=it.c.i18n.contentTitle}}</h4>
<div>{{=it.book.content}}</div> <div>{{=it.book.content}}</div>
{{?}} {{?}}
</article> </article>

View file

@ -1,15 +1,15 @@
<footer> <footer>
<div class="footleft"> <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>
<div class="footright"> <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> </div>
{{? it.isPaginated == 1}} {{? it.isPaginated == 1}}
<div class="footcenter"> <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> <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> </div>
{{?}} {{?}}
</footer> </footer>

View file

@ -1,18 +1,18 @@
<header> <header>
<a class="headleft" href="{{=it.homeurl}}"> <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> </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 title="Settings and menu" class="hicon hicon64 headright"><i class="icon-cog" id="searchImage"></i></div>
{{?}} {{?}}
<div class="headcenter"> <div class="headcenter">
<h1>{{=it.title}}</h1> <h1>{{=it.title}}</h1>
</div> </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%"> <div style="float: left; width: 50%">
<form id="searchForm" action="index.php" method="get"> <form id="searchForm" action="index.php" method="get">
<div style="float: right"> <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> <i class="icon-search"></i>
</button> </button>
</div> </div>
@ -26,21 +26,21 @@
</div> </div>
</form> </form>
</div> </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 id="sortForm" style="float: right; width: 45%; display: none">
<div style="float: right"> <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>
<div class="stop"> <div class="stop">
<select id="sortchoice"> <select id="sortchoice">
<option value="st">{{=it.const.i18n.bookwordTitle}}</option> <option value="st">{{=it.c.i18n.bookwordTitle}}</option>
<option value="sa">{{=it.const.i18n.authorsTitle}}</option> <option value="sa">{{=it.c.i18n.authorsTitle}}</option>
<option value="ss">{{=it.const.i18n.seriesTitle}}</option> <option value="ss">{{=it.c.i18n.seriesTitle}}</option>
<option value="sp">{{=it.const.i18n.pubdateTitle}}</option> <option value="sp">{{=it.c.i18n.pubdateTitle}}</option>
</select> </select>
<select id="sortorder"> <select id="sortorder">
<option value="asc">{{=it.const.i18n.sortorderAsc}}</option> <option value="asc">{{=it.c.i18n.sortorderAsc}}</option>
<option value="desc">{{=it.const.i18n.sortorderDesc}}</option> <option value="desc">{{=it.c.i18n.sortorderDesc}}</option>
</select> </select>
</div> </div>
</div> </div>

View file

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

11
util.js
View file

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