forked from MALSync/MALSync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request MALSync#1094 from NatsuDzn/bentomanga
[TASK] Add Bentomanga
- Loading branch information
Showing
6 changed files
with
176 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { pageInterface } from '../pageInterface'; | ||
|
||
export const Bentomanga: pageInterface = { | ||
name: 'Bentomanga', | ||
domain: 'https://www.bentomanga.com', | ||
languages: ['French'], | ||
type: 'manga', | ||
isSyncPage(url) { | ||
return typeof url.split('/')[5] !== 'undefined' && url.split('/')[5].length > 0; | ||
}, | ||
sync: { | ||
getTitle() { | ||
return j.$('.reader-controls-title > div > a').text().trim(); | ||
}, | ||
getIdentifier(url) { | ||
return utils.urlPart(url, 4); | ||
}, | ||
getOverviewUrl() { | ||
return utils.absoluteLink( | ||
j.$('.reader-controls-title > div > a').attr('href'), | ||
Bentomanga.domain, | ||
); | ||
}, | ||
getEpisode(url) { | ||
return parseInt(utils.urlPart(url, 6)); | ||
}, | ||
getVolume() { | ||
const currentChapter = j.$('#jump-chapter option:selected'); | ||
if (currentChapter.length) { | ||
let temp = currentChapter | ||
.text() | ||
.trim() | ||
.match(/(vol\.|volume)\D?\d+/i); | ||
if (temp !== null) { | ||
temp = temp[0].match(/\d+/); | ||
if (temp !== null) { | ||
return parseInt(temp[0]); | ||
} | ||
} | ||
} | ||
return 0; | ||
}, | ||
}, | ||
overview: { | ||
getTitle() { | ||
return j.$('.component-manga-title_main > h1').text().trim(); | ||
}, | ||
getIdentifier(url) { | ||
return utils.urlPart(url, 4); | ||
}, | ||
uiSelector(selector) { | ||
j.$('.datas').after( | ||
j.html( | ||
`<div class="datas"><h3 class="datas_header">MAL-Sync</h3><div>${selector}</div></div>`, | ||
), | ||
); | ||
}, | ||
list: { | ||
offsetHandler: false, | ||
elementsSelector() { | ||
return j.$('[data-chapter]'); | ||
}, | ||
elementUrl(selector) { | ||
return utils.absoluteLink(selector.find('a.text-truncate').attr('href'), Bentomanga.domain); | ||
}, | ||
elementEp(selector) { | ||
return Bentomanga.sync.getEpisode(Bentomanga.overview!.list!.elementUrl!(selector)); | ||
}, | ||
}, | ||
}, | ||
init(page) { | ||
api.storage.addStyle( | ||
require('!to-string-loader!css-loader!less-loader!./style.less').toString(), | ||
); | ||
j.$(document).ready(function () { | ||
if (page.url.split('/')[3] === 'manga' && typeof page.url.split('/')[4] !== 'undefined') { | ||
con.info('Waiting'); | ||
utils.waitUntilTrue( | ||
() => { | ||
return ( | ||
j.$('#jump-chapter option:selected').text() !== '' || j.$('.div-chapters').length | ||
); | ||
}, | ||
() => { | ||
con.info('Start'); | ||
page.handlePage(); | ||
}, | ||
); | ||
} | ||
}); | ||
utils.changeDetect( | ||
() => { | ||
page.handleList(); | ||
}, | ||
() => { | ||
return j.$('[data-chapter]').length; | ||
}, | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"search": "https://www.bentomanga.com/manga_list?search={searchterm}", | ||
"urls": { | ||
"match": ["*://www.bentomanga.com/*", "*://bentomanga.com/*"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@import './../pages'; | ||
|
||
#malp { | ||
* { | ||
color: white; | ||
} | ||
} | ||
|
||
@media only screen and (max-width: 850px) { | ||
#malp { | ||
.MalLogin { | ||
width: 100%; | ||
} | ||
} | ||
} | ||
|
||
#MalData { | ||
select option { | ||
background-color: #192229 !important; | ||
} | ||
} | ||
|
||
.mal-sync-active { | ||
background-color: #80b133 !important; | ||
|
||
* { | ||
color: white !important; | ||
} | ||
} | ||
|
||
.flash { | ||
background-color: transparent !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"title": "Bentomanga", | ||
"url": "https://www.bentomanga.com/", | ||
"testCases": [ | ||
{ | ||
"url": "https://www.bentomanga.com/manga/ao-no-hako", | ||
"expected": { | ||
"sync": false, | ||
"title": "Ao no hako", | ||
"identifier": "ao-no-hako", | ||
"uiSelector": true, | ||
"epList": { | ||
"43": "https://bentomanga.com/manga/ao-no-hako/chapter/43", | ||
"46": "https://bentomanga.com/manga/ao-no-hako/chapter/46" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "https://www.bentomanga.com/manga/ao-no-hako/chapter/45", | ||
"expected": { | ||
"sync": true, | ||
"title": "Ao no hako", | ||
"identifier": "ao-no-hako", | ||
"overviewUrl": "https://www.bentomanga.com/manga/ao-no-hako", | ||
"episode": 45, | ||
"uiSelector": false | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters