Closes the newly opened tabs when clicked from another tab
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/457406/1133635/Tool%201%20for%20Traffic%20Exchange%20-%20Everve.js
// ==UserScript==
// @name Tool 1 for Traffic Exchange - Everve
// @namespace Close new tabs
// @version 1.1
// @description Closes the newly opened tabs when clicked from another tab
// @author Saputra
// @match *://*/*
// @run-at document-start
// @grant GM_xmlhttpRequest
// @grant window.close
// ==/UserScript==
//Stopping Alert and confirm window
unsafeWindow.alert= function(){};
unsafeWindow.confirm = function(){};
(function() {
'use strict';
//Close by window Name for everve
setTimeout(function(){
if(window.self == top && (window.name == "EvervepopUpWindow")){
window.close();
}
},40000)
//If the url is stopped in shortlinks, move to previous url after 120 seconds
if(window.self == top && window.name.includes("https://")){
setTimeout(function(){
let url = window.name;
if(!url.includes(window.location.hostname)){
window.name = "nextWindowUrl";
window.location.href = url;
}
},120000)
}
//The timeout set is 120 seconds, you can change this accordingly
if(window.self == top && window.history.length == 1){
setTimeout(function(){
window.close();
},120000);
}
})();