// ==UserScript==
// @name eRepublik Licenses
// @version 0.0.1
// @include *http://www.erepublik.com/*/economy/inventory
// @description Added table with taxes and licenses
// @namespace https://greasyfork.org/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)
}
$("#inventory_overview .taxTable table tbody").append("<tr>" + '<td style="padding-left: 5px;">' + '<img style="vertical-align: top;" src="' + $("img", this).attr("src") + '"> ' + $("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();
}
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,
TP, 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: point; }");
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; }");
location.href.match(/economy\/inventory/) && ImproveInventory()