Skip to content

Commit

Permalink
Merge pull request MALSync#1323 from MALSync/voidscans
Browse files Browse the repository at this point in the history
add voidscans
  • Loading branch information
lolamtisch authored Oct 1, 2022
2 parents 725a1d5 + 5b9de7f commit 8e8d71d
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 92 deletions.
181 changes: 95 additions & 86 deletions src/pages/AsuraScans/main.ts
Original file line number Diff line number Diff line change
@@ -1,104 +1,113 @@
import { pageInterface } from '../pageInterface';

export const AsuraScans: pageInterface = {
name: 'AsuraScans',
domain: ['https://asura.gg', 'https://asurascans.com'],
languages: ['English'],
type: 'manga',
isSyncPage(url) {
if (j.$('#readerarea').length) {
return true;
}
return false;
},
isOverviewPage(url) {
return j.$('div.thumbook').length > 0 && j.$('div.bixbox.animefull').length > 0;
},
sync: {
getTitle(url) {
return j.$(j.$('div#content.readercontent div.ts-breadcrumb.bixbox span')[1]).text().trim();
},
getIdentifier(url) {
return AsuraScans.overview!.getIdentifier(AsuraScans.sync.getOverviewUrl(url));
export const AsuraScans: pageInterface = getInter();

export function getInter(): pageInterface {
let thisSelf;
/* eslint-disable-next-line prefer-const */
thisSelf = {
name: 'AsuraScans',
domain: ['https://asura.gg', 'https://asurascans.com'],
languages: ['English'],
type: 'manga',
isSyncPage(url) {
if (j.$('#readerarea').length) {
return true;
}
return false;
},
getOverviewUrl(url) {
return j.$(j.$('div#content.readercontent div.ts-breadcrumb.bixbox a')[1]).attr('href') || '';
isOverviewPage(url) {
return j.$('div.thumbook').length > 0 && j.$('div.bixbox.animefull').length > 0;
},
getEpisode(url) {
const episodePart = j.$('#chapter > option:selected').text();
sync: {
getTitle(url) {
return j.$(j.$('div#content.readercontent div.ts-breadcrumb.bixbox span')[1]).text().trim();
},
getIdentifier(url) {
return AsuraScans.overview!.getIdentifier(AsuraScans.sync.getOverviewUrl(url));
},
getOverviewUrl(url) {
return (
j.$(j.$('div#content.readercontent div.ts-breadcrumb.bixbox a')[1]).attr('href') || ''
);
},
getEpisode(url) {
const episodePart = j.$('#chapter > option:selected').text();

const temp = episodePart.match(/cha?p?t?e?r?\s*(\d+)/i);
const temp = episodePart.match(/cha?p?t?e?r?\s*(\d+)/i);

if (!temp || temp.length < 2) return 1;
if (!temp || temp.length < 2) return 1;

return Number(temp[1]);
},
nextEpUrl(url) {
const next = j.$('a.ch-next-btn').attr('href');
return Number(temp[1]);
},
nextEpUrl(url) {
const next = j.$('a.ch-next-btn').attr('href');

if (next === '#/next/') return undefined;
if (next === '#/next/') return undefined;

return next;
},
},
overview: {
getTitle(url) {
return j.$('h1.entry-title').text().trim();
},
getIdentifier(url) {
return utils.urlPart(url, 4).replace(/^\d+-/gi, '');
},
uiSelector(selector) {
j.$('div.bixbox.animefull')
.first()
.after(j.html(`<div id= "malthing" class="bixbox animefull">${selector}</div>`));
return next;
},
},
list: {
offsetHandler: false,
elementsSelector() {
return j.$('div#chapterlist li div.chbox');
overview: {
getTitle(url) {
return j.$('h1.entry-title').text().trim();
},
getIdentifier(url) {
return utils.urlPart(url, 4).replace(/^\d+-/gi, '');
},
elementUrl(selector) {
return selector.find('a').first().attr('href') || '';
uiSelector(selector) {
j.$('div.bixbox.animefull')
.first()
.after(j.html(`<div id= "malthing" class="bixbox animefull">${selector}</div>`));
},
elementEp(selector) {
const elementEpN = selector.find('span').first().text();
list: {
offsetHandler: false,
elementsSelector() {
return j.$('div#chapterlist li div.chbox');
},
elementUrl(selector) {
return selector.find('a').first().attr('href') || '';
},
elementEp(selector) {
const elementEpN = selector.find('span').first().text();

const temp = elementEpN.match(/chapter \d+/gim);
const temp = elementEpN.match(/chapter \d+/gim);

if (!temp || temp.length === 0) return 0;
if (!temp || temp.length === 0) return 0;

return Number(temp[0].replace(/\D+/g, ''));
return Number(temp[0].replace(/\D+/g, ''));
},
},
},
},
init(page) {
api.storage.addStyle(
require('!to-string-loader!css-loader!less-loader!./style.less').toString(),
);
j.$(document).ready(function () {
if (document.title.includes('Page not found')) {
con.error('404');
return;
}
init(page) {
api.storage.addStyle(
require('!to-string-loader!css-loader!less-loader!./style.less').toString(),
);
j.$(document).ready(function () {
if (document.title.includes('Page not found')) {
con.error('404');
return;
}

if (AsuraScans.isSyncPage(window.location.href)) {
utils.waitUntilTrue(
function () {
if (
j.$('#chapter > option:selected').length &&
j.$('#chapter > option:selected').text() !== 'Select Chapter'
)
return true;
return false;
},
function () {
page.handlePage();
},
);
} else {
page.handlePage();
}
});
},
};
if (AsuraScans.isSyncPage(window.location.href)) {
utils.waitUntilTrue(
function () {
if (
j.$('#chapter > option:selected').length &&
j.$('#chapter > option:selected').text() !== 'Select Chapter'
)
return true;
return false;
},
function () {
page.handlePage();
},
);
} else {
page.handlePage();
}
});
},
};
return thisSelf;
}
12 changes: 6 additions & 6 deletions src/pages/AsuraScans/tests.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"title": "AsuraScans",
"url": "https://asurascans.com/",
"url": "https://asura.gg",
"testCases": [
{
"url": "https://asurascans.com/sss-class-suicide-hunter-chapter-18/",
"url": "https://asura.gg/sss-class-suicide-hunter-chapter-18/",
"expected": {
"sync": true,
"title": "SSS-Class Suicide Hunter",
"identifier": "sss-class-suicide-hunter",
"overviewUrl": "https://asurascans.com/comics/1649969363-sss-class-suicide-hunter/",
"nextEpUrl": "https://asurascans.com/1649969469-sss-class-suicide-hunter-chapter-19/",
"overviewUrl": "https://asura.gg/manga/sss-class-suicide-hunter/",
"nextEpUrl": "https://asura.gg/sss-class-suicide-hunter-chapter-19/",
"episode": 18,
"uiSelector": false
}
},
{
"url": "https://asurascans.com/comics/sss-class-suicide-hunter/",
"url": "https://asura.gg/manga/sss-class-suicide-hunter/",
"expected": {
"sync": false,
"title": "SSS-Class Suicide Hunter",
"identifier": "sss-class-suicide-hunter",
"uiSelector": true,
"epList": {
"25": "https://asurascans.com/sss-class-suicide-hunter-chapter-25/"
"25": "https://asura.gg/sss-class-suicide-hunter-chapter-25/"
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/pages/VoidScans/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { pageInterface } from '../pageInterface';
import { getInter } from '../AsuraScans/main';

const clone = getInter();

clone.name = 'VoidScans';
clone.domain = 'https://void-scans.com';

export const VoidScans: pageInterface = clone;
6 changes: 6 additions & 0 deletions src/pages/VoidScans/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"search": "https://void-scans.com/?s={searchtermPlus}",
"urls": {
"match": ["*://void-scans.com/*"]
}
}
16 changes: 16 additions & 0 deletions src/pages/VoidScans/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import './../pages';

@textColor: #b8b8b8;
@inputBackground: #222;

#malthing {
padding: 10px 15px;
}

#malp {
span span.info {
color: #d9d9d9 !important;
}

margin: 0;
}
31 changes: 31 additions & 0 deletions src/pages/VoidScans/tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"title": "VoidScans",
"url": "https://void-scans.com",
"testCases": [
{
"url": "https://void-scans.com/leveling-up-by-only-eating-chapter-101-chosen/",
"expected": {
"sync": true,
"title": "Leveling Up, by Only Eating!",
"identifier": "leveling-up-by-only-eating",
"overviewUrl": "https://void-scans.com/manga/leveling-up-by-only-eating/",
"nextEpUrl": "https://void-scans.com/leveling-up-by-only-eating-chapter-102-pope/",
"episode": 101,
"uiSelector": false
}
},
{
"url": "https://void-scans.com/manga/leveling-up-by-only-eating/",
"expected": {
"sync": false,
"title": "Leveling Up, by Only Eating!",
"identifier": "leveling-up-by-only-eating",
"uiSelector": true,
"epList": {
"108": "https://void-scans.com/leveling-up-by-only-eating-chapter-108-punk/",
"1": "https://void-scans.com/leveling-up-by-only-eating-chapter-1-ginseng/"
}
}
}
]
}
2 changes: 2 additions & 0 deletions src/pages/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ import { RealmScans } from './RealmScans/main';
import { LuminousScans } from './LuminousScans/main';
import { Animeworld } from './Animeworld/main';
import { MangaBuddy } from './MangaBuddy/main';
import { VoidScans } from './VoidScans/main';

export const pages = {
nineAnime,
Expand Down Expand Up @@ -274,4 +275,5 @@ export const pages = {
LuminousScans,
Animeworld,
MangaBuddy,
VoidScans,
};

0 comments on commit 8e8d71d

Please sign in to comment.