Skip to content

Commit

Permalink
Merge pull request MALSync#1094 from NatsuDzn/bentomanga
Browse files Browse the repository at this point in the history
[TASK] Add Bentomanga
  • Loading branch information
lolamtisch authored Apr 26, 2022
2 parents 6df3221 + 3907c10 commit d066aa9
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 4 deletions.
100 changes: 100 additions & 0 deletions src/pages/Bentomanga/main.ts
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;
},
);
},
};
6 changes: 6 additions & 0 deletions src/pages/Bentomanga/meta.json
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/*"]
}
}
33 changes: 33 additions & 0 deletions src/pages/Bentomanga/style.less
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;
}
30 changes: 30 additions & 0 deletions src/pages/Bentomanga/tests.json
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
}
}
]
}
9 changes: 5 additions & 4 deletions src/pages/Japanread/tests.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"title": "Japanread",
"url": "https://www.japanread.cc/",
"testCases": [{
"testCases": [
{
"url": "https://www.japanread.cc/manga/oshi-no-ko",
"expected": {
"sync": false,
"title": "Oshi no Ko",
"identifier": "oshi-no-ko",
"uiSelector": true,
"epList": {
"32": "https://www.japanread.cc/manga/oshi-no-ko/32",
"46": "https://www.japanread.cc/manga/oshi-no-ko/46"
"77": "https://www.japanread.cc/manga/oshi-no-ko/77",
"65": "https://www.japanread.cc/manga/oshi-no-ko/65"
}
}
},
Expand All @@ -27,4 +28,4 @@
}
}
]
}
}
2 changes: 2 additions & 0 deletions src/pages/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import { MangaHub } from './MangaHub/main';
import { ComicK } from './ComicK/main';
import { AnimeShitai } from './AnimeShitai/main';
import { Japanread } from './Japanread/main';
import { Bentomanga } from './Bentomanga/main';
import { MangaSushi } from './MangaSushi/main';
import { ArangScans } from './ArangScans/main';
import { HunlightScans } from './HunlightScans/main';
Expand Down Expand Up @@ -247,6 +248,7 @@ export const pages = {
ComicK,
AnimeShitai,
Japanread,
Bentomanga,
MangaSushi,
ArangScans,
HunlightScans,
Expand Down

0 comments on commit d066aa9

Please sign in to comment.