Xenforo: Move lazyload img code to all be in one place.

This commit is contained in:
Jim Miller 2019-04-30 15:16:16 -05:00
parent e288691d1c
commit 936a2409b4

View file

@ -220,6 +220,11 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
def make_soup(self,data):
soup = super(BaseXenForoForumAdapter, self).make_soup(data)
## img class="lazyload"
## include lazy load images.
for img in soup.find_all('img',{'class':'lazyload'}):
img['src'] = img['data-src']
## after lazy load images, there are noscript blocks also
## containing <img> tags. The problem comes in when they hit
## book readers such as Kindle and Nook and then you see the
@ -662,11 +667,6 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
for qdiv in postbody.find_all('div',{'class':'quoteExpand'}):
qdiv.extract() # Remove <div class="quoteExpand">click to expand</div>
## img alt="[IMG]" class="bbCodeImage LbImage lazyload
## include lazy load images.
for img in postbody.find_all('img',{'class':'lazyload'}):
img['src'] = img['data-src']
# XenForo uses <base href="https://forums.spacebattles.com/" />
return self.utf8FromSoup(self.getURLPrefix()+'/',postbody)