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;
|
||||
margin-left: 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 {
|
||||
@ -23,7 +26,19 @@ body {
|
||||
max-width: 1000px;
|
||||
min-width: 400px;
|
||||
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 {{{ */
|
||||
@ -36,6 +51,7 @@ body {
|
||||
font-size: xx-large;
|
||||
font-family: monospace;
|
||||
overflow: hidden;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#header .bubble {
|
||||
@ -53,15 +69,37 @@ body {
|
||||
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 {
|
||||
display: block;
|
||||
margin-right: 60px;
|
||||
text-align: right;
|
||||
margin-top: 60px;
|
||||
margin-top: 90px;
|
||||
line-height: 20px;
|
||||
cursor: default;
|
||||
position: relative;
|
||||
top: -100px;
|
||||
top: -2ex;
|
||||
}
|
||||
|
||||
ul#primary-nav li {
|
||||
@ -71,22 +109,11 @@ ul#primary-nav li {
|
||||
|
||||
ul#primary-nav li a {
|
||||
padding: 6px;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-variant: small-caps;
|
||||
/*text-transform: uppercase;*/
|
||||
font-size: 80%;
|
||||
font-weight: bold;
|
||||
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 {
|
||||
display: block;
|
||||
@ -94,10 +121,20 @@ ul#primary-nav li a:hover {
|
||||
height: 38px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
top: -230px;
|
||||
top: -260px;
|
||||
left: 65%;
|
||||
}
|
||||
|
||||
#calibre-home-link {
|
||||
position: relative;
|
||||
top: -298px;
|
||||
left: 0%;
|
||||
z-index: 2;
|
||||
height: 130px;
|
||||
width: 230px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
h2.library_name {
|
||||
font-family: monospace;
|
||||
font-size: 50px;
|
||||
@ -120,7 +157,18 @@ h2.library_name {
|
||||
|
||||
/* 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-top: 2ex;
|
||||
font-size: small;
|
||||
max-height: 2.75em;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#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 class="area">
|
||||
<div class="bubble">
|
||||
<p title="Showing library: {library_path}"
|
||||
>→ {library_name} ←</p>
|
||||
<p><a href="/browse" title="Return to top level"
|
||||
>→ home ←</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="nav-container">
|
||||
<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-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>
|
||||
</div>
|
||||
|
||||
<form id="donate" action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post" title="Donate to support the development of calibre">
|
||||
@ -56,6 +58,7 @@
|
||||
width="1" height="1"></img>
|
||||
</div>
|
||||
</form>
|
||||
<div id="calibre-home-link" title="Go to the calibre website"></div>
|
||||
</div>
|
||||
<!-- End header -->
|
||||
|
||||
@ -68,11 +71,21 @@
|
||||
</div>
|
||||
<div id="search_box">
|
||||
<form name="search_form" action="/browse/search" method="get">
|
||||
Search: <input value="" type="text" title="Search"
|
||||
class="search_input" />
|
||||
<input value="" type="text" title="Search"
|
||||
class="search_input" />
|
||||
<input type="submit" value="Search" title="Search" alt="Search" />
|
||||
</form>
|
||||
</div>
|
||||
<div> </div>
|
||||
<div> </div>
|
||||
<div> </div>
|
||||
|
||||
<div id="main">
|
||||
{main}
|
||||
</div>
|
||||
<div id="footer">
|
||||
[{library_path}] Created by Kovid Goyal
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -109,6 +109,7 @@ function init_sort_combobox() {
|
||||
function init() {
|
||||
$("#container").corner("30px");
|
||||
$("#header").corner("30px");
|
||||
$("#calibre-home-link").click(function() { window.location = "http://calibre-ebook.com"; });
|
||||
|
||||
init_sort_combobox();
|
||||
|
||||
@ -117,5 +118,13 @@ function init() {
|
||||
|
||||
// Top-level feed {{{
|
||||
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.line_edit = SearchLineEdit(self)
|
||||
self.setLineEdit(self.line_edit)
|
||||
c = self.line_edit.completer()
|
||||
c.setCompletionMode(c.PopupCompletion)
|
||||
self.line_edit.key_pressed.connect(self.key_pressed,
|
||||
type=Qt.DirectConnection)
|
||||
self.line_edit.mouse_released.connect(self.mouse_released,
|
||||
|
@ -63,13 +63,37 @@ class BrowseServer(object):
|
||||
# Catalogs {{{
|
||||
def browse_catalog(self, 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='',
|
||||
script='toplevel();')
|
||||
script='toplevel();', main=main)
|
||||
else:
|
||||
raise cherrypy.HTTPError(404, 'Not found')
|
||||
|
||||
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
|
||||
|
||||
# }}}
|
||||
|
@ -30,7 +30,10 @@ class Cache(object):
|
||||
|
||||
def categories_cache(self, restrict_to=frozenset([])):
|
||||
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)
|
||||
if old is None or old[0] <= self.db.last_modified():
|
||||
categories = self.db.get_categories(ids=restrict_to)
|
||||
|
Loading…
x
Reference in New Issue
Block a user