diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index a1e99c94..669a0ad3 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -956,7 +956,8 @@ use_threadmark_wordcounts:true ## When reveal_invisible_text is set true, adapter will search for ## tags and remove the style -## attribute. +## attribute. Also adds class="invisible_text" for custom CSS +## styling, see invisible_text add_to_output_css example below. #reveal_invisible_text:false [base_xenforoforum:epub] @@ -968,6 +969,16 @@ use_threadmark_wordcounts:true #add_to_output_css: # .bbCodeSpoilerContainer { border: 1px solid black; padding: 2px; } +## When reveal_invisible_text:true, you can style the class +## invisible_text as you like for forum "invisible text". See +## reveal_invisible_text above. This is just one example. Note that +## if you also use the add_to_output_css example above for +## bbCodeSpoilerContainer spoilers, you need to combine the CSS lines +## for both under one add_to_output_css setting, with a space leading +## each CSS line. +#add_to_output_css: +# .invisible_text { color:gray; } + [base_xenforo2forum] ## [base_xenforoforum] also applied, but [base_xenforo2forum] takes ## precedence. diff --git a/fanficfare/adapters/base_xenforoforum_adapter.py b/fanficfare/adapters/base_xenforoforum_adapter.py index ec139020..828c0ed0 100644 --- a/fanficfare/adapters/base_xenforoforum_adapter.py +++ b/fanficfare/adapters/base_xenforoforum_adapter.py @@ -788,9 +788,14 @@ class BaseXenForoForumAdapter(BaseSiteAdapter): def _do_utf8FromSoup(self,url,soup,fetch=None,allow_replace_br_with_p=True): if self.getConfig('reveal_invisible_text'): - ## when set, remove style='color:transparent'. + ## when set, remove style='color:transparent' and add + ## class="invisible_text" for span in soup.find_all('span',style='color:transparent'): del span['style'] + if not span.has_attr('class'): + # give it a class list if it doesn't have one. + span['class']=[] + span['class'].append("invisible_text") if self.getConfig('replace_failed_smilies_with_alt_text'): for img in soup.find_all('img',src=re.compile(r'(^data:image|(failedtoload|clear.png)$)')): # logger.debug("replace_failed_smilies_with_alt_text img: %s"%img) diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index 88659dd9..ac5654e3 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -974,7 +974,8 @@ use_threadmark_wordcounts:true ## When reveal_invisible_text is set true, adapter will search for ## tags and remove the style -## attribute. +## attribute. Also adds class="invisible_text" for custom CSS +## styling, see invisible_text add_to_output_css example below. #reveal_invisible_text:false [base_xenforoforum:epub] @@ -986,6 +987,16 @@ use_threadmark_wordcounts:true #add_to_output_css: # .bbCodeSpoilerContainer { border: 1px solid black; padding: 2px; } +## When reveal_invisible_text:true, you can style the class +## invisible_text as you like for forum "invisible text". See +## reveal_invisible_text above. This is just one example. Note that +## if you also use the add_to_output_css example above for +## bbCodeSpoilerContainer spoilers, you need to combine the CSS lines +## for both under one add_to_output_css setting, with a space leading +## each CSS line. +#add_to_output_css: +# .invisible_text { color:gray; } + [base_xenforo2forum] ## [base_xenforoforum] also applied, but [base_xenforo2forum] takes ## precedence.