Class: Mangdown::Mangafox
Instance Attribute Summary
#root
Instance Method Summary
collapse
#is_chapter?, #is_manga?, #is_page?, #manga_chapters, #manga_list, #type
Constructor Details
#initialize(uri, doc) ⇒ Mangafox
Returns a new instance of Mangafox.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/mangdown/adapter/mangafox.rb', line 5
def initialize(uri, doc)
super
@manga_list_css = 'div.manga_list li a'
@chapter_list_css = 'a.tips'
@root = 'http://mangafox.me'
@manga_list_uri = "#{@root}/manga"
@manga_name_css = "#title h1"
@manga_link_prefix = ''
@reverse_chapters = true
@manga_uri_regex =
/#{@root}\/manga\/[^\/]+?\//i
@chapter_uri_regex =
/#{@manga_uri_regex}(v\d+\/)?(c\d+\/)(1\.html)/i
@page_uri_regex = /.+\.(png|jpg|jpeg)$/i
end
|
Instance Method Details
#build_page_uri(uri, manga, chapter, page_num) ⇒ Object
25
26
27
|
# File 'lib/mangdown/adapter/mangafox.rb', line 25
def build_page_uri(uri, manga, chapter, page_num)
uri.sub(/\d+\.html/, "#{page_num}.html")
end
|
#manga_name ⇒ Object
21
22
23
|
# File 'lib/mangdown/adapter/mangafox.rb', line 21
def manga_name
CGI.unescapeHTML(super.sub(/ Manga/, '').downcase).upcase
end
|
#num_pages ⇒ Object
29
30
31
|
# File 'lib/mangdown/adapter/mangafox.rb', line 29
def num_pages
doc.css('select')[1].css('option').length - 1
end
|
#page_image_name ⇒ Object
37
38
39
40
|
# File 'lib/mangdown/adapter/mangafox.rb', line 37
def page_image_name
doc.css('select')[1].css('option[selected]').first().text
.rjust(3,'0')
end
|
#page_image_src ⇒ Object
33
34
35
|
# File 'lib/mangdown/adapter/mangafox.rb', line 33
def page_image_src
page_image[:src]
end
|