Greasy Fork

Subeta Closing

Makes restocking slightly easier.

当前为 2017-06-16 提交的版本,查看 最新版本

// ==UserScript==
// @name         Subeta Closing
// @description  Makes restocking slightly easier.
// @version      1.1
// @author       Unknown
// @match        *://subeta.net/shop.php?shop*
// @grant        none
// @icon         https://subeta.net/favicon.ico
// @icon64       https://img.subeta.net/items/bottle_apothecary_02.gif
// @namespace https://greasyfork.org/users/133026
// ==/UserScript==
function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}



var content = document.body.textContent || document.body.innerText;
var hasText2 = content.indexOf("Give everyone else a chance")!==-1;
var hasText = content.indexOf("has been added to your inventory")!==-1;
async function close_window() {
  if (hasText || hasText2) {
      await sleep(90);
    close();
  }
}
close_window();

for(i in document.getElementsByTagName('form')) {
	if(document.getElementsByTagName('form')[i].action.indexOf("/shop.php?") != -1) {
		document.getElementsByTagName('form')[i].target = "_blank";
	}
}