From 23267e37fa65bb2edd8485653e8125e09e2fcbc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Lucas?=
Date: Mon, 17 Jun 2013 21:41:59 +0200
Subject: [PATCH] Simplify book detail. re #73
---
book.php | 6 +--
bookdetail.php | 103 -------------------------------------------------
util.js | 13 ++++---
3 files changed, 8 insertions(+), 114 deletions(-)
delete mode 100644 bookdetail.php
diff --git a/book.php b/book.php
index 38d4413..55d19f9 100644
--- a/book.php
+++ b/book.php
@@ -169,11 +169,7 @@ class Book extends Base {
$urlParam = $this->getUri ();
if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
$urlParam = str_replace ("&", "&", $urlParam);
- if ($permalink || getCurrentOption ('use_fancyapps') == 0) {
- return 'index.php' . $urlParam;
- } else {
- return 'bookdetail.php' . $urlParam;
- }
+ return 'index.php' . $urlParam;
}
public function getTitle () {
diff --git a/bookdetail.php b/bookdetail.php
deleted file mode 100644
index 51d8f8a..0000000
--- a/bookdetail.php
+++ /dev/null
@@ -1,103 +0,0 @@
-
- *
- */
-
-require_once ("config.php");
-require_once ("book.php");
-
-$book = Book::getBookById($_GET["id"]);
-$authors = $book->getAuthors ();
-$tags = $book->getTags ();
-$serie = $book->getSerie ();
-$book->getLinkArray ();
-
-?>
-
- 0) {
-?>
- :
-
- 0) echo ", ";
-?>
- name) ?>
-
-
-
- :
- seriesIndex, htmlspecialchars ($serie->name)) ?>
-
-getPubDate() != "")
- {
-?>
- :
- getPubDate() ?>
-
-getLanguages () != "")
- {
-?>
- :
- getLanguages () ?>
-
-
-
-
- >getComment (false) ?>
-
\ No newline at end of file
diff --git a/util.js b/util.js
index 33757b6..5ab7e71 100644
--- a/util.js
+++ b/util.js
@@ -71,14 +71,13 @@ function updatePage (data) {
$(".fancydetail").click(function(event){
event.preventDefault();
var url = $(this).attr("href");
- var jsonurl = url.replace ("bookdetail", "getJSON");
+ var jsonurl = url.replace ("index", "getJSON");
$.getJSON(jsonurl, function(data) {
data ["const"] = currentData ["const"];
var detail = templateBookDetail (data);
- $.fancybox( {
- content: detail,
- autoSize: true
- });
+ var fancyparams = fancyBoxObject (data.title, null);
+ fancyparams ["content"] = detail;
+ $.fancybox(fancyparams);
});
});
@@ -91,7 +90,9 @@ function updatePage (data) {
function ajaxifyLinks () {
if (history.pushState) {
- $("a[href^='index']").click (function (event) {
+ var links = $("a[href^='index']");
+ if (getCurrentOption ("use_fancyapps") == 1) links = links.not (".fancydetail");
+ links.click (function (event) {
event.preventDefault();
var url = $(this).attr('href');