mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-04-26 00:43:08 +02:00
Add remove_spoilers & legend_spoilers options to royalroadl.com for Issue #287
This commit is contained in:
parent
620f512d02
commit
37156e8a6c
4 changed files with 54 additions and 4 deletions
|
|
@ -1873,6 +1873,19 @@ cover_exclusion_regexp:(imgur.com/dzOACJf.png|/forum/images/smilies/)
|
|||
## Clear FanFiction from defaults, site has fanfictions and original fiction.
|
||||
extratags:
|
||||
|
||||
## royalroadl.com stories sometimes have 'spoiler' blocks in
|
||||
## posts. When viewed in a browser, the block is hidden until a button
|
||||
## is clicked. eBook viewers can't handle that and the javascript is
|
||||
## disabled. The remove_spoilers option, if uncommented, will remove
|
||||
## spoiler blocks entirely.
|
||||
#remove_spoilers:true
|
||||
|
||||
## This option if uncommented, will put a box around the spoiler
|
||||
## blocks with the original spoiler button text as a label using
|
||||
## fieldset and legend HTML tags. For a simple box, see the
|
||||
## add_to_output_css example for [base_xenforoforum:epub].
|
||||
#legend_spoilers:true
|
||||
|
||||
[samandjack.net]
|
||||
## Some sites require login (or login for some rated stories) The
|
||||
## program can prompt you, or you can save it in config. In
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2011 Fanficdownloader team, 2017 FanFicFare team
|
||||
# Copyright 2011 Fanficdownloader team, 2018 FanFicFare team
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -103,6 +103,30 @@ class RoyalRoadAdapter(BaseSiteAdapter):
|
|||
'''
|
||||
return True
|
||||
|
||||
def make_soup(self,data):
|
||||
soup = super(RoyalRoadAdapter, self).make_soup(data)
|
||||
self.handle_spoilers(soup)
|
||||
return soup
|
||||
|
||||
def handle_spoilers(self,topsoup):
|
||||
'''
|
||||
Modifies tag given as required to do spoiler changes.
|
||||
'''
|
||||
if self.getConfig('remove_spoilers'):
|
||||
for div in topsoup.find_all('div',class_='spoiler'):
|
||||
div.extract()
|
||||
elif self.getConfig('legend_spoilers'):
|
||||
for div in topsoup.find_all('div',class_='spoiler'):
|
||||
div.name='fieldset'
|
||||
legend = topsoup.new_tag('legend')
|
||||
smalltext = div.find('div',class_='smalltext')
|
||||
legend.string = stripHTML(smalltext)
|
||||
smalltext.extract()
|
||||
div.insert(0,legend)
|
||||
for inner in div.find_all('div',class_='spoiler-inner'):
|
||||
del inner['style']
|
||||
#div.button.extract()
|
||||
|
||||
## Getting the chapter list and the meta data, plus 'is adult' checking.
|
||||
def extractChapterUrlsAndMetadata(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2015 Fanficdownloader team, 2017 FanFicFare team
|
||||
# Copyright 2015 Fanficdownloader team, 2018 FanFicFare team
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -247,8 +247,8 @@ def get_valid_set_options():
|
|||
'always_use_forumtags':(base_xenforo_list,None,boollist),
|
||||
'use_reader_mode':(base_xenforo_list,None,boollist),
|
||||
'author_avatar_cover':(base_xenforo_list,None,boollist),
|
||||
'remove_spoilers':(base_xenforo_list,None,boollist),
|
||||
'legend_spoilers':(base_xenforo_list,None,boollist),
|
||||
'remove_spoilers':(base_xenforo_list+['royalroadl.com'],None,boollist),
|
||||
'legend_spoilers':(base_xenforo_list+['royalroadl.com'],None,boollist),
|
||||
'apocrypha_to_omake':(base_xenforo_list,None,boollist),
|
||||
'replace_failed_smilies_with_alt_text':(base_xenforo_list,None,boollist),
|
||||
'fix_pseudo_html': (['webnovel.com'], None, boollist),
|
||||
|
|
|
|||
|
|
@ -1907,6 +1907,19 @@ cover_exclusion_regexp:(imgur.com/dzOACJf.png|/forum/images/smilies/)
|
|||
## Clear FanFiction from defaults, site has fanfictions and original fiction.
|
||||
extratags:
|
||||
|
||||
## royalroadl.com stories sometimes have 'spoiler' blocks in
|
||||
## posts. When viewed in a browser, the block is hidden until a button
|
||||
## is clicked. eBook viewers can't handle that and the javascript is
|
||||
## disabled. The remove_spoilers option, if uncommented, will remove
|
||||
## spoiler blocks entirely.
|
||||
#remove_spoilers:true
|
||||
|
||||
## This option if uncommented, will put a box around the spoiler
|
||||
## blocks with the original spoiler button text as a label using
|
||||
## fieldset and legend HTML tags. For a simple box, see the
|
||||
## add_to_output_css example for [base_xenforoforum:epub].
|
||||
#legend_spoilers:true
|
||||
|
||||
[samandjack.net]
|
||||
## Some sites require login (or login for some rated stories) The
|
||||
## program can prompt you, or you can save it in config. In
|
||||
|
|
|
|||
Loading…
Reference in a new issue