您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Позволяет быстро закрывать подразделения без дополнительных окон
当前为
// ==UserScript== // @name Virtonomica: Unit List v3.0 // @description Позволяет быстро закрывать подразделения без дополнительных окон // @namespace virtonomica // @version 3.0 // @include http://*virtonomic*.*/*/main/company/view/*/unit_list // ==/UserScript== var run = function() { var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window); $ = win.$; var el = $("a[href*='main/unit/view']").parent().each( function() { href = $("a", this).attr('href'); if ( href.search("manufacture") != -1 ) { href1 = href; href1 = href1.replace("main/unit/view","window/technology_market/ask/by_unit"); href1 = href1.replace("manufacture","offer/set"); href = href.replace("manufacture",""); // $(this).append("<a href="+href+"supply><img width=16 height=16 alt='Supply' src='/img/unit_types/warehouse.gif'/><a href="+href1+ " onclick='return doWindow(this, 800, 500);'><img width=16 height=16 alt='Tech' src='/img/icon/invention.gif'/>"); } else { if ( href.search("trading_hall") != -1 ) { href = href.replace("trading_hall","supply"); // $(this).append("<a href="+href+ "><img width=16 height=16 alt='Supply' src='/img/unit_types/warehouse.gif'/>"); } else { if ( href.search("investigation") != -1 ) { href = href.replace("main","window"); href = href.replace("investigation","project_create"); // $(this).append("<a href="+href+ " onclick='return doWindow(this, 800, 320);'><b>New!</b>"); } else { href1 = href.replace("main/unit/view","window/unit/changename"); href2 = href.replace("main/unit/view","window/unit/market/sale"); href3 = href.replace("main/unit/view","window/unit/close"); // $(this).append("<a href="+href1+ " onclick='return doWindow(this, 800, 320);'><img width=16 height=16 alt='Change name' src='/img/units/edit.gif'/>"); $(this).append("<a href="+href2+ " onclick='return doWindow(this, 650, 400);'><img width=16 height=16 alt='Sell' src='/img/common/coin_black.gif'/></a>"); $(this).append("<a href="+href3+ " onclick='return doWindow(this, 800, 360);'><img width=16 height=16 alt='Close' src='/img/del.gif'/></a>"); var delBtn = $('<a href="#">Закрыть быстро</a>'); delBtn.click(function() { if(!confirm('Закрыть предприятие')) return false; var svPostUrl = $(this).parent().children().first().attr('href').replace("main/unit/view","window/unit/close"); var row = $(this).parent().parent(); var data = {}; data['close_unit'] = 'Закрыть предприятие'; //console.log("data = " + JSON.stringify(data)); //console.log("svPostUrl = " + svPostUrl); $.post( svPostUrl, data ) .done(function() { //console.log( "success" ); row.hide(); //window.location = window.location.href; }) .fail(function() { console.log( "error" ); }); //$.post( href3, { close_unit: "Закрыть предприятие" } ); //return false; }); $(this).append(delBtn); } } } }); } var script = document.createElement("script"); script.textContent = '(' + run.toString() + ')();'; document.documentElement.appendChild(script);