Simplify a little the JSON, a little more to do. re # 73
This commit is contained in:
parent
23267e37fa
commit
2029ab7d01
2
base.php
2
base.php
|
@ -311,8 +311,6 @@ class EntryBook extends Entry
|
|||
|
||||
public function getContentArray () {
|
||||
$entry = array ( "title" => $this->title);
|
||||
$entry ["coverurl"] = $this->getCover ();
|
||||
$entry ["thumbnailurl"] = $this->getCoverThumbnail ();
|
||||
$entry ["book"] = $this->book->getContentArray ();
|
||||
return $entry;
|
||||
}
|
||||
|
|
4
book.php
4
book.php
|
@ -126,9 +126,9 @@ class Book extends Base {
|
|||
$su = $link->hrefXhtml ();
|
||||
}
|
||||
|
||||
return array ("hasCover" => $this->hasCover,
|
||||
return array ("id" => $this->id,
|
||||
"hasCover" => $this->hasCover,
|
||||
"preferedData" => $preferedData,
|
||||
"detailUrl" => $this->getDetailUrl (),
|
||||
"rating" => $this->getRating (),
|
||||
"pubDate" => $this->getPubDate (),
|
||||
"languagesName" => $this->getLanguages (),
|
||||
|
|
|
@ -73,7 +73,11 @@
|
|||
"languagesTitle" => localize("language.title"),
|
||||
"contentTitle" => localize("content.summary"),
|
||||
"sortorderAsc" => localize("search.sortorder.asc"),
|
||||
"sortorderDesc" => localize("search.sortorder.desc")));
|
||||
"sortorderDesc" => localize("search.sortorder.desc")),
|
||||
"url" => array (
|
||||
"detailUrl" => "index.php?page=13&id={0}&db={1}",
|
||||
"coverUrl" => "fetch.php?id={0}&db={1}",
|
||||
"thumbnailUrl" => "fetch.php?height=70&id={0}&db={1}"));
|
||||
}
|
||||
|
||||
$out ["containsBook"] = 0;
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
<article class="books">
|
||||
<span class="cover">
|
||||
{{? entry.book.hasCover == 1}}
|
||||
<a data-fancybox-group="group" class="fancycover" href="{{=entry.coverurl}}"><img src="{{=entry.thumbnailurl}}" alt="{{=it.const.i18n.coverAlt}}" /></a>
|
||||
<a data-fancybox-group="group" class="fancycover" href="{{=strformat (it.const.url.coverUrl, entry.book.id, it.databaseId)}}">
|
||||
<img src="{{=strformat (it.const.url.thumbnailUrl, entry.book.id, it.databaseId)}}" alt="{{=it.const.i18n.coverAlt}}" />
|
||||
</a>
|
||||
{{?}}
|
||||
</span>
|
||||
<h2 class="download">
|
||||
|
@ -24,7 +26,7 @@
|
|||
<a href="{{=data.url}}">{{=data.name}}</a><br />
|
||||
{{~}}
|
||||
</h2>
|
||||
<a class="fancydetail" href="{{=entry.book.detailUrl}}">
|
||||
<a class="fancydetail" href="{{=strformat (it.const.url.detailUrl, entry.book.id, it.databaseId)}}">
|
||||
<div class="fullclickpopup">
|
||||
<h2><span class="st">{{=htmlEscape (entry.title)}}</span>
|
||||
{{? entry.book.pubDate != ""}}<span class="sp">({{=entry.book.pubDate}})</span>{{?}}
|
||||
|
|
9
util.js
9
util.js
|
@ -14,6 +14,15 @@ function fancyBoxObject (title, type) {
|
|||
return out;
|
||||
}
|
||||
|
||||
function strformat () {
|
||||
var s = arguments[0];
|
||||
for (var i = 0; i < arguments.length - 1; i++) {
|
||||
var reg = new RegExp("\\{" + i + "\\}", "gm");
|
||||
s = s.replace(reg, arguments[i + 1]);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function getCurrentOption (option) {
|
||||
return $.cookie (option);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue