您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Обновление главного окна после закрытия дочернего
// ==UserScript== // @name Virtonomica: Обновление главного окна после закрытия дочернего // @namespace virtonomica // @include http*://*virtonomic*.*/*/main/unit/view/* // @include http*://*virtonomic*.*/*/window/unit/supply/create/*/step2 // @include http*://*virtonomic*.*/*/window/unit/equipment/* // @description Обновление главного окна после закрытия дочернего // @version 1.7 // ==/UserScript== var run = function() { var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window); $ = win.$; function getVal(spName){ return JSON.parse(window.localStorage.getItem(spName)); } function setVal(spName, pValue){ window.localStorage.setItem(spName, JSON.stringify(pValue)); } var _popup = null; var popup_changed = 0; function waitfor(msec, count) { // Check if condition met. If not, re-check later (msec). console.log("popup_opened = " + (_popup !== null && !_popup.closed)); while (_popup !== null && !_popup.closed) { count++; if(popup_changed != 1){ popup_changed = getVal('popup_changed'); } setTimeout(function() { waitfor(msec, count); }, msec); return; } _popup = null; // Condition finally met. callback() can be executed. console.log("count = " + count); if(popup_changed == 1){ window.location.reload(); } } if (/\/\w+\/window\/unit\/supply\/create\/\d+\/step2/.test(window.location) || /\/\w+\/window\/unit\/equipment\/\d+/.test(window.location)) { $('#submitLink').click(function(){ setVal('popup_changed', 1); }); $('#buy_button').click(function(){ setVal('popup_changed', 1); }); $('#repair_button').click(function(){ setVal('popup_changed', 1); }); $('#terminateLink').click(function(){ setVal('popup_changed', 1); }); } else { $('a[onclick*="doWindow(this"]').unbind().click(function(){ var matches = $(this).attr('onclick').match(/doWindow\(this[^\d]+['"]?(\d+)['"]?,\s*['"]?(\d+)['"]?\)/); var url = $(this).attr('href'); setVal('popup_changed', 0); popup_changed = 0; _popup = popup(url, matches[1], matches[2]); if (/\/\w+\/window\/unit\/supply\/create\/\d+\/step1\/\d+/.test(url) || /\/\w+\/window\/unit\/equipment\/\d+/.test(url)) { waitfor(100, 0, 0); } else { _popup = null; } }); } }; if(window.top == window) { var script = document.createElement("script"); script.textContent = '(' + run.toString() + ')();'; document.documentElement.appendChild(script); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址