Save current JSON data instead of generated HTML. Reenabled tool click. re #73

This commit is contained in:
Sébastien Lucas 2013-06-16 15:08:47 +02:00
parent 6ee817710e
commit b49432e3e1
3 changed files with 17 additions and 14 deletions

View file

@ -86,16 +86,6 @@
$(".fancyabout").fancybox(fancyBoxObject ('COPS <?php echo VERSION ?>', 'ajax'));
<?php } ?>
$(".headright").click(function(){
if ($("#tool").is(":hidden")) {
$("#tool").slideDown("slow");
$.cookie('toolbar', '1');
} else {
$("#tool").slideUp();
$.removeCookie('toolbar');
}
});
$.when($.get('templates/default/header.html'),
$.get('templates/default/footer.html'),
$.get('templates/default/bookdetail.html'),
@ -118,7 +108,7 @@
};
templatePage = doT.template (page [0], undefined, defPage);
var toto = "toto";
currentData = data [0];
updatePage (data [0]);
history.replaceState(data [0], "", window.location);

View file

@ -6,7 +6,7 @@
<div class="headcenter">
<h1>{{=it.title}}</h1>
</div>
<div id="tool">
<div id="tool" style="display: none">
<div style="float: left; width: 60%">
<form action="index.php" method="get">
<div style="float: right">

17
util.js
View file

@ -1,4 +1,4 @@
var templatePage, templateBookDetail, templateMain, result;
var templatePage, templateBookDetail, templateMain, currentData;
var isEink = /Kobo|Kindle|EBRD1101/i.test(navigator.userAgent);
@ -32,12 +32,25 @@ function navigateTo (url) {
}
function updatePage (data) {
result = templatePage (data);
currentData = data;
var result = templatePage (data);
document.title = data.title;
$(".container").html (result);
if ($.cookie('toolbar') == 1) $("#tool").show ();
ajaxifyLinks ();
$(".headright").click(function(){
if ($("#tool").is(":hidden")) {
$("#tool").slideDown("slow");
$.cookie('toolbar', '1');
} else {
$("#tool").slideUp();
$.removeCookie('toolbar');
}
});
$(".fancydetail").click(function(event){
event.preventDefault();
var url = $(this).attr("href");