3 * COPS (Calibre OPDS PHP Server) HTML main script
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author Sébastien Lucas <sebastien@slucas.fr>
10 require_once ("config.php");
11 require_once ("base.php");
12 require_once ("author.php");
13 require_once ("serie.php");
14 require_once ("tag.php");
15 require_once ("language.php");
16 require_once ("book.php");
18 // If we detect that an OPDS reader try to connect try to redirect to feed.php
19 if (preg_match("/(PocketBook|MantanoReader|FBReader|Stanza|Aldiko|Moon+ Reader|CoolReader)/", $_SERVER['HTTP_USER_AGENT'])) {
20 header("location: feed.php");
24 header ("Content-Type:text/html;charset=utf-8");
25 $page = getURLParam ("page", Base::PAGE_INDEX);
26 $query = getURLParam ("query");
27 $qid = getURLParam ("id");
28 $n = getURLParam ("n", "1");
31 <html xmlns="http://www.w3.org/1999/xhtml">
33 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
35 <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jQuery/jquery-1.10.2.min.js") ?>"></script>
36 <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jquery-cookie/jquery.cookies.js") ?>"></script>
37 <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/Magnific-Popup/jquery.magnific-popup.min.js") ?>"></script>
38 <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/Magnific-Popup/magnific-popup.css") ?>" media="screen" />
39 <script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
40 <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/doT/doT.min.js") ?>"></script>
41 <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/lru/lru.js") ?>"></script>
42 <script type="text/javascript" src="<?php echo getUrlWithVersion("util.js") ?>"></script>
43 <link rel="related" href="<?php echo $config['cops_full_url'] ?>feed.php" type="application/atom+xml;profile=opds-catalog" title="<?php echo $config['cops_title_default']; ?>" />
44 <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
45 <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic' />
46 <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/normalize/normalize.css") ?>" />
47 <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("styles/font-awesome.css") ?>" media="screen" />
48 <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
49 <script type="text/javascript">
51 $(document).ready(function() {
52 // Handler for .ready() called.
54 var url = "<?php echo "getJSON.php?" . addURLParameter ($_SERVER["QUERY_STRING"], "complete", 1); ?>";
56 $.when($.get('templates/default/header.html'),
57 $.get('templates/default/footer.html'),
58 $.get('templates/default/bookdetail.html'),
59 $.get('templates/default/main.html'),
60 $.get('templates/default/page.html'),
61 $.getJSON(url)).done(function(header, footer, bookdetail, main, page, data){
62 templateBookDetail = doT.template (bookdetail [0]);
65 bookdetail: bookdetail [0]
68 templateMain = doT.template (main [0], undefined, defMain);
74 bookdetail: bookdetail [0]
77 templatePage = doT.template (page [0], undefined, defPage);
78 currentData = data [0];
80 updatePage (data [0]);
81 cache.put (url, data [0]);
82 history.replaceState(url, "", window.location);