Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funmanga.com support #136

Open
blindbox opened this issue Aug 11, 2019 · 0 comments
Open

Funmanga.com support #136

blindbox opened this issue Aug 11, 2019 · 0 comments

Comments

@blindbox
Copy link

blindbox commented Aug 11, 2019

Hey guys, I've added funmanga support.

If I have the time to figure out how to add it directly into the code, and make sure it's compatible with older browers, I'll create a pull request, but for now, here's the export (path of least resistance 😄 )

	{
		url:	'funmanga.com/',
		img:	[['#chapter_img']],
		back:	function(html, pos){
				const parser = new DOMParser();
				
				const doc = parser.parseFromString(html, "text/html");
				
				const currentPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option[selected="selected"]')[0].value
				
				const firstPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const firstLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const currentChapter = parseInt(currentPageLink.split('/')[4])
				
				const firstChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:last-child")[0].value.split('/')[4])
				
				const lastChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:first-child")[0].value.split('/')[4])
				
				const currentPage = parseInt(currentPageLink.split('/')[5])
				
				const lastPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:last-child')[0].value
				
				const isFirstPage = currentPageLink === firstPageLink
				
				const isLastPage = currentPageLink === lastPageLink
				
				
				const nextChapter = isLastPage ? currentChapter + 1 : currentChapter
				
				const nextPage = isLastPage ? 1 : currentPage + 1
				
				const prevPage = isFirstPage ? 1 : currentPage - 1
				
				const isFirstChapter = firstChapter === currentChapter
				
				const prevChapter = isFirstPage && !isFirstChapter ? currentChapter - 1 : currentChapter
				
				const seriesSlug = currentPageLink.split('/')[3]
				
				const nextPageLink = '/' + seriesSlug + '/' + nextChapter + '/' + nextPage
				
				const prevPageLink = '/' + seriesSlug + '/' + prevChapter + '/' + prevPage
				return prevPageLink
				},
		next:	function(html, pos){
				const parser = new DOMParser();
				
				const doc = parser.parseFromString(html, "text/html");
				
				const currentPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option[selected="selected"]')[0].value
				
				const firstPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const firstLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const currentChapter = parseInt(currentPageLink.split('/')[4])
				
				const firstChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:last-child")[0].value.split('/')[4])
				
				const lastChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:first-child")[0].value.split('/')[4])
				
				const currentPage = parseInt(currentPageLink.split('/')[5])
				
				const lastPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:last-child')[0].value
				
				const isFirstPage = currentPageLink === firstPageLink
				
				const isLastPage = currentPageLink === lastPageLink
				
				
				const nextChapter = isLastPage ? currentChapter + 1 : currentChapter
				
				const nextPage = isLastPage ? 1 : currentPage + 1
				
				const prevPage = isFirstPage ? 1 : currentPage - 1
				
				const isFirstChapter = firstChapter === currentChapter
				
				const prevChapter = isFirstPage && !isFirstChapter ? currentChapter - 1 : currentChapter
				
				const seriesSlug = currentPageLink.split('/')[3]
				
				const nextPageLink = '/' + seriesSlug + '/' + nextChapter + '/' + nextPage
				
				const prevPageLink = '/' + seriesSlug + '/' + prevChapter + '/' + prevPage
				return nextPageLink
				},
		first:	function(html){
				const parser = new DOMParser();
				
				const doc = parser.parseFromString(html, "text/html");
				
				const currentPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option[selected="selected"]')[0].value
				
				const firstPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const firstLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const currentChapter = parseInt(currentPageLink.split('/')[4])
				
				const firstChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:last-child")[0].value.split('/')[4])
				
				const lastChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:first-child")[0].value.split('/')[4])
				
				const currentPage = parseInt(currentPageLink.split('/')[5])
				
				const lastPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:last-child')[0].value
				
				const isFirstPage = currentPageLink === firstPageLink
				
				const isLastPage = currentPageLink === lastPageLink
				
				
				const nextChapter = isLastPage ? currentChapter + 1 : currentChapter
				
				const nextPage = isLastPage ? 1 : currentPage + 1
				
				const prevPage = isFirstPage ? 1 : currentPage - 1
				
				const isFirstChapter = firstChapter === currentChapter
				
				const prevChapter = isFirstPage && !isFirstChapter ? currentChapter - 1 : currentChapter
				
				const seriesSlug = currentPageLink.split('/')[3]
				
				const nextPageLink = '/' + seriesSlug + '/' + nextChapter + '/' + nextPage
				
				const prevPageLink = '/' + seriesSlug + '/' + prevChapter + '/' + prevPage
				return firstPageLink
				},
		last:	function(html){
				const parser = new DOMParser();
				
				const doc = parser.parseFromString(html, "text/html");
				
				const currentPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option[selected="selected"]')[0].value
				
				const firstPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const firstLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:nth-child(2)')[0].value
				
				const currentChapter = parseInt(currentPageLink.split('/')[4])
				
				const firstChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:last-child")[0].value.split('/')[4])
				
				const lastChapter = parseInt(doc.querySelectorAll(".extra-buttons > select > option:first-child")[0].value.split('/')[4])
				
				const currentPage = parseInt(currentPageLink.split('/')[5])
				
				const lastPageLink = doc.querySelectorAll('.widget-heading select.hidden-xs option:last-child')[0].value
				
				const isFirstPage = currentPageLink === firstPageLink
				
				const isLastPage = currentPageLink === lastPageLink
				
				
				const nextChapter = isLastPage ? currentChapter + 1 : currentChapter
				
				const nextPage = isLastPage ? 1 : currentPage + 1
				
				const prevPage = isFirstPage ? 1 : currentPage - 1
				
				const isFirstChapter = firstChapter === currentChapter
				
				const prevChapter = isFirstPage && !isFirstChapter ? currentChapter - 1 : currentChapter
				
				const seriesSlug = currentPageLink.split('/')[3]
				
				const nextPageLink = '/' + seriesSlug + '/' + nextChapter + '/' + nextPage
				
				const prevPageLink = '/' + seriesSlug + '/' + prevChapter + '/' + prevPage
				return lastPageLink
				},
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant