Crunchyroll-Downloader-v3.0/CRD-addon/inject.js
hama3254 6e665140e4 3.4 update
- added a http webserver and made a Firefox addon to control the downloader
 (the server need to be activated in the settings)
 basic example : https://www.youtube.com/watch?v=AzgNzCrXfpo (works also for funimation)

-rewritten the funimation name methods and added subfolder support
-fixed issues with funimation subtitels
2020-08-16 23:27:48 +02:00

35 lines
1.4 KiB
JavaScript

var episodeCount = document.getElementsByClassName("episode").length;
var i;
for (i = 0; i < episodeCount; i++) {
document.getElementsByClassName("episode")[i].setAttribute('href', "javascript:" + document.getElementsByClassName("episode")[i].href);
document.getElementsByClassName("episode")[i].setAttribute('onclick', 'deselect(this.id)')
//document.getElementsByClassName("episode")[i].style.background = "#f78c25";
document.getElementsByClassName("episode")[i].setAttribute('id', makeid(8))
//document.getElementsByClassName("episode")[i].classList.add('CRD-Selected')
}
function deselect(clicked_id) {
var seleceted = document.getElementById(clicked_id).classList.contains('CRD-Selected')
if (seleceted == true) {
document.getElementById(clicked_id).classList.remove('CRD-Selected')
document.getElementById(clicked_id).style.background = "#ffffff";
} else {
document.getElementById(clicked_id).classList.add('CRD-Selected')
document.getElementById(clicked_id).style.background = "#f78c25";
}
}
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}