add-on improvments

-chrome add-on fully functional
-add-on status added
This commit is contained in:
hama3254 2020-10-15 13:49:06 +02:00
parent e60637c66c
commit 1c309ef781
15 changed files with 120 additions and 79 deletions

Binary file not shown.

View File

@ -19,8 +19,8 @@ chrome.tabs.query({
}, },
function (results) { function (results) {
if (results > 0 ) if (results > 0) {
{
onExecuted(results); onExecuted(results);
} else { } else {
onError("error") onError("error")
@ -30,11 +30,12 @@ chrome.tabs.query({
} else if (tab.url.includes('funimation.com')) { } else if (tab.url.includes('funimation.com')) {
chrome.tabs.executeScript(null, { chrome.tabs.executeScript(null, {
code: 'document.getElementsByClassName("trackVideo")[0].href' //code: 'document.getElementsByClassName("trackVideo")[0].href'
code: 'document.getElementsByClassName("trackVideo").length;'
}, },
function (results) { function (results) {
if (results !== null) { if (results > 0) {
FunimationSuccess(results); FunimationSuccess(results);
} else { } else {
@ -152,10 +153,10 @@ document.getElementById('btn_add').addEventListener('click', () => {
setTimeout(function () { setTimeout(function () {
document.getElementById("btn_add").style.background = "#ff8000" document.getElementById("btn_add").style.background = "#ff8000"
}, 4000); }, 10000);
setTimeout(function () { setTimeout(function () {
document.getElementById("btn_add").disabled = false; document.getElementById("btn_add").disabled = false;
}, 4000); }, 10000);
} else { } else {
add_one_error(results); add_one_error(results);
@ -173,6 +174,9 @@ document.getElementById('btn_add_funimation').addEventListener('click', () => {
currentWindow: true currentWindow: true
}, },
function (tabs) { function (tabs) {
document.getElementById("btn_add_funimation").disabled = true;
document.getElementById("btn_add_funimation").style.background = "#c9c9c9"
console.log(tabs.length); console.log(tabs.length);
let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
console.log(tab.url); console.log(tab.url);
@ -188,6 +192,12 @@ document.getElementById('btn_add_funimation').addEventListener('click', () => {
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
setTimeout(function () {
document.getElementById("btn_add_funimation").style.background = "#ff8000"
}, 10000);
setTimeout(function () {
document.getElementById("btn_add_funimation").disabled = false;
}, 10000);
}); });
}); });
@ -231,9 +241,12 @@ document.getElementById('btn_add_mass').addEventListener('click', () => {
}); });
function onExecuted(result) { function onExecuted(result) {
console.log(result[0]); chrome.tabs.executeScript(null, {
code: "document.getElementsByClassName('episode')[0].href.includes('javascript:');"
if (result[0].includes('javascript:')) { },
function (result) {
//alert(result);
if (result == 'true') {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
document.getElementById("btn_add_mass").hidden = false; document.getElementById("btn_add_mass").hidden = false;
document.getElementById("btn_select_all").hidden = false; document.getElementById("btn_select_all").hidden = false;
@ -250,9 +263,10 @@ function onExecuted(result) {
document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_select_none").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
console.log(false); console.log(false);
} }
});
} }
function onError(error) { function onError(error) {
@ -296,9 +310,11 @@ document.getElementById('btn_enable_funimation_select').addEventListener('click'
}); });
function FunimationSuccess(result) { function FunimationSuccess(result) {
console.log(result[0]); chrome.tabs.executeScript(null, {
code: "document.getElementsByClassName('trackVideo')[0].href.includes('javascript:');"
if (result[0].includes('javascript:')) { },
function (result) {
if (result == 'true') {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
document.getElementById("btn_add_mass").hidden = false; document.getElementById("btn_add_mass").hidden = false;
document.getElementById("btn_select_all").hidden = false; document.getElementById("btn_select_all").hidden = false;
@ -319,6 +335,7 @@ function FunimationSuccess(result) {
console.log(false); console.log(false);
} }
});
} }
function FunimationError(error) { function FunimationError(error) {

View File

@ -182,6 +182,7 @@ Public Class GeckoFX
t.Start() t.Start()
Else Else
Main.StatusMainForm.Text = "Status: no video found"
Anime_Add.StatusLabel.Text = "fail?" Anime_Add.StatusLabel.Text = "fail?"
End If End If
End If End If

View File

@ -1398,6 +1398,12 @@ Public Class Main
Dim Pfad5 As String = Pfad2.Replace(Chr(34), "") Dim Pfad5 As String = Pfad2.Replace(Chr(34), "")
If My.Computer.FileSystem.FileExists(Pfad5) Then 'Pfad = Kompeltter Pfad mit Dateinamen + ENdung 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 If MessageBox.Show("The file " + Pfad5 + " already exists." + vbNewLine + "You want to override it?", "File exists!", MessageBoxButtons.OKCancel) = DialogResult.OK Then
Try Try
My.Computer.FileSystem.DeleteFile(Pfad5) My.Computer.FileSystem.DeleteFile(Pfad5)
@ -2583,10 +2589,7 @@ Public Class Main
If InStr(htmlReq, "HTMLSingle=") Then If InStr(htmlReq, "HTMLSingle=") Then
Debug.WriteLine("Single episode mode - Crunchyroll") Debug.WriteLine("Single episode mode - Crunchyroll")
Me.Invoke(New Action(Function()
StatusMainForm.Text = "Status: Download added from plugin"
Return Nothing
End Function))
Try Try
Dim html() As String = htmlReq.Split(New String() {"HTMLSingle="}, System.StringSplitOptions.RemoveEmptyEntries) Dim html() As String = htmlReq.Split(New String() {"HTMLSingle="}, System.StringSplitOptions.RemoveEmptyEntries)
Dim DecodedHTML As String = UrlDecode(html(1)) Dim DecodedHTML As String = UrlDecode(html(1))
@ -2598,6 +2601,11 @@ Public Class Main
Dim TitleSplit() As String = DecodedHTML.Split(New String() {"<title>"}, System.StringSplitOptions.RemoveEmptyEntries) 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) Dim TitleSplit2() As String = TitleSplit(1).Split(New String() {"</title>"}, System.StringSplitOptions.RemoveEmptyEntries)
WebbrowserTitle = TitleSplit2(0) WebbrowserTitle = TitleSplit2(0)
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 If Grapp_RDY = True Then
Dim t As Thread Dim t As Thread
t = New Thread(AddressOf GrappURL) t = New Thread(AddressOf GrappURL)
@ -2617,6 +2625,17 @@ Public Class Main
End If End If
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) 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
Catch ex As Exception Catch ex As Exception
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom 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) 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("single episode mode - Funimation")
'Debug.WriteLine(htmlReq) 'Debug.WriteLine(htmlReq)
Me.Invoke(New Action(Function() Me.Invoke(New Action(Function()
StatusMainForm.Text = "Status: Download added from plugin" StatusMainForm.Text = "Status: Download added from add-on"
Return Nothing Return Nothing
End Function)) End Function))
Try Try
@ -2694,6 +2713,10 @@ Public Class Main
Else Else
ListBoxList.Add(WebbrowserURL) 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
End If End If
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage

View File

@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.5.3")> <Assembly: AssemblyVersion("3.5.4")>
<Assembly: AssemblyFileVersion("3.5.3")> <Assembly: AssemblyFileVersion("3.5.4")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@ -42,7 +42,7 @@
<i class="checkmark"></i> <i class="checkmark"></i>
</div> </div>
<h1>Failed!</h1> <h1>Failed!</h1>
<p></p> <p>no video found</p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -27,7 +27,7 @@
.liClass{margin-bottom:8px} .liClass{margin-bottom:8px}
</style> </style>
<body id="bodypage" class="main-bg" > <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"> <img alt="image error" src="balken.png" class="class-balken">
<script> <script>