討論 » 建立請求

IM SO BAD AT CODING HELP ME BABY JESUS

§
發表於:2022-10-15

i am clueless. I want a 10 seconds pause before it closes the tab. but i dont know how to pause or make it wait or whatever. i read some stuff on a promise or something but i didnt understand. i know absolutely nothing about how to do that. i read something about awake timers or promises. idk. i am lost. can someone please tell me how i can add a wait command of 10 seconds into this script, BEFORE it closes the page. and please please dont just type the answer part, please insert it into the entire piece where it should be bc i wont know what to do with the fragment lol. im legit so unknowledgeable on this topic.

// ==UserScript==

// @include *megaup.net/*.rar
// @include *download.megaup.net/?idurl=*
// @icon https://icons.duckduckgo.com/ip2/megaup.net.ico
// @run-at document-end
// @grant window.close
// ==/UserScript==
if(location.href.search(/download\.megaup\.net\/\?idurl/gi)>-1){
document.title="✔️"+document.title
setTimeout(()=>{window.close(document.URL)},5000)
}else{
document.title="⏳"+document.title
setTimeout(()=>{document.querySelector('[value="Create Download Link"]').click()},6000)
}

§
發表於:2022-10-16

There are already was 5 seconds delay before closing a tab. So you need a 15 maybe? This is 15:

// ==UserScript==
// @include   *megaup.net/*.rar
// @include   *download.megaup.net/?idurl=*
// @icon      https://icons.duckduckgo.com/ip2/megaup.net.ico
// @run-at    document-end
// @grant     window.close
// ==/UserScript==

if (location.href.search(/download\.megaup\.net\/\?idurl/gi) > -1) {
  document.title = "✔️" + document.title;
  setTimeout(() => window.close(document.URL), 15000);
} else {
  document.title = "⏳" + document.title;
  setTimeout(() => document.querySelector('[value="Create Download Link"]').click(), 6000);
}

發表回覆

登入以回復