mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
b9499d7fc7
@ -12,6 +12,9 @@ body {
|
|||||||
background-color: #F6F3E9;
|
background-color: #F6F3E9;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
-moz-box-shadow: 5px 5px 5px #ccc;
|
||||||
|
-webkit-box-shadow: 5px 5px 5px #ccc;
|
||||||
|
box-shadow: 5px 5px 5px #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
@ -23,7 +26,19 @@ body {
|
|||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
padding-bottom: 30px;
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
padding-left: 0.5em;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
font-size: small;
|
||||||
|
color: #a6a399;
|
||||||
|
text-align: right;
|
||||||
|
margin-right: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Header {{{ */
|
/* Header {{{ */
|
||||||
@ -36,6 +51,7 @@ body {
|
|||||||
font-size: xx-large;
|
font-size: xx-large;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header .bubble {
|
#header .bubble {
|
||||||
@ -53,15 +69,37 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#header a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-shadow: #27211b 2px 2px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header a:hover {
|
||||||
|
background-color: #39a9cf;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
text-shadow: #27211b 1px 1px 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-container {
|
||||||
|
position: relative;
|
||||||
|
height: 130px;
|
||||||
|
top: -130px;
|
||||||
|
left: 0%;
|
||||||
|
}
|
||||||
|
|
||||||
ul#primary-nav {
|
ul#primary-nav {
|
||||||
display: block;
|
display: block;
|
||||||
margin-right: 60px;
|
margin-right: 60px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-top: 60px;
|
margin-top: 90px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -100px;
|
top: -2ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#primary-nav li {
|
ul#primary-nav li {
|
||||||
@ -71,22 +109,11 @@ ul#primary-nav li {
|
|||||||
|
|
||||||
ul#primary-nav li a {
|
ul#primary-nav li a {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
font-variant: small-caps;
|
font-variant: small-caps;
|
||||||
/*text-transform: uppercase;*/
|
|
||||||
font-size: 80%;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-shadow: #27211b 2px 2px 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#primary-nav li a:hover {
|
|
||||||
background-color: #39a9cf;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
text-shadow: #27211b 1px 1px 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#donate {
|
#donate {
|
||||||
display: block;
|
display: block;
|
||||||
@ -94,10 +121,20 @@ ul#primary-nav li a:hover {
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -230px;
|
top: -260px;
|
||||||
left: 65%;
|
left: 65%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#calibre-home-link {
|
||||||
|
position: relative;
|
||||||
|
top: -298px;
|
||||||
|
left: 0%;
|
||||||
|
z-index: 2;
|
||||||
|
height: 130px;
|
||||||
|
width: 230px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
h2.library_name {
|
h2.library_name {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
@ -120,7 +157,18 @@ h2.library_name {
|
|||||||
|
|
||||||
/* Sort select {{{ */
|
/* Sort select {{{ */
|
||||||
|
|
||||||
.sort_select { float: left; margin-left: 1em; margin-top: 2ex; font-size: small; }
|
.sort_select {
|
||||||
|
float: left;
|
||||||
|
margin-left: 1em;
|
||||||
|
margin-top: 2ex;
|
||||||
|
font-size: small;
|
||||||
|
max-height: 2.75em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort_select label {
|
||||||
|
font-size: medium;
|
||||||
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -131,9 +179,40 @@ h2.library_name {
|
|||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
margin-top: 2ex;
|
margin-top: 2ex;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
|
max-height: 2.75em;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search_box .search_input { padding: 0.35em }
|
#search_box .search_input { padding: 0.35em }
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
/* Top level {{{ */
|
||||||
|
.toplevel ul {
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toplevel li {
|
||||||
|
margin: 0.75em;
|
||||||
|
padding: 0.75em;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toplevel li:hover {
|
||||||
|
background-color: #d6d3c9;
|
||||||
|
font-weight: bold;
|
||||||
|
-moz-box-shadow: 5px 5px 5px #ccc;
|
||||||
|
-webkit-box-shadow: 5px 5px 5px #ccc;
|
||||||
|
box-shadow: 5px 5px 5px #ccc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.toplevel li span { display: none }
|
||||||
|
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,16 +33,18 @@
|
|||||||
<div id="header">
|
<div id="header">
|
||||||
<div class="area">
|
<div class="area">
|
||||||
<div class="bubble">
|
<div class="bubble">
|
||||||
<p title="Showing library: {library_path}"
|
<p><a href="/browse" title="Return to top level"
|
||||||
>→ {library_name} ←</p>
|
>→ home ←</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="nav-container">
|
||||||
<ul id="primary-nav">
|
<ul id="primary-nav">
|
||||||
<li><a id="nav-mobile" href="/mobile" title="A version of this website suited for mobile browsers">Mobile</a></li>
|
<li><a id="nav-mobile" href="/mobile" title="A version of this website suited for mobile browsers">Mobile</a></li>
|
||||||
|
|
||||||
<li><a id="nav-demo" href="/old" title="The old version of this webiste">Old</a></li>
|
<li><a id="nav-demo" href="/old" title="The old version of this webiste">Old</a></li>
|
||||||
<li><a id="nav-download" href="/opds" title="A feed based version of this website, used in special purpose applications">Feed</a></li>
|
<li><a id="nav-download" href="/opds" title="An OPDS feed based version of this website, used in special purpose applications">Feed</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form id="donate" action="https://www.paypal.com/cgi-bin/webscr"
|
<form id="donate" action="https://www.paypal.com/cgi-bin/webscr"
|
||||||
method="post" title="Donate to support the development of calibre">
|
method="post" title="Donate to support the development of calibre">
|
||||||
@ -56,6 +58,7 @@
|
|||||||
width="1" height="1"></img>
|
width="1" height="1"></img>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<div id="calibre-home-link" title="Go to the calibre website"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- End header -->
|
<!-- End header -->
|
||||||
|
|
||||||
@ -68,11 +71,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="search_box">
|
<div id="search_box">
|
||||||
<form name="search_form" action="/browse/search" method="get">
|
<form name="search_form" action="/browse/search" method="get">
|
||||||
Search: <input value="" type="text" title="Search"
|
<input value="" type="text" title="Search"
|
||||||
class="search_input" />
|
class="search_input" />
|
||||||
<input type="submit" value="Search" title="Search" alt="Search" />
|
<input type="submit" value="Search" title="Search" alt="Search" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div> </div>
|
||||||
|
<div> </div>
|
||||||
|
<div> </div>
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
{main}
|
||||||
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
[{library_path}] Created by Kovid Goyal
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -109,6 +109,7 @@ function init_sort_combobox() {
|
|||||||
function init() {
|
function init() {
|
||||||
$("#container").corner("30px");
|
$("#container").corner("30px");
|
||||||
$("#header").corner("30px");
|
$("#header").corner("30px");
|
||||||
|
$("#calibre-home-link").click(function() { window.location = "http://calibre-ebook.com"; });
|
||||||
|
|
||||||
init_sort_combobox();
|
init_sort_combobox();
|
||||||
|
|
||||||
@ -117,5 +118,13 @@ function init() {
|
|||||||
|
|
||||||
// Top-level feed {{{
|
// Top-level feed {{{
|
||||||
function toplevel() {
|
function toplevel() {
|
||||||
|
$(".sort_select").hide();
|
||||||
|
|
||||||
|
$(".toplevel li").corner("15px");
|
||||||
|
|
||||||
|
$(".toplevel li").click(function() {
|
||||||
|
var href = $(this).children("span").html();
|
||||||
|
window.location = href;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
@ -73,6 +73,8 @@ class SearchBox2(QComboBox):
|
|||||||
self.normal_background = 'rgb(255, 255, 255, 0%)'
|
self.normal_background = 'rgb(255, 255, 255, 0%)'
|
||||||
self.line_edit = SearchLineEdit(self)
|
self.line_edit = SearchLineEdit(self)
|
||||||
self.setLineEdit(self.line_edit)
|
self.setLineEdit(self.line_edit)
|
||||||
|
c = self.line_edit.completer()
|
||||||
|
c.setCompletionMode(c.PopupCompletion)
|
||||||
self.line_edit.key_pressed.connect(self.key_pressed,
|
self.line_edit.key_pressed.connect(self.key_pressed,
|
||||||
type=Qt.DirectConnection)
|
type=Qt.DirectConnection)
|
||||||
self.line_edit.mouse_released.connect(self.mouse_released,
|
self.line_edit.mouse_released.connect(self.mouse_released,
|
||||||
|
@ -63,13 +63,37 @@ class BrowseServer(object):
|
|||||||
# Catalogs {{{
|
# Catalogs {{{
|
||||||
def browse_catalog(self, category=None):
|
def browse_catalog(self, category=None):
|
||||||
if category == None:
|
if category == None:
|
||||||
#categories = self.categories_cache()
|
categories = self.categories_cache()
|
||||||
|
category_meta = self.db.field_metadata
|
||||||
|
cats = [
|
||||||
|
(_('Newest'), 'newest'),
|
||||||
|
]
|
||||||
|
def getter(x):
|
||||||
|
return category_meta[x]['name'].lower()
|
||||||
|
for category in sorted(categories,
|
||||||
|
cmp=lambda x,y: cmp(getter(x), getter(y))):
|
||||||
|
if len(categories[category]) == 0:
|
||||||
|
continue
|
||||||
|
if category == 'formats':
|
||||||
|
continue
|
||||||
|
meta = category_meta.get(category, None)
|
||||||
|
if meta is None:
|
||||||
|
continue
|
||||||
|
cats.append((meta['name'], category))
|
||||||
|
cats = ['<li title="{2} {0}">{0}<span>/browse/category/{1}</span></li>'.format(xml(x, True),
|
||||||
|
xml(y), xml(_('Browse books by'))) for x, y in cats]
|
||||||
|
|
||||||
|
main = '<div class="toplevel"><h3>{0}</h3><ul>{1}</ul></div>'\
|
||||||
|
.format(_('Choose a category to browse by:'), '\n\n'.join(cats))
|
||||||
ans = self.browse_template().format(title='',
|
ans = self.browse_template().format(title='',
|
||||||
script='toplevel();')
|
script='toplevel();', main=main)
|
||||||
else:
|
else:
|
||||||
raise cherrypy.HTTPError(404, 'Not found')
|
raise cherrypy.HTTPError(404, 'Not found')
|
||||||
|
|
||||||
cherrypy.response.headers['Content-Type'] = 'text/html'
|
cherrypy.response.headers['Content-Type'] = 'text/html'
|
||||||
cherrypy.response.headers['Last-Modified'] = self.last_modified(self.build_time)
|
updated = self.db.last_modified()
|
||||||
|
cherrypy.response.headers['Last-Modified'] = \
|
||||||
|
self.last_modified(max(updated, self.build_time))
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -30,7 +30,10 @@ class Cache(object):
|
|||||||
|
|
||||||
def categories_cache(self, restrict_to=frozenset([])):
|
def categories_cache(self, restrict_to=frozenset([])):
|
||||||
base_restriction = self.search_cache('')
|
base_restriction = self.search_cache('')
|
||||||
restrict_to = frozenset(restrict_to).intersection(base_restriction)
|
if restrict_to:
|
||||||
|
restrict_to = frozenset(restrict_to).intersection(base_restriction)
|
||||||
|
else:
|
||||||
|
restrict_to = base_restriction
|
||||||
old = self._category_cache.pop(frozenset(restrict_to), None)
|
old = self._category_cache.pop(frozenset(restrict_to), None)
|
||||||
if old is None or old[0] <= self.db.last_modified():
|
if old is None or old[0] <= self.db.last_modified():
|
||||||
categories = self.db.get_categories(ids=restrict_to)
|
categories = self.db.get_categories(ids=restrict_to)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user