From 1e12cfeb744de198c51d0dc5d4f72a8b669b3b30 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Jan 2010 23:16:30 -0700 Subject: [PATCH] Fix #4606 (Viewer crash on MOBI files created from PDB) --- resources/recipes/globe_and_mail.recipe | 2 +- src/calibre/gui2/viewer/documentview.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/recipes/globe_and_mail.recipe b/resources/recipes/globe_and_mail.recipe index 71d6b2b304..0ef8bd9dd8 100644 --- a/resources/recipes/globe_and_mail.recipe +++ b/resources/recipes/globe_and_mail.recipe @@ -32,7 +32,7 @@ class GlobeAndMail(BasicNewsRecipe): 'gallery-controls', 'video', 'galleryLoading','deck','header', 'toolsBottom'] }, {'class':['credit','inline-img-caption','tab-pointer'] }, - dict(name='div', attrs={'id':'lead-photo'}), + dict(name='div', attrs={'id':['lead-photo', 'most-popular-story']}), dict(name='div', attrs={'class':'right'}), dict(name='div', attrs={'id':'footer'}), dict(name='div', attrs={'id':'beta-msg'}), diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 790b1c4f2f..aedd709bb8 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -350,7 +350,13 @@ class Document(QWebPage): return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results def set_bottom_padding(self, amount): - self.javascript('$("body").css("padding-bottom", "%dpx")' % amount) + padding = '%dpx'%amount + try: + old_padding = unicode(self.javascript('$("body").css("padding-bottom")').toString()) + except: + old_padding = '' + if old_padding != padding: + self.javascript('$("body").css("padding-bottom", "%s")' % padding) class EntityDeclarationProcessor(object):