您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Added table with licenses and taxes
当前为
// ==UserScript== // @name eRepublik Licenses and taxes // @version 0.1.1 // @include *http://www.erepublik.com/*/economy/inventory // @description Added table with licenses and taxes // @require http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/js/jquery.tablesorter.min.js // @namespace http://greasyfork.icu/users/2402 // ==/UserScript== function AddStyle(t) { $("head").append("<style>" + t + "</style>") } function ImproveInventory() { var f = { createTable: function () { $("#sell_offers").after('<div class="taxTable" style="display: block;">' + '<table width="100%">' + "<thead>" + "<tr>" + '<th style="height: 40px; text-align: center; padding-left: 0px;"> </th>' + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/1/default.png" title="Food">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/2/default.png" title="Weapons">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/3/default.png" title="Tickets">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/4/default.png" title="Tickets">' + "</th>" +'<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/5/default.png" title="Hospital">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/6/default.png" title="Defence Systems">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/7/default.png" title="Food raw materials">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/12/default.png" title="Weapons raw materials">' + "</th>" + '<th style="height: 40px; text-align: center; padding-left: 0px;">' + '<img width="35px" height="35px" src="http://www.erepublik.com/images/icons/industry/17/default.png" title="Weapons raw materials">' + "</th>" + "</tr>" + "</thead>" + "<tbody></tbody>" + "</table>" + "</div>"); f.populateTable(); $("#inventory_overview .taxTable table tbody td").each(function () { var e = $(this).width(); $(".taxLinkHolder", this).width(e - 4) }) }, populateTable: function () { $("#market_licenses_select .ml_repeat li").each(function () { function e(e, t, n) { return '<a href="http://www.erepublik.com/' + LANG + "/economy/market/" + e + "/" + t + "/" + n + '/citizen/0/price_asc/1" target="_blank"><div class="taxLinkItem">Q' + n + "</div></a>" } var t = img_country[$(this).find("img").attr("src").split("/")[6].split(".")[0]], n = { 1: parseFloat(unsafeWindow.countryList[t].taxes["1"].value_added_tax), 2: parseFloat(unsafeWindow.countryList[t].taxes["2"].value_added_tax), 3: parseFloat(unsafeWindow.countryList[t].taxes["3"].value_added_tax), 4: parseFloat(unsafeWindow.countryList[t].taxes["4"].value_added_tax), 5: parseFloat(unsafeWindow.countryList[t].taxes["5"].value_added_tax), 6: parseFloat(unsafeWindow.countryList[t].taxes["6"].value_added_tax), 7: parseFloat(unsafeWindow.countryList[t].taxes["7"].value_added_tax), 12: parseFloat(unsafeWindow.countryList[t].taxes["12"].value_added_tax), 17: parseFloat(unsafeWindow.countryList[t].taxes["17"].value_added_tax) }; if (t != unsafeWindow.citizenshipCountry) { n["1"] += parseFloat(unsafeWindow.countryList[t].taxes["1"].import_tax); n["2"] += parseFloat(unsafeWindow.countryList[t].taxes["2"].import_tax); n["3"] += parseFloat(unsafeWindow.countryList[t].taxes["3"].import_tax); n["4"] += parseFloat(unsafeWindow.countryList[t].taxes["4"].import_tax); n["5"] += parseFloat(unsafeWindow.countryList[t].taxes["5"].import_tax); n["6"] += parseFloat(unsafeWindow.countryList[t].taxes["6"].import_tax); n["7"] += parseFloat(unsafeWindow.countryList[t].taxes["7"].import_tax); n["12"] += parseFloat(unsafeWindow.countryList[t].taxes["12"].import_tax); n["17"] += parseFloat(unsafeWindow.countryList[t].taxes["17"].import_tax) }; image = "http://s3.www.erepublik.net/images/flags_png/M/" + $(this).find("img").attr("src").split("/")[6].split(".")[0] + ".png" $("#inventory_overview .taxTable table tbody").append("<tr>" + '<td style="padding-left: 5px;">' + '<img style="vertical-align: top;" src="' + image + '"> ' + $("img", this).attr("alt") + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 1, 1) + e(t, 1, 2) + e(t, 1, 3) + e(t, 1, 4) + e(t, 1, 5) + e(t, 1, 6) + e(t, 1, 7) + "</div>" + "<span>" + n["1"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 2, 1) + e(t, 2, 2) + e(t, 2, 3) + e(t, 2, 4) + e(t, 2, 5) + e(t, 2, 6) + e(t, 2, 7) + "</div>" + "<span>" + n["2"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 3, 1) + e(t, 3, 2) + e(t, 3, 3) + e(t, 3, 4) + e(t, 3, 5) + "</div>" + "<span>" + n["3"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 4, 1) + e(t, 4, 2) + e(t, 4, 3) + e(t, 4, 4) + e(t, 4, 5) + "</div>" + "<span>" + n["4"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 5, 1) + e(t, 5, 2) + e(t, 5, 3) + e(t, 5, 4) + e(t, 5, 5) + "</div>" + "<span>" + n["5"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<div class="taxLinkHolder">' + '<div class="taxLinkItemTransparent"> </div>' + e(t, 6, 1) + e(t, 6, 2) + e(t, 6, 3) + e(t, 6, 4) + e(t, 6, 5) + "</div>" + "<span>" + n["6"] + "%</span>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<a href="http://www.erepublik.com/' + LANG + "/economy/market/" + t + '/7/1/citizen/0/price_asc/1" target="_blank">' + n["7"] + "%</a>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<a href="http://www.erepublik.com/' + LANG + "/economy/market/" + t + '/12/1/citizen/0/price_asc/1" target="_blank">' + n["12"] + "%</a>" + "</td>" + '<td class="taxLink" style="text-align: center; padding-left: 0px;">' + '<a href="http://www.erepublik.com/' + LANG + "/economy/market/" + t + '/17/1/citizen/0/price_asc/1" target="_blank">' + n["17"] + "%</a>" + "</td>" +"</tr>") }) } }; f.createTable(); $("#product_select").after("<a id='pitanka' style='float: right; color: #fff; background-color: navy; border : 1px solid navy; cursor: pointer; margin: 7px 0 0 1px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -khtml-border-radius: 3px; border-radius: 3px; display: block' href='javascript:void(0);' title='click to retrieve all market prices'> ? </a>"); $("#pitanka").click(function() { var s = $("#sell_product").attr("src"), i = s.split("/")[6], q = s.split("/")[7]; q = parseInt(q.split("_")[0].replace(/[^0-9]/g,"")); $("#marketPrices").remove(); getPrices(i, q); }) } function getPrices(industry, quality) { var price = 0, taxes = 0, stock = 0; function e(c, i, q, cn) { return '<a href="http://www.erepublik.com/' + LANG + "/economy/market/" + c + "/" + i + "/" + q + '/citizen/0/price_asc/1" target="_blank"> ' + cn + "</a>" } img = $("#sell_product").attr("src"); $("#sell_offers").after('<div class="pricesTable" style="display: block;">' + '<table width="100%" id="marketPrices" class="tablesorter">' + "<thead>" + "<tr>" + '<th style="height: 40px; text-align: center; padding-left: 5px;"> <img src=' + img + ' alt=""> </th>' + '<th style="height: 40px; text-align: center; padding-left: 0px;"> Taxes (import+vat) </th>' + '<th style="height: 40px; text-align: center; padding-left: 0px;"> Stock </th>' + '<th style="height: 40px; text-align: center; padding-left: 0px;"> Sell price </th>' + '<th style="height: 40px; text-align: center; padding-left: 0px;"> Price w.o. taxes </th>' + "</tr>" + "</thead>" + "<tbody></tbody>" + "</table>" + "</div>"); $.each(img_country, function(countryName, countryId) { $.ajax({ url: "/" + LANG + "/economy/market/" + countryId + "/" + industry + "/" + quality, async: false, }) .done(function(t) { table = $(t).find('#content table td.m_product').parent(); $(table).each(function() { var row = $(this); price = $(row[0]).find('.m_price'); stock = $.trim($(row[0]).find('.m_stock').text()); price = parseFloat($.trim(price.find('> strong').text()) + $.trim(price.find('sup').contents().filter(function() { return this.nodeType == 3}).text())); return false; }) }) war = unsafeWindow.countryList[countryId].war == 1 ? " war" : ""; embargo = unsafeWindow.countryList[countryId].embargo == 1 ? " embargo" : ""; conquered = unsafeWindow.countryList[countryId].conquered == 1 ? " conquered" : ""; if (unsafeWindow.countryList[countryId].taxes[industry] != undefined) { vat = parseFloat(unsafeWindow.countryList[countryId].taxes["1"].value_added_tax); imp = parseFloat(unsafeWindow.countryList[countryId].taxes["1"].import_tax); taxes = countryName != CScountry ? vat + imp : (industry == 7 || industry == 12 || industry == 17) ? 0 : vat ; noVat = price / (1 + taxes / 100); taxes = taxes + " %"; } else { taxes = "no license"; noVat = 0; } local = CS == countryId ? " local" : ""; image = "http://s3.www.erepublik.net/images/flags_png/M/" + countryName + ".png" $("#inventory_overview .pricesTable table tbody").append("<tr>" + '<td style="text-align: left;" class="pricescell ' + conquered + war + embargo + local + '">' + '<img style="vertical-align: top;" src="' + image + '"> ' + e(countryId, industry, quality, countryName) + "</td>" + '<td class="pricescell' + local + '">' + taxes + "</td>" + '<td class="pricescell ' + local + '">' + stock + "</td>" + '<td class="pricescell ' + local + '">' + price.toFixed(2) + "</td>" + '<td class="pricescell ' + local + '">' + noVat.toFixed(4) + "</td>" + "</tr>") }) $("#marketPrices").tablesorter({ sortList: [[3]] }); } var img_country = { Romania: 1, Brazil: 9, Italy: 10, France: 11, Germany: 12, Hungary: 13, China: 14, Spain: 15, Canada: 23, USA: 24, Mexico: 26, Argentina: 27, Venezuela: 28, "United-Kingdom": 29, Switzerland: 30, Netherlands: 31, Belgium: 32, Austria: 33, "Czech-Republic": 34, Poland: 35, Slovakia: 36, Norway: 37, Sweden: 38, Finland: 39, Ukraine: 40, Russia: 41, Bulgaria: 42, Turkey: 43, Greece: 44, Japan: 45, "South-Korea": 47, India: 48, Indonesia: 49, Australia: 50, "South-Africa": 51, "Republic-of-Moldova": 52, Portugal: 53, Ireland: 54, Denmark: 55, Iran: 56, Pakistan: 57, Israel: 58, Thailand: 59, Slovenia: 61, Croatia: 63, Chile: 64, Serbia: 65, Malaysia: 66, Philippines: 67, Singapore: 68, "Bosnia-Herzegovina": 69, Estonia: 70, Latvia: 71, Lithuania: 72, "North-Korea": 73, Uruguay: 74, Paraguay: 75, Bolivia: 76, Peru: 77, Colombia: 78, "Republic-of-Macedonia-FYROM": 79, Montenegro: 80, "Republic-of-China-Taiwan": 81, Cyprus: 82, Belarus: 83, "New-Zealand": 84, "Saudi-Arabia": 164, Egypt: 165, "United-Arab-Emirates": 166, Albania: 167, Georgia: 168, Armenia: 169, Nigeria: 170, Cuba: 171 } var $ = jQuery, CScountry = $("#menu5 li a:eq(0)").attr("href").split("/").pop(), LANG = erepublik.settings.culture, CS = erepublik.citizen.country, ID = erepublik.citizen.citizenId, CC = erepublik.citizen.currency AddStyle("#inventory_overview #sell_offers table th span#netPriceG,#inventory_overview #sell_offers table th span#netPrice, #inventory_overview #sell_offers table th span#totalNetPriceG,#inventory_overview #sell_offers table th span#totalNetPrice { float: left; height: 14px; clear: both; padding: 8px 0px; padding-left: 5px; color: #88AFC9; font-size: 12px; font-weight: bold; }"); AddStyle("#inventory_overview #sell_offers table td.total_net_price { text-align: right; padding-right: 25px; padding-left: 0; }"); AddStyle("#inventory_overview .taxTable { background-color: #BAE7F9; float: left; width: 730px; position: relative; -moz-border-radius: 5px; -webkit-border-radius: 5px;border-radius: 5px; margin-top: 11px; margin-left: 15px; }"); AddStyle("#inventory_overview .taxTable table { width: 718px; border: 1px solid #95D4ED; background: white; margin: 5px auto; }"); AddStyle("#inventory_overview .taxTable table th { background: #F7FCFF; }"); AddStyle("#inventory_overview .taxTable table tbody td { border-top: 1px solid #E2F3F9; color: #5E5E5E; padding: 5px 0 5px 25px; }"); AddStyle("#inventory_overview .taxTable table tbody tr:hover td { background-color: #FFFFE7; }"); AddStyle("#inventory_overview .taxTable table .taxLink { cursor: pointer; }"); AddStyle("#inventory_overview .taxTable table .taxLink .taxLinkHolder { border: 2px solid #CFEFFB; border-radius: 3px; -moz-border-radius: 3px; position: absolute; margin-top: -7px; display: none; z-index: 100; }"); AddStyle("#inventory_overview .taxTable table .taxLink:hover .taxLinkHolder { display: block; }"); AddStyle("#inventory_overview .taxTable table .taxLink .taxLinkHolder .taxLinkItemTransparent { background: none repeat scroll 0 0 transparent; text-align: center; height: 25px; }"); AddStyle("#inventory_overview .taxTable table .taxLink .taxLinkHolder .taxLinkItem { background-color: #FFFFE7; text-align: center; }"); AddStyle("#inventory_overview .taxTable table .taxLink .taxLinkHolder .taxLinkItem:hover { background-color: #F7FCFF !important; }"); AddStyle("#inventory_overview .pricesTable { background-color: #BAE7F9; float: left; width: 730px; position: relative; -moz-border-radius: 5px; -webkit-border-radius: 5px;border-radius: 5px; margin-top: 11px; margin-left: 15px; }"); AddStyle("#inventory_overview .pricesTable table { width: 718px; border: 1px solid #95D4ED; background: white; margin: 5px auto; }"); AddStyle("#inventory_overview .pricesTable table th { background: #F7FCFF; cursor: pointer; }"); AddStyle("#inventory_overview .pricesTable table tbody td { border-top: 1px solid #E2F3F9; color: #5E5E5E; padding: 5px 0 5px 25px; }"); AddStyle("#inventory_overview .pricesTable table tbody tr:hover td { background-color: #FFFFE7; }"); AddStyle("#inventory_overview .pricesTable .conquered { text-decoration: line-through; }"); AddStyle("#inventory_overview .pricesTable .war { color: red; }"); AddStyle("#inventory_overview .pricesTable .embargo { color: red; }"); AddStyle(".tablesorter-headerUnSorted { background: transparent url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==) no-repeat center right !important; }"); AddStyle(".tablesorter-headerDesc { background: transparent url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7) no-repeat center right !important; }"); AddStyle(".tablesorter-headerAsc { background: transparent url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7) no-repeat center right !important; }"); AddStyle("#inventory_overview .pricesTable .local { background-color: #efefef; }"); AddStyle("#inventory_overview .pricesTable .pricescell { text-align: right; padding-right: 5px; "); ImproveInventory();