mirror of
https://github.com/hama3254/Crunchyroll-Downloader-v3.0.git
synced 2024-11-13 03:35:05 +01:00
add-on improvments
-chrome add-on fully functional -add-on status added
This commit is contained in:
parent
e60637c66c
commit
1c309ef781
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -15,26 +15,27 @@ chrome.tabs.query({
|
||||
|
||||
chrome.tabs.executeScript(null, {
|
||||
//code: 'document.getElementsByClassName("episode")[0].href;'
|
||||
code: 'document.getElementsByClassName("episode").length;'
|
||||
code: 'document.getElementsByClassName("episode").length;'
|
||||
},
|
||||
function (results) {
|
||||
|
||||
if (results > 0 )
|
||||
{
|
||||
onExecuted(results);
|
||||
} else {
|
||||
onError("error")
|
||||
if (results > 0) {
|
||||
|
||||
onExecuted(results);
|
||||
} else {
|
||||
onError("error")
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else if (tab.url.includes('funimation.com')) {
|
||||
chrome.tabs.executeScript(null, {
|
||||
code: 'document.getElementsByClassName("trackVideo")[0].href'
|
||||
//code: 'document.getElementsByClassName("trackVideo")[0].href'
|
||||
code: 'document.getElementsByClassName("trackVideo").length;'
|
||||
},
|
||||
function (results) {
|
||||
|
||||
if (results !== null) {
|
||||
if (results > 0) {
|
||||
FunimationSuccess(results);
|
||||
|
||||
} else {
|
||||
@ -152,10 +153,10 @@ document.getElementById('btn_add').addEventListener('click', () => {
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById("btn_add").style.background = "#ff8000"
|
||||
}, 4000);
|
||||
}, 10000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("btn_add").disabled = false;
|
||||
}, 4000);
|
||||
}, 10000);
|
||||
|
||||
} else {
|
||||
add_one_error(results);
|
||||
@ -173,7 +174,10 @@ document.getElementById('btn_add_funimation').addEventListener('click', () => {
|
||||
currentWindow: true
|
||||
},
|
||||
function (tabs) {
|
||||
console.log(tabs.length);
|
||||
document.getElementById("btn_add_funimation").disabled = true;
|
||||
document.getElementById("btn_add_funimation").style.background = "#c9c9c9"
|
||||
|
||||
console.log(tabs.length);
|
||||
let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
|
||||
console.log(tab.url);
|
||||
const form = document.createElement('form');
|
||||
@ -188,6 +192,12 @@ document.getElementById('btn_add_funimation').addEventListener('click', () => {
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
setTimeout(function () {
|
||||
document.getElementById("btn_add_funimation").style.background = "#ff8000"
|
||||
}, 10000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("btn_add_funimation").disabled = false;
|
||||
}, 10000);
|
||||
});
|
||||
});
|
||||
|
||||
@ -231,28 +241,32 @@ document.getElementById('btn_add_mass').addEventListener('click', () => {
|
||||
});
|
||||
|
||||
function onExecuted(result) {
|
||||
console.log(result[0]);
|
||||
chrome.tabs.executeScript(null, {
|
||||
code: "document.getElementsByClassName('episode')[0].href.includes('javascript:');"
|
||||
},
|
||||
function (result) {
|
||||
//alert(result);
|
||||
if (result == 'true') {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = false;
|
||||
document.getElementById("btn_select_all").hidden = false;
|
||||
document.getElementById("btn_select_none").hidden = false;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
console.log(true);
|
||||
} else {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_enable_select").hidden = false;
|
||||
document.getElementById("btn_add_mass").hidden = true;
|
||||
document.getElementById("btn_select_all").hidden = true;
|
||||
document.getElementById("btn_select_none").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
console.log(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (result[0].includes('javascript:')) {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = false;
|
||||
document.getElementById("btn_select_all").hidden = false;
|
||||
document.getElementById("btn_select_none").hidden = false;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
console.log(true);
|
||||
} else {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_enable_select").hidden = false;
|
||||
document.getElementById("btn_add_mass").hidden = true;
|
||||
document.getElementById("btn_select_all").hidden = true;
|
||||
document.getElementById("btn_select_none").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
|
||||
console.log(false);
|
||||
}
|
||||
}
|
||||
|
||||
function onError(error) {
|
||||
@ -296,29 +310,32 @@ document.getElementById('btn_enable_funimation_select').addEventListener('click'
|
||||
});
|
||||
|
||||
function FunimationSuccess(result) {
|
||||
console.log(result[0]);
|
||||
chrome.tabs.executeScript(null, {
|
||||
code: "document.getElementsByClassName('trackVideo')[0].href.includes('javascript:');"
|
||||
},
|
||||
function (result) {
|
||||
if (result == 'true') {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = false;
|
||||
document.getElementById("btn_select_all").hidden = false;
|
||||
document.getElementById("btn_select_none").hidden = false;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
|
||||
if (result[0].includes('javascript:')) {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = false;
|
||||
document.getElementById("btn_select_all").hidden = false;
|
||||
document.getElementById("btn_select_none").hidden = false;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
console.log(true);
|
||||
} else {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = true;
|
||||
document.getElementById("btn_select_all").hidden = true;
|
||||
document.getElementById("btn_select_none").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = false;
|
||||
|
||||
document.getElementById("btn_enable_funimation_select").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
console.log(true);
|
||||
} else {
|
||||
document.getElementById("btn_add").hidden = true;
|
||||
document.getElementById("btn_add_funimation").hidden = true;
|
||||
document.getElementById("btn_enable_select").hidden = true;
|
||||
document.getElementById("btn_add_mass").hidden = true;
|
||||
document.getElementById("btn_select_all").hidden = true;
|
||||
document.getElementById("btn_select_none").hidden = true;
|
||||
document.getElementById("btn_enable_funimation_select").hidden = false;
|
||||
|
||||
console.log(false);
|
||||
}
|
||||
console.log(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function FunimationError(error) {
|
||||
|
@ -182,6 +182,7 @@ Public Class GeckoFX
|
||||
t.Start()
|
||||
|
||||
Else
|
||||
Main.StatusMainForm.Text = "Status: no video found"
|
||||
Anime_Add.StatusLabel.Text = "fail?"
|
||||
End If
|
||||
End If
|
||||
|
@ -1398,6 +1398,12 @@ Public Class Main
|
||||
|
||||
Dim Pfad5 As String = Pfad2.Replace(Chr(34), "")
|
||||
If My.Computer.FileSystem.FileExists(Pfad5) Then 'Pfad = Kompeltter Pfad mit Dateinamen + ENdung
|
||||
Me.Invoke(New Action(Function()
|
||||
|
||||
Anime_Add.StatusLabel.Text = "Status: The file video already exists."
|
||||
StatusMainForm.Text = "Status: The file video already exists."
|
||||
Return Nothing
|
||||
End Function))
|
||||
If MessageBox.Show("The file " + Pfad5 + " already exists." + vbNewLine + "You want to override it?", "File exists!", MessageBoxButtons.OKCancel) = DialogResult.OK Then
|
||||
Try
|
||||
My.Computer.FileSystem.DeleteFile(Pfad5)
|
||||
@ -2583,10 +2589,7 @@ Public Class Main
|
||||
|
||||
If InStr(htmlReq, "HTMLSingle=") Then
|
||||
Debug.WriteLine("Single episode mode - Crunchyroll")
|
||||
Me.Invoke(New Action(Function()
|
||||
StatusMainForm.Text = "Status: Download added from plugin"
|
||||
Return Nothing
|
||||
End Function))
|
||||
|
||||
Try
|
||||
Dim html() As String = htmlReq.Split(New String() {"HTMLSingle="}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim DecodedHTML As String = UrlDecode(html(1))
|
||||
@ -2598,25 +2601,41 @@ Public Class Main
|
||||
Dim TitleSplit() As String = DecodedHTML.Split(New String() {"<title>"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
Dim TitleSplit2() As String = TitleSplit(1).Split(New String() {"</title>"}, System.StringSplitOptions.RemoveEmptyEntries)
|
||||
WebbrowserTitle = TitleSplit2(0)
|
||||
If Grapp_RDY = True Then
|
||||
Dim t As Thread
|
||||
t = New Thread(AddressOf GrappURL)
|
||||
t.Priority = ThreadPriority.Normal
|
||||
t.IsBackground = True
|
||||
t.Start()
|
||||
Else
|
||||
If Application.OpenForms().OfType(Of Anime_Add).Any = True Then
|
||||
Me.Invoke(New Action(Function()
|
||||
Anime_Add.ListBox1.Items.Add(WebbrowserURL)
|
||||
Return Nothing
|
||||
End Function))
|
||||
|
||||
If CBool(InStr(WebbrowserText, "hardsub_lang")) Then
|
||||
Me.Invoke(New Action(Function()
|
||||
StatusMainForm.Text = "Status: Download added from add-on"
|
||||
Return Nothing
|
||||
End Function))
|
||||
If Grapp_RDY = True Then
|
||||
Dim t As Thread
|
||||
t = New Thread(AddressOf GrappURL)
|
||||
t.Priority = ThreadPriority.Normal
|
||||
t.IsBackground = True
|
||||
t.Start()
|
||||
Else
|
||||
ListBoxList.Add(WebbrowserURL)
|
||||
If Application.OpenForms().OfType(Of Anime_Add).Any = True Then
|
||||
Me.Invoke(New Action(Function()
|
||||
Anime_Add.ListBox1.Items.Add(WebbrowserURL)
|
||||
Return Nothing
|
||||
End Function))
|
||||
|
||||
Else
|
||||
ListBoxList.Add(WebbrowserURL)
|
||||
End If
|
||||
End If
|
||||
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
|
||||
sendHTMLResponse(strRequest, clientSocket)
|
||||
Else
|
||||
Me.Invoke(New Action(Function()
|
||||
StatusMainForm.Text = "Status: no video found"
|
||||
Return Nothing
|
||||
End Function))
|
||||
Dim ErrorPage As String = My.Resources.Post_error_Top + "no video found" + My.Resources.Post_error_Bottom
|
||||
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
|
||||
strRequest = rootPath & "error_Page.html" 'PostPage
|
||||
sendHTMLResponse(strRequest, clientSocket)
|
||||
End If
|
||||
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
|
||||
sendHTMLResponse(strRequest, clientSocket)
|
||||
|
||||
Catch ex As Exception
|
||||
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
|
||||
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
|
||||
@ -2666,7 +2685,7 @@ Public Class Main
|
||||
Debug.WriteLine("single episode mode - Funimation")
|
||||
'Debug.WriteLine(htmlReq)
|
||||
Me.Invoke(New Action(Function()
|
||||
StatusMainForm.Text = "Status: Download added from plugin"
|
||||
StatusMainForm.Text = "Status: Download added from add-on"
|
||||
Return Nothing
|
||||
End Function))
|
||||
Try
|
||||
@ -2694,6 +2713,10 @@ Public Class Main
|
||||
|
||||
Else
|
||||
ListBoxList.Add(WebbrowserURL)
|
||||
Me.Invoke(New Action(Function()
|
||||
StatusMainForm.Text = "Status: " + ListBoxList.Count.ToString + " Downloads in queue"
|
||||
Return Nothing
|
||||
End Function))
|
||||
End If
|
||||
End If
|
||||
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
|
||||
|
@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("3.5.3")>
|
||||
<Assembly: AssemblyFileVersion("3.5.3")>
|
||||
<Assembly: AssemblyVersion("3.5.4")>
|
||||
<Assembly: AssemblyFileVersion("3.5.4")>
|
||||
<Assembly: NeutralResourcesLanguage("en")>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<style>
|
||||
body {
|
||||
@ -42,7 +42,7 @@
|
||||
<i class="checkmark">✘</i>
|
||||
</div>
|
||||
<h1>Failed!</h1>
|
||||
<p></p>
|
||||
<p>no video found</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -27,7 +27,7 @@
|
||||
.liClass{margin-bottom:8px}
|
||||
</style>
|
||||
<body id="bodypage" class="main-bg" >
|
||||
<a class="main_titel">Crunchyroll Downloader</a>
|
||||
<a class="main_titel">Status: no video found</a>
|
||||
<img alt="image error" src="balken.png" class="class-balken">
|
||||
|
||||
<script>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user