-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Animeworld.tv (#1182)
* Add Animeworld page support * Add Animeworld player url * Add Animeworld support * Add Animeworld to supported pages * Run linting tool * Updated css for Animeworld.tv * Fix in Animeworld.tv Fix global require warning and Unexpected unnamed function warning * Updated tests for Animeworld.tv * Changed getEpisode selector * Implemented getMalUrl * Reverted back to master * getMalUrl always return mal url if available * Fix getMalUrl misunderstanding getMalUrl always return mal url if available else checks the requested provider * Fixed page match url * Added 9anime-like active episode overview * Fixed small bug when changing episode * disable hex rule * fix some things in animeworld * narrow selector * enable test * fix overviewurl * fix test Co-authored-by: Henrik <22085664+henrik9999@users.noreply.github.com>
- Loading branch information
1 parent
6c290b7
commit 1f0728e
Showing
7 changed files
with
150 additions
and
1 deletion.
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
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,92 @@ | ||
import { pageInterface } from '../pageInterface'; | ||
|
||
export const Animeworld: pageInterface = { | ||
name: 'Animeworld', | ||
domain: 'https://www.animeworld.tv', | ||
languages: ['Italian'], | ||
type: 'anime', | ||
isSyncPage(url) { | ||
if (url.split('/')[4] !== undefined && url.split('/')[4].length) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
sync: { | ||
getTitle(url) { | ||
return j.$('#anime-title').text().trim(); | ||
}, | ||
getIdentifier(url) { | ||
return utils.urlPart(url, 4); | ||
}, | ||
getOverviewUrl(url) { | ||
return utils.absoluteLink( | ||
j.$('div.server:not([style*="display: none"]) a[href*="/play"]').first().attr('href'), | ||
Animeworld.domain, | ||
); | ||
}, | ||
getMalUrl(provider) { | ||
const malUrl = j.$('#mal-button').attr('href'); | ||
if (malUrl) { | ||
return malUrl; | ||
} | ||
|
||
if (provider === 'ANILIST') { | ||
return j.$('#anilist-button').attr('href') || false; | ||
} | ||
|
||
return false; | ||
}, | ||
getEpisode(url) { | ||
return parseInt( | ||
j.$('div.server a[href*="/play"].active').first().attr('data-episode-num') || '1', | ||
); | ||
}, | ||
uiSelector(selector) { | ||
j.$('div.widget.player') | ||
.first() | ||
.after( | ||
j.html( | ||
`<div id="mal-sync-ui-selector" class="widget crop text-center">${selector}</div>`, | ||
), | ||
); | ||
}, | ||
}, | ||
overview: { | ||
getTitle(url) { | ||
return ''; | ||
}, | ||
getIdentifier(url) { | ||
return ''; | ||
}, | ||
uiSelector(selector) { | ||
// no ui | ||
}, | ||
list: { | ||
offsetHandler: false, | ||
elementsSelector() { | ||
return j.$('div.server a[href*="/play"]'); | ||
}, | ||
elementUrl(selector) { | ||
return utils.absoluteLink(selector.attr('href'), Animeworld.domain); | ||
}, | ||
elementEp(selector) { | ||
return Number(selector.attr('data-episode-num')); | ||
}, | ||
}, | ||
}, | ||
init(page) { | ||
api.storage.addStyle( | ||
// eslint-disable-next-line global-require | ||
require('!to-string-loader!css-loader!less-loader!./style.less').toString(), | ||
); | ||
utils.fullUrlChangeDetect(() => { | ||
page.reset(); | ||
j.$('#mal-sync-ui-selector').remove(); | ||
if (document.title.includes('Pagina non trovata')) { | ||
con.error('404'); | ||
return; | ||
} | ||
page.handlePage(); | ||
}); | ||
}, | ||
}; |
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,5 @@ | ||
{ | ||
"urls": { | ||
"match": ["*://*.animeworld.tv/play/*"] | ||
} | ||
} |
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,28 @@ | ||
@import './../pages'; | ||
|
||
@activeEp: #002966 !important; | ||
|
||
.mal-sync-active { | ||
color: #ffffff !important; | ||
} | ||
|
||
#malp { | ||
padding: 0% 2%; | ||
margin: 1%; | ||
} | ||
|
||
#malp * { | ||
color: black; | ||
select option { | ||
color: black; | ||
background-color: white; | ||
} | ||
} | ||
|
||
body.dark #malp * { | ||
color: white; | ||
select option { | ||
color: white; | ||
background-color: black; | ||
} | ||
} |
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,17 @@ | ||
{ | ||
"title": "animeworld", | ||
"url": "https://www.animeworld.tv/", | ||
"testCases": [ | ||
{ | ||
"url": "https://www.animeworld.tv/play/otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH/htfv9X", | ||
"expected": { | ||
"sync": true, | ||
"title": "Otome Game Sekai wa Mob ni Kibishii Sekai desu", | ||
"identifier": "otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH", | ||
"overviewUrl": "https://www.animeworld.tv/play/otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH/htfv9X", | ||
"episode": 1, | ||
"uiSelector": true | ||
} | ||
} | ||
] | ||
} |
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