您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Добавляет фильтр в окно снабжения
当前为
// ==UserScript== // @name Virtonomica: фильтр в окне снабжения // @namespace virtonomica // @version 1.2 // @description Добавляет фильтр в окно снабжения // @include http://*virtonomic*.*/*/window/unit/supply/multiple/vendor:*/product:*/brandname:* // ==/UserScript== var run = function() { var win = (typeof(unsafeWindow) != 'undefined' ? unsafeWindow : top.window); $ = win.$; var filterByCountry = '<option value="0"> </option>'; var filterByRegion = '<option value="0"> </option>'; var filterByTown = '<option value="0"> </option>'; var filterByUnitType = '<option value="0"> </option>'; ///////////////// var countries = new Array(); $('table[class="list"] > tbody > tr > td:nth-child(2) > img').each(function(){ var img = $(this); var country = img.attr('title'); countries[country] = 1; }); for (key in countries) { filterByCountry = filterByCountry + '<option>'+key+'</option>'; } ///////////////// var regions = new Array(); $('table[class="list"] > tbody > tr > td:nth-child(2)').each(function(){ var cell = $(this); var first = cell.html().indexOf(' ') + 6; var second = cell.html().indexOf('<br>'); var region = cell.html().substr(first, second - first); regions[region] = 1; }); for (key in regions) { if(key != ''){ filterByRegion = filterByRegion + '<option>'+key+'</option>'; } } ///////////////// var towns = new Array(); $('table[class="list"] > tbody > tr > td:nth-child(2) > b').each(function(){ var cell = $(this); var town = cell.text(); towns[town] = 1; }); for (key in towns) { if(key != ''){ filterByTown = filterByTown + '<option>'+key+'</option>'; } } ///////////////// var types = new Array(); $('table[class="list"] > tbody > tr > td:nth-child(3) > a:nth-child(2)').each(function(){ var row = $(this); var type = row.text(); var matches = row.text().match(/\(([^)]+)\)$/); if(matches != null && matches.length > 1){ type = matches[1]; } types[type] = 1; }); for (key in types) { filterByUnitType = filterByUnitType + '<option>'+key+'</option>'; } ///////////////// $('table[class="list"]').first().before('<select id="filterByCountry">'+filterByCountry+'</select>'); $('table[class="list"]').first().before('<select id="filterByRegion">'+filterByRegion+'</select>'); $('table[class="list"]').first().before('<select id="filterByTown">'+filterByTown+'</select>'); $('table[class="list"]').first().before('<select id="filterByUnitType">'+filterByUnitType+'</select>'); ///////////////// $('#filterByCountry').change( function(){ var search = $(this).val(); $('table[class="list"] > tbody > tr > td:nth-child(2) > img').each(function() { var img = $(this); var country = img.attr('title'); if (search == '0' || country == search ){ $(this.parentNode.parentNode).show(); } else { $(this.parentNode.parentNode).hide(); } }); $('#filterByRegion').val('0'); $('#filterByTown').val('0'); $('#filterByUnitType').val('0'); }); $('#filterByRegion').change( function(){ var search = $(this).val(); $('table[class="list"] > tbody > tr > td:nth-child(2)').each(function() { var cell = $(this); var first = cell.html().indexOf(' ') + 6; var second = cell.html().indexOf('<br>'); var region = cell.html().substr(first, second - first); if (search == '0' || search == region ){ $(this.parentNode).show(); } else { $(this.parentNode).hide(); } }); $('#filterByCountry').val('0'); $('#filterByTown').val('0'); $('#filterByUnitType').val('0'); }); $('#filterByTown').change( function(){ var search = $(this).val(); $('table[class="list"] > tbody > tr > td:nth-child(2) > b').each(function() { var cell = $(this); var town = cell.text(); if (search == '0' || search == town) { $(this.parentNode.parentNode).show(); } else { $(this.parentNode.parentNode).hide(); } }); $('#filterByCountry').val('0'); $('#filterByRegion').val('0'); $('#filterByUnitType').val('0'); }); $('#filterByUnitType').change( function(){ var search = $(this).val(); $('table[class="list"] > tbody > tr > td:nth-child(3) > a:nth-child(2)').each(function() { var row = $(this); var matches = row.text().match(/\(([^)]+)\)$/); if (search == '0' || row.text() == search || (matches != null && matches[1] == search) ){ $(this.parentNode.parentNode).show(); } else { $(this.parentNode.parentNode).hide(); } }); $('#filterByCountry').val('0'); $('#filterByRegion').val('0'); $('#filterByTown').val('0'); }); } if(window.top == window) { var script = document.createElement("script"); script.textContent = '(' + run.toString() + ')();'; document.documentElement.appendChild(script); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址