-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
New Page AnimesOnline #2392
New Page AnimesOnline #2392
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { pageInterface } from '../pageInterface'; | ||
|
||
let originalSrc; | ||
const changeSrc = (currentPlayer, currentTries = 0) => { | ||
const tempSrc = $(`#tab-${currentPlayer} video`).attr('src'); | ||
|
||
if (tempSrc === undefined) { | ||
if (currentTries >= 100) { | ||
alert('MAL-SYNC: Cant find target src video, please refresh the page and try again!'); | ||
return; | ||
} | ||
|
||
setTimeout(() => { | ||
currentTries++; | ||
changeSrc(currentPlayer, currentTries); | ||
}, 50); | ||
return; | ||
} | ||
|
||
$('.player.current').removeClass('current'); | ||
$('#tab-1').addClass('current'); | ||
|
||
$($('video')[0]).attr('src', currentPlayer === 1 ? originalSrc : tempSrc ?? originalSrc); | ||
}; | ||
|
||
export const AnimesOnline: pageInterface = { | ||
name: 'Animes Online', | ||
domain: 'animesonline.in', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||
languages: ['Portuguese'], | ||
type: 'anime', | ||
isSyncPage(url) { | ||
return utils.urlPart(url, 3).startsWith('video'); | ||
}, | ||
isOverviewPage(url) { | ||
return ['anime', 'animes-dublado'].includes(utils.urlPart(url, 3)); | ||
}, | ||
sync: { | ||
getTitle(url) { | ||
return j.$(j.$('.breadcrumb li')[2]).text().replace('- Dublado', '').trim(); | ||
}, | ||
getIdentifier(url) { | ||
return j.$(j.$('.breadcrumb li')[2]).text().trim().replace('- Dublado', ''); | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicated code. One could just call |
||
getOverviewUrl(url) { | ||
return j.$(j.$('.breadcrumb li')[2]).find('a').attr('href') ?? ''; | ||
}, | ||
getEpisode(url) { | ||
return Number(j.$(j.$('.breadcrumb li')[3]).text().split('ep')[1].trim()); | ||
}, | ||
nextEpUrl(url) { | ||
return j.$(j.$('.playerbox .controls a')[2]).attr('href'); | ||
}, | ||
}, | ||
overview: { | ||
getTitle(url) { | ||
return j.$(j.$('.breadcrumb li')[2]).text().replace('- Dublado', '').trim(); | ||
}, | ||
getIdentifier(url) { | ||
return j.$(j.$('.breadcrumb li')[2]).text().replace('- Dublado', '').trim(); | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More duplicated code. You can just call the functions of the sync section |
||
uiSelector(selector) { | ||
j.$('.banner-infos > .info:last-child').after( | ||
j.html(`<div title="MalSync">${j.html(selector)}</div>`), | ||
); | ||
}, | ||
list: { | ||
offsetHandler: false, | ||
elementsSelector() { | ||
return j.$('.episode-card'); | ||
}, | ||
elementUrl(selector) { | ||
return utils.absoluteLink( | ||
j.$(selector.find('a').first()).attr('href'), | ||
AnimesOnline.domain, | ||
); | ||
}, | ||
elementEp(selector) { | ||
return Number(selector.find('.card-title span').text().split('EP')[1].trim()); | ||
}, | ||
}, | ||
}, | ||
init(page) { | ||
j.$(document).ready(function () { | ||
api.storage.addStyle( | ||
require('!to-string-loader!css-loader!less-loader!./style.less').toString(), | ||
); | ||
|
||
originalSrc = $($('.player video')[0]).attr('src'); | ||
|
||
page.handlePage(); | ||
|
||
$('.player-option a').on('click', function () { | ||
const currentPlayer = Number($(this).parent().data('tab').split('-')[1]); | ||
|
||
// required to make a first click so it thinks that the player is setup and playing | ||
$('video')[0].click(); | ||
// @ts-ignore | ||
$('video')[0].pause(); | ||
|
||
setTimeout(() => { | ||
changeSrc(currentPlayer); | ||
}, 500); | ||
}); | ||
}); | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"search": "https://www.animesonline.in/busca?s={searchtermPlus}", | ||
"urls": { | ||
"match": ["*://*.animesonline.in/*"] | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@import './../pages'; | ||
|
||
#malp { | ||
margin-top: 10px; | ||
} | ||
|
||
#MalData { | ||
flex-direction: column; | ||
} | ||
|
||
#malStatus, | ||
#malTotal, | ||
#malEpisodes, | ||
#malUserRating, | ||
#malRating, | ||
#malVolumes, | ||
#malTotalVol, | ||
#malTotalCha, | ||
#AddMal { | ||
color: #fff; | ||
font-weight: 400; | ||
} | ||
|
||
// Fix spacing | ||
.MalLogin:last-child span::after { | ||
content: ' '; | ||
} | ||
|
||
article.episode-card.mal-sync-active::before { | ||
content: 'MAL-SYNC'; | ||
display: inline-block; | ||
position: absolute; | ||
right: 0; | ||
z-index: 1; | ||
background: #002966; | ||
padding: 5px 10px; | ||
border-radius: 0 3px; | ||
} | ||
|
||
.malp-group { | ||
display: flex !important; | ||
margin-top: 4px; | ||
} | ||
|
||
.malp-group-label { | ||
padding-top: 0 !important; | ||
color: #2ecc71; | ||
} | ||
|
||
.open-info-popup.floatbutton > i { | ||
filter: invert(1); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"title": "AnimesOnline", | ||
"url": "https://www.animesonline.in/", | ||
"testCases": [ | ||
{ | ||
"url": "https://www.animesonline.in/anime/398a5cebfadb2606fbf802b42aad57755b4eae55", | ||
"expected": { | ||
"sync": false, | ||
"title": "One Piece", | ||
"identifier": "One Piece", | ||
"uiSelector": true, | ||
"epList": { | ||
"1": "https://www.animesonline.in/video/346066", | ||
"10": "https://www.animesonline.in/video/346030", | ||
"17": "https://www.animesonline.in/video/346054" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "https://www.animesonline.in/video/346066", | ||
"expected": { | ||
"sync": true, | ||
"title": "One Piece", | ||
"identifier": "One Piece", | ||
"episode": 1, | ||
"overviewUrl": "https://www.animesonline.in/anime/398a5cebfadb2606fbf802b42aad57755b4eae55", | ||
"nextEpUrl": "https://www.animesonline.in/video/346078" | ||
} | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alerts are a bit hard. Please use