Almost everything is in javascript now ... index.php could be an HTML page. re #73
This commit is contained in:
parent
fccb7a9820
commit
10ed3f7944
35
index.php
35
index.php
|
@ -22,28 +22,12 @@
|
|||
exit ();
|
||||
}
|
||||
|
||||
$withToolbar = false;
|
||||
if (!isset($_COOKIE['toolbar'])) $withToolbar = true;
|
||||
|
||||
header ("Content-Type:application/xhtml+xml;charset=utf-8");
|
||||
$page = getURLParam ("page", Base::PAGE_INDEX);
|
||||
$query = getURLParam ("query");
|
||||
$qid = getURLParam ("id");
|
||||
$n = getURLParam ("n", "1");
|
||||
$database = GetUrlParam (DB);
|
||||
|
||||
/* Test to see if pages are opened on an Eink screen
|
||||
* test Kindle, Kobo Touch and Sony PRS-T1 Ereader.
|
||||
* HTTP_USER_AGENT = "Mozilla/5.0 (Linux; U; en-us; EBRD1101; EXT) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
|
||||
*/
|
||||
|
||||
if (preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
$isEink = 1;
|
||||
} else {
|
||||
$isEink = 0;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
@ -52,10 +36,8 @@
|
|||
<title>COPS</title>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery-1.9.1.min.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.cookies.js") ?>"></script>
|
||||
<?php if (getCurrentOption ('use_fancyapps') == 1) { ?>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/fancybox/jquery.fancybox.pack.js") ?>"></script>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/fancybox/jquery.fancybox.css") ?>" media="screen" />
|
||||
<?php } ?>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/doT/doT.min.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("util.js") ?>"></script>
|
||||
|
@ -69,23 +51,6 @@
|
|||
$(document).ready(function() {
|
||||
// Handler for .ready() called.
|
||||
|
||||
$("#sort").click(function(){
|
||||
$('.books').sortElements(function(a, b){
|
||||
var test = 1;
|
||||
if ($("#sortorder").val() == "desc")
|
||||
{
|
||||
test = -1;
|
||||
}
|
||||
return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? test : -test;
|
||||
});
|
||||
});
|
||||
|
||||
<?php if (getCurrentOption ('use_fancyapps') == 1) { ?>
|
||||
$(".fancycover").fancybox(fancyBoxObject (null, 'image'));
|
||||
|
||||
$(".fancyabout").fancybox(fancyBoxObject ('COPS <?php echo VERSION ?>', 'ajax'));
|
||||
<?php } ?>
|
||||
|
||||
$.when($.get('templates/default/header.html'),
|
||||
$.get('templates/default/footer.html'),
|
||||
$.get('templates/default/bookdetail.html'),
|
||||
|
|
42
util.js
42
util.js
|
@ -14,6 +14,10 @@ function fancyBoxObject (title, type) {
|
|||
return out;
|
||||
}
|
||||
|
||||
function getCurrentOption (option) {
|
||||
return $.cookie (option);
|
||||
}
|
||||
|
||||
function htmlEscape(str) {
|
||||
return String(str)
|
||||
.replace(/&/g, '&')
|
||||
|
@ -42,6 +46,17 @@ function updatePage (data) {
|
|||
|
||||
ajaxifyLinks ();
|
||||
|
||||
$("#sort").click(function(){
|
||||
$('.books').sortElements(function(a, b){
|
||||
var test = 1;
|
||||
if ($("#sortorder").val() == "desc")
|
||||
{
|
||||
test = -1;
|
||||
}
|
||||
return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? test : -test;
|
||||
});
|
||||
});
|
||||
|
||||
$(".headright").click(function(){
|
||||
if ($("#tool").is(":hidden")) {
|
||||
$("#tool").slideDown("slow");
|
||||
|
@ -52,18 +67,25 @@ function updatePage (data) {
|
|||
}
|
||||
});
|
||||
|
||||
$(".fancydetail").click(function(event){
|
||||
event.preventDefault();
|
||||
var url = $(this).attr("href");
|
||||
var jsonurl = url.replace ("bookdetail", "getJSON");
|
||||
$.getJSON(jsonurl, function(data) {
|
||||
var detail = templateBookDetail (data);
|
||||
$.fancybox( {
|
||||
content: detail,
|
||||
autoSize: true
|
||||
if (getCurrentOption ("use_fancyapps") == 1) {
|
||||
$(".fancydetail").click(function(event){
|
||||
event.preventDefault();
|
||||
var url = $(this).attr("href");
|
||||
var jsonurl = url.replace ("bookdetail", "getJSON");
|
||||
$.getJSON(jsonurl, function(data) {
|
||||
data ["i18n"] = currentData ["i18n"];
|
||||
var detail = templateBookDetail (data);
|
||||
$.fancybox( {
|
||||
content: detail,
|
||||
autoSize: true
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(".fancycover").fancybox(fancyBoxObject (null, 'image'));
|
||||
|
||||
$(".fancyabout").fancybox(fancyBoxObject ('COPS ' + currentData.version, 'ajax'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue