#1
|
|||
|
|||
Button trigger several event scripts, skip restrictions name
LogId:
07.08.24 15.17.14 <--> 07.08.24 15.28.56 jdlog://3764411370661/ Problem: I implemented two Event Scripts, each one should be executed by an "EventScripter Trigger" button. In the Code of the Event Script I validate that the Name of the button corresponds to the one I want to execute the Script. However, I noticed that both scripts are executed, regardless of which button I click on. Code:
if (name = "Links") { var links = ""; for (var i = 0; i < getAllDownloadLinks().length; i++) { var package = getAllDownloadLinks()[i]; links = links + package.getName() + ":" + package.getContentURL() + "\r"; } alert(links) } Code:
if (name = "Favorites") { var favorites = ["mega.nz", "streamtape.com", "gofile.io", "send.cm"]; function getFavoriteIndex(domain) { for (var i = 0; i < favorites.length; i++) { if (favorites[i] === domain) { return i; } } return -1; } for (var i = 0; i < getAllCrawledPackages().length; i++) { var best = -1; var package = getAllCrawledPackages()[i]; for (var j = 0; j < package.getDownloadLinks().length; j++) { var link = package.getDownloadLinks()[j]; var domain = link.getContentURL().split('/')[2]; var favorite = getFavoriteIndex(domain); if (favorite >= 0 && (best == -1 || best > favorite)) { best = favorite; } } for (var j = 0; j < package.getDownloadLinks().length; j++) { var link = package.getDownloadLinks()[j]; var domain = link.getContentURL().split('/')[2]; link.setEnabled(best == -1 || favorites[best] == domain); if (best > -1) { link.setPriority("HIGHEST"); } } } } Last edited by Jiaz; 07.08.2024 at 22:25. |
Thread Tools | |
Display Modes | |
|
|