Greasy Fork is available in English.

讨论 » 创建请求

Sricpt for read mails

§
发表于:2021-02-21

Hey I need your help.
I want to create a script that will run with Tampermonkey addon.
It should confirm a button after login on the corresponding website, click a link after redirection and make a timeout of 90sec. Then close 2 tabs and start from the beginning.

How do I start? I have no experience

§
发表于:2021-02-21

Start sharing the website here, and the website html
start here https://www.w3schools.com/js/DEFAULT.asp

// @grant window.close

§
发表于:2021-02-23
编辑于:2021-02-23

The site is called ebesucher.de

The links to open all start the same "http://www.ebesucher.de/?link=showmail&"

once the link is opened should run in timer of 100sec, then the following link should be opened, "https://www.ebesucher.de/mailcheck.php?" again a timeout of 100sec and close the tab once. and refresh the site

and repeat

Sorry I am new and beginner

§
发表于:2021-02-23

You just want to open all the links that start start with "http://www.ebesucher.de/?link=showmail&"
Then open after 100 secs "https://www.ebesucher.de/mailcheck.php?"
Then close "https://www.ebesucher.de/mailcheck.php?" after 100 secs
Then close "https://www.ebesucher.de/mailcheck.php?" (so that your browser tabs will return to the website ebesucher.de)
Is that all?

§
发表于:2021-02-24
编辑于:2021-02-24

yes i think it is very simple.

I start on ebesucher.de/mailviewer
Then open a mail with the link http://www.ebesucher.de/?link=showmail&***userid****
Timeout 100seconds
Then open link in the mail https://www.ebesucher.de/mailcheck.php?***userid*****
Timeout 100 seconds
Both tabs close I'm back on the "ebesucher.de/mailviewer" again
after 90 seconds the script should start again and open the next mail and repeat everything.

The read mails are automatically hidden at Ebesucher.

§
发表于:2021-02-24

This is kind of what you want and will need to do, learn from it and make it the way you want...

// ==UserScript==
// @name Auto open and close unread emails on ebesucher.de
// @namespace ebesucher.de
// @version 0.1
// @description Autp Open All Unread emails on ebesucher.de
// @author hacker09
// @match https://www.ebesucher.de/mailviewer/*
// @match https://www.ebesucher.de/mailcheck.php?*
// @run-at document-end
// @grant window.close
// ==/UserScript==

(function() {
'use strict';
if(location.pathname.match('showmail') !== null) { //Starts the if condition only if the actual opened tab is the http://www.ebesucher.de/?link=showmail&***userid****
setTimeout(function(){ //Start running the codes below after the timeout...

// Add here the codes to open a mail with the link http://www.ebesucher.de/?link=showmail&***userid****
//The code will look similar to document.querySelector("#comment-186972 > div.user-content").click()
//you must select the correct element, google "how to select an element with the browser devtools" and you may find the answer

window.top.close(); //Close the actual tab
}, 3000); //After 3 seconds (3000 milliseconds)
} //Finishes the if condition

if(location.pathname.match('mailcheck') !== null) { //Starts the if condition only if the actual opened tab is the https://www.ebesucher.de/mailcheck.php?
setTimeout(function(){ //Start running the codes below after the timeout...

// Add here the codes to open "https://www.ebesucher.de/mailcheck.php?"
//The code will look similar to document.querySelector("#comment-186972 > div.user-content").click()
//you must select the correct element, google "how to select an element with the browser devtools" and you may find the answer

window.top.close(); //Close the actual tab
}, 3000); //After 3 seconds (3000 milliseconds)
} //Finishes the if condition
})();

§
发表于:2021-02-26

I can't find a button because it seems that an image has been created as a button and this is then clickable.
now I have tried to implement this with a "window.open" but despite the correct link I get the message "the link is old" from the operator of the website

§
发表于:2021-02-26

If it's a button,image, text or whatever, you can get the element id/class/etc anyways...
google "how to select an element with the browser devtools" and you may find the answer

I forgot to add the "window.open", but because I don't know what's the element link I couldn't implement it anyways...

Try opening the link manually, if it works when you manually open the link it means that you are probably coding something wrong

§
发表于:2021-02-28

thanks for your help and the first codes
i have the script now as i wanted it to be

§
发表于:2021-02-28

// ==UserScript==
// @name Mailcheck eBesucher
// @namespace ebesucher.de
// @version 0.1
// @description Autp Open All Unread emails on ebesucher.de
// @author hacker09
// @match https://www.ebesucher.de/mailviewer
// @match https://www.ebesucher.de/showmail*
// @match https://www.ebesucher.de/mailcheck*
// @run-at document-end
// @grant window.close
// ==/UserScript==

(function() {
'use strict';
if(location.pathname.match('mailviewer') !== null) { //Starts the if condition only if the actual opened tab is the http://www.ebesucher.de/mailviewer
setTimeout(function(){ //Start running the codes below after the timeout...

var link=Array.from(document.querySelectorAll("a[href]")).filter(v=>v.href.indexOf("uid=105585616")>=0)[0];
if(link){
window.open(link.href);
}
}, 3000); //3s (3000 millisekunden)
setTimeout(function(){
window.location.reload(1);
}, 120000);
}


if(location.pathname.match('showmail') !== null) { //Starts the if condition only if the actual opened tab is the https://www.ebesucher.de/showmail.php?
setTimeout(function(){ //Start running the codes below after the timeout...

var link=Array.from(document.querySelectorAll("a[href]")).filter(v=>v.href.indexOf("mailcheck.php?")>=0)[0];
if(link){
window.open(link.href);
}


window.top.close(); //Close the actual tab
}, 20000); //After 10 seconds (10000 milliseconds)
} //Finishes the if condition
if(location.pathname.match('mailcheck') !== null) { //Starts the if condition only if the actual opened tab is the http://www.ebesucher.de/mailcheck
setTimeout(function(){ //Start running the codes below after the timeout...


window.top.close(); //Close the actual tab
}, 60000); //After 60 seconds (60000 milliseconds)
} //Finishes the if condition




})();

发表回复

登录以发表回复。