diff --git a/resources/content_server/browse/browse.css b/resources/content_server/browse/browse.css index 1243795e55..75832e47f9 100644 --- a/resources/content_server/browse/browse.css +++ b/resources/content_server/browse/browse.css @@ -355,6 +355,25 @@ h2.library_name { color: red; } +#booklist > #pagelist { display: none; } + +#goto_page_dialog ul { + list-style-type: none; + font-size: medium; +} + +#goto_page_dialog li { + margin-bottom: 1.5ex; +} + +#goto_page_dialog a { + text-decoration: none; + color: blue; +} + +#goto_page_dialog a:hover { + color: red; +} #booklist .left .ui-button-text { font-size: medium; diff --git a/resources/content_server/browse/browse.html b/resources/content_server/browse/browse.html index 6d4c79c4c9..de78e432d7 100644 --- a/resources/content_server/browse/browse.html +++ b/resources/content_server/browse/browse.html @@ -96,5 +96,6 @@
+
diff --git a/resources/content_server/browse/browse.js b/resources/content_server/browse/browse.js index e0585a9afd..2d9bc01082 100644 --- a/resources/content_server/browse/browse.js +++ b/resources/content_server/browse/browse.js @@ -202,6 +202,23 @@ function previous_page() { else last_page(); } +function gp_internal(id) { + var gp = $('#goto_page_dialog'); + gp.dialog('close'); + var elem = $("#booklist #" + id); + load_page(elem); +} + +function goto_page() { + var gp = $('#goto_page_dialog'); + var pl = $('#booklist > #pagelist'); + gp.html(pl.html()); + gp.dialog('option', 'title', pl.attr('title')); + gp.dialog('option', 'height', $(window).height() - 100); + gp.dialog('open'); + +} + function load_page(elem) { if (elem.is(":visible")) return; var ld = elem.find('.load_data'); @@ -251,6 +268,12 @@ function booklist(hide_sort) { modal: true, show: 'slide' }); + $("#goto_page_dialog").dialog({ + autoOpen: false, + modal: true, + show: 'slide' + }); + first_page(); } diff --git a/resources/recipes/irish_times.recipe b/resources/recipes/irish_times.recipe index 14f31cf45f..0ac130ed7a 100644 --- a/resources/recipes/irish_times.recipe +++ b/resources/recipes/irish_times.recipe @@ -13,7 +13,6 @@ class IrishTimes(BasicNewsRecipe): language = 'en_IE' timefmt = ' (%A, %B %d, %Y)' - oldest_article = 3 no_stylesheets = True simultaneous_downloads= 1 @@ -35,12 +34,11 @@ class IrishTimes(BasicNewsRecipe): def print_version(self, url): if url.count('rss.feedsportal.com'): - u = 'http://www.irishtimes.com' + \ - (((url[69:].replace('0C','/')).replace('0A','0'))).replace('0Bhtml/story01..htm','_pf.html') + u = 'http://www.irishtimes.com' + \ + (((url[69:].replace('0C','/')).replace('0A','0'))).replace('0Bhtml/story01.htm','_pf.html') else: u = url.replace('.html','_pf.html') return u - def get_article_url(self, article): return article.link diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index 952559a9e2..17f6eb9f46 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -241,9 +241,12 @@ class EPUBOutput(OutputFormatPlugin): self.log.debug('Encrypting font:', uri) with open(path, 'r+b') as f: data = f.read(1024) - f.seek(0) - for i in range(1024): - f.write(chr(ord(data[i]) ^ key[i%16])) + if len(data) >= 1024: + f.seek(0) + for i in range(1024): + f.write(chr(ord(data[i]) ^ key[i%16])) + else: + self.log.warn('Font', path, 'is invalid, ignoring') if not isinstance(uri, unicode): uri = uri.decode('utf-8') fonts.append(u''' diff --git a/src/calibre/ebooks/snb/snbfile.py b/src/calibre/ebooks/snb/snbfile.py index ed5aa45c08..e42533f241 100644 --- a/src/calibre/ebooks/snb/snbfile.py +++ b/src/calibre/ebooks/snb/snbfile.py @@ -118,8 +118,8 @@ class SNBFile: return False if self.rev80 != SNBFile.REV80: return False - if self.revA3 != SNBFile.REVA3: - return False +# if self.revA3 != SNBFile.REVA3: +# return False if self.revZ1 != SNBFile.REVZ1: return False if self.revZ2 != SNBFile.REVZ2: diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index c6177ed882..fd42bfe671 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -315,6 +315,9 @@ class ToolBar(QToolBar): # {{{ self.child_bar.addWidget(self.spacers[1]) if gprefs['show_child_bar']: self.addWidget(self.spacers[3]) + else: + for s in self.spacers[2:]: + s.setVisible(False) def setup_tool_button(self, ac, menu_mode=None): ch = self.widgetForAction(ac) diff --git a/src/calibre/library/comments.py b/src/calibre/library/comments.py index 83eec89abe..00a6ef55ae 100644 --- a/src/calibre/library/comments.py +++ b/src/calibre/library/comments.py @@ -131,7 +131,8 @@ def comments_to_html(comments): def sanitize_comments_html(html): text = html2text(html) md = markdown.Markdown(safe_mode=True) - return md.convert(text) + cleansed = re.sub('\n+', '', md.convert(text)) + return cleansed def test(): for pat, val in [ diff --git a/src/calibre/library/server/base.py b/src/calibre/library/server/base.py index 29636c5659..711fcf03d8 100644 --- a/src/calibre/library/server/base.py +++ b/src/calibre/library/server/base.py @@ -147,7 +147,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache, self.config['/'] = { 'tools.digest_auth.on' : True, 'tools.digest_auth.realm' : ( - _('Password to access your calibre library. Username is ') + 'Password to access your calibre library. Username is ' + opts.username.strip()), 'tools.digest_auth.users' : {opts.username.strip():opts.password.strip()}, } diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index 5609416273..db5c83689b 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -43,18 +43,33 @@ def render_book_list(ids, prefix, suffix=''): # {{{
''' - rpages = [] + pagelist_template = u'''\ +
+ +
+ ''' + rpages, lpages = [], [] for i, x in enumerate(pages): pg, pos = x ld = xml(json.dumps(pg), True) + start, end = pos+1, pos+len(pg) rpages.append(page_template.format(i, ld, xml(_('Loading, please wait')) + '…', - start=pos+1, end=pos+len(pg), prefix=prefix)) + start=start, end=end, prefix=prefix)) + lpages.append(' '*20 + (u'
  • ' + '{start} to {end}
  • ').format(start=start, end=end, + id='page%d'%i)) rpages = u'\n\n'.join(rpages) + lpages = u'\n'.join(lpages) + pagelist = pagelist_template.format(pages=lpages) templ = u'''\

    {0} {suffix}

    +
    {pagelist}
    {navbar}
    @@ -64,24 +79,31 @@ def render_book_list(ids, prefix, suffix=''): # {{{
    ''' - + gp_start = gp_end = '' + if len(pages) > 1: + gp_start = '' % \ + (_('Go to') + '…') + gp_end = '' navbar = u'''\ '''.format(first=_('First'), last=_('Last'), previous=_('Previous'), - next=_('Next'), num=num) + next=_('Next'), num=num, gp_start=gp_start, gp_end=gp_end) return templ.format(_('Browsing %d books')%num, suffix=suffix, - pages=rpages, navbar=navbar) + pages=rpages, navbar=navbar, pagelist=pagelist, + goto=xml(_('Go to'), True) + '…') # }}}