Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name eRepublik Stuff++
- // @version 2.8.11
- // @include *www.erepublik.com*
- // @grant none
- // @grant GM_info
- // ==/UserScript==
- function ಠ_ಠ() {
- function t(t) {
- U("head").append("<style>" + t + "</style>")
- }
- function e(t) {
- return ("" + t).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
- }
- function i() {
- t("#NoKills{cursor:default;font:bold 11px arial;float:left;width:145px;margin:0 3px}#NoKills strong{color:#666}#NoKills span{color:#3c8fa7;float:right}"), U("#NoKills").remove(), U("#eRS_settings").before('<div id="NoKills" title="Click to reset stats"><strong>Kills today:</strong><span>' + e(H.stats[0]) + "</span><br><strong>Hits:</strong><span>" + e(H.stats[1]) + "</span><br><strong>Damage:</strong><span>" + e(H.stats[2]) + "</span></div>"), U("#NoKills").tipsy({
- gravity: "e"
- }).click(function() {
- U(".tipsy").hide(), f()
- })
- }
- function a() {
- setTimeout(a, 5e2), U("#maxRecover").remove(), U("#current_health").after('<strong id="maxRecover" style="text-align:right;margin-right:5px;width:98%;background:none">' + food_remaining + "</strong>")
- }
- function o() {
- function t(t) {
- return 10 > t ? "0" + t : t
- }
- setTimeout(o, 1e3), U("#full_energy").remove()
- var e = Math.max(360 * Math.ceil((reset_health_to_recover - food_remaining) / globalNS.userInfo.energyPerInterval) - 360 + 60 * parseInt(U("#foodResetHours").text()), 0)
- U("#current_health").before('<strong id="full_energy" style="text-align:left;left:' + (j ? 5 : 15) + 'px;background:none">' + t(parseInt(e / 3600)) + ":" + t(parseInt(e % 3600 / 60)) + "</strong>").css("padding-left", j ? "10px" : 0)
- }
- function n() {
- U.get("/" + G + "/economy/inventory", function(i) {
- var a = i.replace(/src=/g, "tmpsrc="),
- o = 0
- if (H.showStorageInv || (t("#sideInventory{position:absolute;background:#FFF;display:none}#sideInventory img,#sideInventory span{float:left;clear:both}#sideInventory img{width:39px;height:39px;background:linear-gradient(#EEF1EC,#D5DECF)}#sideInventory span{font:bold 10px arial;color:#578B4D;background:linear-gradient(#BEE698,#98D780);width:39px;text-align:center;cursor:default}.col{line-height:19px}"), U("body").prepend('<div id="sideInventory"></div>'), U(".item_mask ul li,.bazooka .item", a).each(function() {
- if (0 !== +U("strong", this).text()) {
- var t = U("strong", this).attr("id") ? U("strong", this).attr("id").split("stock_")[1] : "",
- e = (U("#product_details_" + t + " .attributes", a).html() || "") + (U("#product_details_" + t + " .extra", a).html() || ""),
- i = t.split("_")
- 1 == i[0] && i[1] < 8 && (o += +U("strong", this).text().replace(/,/g, "") * (i[1] < 7 ? 2 * i[1] : 20)), U(this).parent().hasClass("bazooka") && U(".b_parts li", a).each(function() {
- e += U(this).attr("title") + ': <span class="col defense">' + U("strong", this).text() + "</span></br>"
- }), U("#sideInventory").append('<img title="' + e.replace(/"/g, "'") + '"' + F(U("img", this).attr("tmpsrc").split("/images/")[1]) + "><span>" + (U(".timer", this).length ? parseInt(U(".timer", this).attr("data-duration") / 3600) + "h" : U("strong", this).text()) + "</span>")
- }
- }), U("#sideInventory img").tipsy({
- gravity: "w",
- html: !0
- }).parent().fadeIn(500)), !H.storageCapacity) {
- var n = U(".area.storage h4:first strong", a).text().replace(/[,()]/g, "").split("/")
- U(".currency_amount").after('<div id="storageCapacity" title="Free space: ' + e(n[1] - n[0]) + (H.showStorageInv ? "" : "<br>Total food: " + e(o) + "HP") + '" style="float:left;color:#585858;font-size:11px;cursor:default;display:none"><img style="float:left;margin:0 6px 0 2px;width:22px;height:16px"' + F("modules/manager/tab_storage.png") + "><strong>" + e(n[0]) + " / " + e(n[1]) + "</strong></div>").siblings("#storageCapacity").slideDown(), U("#storageCapacity").tipsy({
- gravity: "e",
- html: !0
- })
- }
- })
- }
- function r() {
- function t() {
- "AUTOBOT ON" == U("#AutoBotSwitch").text() || !H.lvlUpNoRecovery && globalNS.userInfo.wellness + food_remaining > 10 * (U("#experienceTooltip strong:eq(2)").text() - U("#experienceTooltip strong:eq(1)").text()) || globalNS.userInfo.wellness >= reset_health_to_recover || food_remaining < smallestFood.use || U.getJSON("/" + G + "/main/eat?format=json&_token=" + SERVER_DATA.csrfToken + "&buttonColor=blue", function(t) {
- energy.processResponse(t)
- })
- }
- t()
- var e = setInterval(t, 5e2)
- U("#fight_btn").click(function() {
- clearInterval(e), e = setInterval(t, 5e2)
- })
- }
- function s() {
- t(".eRS_quickMarket{display:none;position:relative;top:-62px}.eRS_quickMarket img{width:18px;height:20px;vertical-align:middle;margin-bottom:2px}#menu4 ul li:nth-child(1):hover > .eRS_quickMarket{display:block}")
- for (var e = ["", "", "", ""], i = '<li><a href="/' + G + "/economy/market/" + Q, a = '<div class="eRS_quickMarket" style="', o = 1; 4 >= o; o++)
- for (var n = 1; 8 >= n; n++) 1 == o && (e[0] += 8 > n ? i + "/1/" + n + '"><img' + F("icons/industry/" + o + "/q" + n + ".png") + "> Food Q" + n + "</li>" : i + '/7/1"><img' + F("icons/industry/7/default.png") + "> Food Raw</li>"), 2 == o && (e[1] += 8 > n ? i + "/2/" + n + '"><img' + F("icons/industry/" + o + "/q" + n + ".png") + "> Weapon Q" + n + "</li>" : i + '/12/1"><img' + F("icons/industry/12/default.png") + "> Weapon Raw</li>"), 3 == o && 5 >= n && (e[2] += i + "/3/" + n + '"><img' + F("icons/industry/" + o + "/q" + n + ".png") + "> Ticket Q" + n + "</li>"), 4 == o && (e[3] += 8 > n ? i + "/4/" + n + '"><img' + F("icons/industry/" + o + "/q" + n + ".png") + "> House Q" + n + "</li>" : i + '/17/1"><img' + F("icons/industry/17/default.png") + "> House Raw</li>")
- U("#menu4 ul li:eq(0)").append(a + 'right:401px"><ul>' + e[0] + "</ul></div>" + a + 'right:264px"><ul>' + e[1] + "</ul></div>" + a + 'left:138px"><ul>' + e[2] + "</ul></div>" + a + '"><ul>' + e[3] + "</ul></div>")
- }
- function l() {
- function e(t) {
- t < i.length && U.post(update_salary_url, i[t], function(a) {
- var o = U("#old_salary_" + i[t].employeeId).parent().parent()
- a.status ? (U("#old_salary_" + i[t].employeeId + ",#salary_value_" + i[t].employeeId).val(a.result.salary), U("#current_salary_" + i[t].employeeId).html(a.result.salary + " " + J), o.append('<div class="notice_holder"><strong>' + a.result.message + "</strong></div>"), setTimeout(function() {
- U(".notice_holder", o).remove()
- }, 4e3), setTimeout(recalculateDues, 50)) : o.append('<div class="error_holder"><strong>' + a.message + '</strong><a href="javascript:;"></a></div>').click(function() {
- U(".error_holder", o).remove()
- }), setTimeout(e, 5e2, t + 1)
- })
- }
- t("#changeAll{cursor:pointer;background:#83B70B;border:1px;color:#fff;font:bold 11px arial;height:24px}#changeAll:hover{background:#FB7E3D}"), U(".area h4").append('<div style="float:right"><input type="text" style="margin:0 5px;width:40px;text-align:right" class="field" id="eRS_same_all"><button id="changeAll">Lower for All</button></div>')
- var i = []
- U.get("/" + G + "/economy/job-market/" + Q, function(t) {
- U("#eRS_same_all,#job_salary_value").val(parseFloat(U("strong,sup", U(".jm_salary:eq(1)", t.replace(/src=/g, "tmpsrc="))).text())), U("#changeAll").click(function() {
- U(".list_group .employee_salary.c3").each(function() {
- var t = U(".old_salary_value", this).attr("id").split("_")[2],
- e = U("#eRS_same_all").val().replace(/,/g, ".")
- e < U("#old_salary_" + t, this).val() && i.push({
- action_type: "update_salary",
- employeeId: t,
- salary: e,
- _token: U("#_token").val()
- })
- }), e(0)
- })
- }), U(".bottom_details").css("cssText", "position:sticky;bottom:0"), U(".list_group").css("box-shadow", "none"), U("#edit_mode").after('<a id="SortButton" class="blue_plastic"><span style="line-height:30px"></span></a>'), U("#SortButton").click(function() {
- var t = []
- U(".current_salary").each(function() {
- t.push({
- wage: U(this).text().split(" ")[0],
- row: U(this).parent().parent()
- })
- }), "ASC" != U("#SortButton span").text() ? (U("#SortButton span").text("ASC"), t.sort(function(t, e) {
- return t.wage - e.wage
- })) : (U("#SortButton span").text("DESC"), t.reverse())
- for (var e = 0; e < t.length; e++) U(".list_group").append(t[e].row)
- }).click()
- }
- function p() {
- var t = location.href.split("/")
- if (!(t[7] > 4 || -1 != t[8].indexOf("?"))) {
- var e = U(".solid.durability strong:eq(0)").text(),
- i = "HP"
- 1 == t[7] && (e = 7 != t[8] ? 2 * t[8] : 20), 2 == t[7] && (i = "Hit"), 3 == t[7] && (i = "Zone", e = t[8]), 4 == t[7] && (e = U(".solid.health").text()), U("#marketplace thead .m_provider").after('<th style="width:110px">Cost Per ' + i + "</th>"), U("#marketplace .price_sorted tr").each(function() {
- var t = parseFloat(U(".m_price", this).text()) / e
- t = t.toFixed(.1 >= t ? 4 : 2).split("."), U(".m_provider", this).after('<td class="stprice"><strong>' + t[0] + "</strong><sup>." + t[1] + "<strong> " + J + "/" + i + "</strong></sup></td>")
- })
- }
- }
- function c() {
- U(".sell_selector .industry_quality_selector").click(function() {
- var t = Math.max(U(this).attr("quality"), 1),
- e = U(this).attr("industry")
- U("#sell_amount").val(Math.min(itemAmounts[e][t] - (itemPartials[e] ? !!itemPartials[e][t] : 0), 99999))
- var i = U("img", this).attr("src").split("/industry/")[1],
- a = 0
- U('tr[id^="offer_"]:visible .offer_image').each(function() {
- U(this).attr("src").split("/industry/")[1] == i && (a = U(this).parent().parent().find(".offer_price strong").text().replace(/,/g, ""), setTimeout(function() {
- U("#sell_price").val(a)
- }, 0))
- }), a || (setTimeout(function() {
- U("#sell_price").val(0)
- }, 0), U.get("/" + G + "/economy/market/" + Q + "/" + e + "/" + t, function(t) {
- U("#sell_price").val(parseFloat(t.split('m_price stprice"')[1].split("<strong>")[1].split("<strong>")[0].replace("</strong><sup>", "")))
- }))
- }), U(document).ajaxSuccess(function(t, e, i) {
- /postMarketOffer/.test(i.url) && U("#sell_amount").val(Math.min(itemAmounts[i.data.split("industryId=")[1].split("&")[0]][i.data.split("customization=")[1].split("&")[0]], 99999))
- })
- }
- function d() {
- U("#back_to_battle").click(function() {
- H.stats[0]++, H.stats[2] += +U(".award_damage strong").text(), W()
- })
- }
- function g() {
- function t() {
- U("button[data-currency=GOLD]").each(function() {
- var t = U(this).attr("data-price"),
- i = Math.min(U(this).attr("data-max"), 10, Math.floor(100 * U("#eCash").val() / t) / 100)
- U(this).parent().find("input").val(i), U(this).text(U(this).attr("data-i18n") + " " + e(Math.ceil(i * t * 100) / 100) + " " + J)
- })
- }
- U(document).ajaxSuccess(t), t()
- }
- function u() {
- function i() {
- U('tr[id^="offer_"]:visible').each(function() {
- U(".fluid_blue_dark_small,.Net_unit,.Total_net", this).remove()
- var t = A(U(".offer_flag", this).attr("src").split("/M/")[1].split(".")[0]),
- i = U(".offer_image", this).attr("src").split("/industry/")[1].split("/"),
- a = -1 != i[1].split("_")[0].indexOf("q") ? i[1].split("_")[0].replace("q", "") : 1,
- n = countryList[t].taxes[i[0]],
- r = U(".offer_price strong", this).text().replace(/,/g, "") / ((100 + (+n.value_added_tax + (t != Q ? +n.import_tax : 0))) / 100),
- s = r * U(".offer_amount", this).text().replace(/,/g, "")
- U(".offer_price", this).after('<td class="Net_unit"><strong>' + r.toFixed(4) + "</strong> " + J + '</td><td class="Total_net"><strong>' + e(s.toFixed(2)) + "</strong> " + J + '<br><strong style="text-align:right;font-size:11px">' + e((s / o).toFixed(2)) + '</strong><span style="font-size:11px"> GOLD</span></td>'), U(".delete_offer", this).after('<a title="Show offer on market" href="/' + G + "/economy/market/" + t + "/" + i[0] + "/" + a + "?sellerId=" + $ + "&sellerName=" + U(".user_identity").text() + "&offerId=" + U(this).attr("id").split("_")[1] + "&offerAmount=" + U(".offer_amount", this).text().replace(/,/g, "") + "&offerPrice=" + U(".offer_price strong", this).text().replace(/,/g, "") + '" target="_blank" class="fluid_blue_dark_small" style="float:right;margin:0 2px 0 7px"><span>O</span></a><a title="Visit market" target="_blank" class="fluid_blue_dark_small" style="float:right" href="/' + G + "/economy/market/" + t + "/" + i[0] + "/" + a + '"><span>M</span></a>')
- })
- }
- t("td:last-child,#Net_unit,.Net_unit,#Total_net,.Total_net,#Total_netF{padding-left:0!important}.Total_net,#Total_netF{padding:15px;text-align:right}.delete_offer{opacity:1!important}")
- var a = U(".area.storage h4:first strong").text().replace(/[,()]/g, "").split("/")
- U(".area.storage h4:first strong").append(" Free space: " + e(a[1] - a[0])), U("th input").css("width", "50px"), U(".offers_product").css("width", "70px").next().css("width", "80px").next().css("width", "120px").next().css("width", "60px").next().css("width", "132px").find("a").css("cssText", "left:10px;margin-right:20px"), U("#sell_offers table").append('<tfoot><tr style="background:#F7FCFF;height:44px"><td colspan="4"><td id="Total_netF"></td><td colspan="2"></td></tr></tfoot>')
- var o
- U.get("/" + G + "/economy/exchange-market/", function(t) {
- o = t.split("data-price='")[1].split("'")[0], i()
- }), setInterval(function() {
- var t = 0
- U(".Total_net:visible").each(function() {
- t += +U("strong:eq(0)", this).text().replace(/,/g, "")
- }), U("#Total_netF").html("<strong>" + e(t.toFixed(2)) + "</strong> " + J + '<br><strong style="font-size:11px">' + e((t / o).toFixed(2)) + '</strong><font style="font-size:11px"> GOLD</font>'), U("#Net_unit,#Total_net").remove()
- var i = A(U("#market_select img").attr("src").split("/M/")[1].split(".")[0]),
- a = countryList[i].taxes[U("#sell_product").attr("src").split("/industry/")[1].split("/")[0]],
- n = (+U("#sell_price").val() || 0) / ((100 + (+a.value_added_tax + (i != Q ? +a.import_tax : 0))) / 100),
- r = n * (+U("#sell_amount").val() || 0)
- U(".offers_price").after('<th id="Net_unit"><strong>Net/unit</strong><b>' + n.toFixed(4) + " " + J + '</b></th><th id="Total_net"><strong>Total Net Value</strong><b>' + e(r.toFixed(2)) + " " + J + '</b><span style="float:left;height:14px;clear:both;padding:8px 0px 8px 5px;color:#88AFC9;font-size:11px;font-weight:bold">' + e((r / o).toFixed(2)) + " GOLD</span></th>")
- }, 100), U(document).ajaxSuccess(i)
- }
- function h() {
- t("#eRS_settings{margin:5px 0 -5px;width:100%;display:inline-block;cursor:pointer;background:#83B70B;color:white;font:bold 11px Arial;text-align:center;padding:3px 0px;border-radius:1px}#eRS_settings:hover,#eRS_options a:hover{background:#FB7E3D}#eRS_options a{cursor:pointer;color:white;font-weight:bold;background:#83B70B;padding:5px;margin:20px;border-radius:1px}")
- for (var e = [
- ["Battlefield", [
- ["Improve battlefield", "battlefield"],
- ["Enable AutoBot", "autoBot"],
- ["Show merc, FF, and TP progress", "battleMercFF"],
- ["Automatically close wrong side warning", "wrongSideNotice"]
- ]],
- ["Common settings", [
- ["Automatic energy recovery", "energyRecovery"],
- ["Stop recovery to maximize level-up refill", "lvlUpNoRecovery"],
- ["Show remaining time to full energy bar", "fullEnergy"],
- ["Show maximum energy to recover", "maxEnergy"],
- ["Autorefresh main page every 10 minutes", "autoRefresh"],
- ["Display XP needed to level-up", "xpLeft"],
- ["Kills, damage and hits on sidebar", "showStats"],
- ["Remove external link warning", "externalLinks"],
- ["Hide notifications", "removeNotifications"],
- ["Epic battle sensor", "epicSensor"],
- ["Ignore epic dictatorship battles", "ignoreDictatorship"],
- ["Show rankings by damage instead of kills", "damageRankings"],
- ["Show active damage boosters everywhere", "damageBoosterTimer"]
- ]],
- ["Companies", [
- ["Company manager", "companyManager"],
- ["Employee manager", "employeeManager"],
- ["Add employees link to My places", "addEmployeesLink"]
- ]],
- ["Main page", [
- ["Improve feeds", "improvedFeeds"],
- ["Hide BH and GF posts", "hideBHGF"],
- ["Add international and latest articles", "morePress"]
- ]],
- ["Marketplace", [
- ["Autofill maximum product amount", "autofillMarket"],
- ["Product quick links", "marketLinks"],
- ["Display cost per use", "costPerUse"],
- ["Show the best local/CS price when abroad", "localOffer"]
- ]],
- ["Monetary market", [
- ["Autofill maximum gold amount", "autofillGold"]
- ]],
- ["Profile", [
- ["Improve profile page", "improveProfile"],
- ["Influence calculator", "influenceCalculator"]
- ]],
- ["Storage", [
- ["Improve inventory", "improveInventory"],
- ["Display storage inventory", "showStorageInv"],
- ["Display storage info", "storageCapacity"],
- ["Autofill amount and real price", "getItemPrice"]
- ]],
- ["Wars page", [
- ["Show dom. points and wall percentages", "getPoints"],
- ["Show merc, FF, and TP progress", "mercFF"],
- ["Add direct links for each side in RWs", "directRWLinks"],
- ["Single row layout", "singleRowWars"]
- ]]
- ], i = "", a = 0; a < e.length; a++) {
- a && 3 != a || (i += '<div style="width:48%;margin:0.5%;float:left;background:#242B27">'), i += '<span style="background:#FB7E3D;color:white;padding:2px;font-weight:bold;display:inline-block;width:98.7%;text-align:center">' + e[a][0] + "</span>"
- for (var o = 0; o < e[a][1].length; o++) i += '<span style="color:white;padding:2px 5px;display:inline-block;width:100%;font-size:13px">' + e[a][1][o][0] + '<input type="checkbox" style="float:right;margin:2px 10px" id="' + e[a][1][o][1] + '"></span>';
- (2 == a || 8 == a) && (i += "</div>")
- }
- U("body").append('<div id="eRS_block" style="display:none;z-index:999998;position:fixed;top:0;width:100%;height:100%;background:rgba(0,0,0,0.6)"></div><div id="eRS_options" style="display:none;width:600px;margin:auto;cursor:default;position:fixed;left:' + (U(window).width() - 600) / 2 + 'px;z-index:999999"><div style="position:absolute;top:-20px;width:100%;text-align:center"><a href="https://docs.google.com/spreadsheets/d/1nal62cgC7lUmrur6NRzlPVU3uxtE59WGV9-bZcPoIw8/edit" target="_blank">Script Homepage</a><a id="reset" title="Deletes all stored data (settings, stats, caches). If you use other eRepublik scripts utilizing localStorage, their data will be deleted, too.">RESET</a><a href="https://googledrive.com/host/0B3iVfXry1NkpbHRqUmdWTVhtXzQ/eRepublik_Stuff++.user.js">UPDATE</a><a href="/' + G + '/citizen/profile/6365664">Contact / Donate</a><a>Close</a></div>' + i + "</div>"), setTimeout(H.x), U("#eRS_options").css("top", (U(window).height() - U("#eRS_options").height()) / 2 + "px").find("input").each(function() {
- U(this).prop("checked", !H[U(this).attr("id")])
- }).change(function() {
- H[U(this).attr("id")] = !U(this).prop("checked"), W()
- }), U("#eRS_options a:last,#eRS_block").click(function() {
- U("#eRS_options,#eRS_block").hide()
- }), U(".user_finances").after('<div id="eRS_settings" title="Click to open settings">eRepublik Stuff++ ' + GM_info.script.version + "</div>"), U("#eRS_settings").tipsy({
- gravity: "e"
- }).click(function() {
- U("#eRS_options,#eRS_block").show()
- }), U("#reset").click(function() {
- localStorage.clear(), location.reload()
- })
- }
- function f() {
- H.stats = [0, 0, 0], W(), H.showStats || i()
- }
- function m() {
- function t() {
- U('a[href*="/main/warn/"]').each(function() {
- var t = U(this).text().replace(/[;:.,]+$/, ""),
- e = /https?:\/\/[a-zA-Z0-9][.]+$/,
- i = U(this)[0].previousSibling || {},
- a = U(this)[0].nextSibling || {}
- if ((4 == location.href.split("/").length || /www\.|https?:\/\//.test(t)) && U(this).attr("href", /https?:\/\//.test(t) ? t : "http://" + t).after(/[;:.,]+$/.exec(U(this).text())).text(t), e.test(i.nodeValue || "")) {
- var o = e.exec(i.nodeValue)
- U(this).text(o + U(this).text()).attr("href", U(this).text()), i.nodeValue = i.nodeValue.split(o)[0]
- }
- if ("'" == (a.nodeValue || "")[0]) {
- var n = a.nodeValue.split(" ")[0]
- U(this).text(U(this).text() + n).attr("href", U(this).text()), a.nodeValue = a.nodeValue.split(n)[1]
- }
- /main\/warn/.test(U(this).attr("href")) && U.get(U(this).attr("href"), U.proxy(function(t) {
- U(this).attr("href", t.split('class="content"')[1].split('href="')[1].split('"')[0])
- }, this))
- })
- }
- U(document).ajaxSuccess(function(e, i, a) {
- /main\/warn|\/eat|\/inventory|\/campaigns/.test(a.url) || t()
- }), t()
- }
- function _() {
- U("#xpleft").remove()
- var t = U("#experienceTooltip strong:eq(2)").text() - U("#experienceTooltip strong:eq(1)").text()
- U(".user_level").append('<div id="xpleft" style="float:right;position:relative;font-size:10px;color:#777;' + (j ? 'top:-3px;left:23px"><span style="' : 'top:14px">XP left: <span style="padding:1px') + ";background:" + (reset_health_to_recover <= 10 * t ? "#6ebce5" : "red") + ';color:white;font-weight:bold;border-radius:2px">' + t + "</span></div>"), setTimeout(_, 200)
- }
- function x() {
- t("#CompanyManager{float:right}#CompanyManager strong{position:relative;bottom:8px;right:5px;font-size:12px}#CompanyManager span{cursor:pointer;border-radius:3px}#CompanyManager span:hover{opacity:0.5}#CompanyManager img{height:30px}")
- for (var e = [0, 0, 0], i = 1; 15 >= i; i++) e[5 >= i ? 0 : 10 >= i ? 1 : 2] += pageDetails.resources[i].bonus
- U(".area h4 a").remove(), U(".area h4").append('<span style="float:left;margin:23px 1px -100%;color:#656565;font:90% bold">Food: <b>+' + e[0] + "%</b> Weapon: <b>+" + e[1] + "%</b> House: <b>+" + e[2] + '%</b></span><div id="CompanyManager"><strong>Work as Manager</strong></div>'), U(".area h4 b").each(function() {
- U(this).css("color", 100 == parseInt(U(this).text()) ? "#83B70B" : parseInt(U(this).text()) > 0 ? "#FB7E3D" : "#D74A4A")
- }), U(".listing.companies:not(.disabled) .area_pic > img").each(function() {
- U('#CompanyManager img[src="' + U(this).attr("src") + '"]').length || U("#CompanyManager").append('<span><img src="' + U(this).attr("src") + '" title="' + U('.listing.companies .area_pic > img[src="' + U(this).attr("src") + '"]:eq(0)').attr("title") + '"></span>')
- }), U("#CompanyManager span").click(function() {
- U(".listing.companies:not(.disabled) .area_pic > img").parent().parent().find(".owner_work").removeClass("active"), window.pageDetails.recoverable_health.value = food_remaining, U('.listing.companies:not(.disabled) .area_pic > img[src="' + U("img", this).attr("src") + '"]:lt(' + Math.floor((globalNS.userInfo.wellness + Math.min(pageDetails.recoverable_health.value, pageDetails.recoverable_health_in_food)) / 10) + ")").parent().parent().find(".owner_work:not(.active)").addClass("active"), U(".listing.companies:not(.disabled)").each(function(t, e) {
- applyCheck(e), warnForCritical()
- })
- })
- }
- function v() {
- function e(t) {
- var e = 0
- return U.each(tickets, function(i, a) {
- a >= t / 20 && (e = a)
- }), e > 0 ? "Q" + e + " ticket" : t + "cc"
- }
- t(".booster_timer{bottom:90px!important;left:5px!important}#special_items_list,.deploy_bomb{display:block!important}#switch_side{position:absolute;right:37px;background:#83B70B;color:#FFF;padding:3px;font:bold 11px Arial}#switch_side:hover{background:#FB7E3D;cursor:pointer}#pvp .campaign_details .entry em{opacity:1}#pvp .campaign_details .entry .pdomi_left em{right:5px}#eRSTravel{display:none;position:absolute;top:0;right:115px;background:#4B4B49;border:1px solid #333;color:#FFF;font:11px Arial;padding:1px 4px}#round_number{position:absolute;top:26px;width:100%;color:white;text-align:center;font:13px ds-digitalbold_italic}.top5_list{position:absolute;top:-6px;padding:2px 0;border-radius:2px;background:rgba(0,0,0,0.6);color:white;cursor:default;z-index:31;font:bold 9px Arial,sans-serif}.top5_list a{color:#83B70B;margin:0 3px}.top5_list span{float:right;margin:0 3px}#right_top5{right:0}#campaign_top5{top:60px}#personal_stats{cursor:default;text-align:center;position:absolute;top:7px;width:100%;color:#FFE49B;font:bold 11px Arial,sans-serif}.eRS_hasBudget span{color:#FFE49B}"), U("#drop_part,#special_weapons_go,.battle_heroes").remove(), U(".weapon_link").removeAttr("target"), U("#special_items_list").append(U(".addon").children()), U(".deploy_bomb").hide(), U.cookie("collection_full", 1, {
- expires: 999,
- path: "/"
- }), clearInterval(globalSleepInterval), b(), U(".country_avatar.dictatorship").length || U(".status_bar").append('<a id="switch_side">SWITCH SIDE</a>')
- var i = regionsInvolved[rightBattleId]
- U("#pvp").append('<select id="eRSTravel"><option>Select region</option></select><div id="round_number">Round ' + SERVER_DATA.zoneId + "</div>")
- for (var a in i) i.hasOwnProperty(a) && U("#eRSTravel").append('<option value="' + i[a].id + '" title="' + e(i[a].travelCost) + '">' + i[a].name + (i[a].current_owner_country_id != i[a].original_owner_country_id ? "*" : "") + "</option>")
- U("#switch_side").click(function() {
- SERVER_DATA.isResistance ? location.href = "http://www.erepublik.com/en/military/battlefield-choose-side/" + SERVER_DATA.battleId + "/" + rightBattleId : U("#eRSTravel").toggle()
- }), U("#eRSTravel").change(function() {
- "Select region" != U("option:selected", this).text() && (confirm("Are you sure you want to change location?") ? U.post("/" + G + "/main/travel/", {
- battleId: SERVER_DATA.battleId,
- _token: SERVER_DATA.csrfToken,
- toCountryId: rightBattleId,
- inRegionId: U("option:selected", this).attr("value")
- }, function() {
- location.reload()
- }) : U("#eRSTravel").hide())
- }), U("#mu_missions.isclosed a.close_pop").click(function() {
- U(".mission_details label").length && !U(".eRS_hasBudget").length && battleStats.getBattleStats()
- }), U(".dropdown_filter").after('<div class="data_filters_div dropdown_filter"><label>Top5 lists settings</label><br><select id="eRS_killsdamage"><option value="damage">Damage</option><option value="kills">Kills</option></select></div><div class="data_filters_div dropdown_filter"><select id="eRS_division"><option value="1">Division 1</option><option value="2">Division 2</option><option value="3">Division 3</option><option value="4">Division 4</option></select></div>'), U("#eRS_killsdamage").val(Y).change(function() {
- Y = U(this).val(), H.damageRankings = "kills" == Y, W(), b()
- }), U("#eRS_division").val(I()).change(b)
- }
- function b(t) {
- if ("undefined" == typeof right_percent) return setTimeout(b, 100)
- U(".activated").text() && U(".activated").css("cssText", "display:block;" + ((SERVER_DATA.mustInvert ? 100 - current_domination : current_domination) < Math.max.apply(null, U("strong[data-bind=mu_treshold]").map(function(t, e) {
- return parseInt(U(e).text())
- }).get()) ? "filter:hue-rotate(110deg);-webkit-filter:hue-rotate(110deg)" : "filter:none;-webkit-filter:none")), U(".top5_list").remove(), U("#battleConsole").append('<div id="left_top5" class="top5_list"></div><div id="right_top5" class="top5_list"></div><div id="campaign_top5" class="top5_list"></div>')
- var i = currentStats[SERVER_DATA.zoneId][U("#eRS_division").val()] || {},
- a = (i[leftBattleId] || {})["top_" + Y],
- o = (i[rightBattleId] || {})["top_" + Y],
- n = (overallStats[0][leftBattleId] || {})["top_" + Y],
- r = '<a href="/' + G + "/citizen/profile/"
- for (var s in a) a.hasOwnProperty(s) && U("#left_top5").append(r + a[s].citizen_id + '">' + fightersData[a[s].citizen_id].name + "</a><span>" + e(a[s][Y]) + "</span><br>")
- for (var l in o) o.hasOwnProperty(l) && U("#right_top5").append(r + o[l].citizen_id + '">' + fightersData[o[l].citizen_id].name + "</a><span>" + e(o[l][Y]) + "</span><br>")
- for (var p in n) n.hasOwnProperty(p) && U("#campaign_top5").append(r + n[p].citizen_id + '">' + fightersData[n[p].citizen_id].name + "</a><span>" + e(n[p][Y]) + "</span><br>")
- for (var c in t) t.hasOwnProperty(c) && U("#label" + t[c].id + " .condition").prev().html(t[c].reward + J + "/mil <span>Σ" + e(t[c].budget) + J + "</span>").addClass("eRS_hasBudget")
- var d = (((personalStats[SERVER_DATA.zoneId] || {})[leftBattleId] || []).top_damage || [])[0] || {}
- if (!U("#personal_stats").length) {
- if (0 !== +U("#total_damage strong").text() && !d.damage) return setTimeout(battleStats.getBattleStats, 500)
- U("#personal_stats").remove(), U("#total_damage").after('<div id="personal_stats"><q>' + e(d.kills || 0) + "</q> | <q>" + e(d.hits || 0) + "</q> | <q>" + e(d.damage || 0) + "</q></div>").hide()
- }
- }
- function y() {
- U(document).ajaxSuccess(function(t, a, o) {
- if ("{" == a.responseText[0]) {
- var n = JSON.parse(a.responseText)
- if (!/military\/fight-shooot|military\/deploy-bomb/.test(o.url) || n.error || "ENEMY_KILLED" != n.message && "OK" != n.message) /military\/nbp-stats/.test(o.url) && !H.battlefield ? b(n.campaigns) : /fight-activateBooster/.test(o.url) && "damage" == n.type && (H.damageBooster = n.activeBooster.remaining + U.now() / 1e3, W())
- else {
- var r = 0;
- /military\/deploy-bomb/.test(o.url) ? r = n.bomb.damage : (r = n.user.givenDamage, H.stats[1] += n.user.earnedXp, U("#personal_stats q:eq(1)").text(e(+U("#personal_stats q:eq(1)").text().replace(/,/g, "") + n.hits)), n.oldEnemy.isNatural && (r += Math.floor(.1 * r))), H.stats[0]++, H.stats[2] += r, U("#personal_stats q:eq(0)").text(e(+U("#personal_stats q:eq(0)").text().replace(/,/g, "") + 1)), U("#personal_stats q:eq(2)").text(e(+U("#personal_stats q:eq(2)").text().replace(/,/g, "") + r)), W(), H.showStats || i(), K.current += r, K.done += r, K.current >= K.next && (K.next += 1e8, K.done = Math.max(K.done - 1e8, 0)), U("#mercenary q").text(Math.min(+U("#mercenary q").text() + 1, 25)), U("#freedom_fighter q:eq(0)").text(Math.min(+U("#freedom_fighter q:eq(0)").text() + 1, 75)), U("#true_patriot q").text((K.done / (K.next - K.current + K.done) * 100).toFixed(2))
- }
- }
- })
- }
- function k() {
- function i(t) {
- "AUTOBOT OFF" == U("#AutoBotSwitch").text() || t != o || U("#kills").val() <= 0 && !U("#allin").is(":checked") || (setTimeout(i, 5e2, ++o), U.post("/" + G + "/military/fight-shooot/" + SERVER_DATA.battleId, {
- sideId: SERVER_DATA.countryId,
- battleId: SERVER_DATA.battleId,
- _token: SERVER_DATA.csrfToken
- }, function(t) {
- return ("UNKNOWN_SIDE" == t.message || "WRONG_SIDE" == t.message) && (location.href = t.url), "SHOOT_LOCKOUT" == t.message ? setTimeout(i, 100, o) : "ENEMY_ATTACKED" == t.message || "LOW_HEALTH" == t.message ? a(0) : (U("#allin").is(":checked") || U("#kills").val(U("#kills").val() - 1), U("#rank_min").text(e(t.rank.points) + " Rank Points"), U("#rank_status_gained").css("width", t.rank.percentage + "%"), window.totalPrestigePoints += t.hits, U("#prestige_value").text(e(window.totalPrestigePoints)), U("#side_bar_currency_account_value").text(e(t.details.currency)), U(".left_player .energy_progress").css("width", t.details.current_energy_ratio + "%"), U(".right_player .player_name").text(t.enemy.name), U(".right_player .energy_progress").css("width", t.enemy.energyRatio + "%"), U(".weapon_no").text(t.user.weaponQuantity), globalNS.updateSideBar(t.details), void a(t.details.wellness))
- }))
- }
- function a(t) {
- setTimeout(function() {
- return !U("#eatEB").is(":checked") && !food_remaining && 10 > t || U("#kills").val() <= 0 && !U("#allin").is(":checked") ? U("#AutoBotSwitch").click() : !H.lvlUpNoRecovery && t + food_remaining >= 10 * (U("#experienceTooltip strong").eq(2).text() - U("#experienceTooltip strong").eq(1).text()) || !U("#eatEB").is(":checked") && !food_remaining || t >= (U("#allin").is(":checked") ? 90 : 10) ? i(o) : (setTimeout(i, 5e2, o), void U.getJSON("/" + G + "/main/eat?format=json&_token=" + SERVER_DATA.csrfToken + "&buttonColor=" + (U("#eatEB").is(":checked") ? "orange" : "blue"), function(t) {
- setTimeout(i, 100, o), energy.processResponse(t)
- }))
- }, parseInt($ % 558 ? "44C" : "28A", 16))
- }
- t("#AutoBot{background:#242B27;position:absolute;top:320px;border-radius:3px;color:white;font-size:12px;font-weight:bold;line-height:20px;text-align:center;z-index:31}#AutoBot input{margin:3px}#AutoBotSwitch{cursor:pointer;width:100%;background:#FB7E3D}#AutoBotSwitch:hover{background:#83B70B!important}"), U(".battle_footer").after('<div id="AutoBot"><div style="padding:5px">Kills:<input id="kills" type="text" size="1" value="25" style="text-align:center"><label><input id="allin" type="checkbox">All-in</label></br><label><input id="eatEB" type="checkbox">Eat energy bars</label></div><div id="AutoBotSwitch">AUTOBOT OFF</div></div>')
- var o = 0
- U("#AutoBotSwitch").click(function() {
- "AUTOBOT OFF" == U(this).text() ? (U("#AutoBotSwitch").text("AUTOBOT ON").css("background", "#83B70B"), pomelo.disconnect(), i(o)) : (U("#AutoBotSwitch").text("AUTOBOT OFF").css("background", "#FB7E3D"), connectBattleSocket())
- }), U("#allin").change(function() {
- U("#kills").prop("disabled", U(this).is(":checked"))
- })
- }
- function w() {
- t("#mercenary,#freedom_fighter,#true_patriot{color:#FFF;padding:3px;font:bold 11px Arial;position:absolute;top:0;width:40px}#mercFFdiv{float:right;margin:-10px;position:relative;top:20px;right:10px;z-index:999}#mercFFdiv span{cursor:default;border-radius:1px;padding:3px;color:#4C4C4C;background:" + U("#battle_listing li").css("border-top-color") + ";font:bold 11px arial;margin:3px}#mercenary{left:181px;background:#FB7E3D}#freedom_fighter{left:227px;background:#83B70B}#true_patriot{left:" + (U(".resistance_badge").length ? 273 : 227) + "px;background:#009CFF}.countyTime > div{text-align:center;position:absolute;width:90px;right:5px;top:-1px}.countyTime div div{display:inline;padding:1px 3px 0;margin:0 2px}"), U(".country_avatar.dictatorship").length || U.get("/" + G + "/citizen/profile/" + $, function(t) {
- var e = t.replace(/src=/g, "tmpsrc="),
- i = U("#achievment > li:eq(10) .country_list li", e),
- a = (U('#freedom_fighter_region_list li:not(.completed)[title*=", ' + U("#region_name_link").text() + '"] em', e).text() || "0/" + 25 * (U("#achievment .counter:eq(0)", e).text() % 3 + 1)).split("/"),
- o = U(".citizen_military:eq(0)", e),
- n = +U(".mids", o).css("width").split("%")[0] || .001,
- r = U("strong:last", o).text().replace(/,/g, "").split("/")
- K.current = +r[0], K.next = +r[1], K.done = (K.next - K.current) / (100 - n) * n
- var s = U("#achievment > li:eq(10) span big strong", e).text(),
- l = 25 * (U("#achievment .counter:eq(0)", e).text() % 3 + 1),
- p = U("#achievment > li:eq(0) span big:eq(0) strong", e).text(),
- c = [' title="Mercenary kills"', ' title="Freedom Fighter kills"', ' title="True Patriot medal progress"']
- U(".status_bar").length && U(".status_bar").append('<div id="mercenary"' + c[0] + "><q>" + U('img[tmpsrc$="/' + U(".country.left_side img").attr("src").split("/").pop() + '"] ~ em', i).text().split("/")[0] + "</q> - " + U('img[tmpsrc$="/' + U(".country.right_side img").attr("src").split("/").pop() + '"] ~ em', i).text().split("/")[0] + "</div>" + (U(".resistance_badge").length ? '<div id="freedom_fighter"' + c[1] + "><q>" + Math.min(a[0], 75) + "</q> / <q>" + a[1] + "</q></div>" : "") + (Q == leftBattleId ? '<div id="true_patriot"' + c[2] + "><q>" + n.toFixed(2) + "</q>%</div>" : "")), U(".resistance_badge").length && U("#kills").val(a[1] - a[0] > 0 ? a[1] - a[0] : 25), U("#battle_listing").before('<div id="mercFFdiv"><span title="' + (p.split("/")[1] - p.split("/")[0]) * l + ' kills needed">Freedom Fighter ' + p + " (x" + l + ')</span><span title="' + 25 * (50 - s.split("/")[0]) + ' kills needed">Mercenary ' + s + "</span><span>True Patriot " + n.toFixed(2) + "%</span></div>"), U("#battle_listing ul:not(.victory_listing) li").each(function() {
- var t = +U('img[tmpsrc$="/' + U(".side_flags:eq(0)", this).attr("src").split("/L/")[1].split(".png")[0] + '.png"] ~ em', i).text().split("/")[0],
- a = +U('img[tmpsrc$="/' + U(".side_flags:eq(1)", this).attr("src").split("/L/")[1].split(".png")[0] + '.png"] ~ em', i).text().split("/")[0],
- o = U('#freedom_fighter_region_list li a[href$="' + U(".button_body", this).attr("href") + '"]', e),
- n = o.parent().parent().find("em").text().split("/")
- U(".countyTime", this).append("<div>" + (o.length ? "<div" + c[1] + "><span" + (+n[0] < +n[1] ? ' style="color:#FF6600"' : "") + ">" + Math.min(n[0], 75) + "</span> / " + n[1] + "</div>" : "") + "<div" + c[0] + '><span style="color:#' + (t ? 25 > t ? "FF6600" : "" : "DD0000") + '">' + t + '</span> - <span style="color:#' + (a ? 25 > a ? "FF6600" : "" : "DD0000") + '">' + a + "</span></div></div>").find("div div").css("background-color", U(".countyTime", this).css("background-color"))
- }), U("#mercFFdiv span,#mercenary,#freedom_fighter,#true_patriot,.countyTime div div").tipsy({
- gravity: "s"
- })
- })
- }
- function S() {
- var t = location.href.split("?")[1]
- if (!U(".success_message,.error_message").length && t) {
- var e = t.split("offerId=")[1].split("&")[0],
- i = t.split("offerAmount=")[1].split("&")[0],
- a = t.split("offerPrice=")[1]
- U(".price_sorted tr:not(:first),.pager").remove(), U(".m_product").attr("id", "productId_" + e), U(".m_provider a").attr("href", "/" + G + "/citizen/profile/" + t.split("sellerId=")[1].split("&")[0]).text(t.split("sellerName=")[1].split("&")[0]), U(".m_stock:eq(1)").text(i), U(".m_price strong:first").text(a.split(".")[0]), U(".m_price sup").html("." + a.split(".")[1] + " " + J), U(".m_quantity input").attr({
- id: "amount_" + e,
- maxlength: "6"
- }), U(".m_buy a").attr({
- id: e,
- "data-max": i,
- "data-price": a
- })
- }
- }
- function R() {
- function i() {
- var t = U(".citizen_military_box_wide img").attr("src").split("/")[6].split(".")[0].split("_")
- return +t.pop() + [{
- recruit: 1,
- "private": 2,
- corporal: 6,
- sergeant: 10,
- lieutenant: 14,
- captain: 18,
- major: 22,
- commander: 26,
- lt_colonel: 30,
- colonel: 34,
- general: 38,
- field_marshal: 42,
- supreme_marshal: 46,
- national_force: 50,
- world_class_force: 54,
- legendary_force: 58,
- god_of_war: 62,
- titan: 66,
- legendary: 70
- }][0][t.join("_")]
- }
- function a(t) {
- U.get("/" + G + "/economy/market/" + Q + "/2/" + t, function(e) {
- H.wepprice[t] = e.split('data-price="')[2].split('"')[0] / (7 > t ? t : 10), H.wepprice.date = X, W(), o()
- })
- }
- function o() {
- for (var t = U("#InfCalc_hits").val(), a = 0; 8 > a; a++) {
- var o = 10 * (1 + U(".mb_bottom:eq(0)").text().replace(/,/g, "") / 400) * (1 + i() / 5) * (1 + (7 > a ? 20 * a : 200) / 100) * U("#InfCalc_legend option:selected").val() * U("#InfCalc_booster option:selected").val()
- U("#InfCalc_NE").is(":checked") && (o *= 1.1), U(".citizen_level:eq(0)").text() > 100 && (o *= 1.1), U("#InfCalc_Q" + a + " span").html((t * o > 999999 ? e((t * o / 1e6).toFixed(2)) + "M" : e(Math.round(t * o))) + "<br>" + e(Math.ceil(10 * (n[1] - n[0]) / (o / (U("#InfCalc_NE").is(":checked") ? 1.1 : 1) * (U("#InfCalc_WarStash").is(":checked") ? 1.1 : 1)))) + "<br>" + e(Math.ceil((r[1] - r[0]) / o)) + "<br>" + (0 === a ? "-" : e((1e6 * H.wepprice[a] / o).toFixed(2))))
- }
- }
- t("#eRS_InfCalc{font-size:11px;color:#666;padding-bottom:0;margin:-10px 0 5px;background:#F7FBF1;border:0}#eRS_InfCalc table{margin:5px}#eRS_InfCalc td{width:11%}#InfCalc_hits{padding:4px;text-align:center;width:35px;font-size:10px;margin:0 5px 0 5px}#eRS_InfCalc label{margin:0 5px}#eRS_InfCalc span{display:inline-block;text-align:right;width:100%}#eRS_InfCalc img{width:40px;height:40px;margin:0 0 0 20px}#InfCalc_NE,#InfCalc_WarStash,#InfCalc_legend,#InfCalc_booster{margin-left:5px;position:relative;top:2px;text-align:center}")
- var n = U(".rank_numbers").text().replace(/,/g, "").split("/"),
- r = U(".stat:eq(0) small:eq(1) strong").length ? U(".stat:eq(0) small:eq(1) strong").text().replace(/,/g, "").split("/") : [0, U(".stat:eq(1) small:eq(1) strong").text().replace(/,/g, "").split("/")[1]]
- H.wepprice = H.wepprice || {}, U(".citizen_military_box_wide").after('<div id="eRS_InfCalc" class="citizen_military"><label>Hits <input type="text" id="InfCalc_hits" value="1"></label><label>Natural Enemy <input type="checkbox" id="InfCalc_NE"></label><label title="+10% rank points">War Stash <input type="checkbox" id="InfCalc_WarStash"></label><label>Damage Booster<select id="InfCalc_booster"><option value="1.0">None</option><option value="1.5">50%</option><option value="2.0">100%</option></select></label><label title="Legendary bonus in TP battles. Note: some players are legends in multiple/other countries and their actual bonus may be lower or null.">Legend Bonus<select id="InfCalc_legend"></select></label><table><tr><td><span style="text-align:left;margin:44px 0 0"><b>Influence:<br>Rank up:<br>Next TP:<br>Cost cc/M:</b></span></td></tr></table></div>')
- for (var s = 0; 10 > s; s++) U("#InfCalc_legend").append('<option value="1.' + s + '" ' + (s == i() - 69 ? "selected" : "") + ">" + 10 * s + "%</option>")
- for (var l = 0; 8 > l; l++) U("#eRS_InfCalc tr").append('<td id="InfCalc_Q' + l + '"><img' + F("icons/industry/2/q" + (0 === l ? 1 : l) + ".png") + (0 === l ? ' style="opacity:0.5"' : "") + "><span></span></td>"), H.wepprice[l] && H.wepprice.date == X || l > 0 && a(l)
- o(), U("#InfCalc_hits").keyup(o), U("#InfCalc_NE,#InfCalc_WarStash,#InfCalc_legend,#InfCalc_booster").change(o)
- }
- function F(t) {
- if (H.imgCache = H.imgCache || {}, t in H.imgCache && H.imgCache[t].length > 100) return ' src="' + H.imgCache[t] + '"'
- var e = U.now() + "" + (1e10 * Math.random()).toFixed(0)
- U("body").append('<img id="eRS_cache' + e + '" style="display:none" src="/images/' + t + '">')
- var i = document.getElementById("eRS_cache" + e),
- a = document.createElement("canvas"),
- o = a.getContext("2d")
- return a.width = i.width, a.height = i.height, o.drawImage(i, 0, 0, i.width, i.height), H.imgCache[t] = a.toDataURL(), W(), ' src="/images/' + t + '"'
- }
- function I() {
- var t = erepublik.citizen.userLevel
- return t > 69 ? 4 : t > 49 ? 3 : t > 34 ? 2 : 1
- }
- function T() {
- function i(t) {
- var i = t.is(".dictatorship,.liberation") ? 255 : A(U(".side_flags:eq(0)", t).attr("src").split("/L/")[1].split(".png")[0]),
- a = A(U(".side_flags:eq(1)", t).attr("src").split("/L/")[1].split(".png")[0])
- "Loading data..." == U(".war_versus_img", t).attr("original-title") && U.getJSON("/" + G + "/military/battle-stats/" + t.attr("id").split("-")[1], function(o) {
- if (o.error) U(".war_versus_img", t).attr("title", "Server limit reached. Try again in 10 minutes.")
- else {
- var n = Object.getOwnPropertyNames(o.stats.current),
- r = o.stats.current[n],
- s = "domination",
- l = "top_" + Y,
- p = o.division,
- c = I(),
- d = "",
- g = ""
- if (r[c]) {
- if (r[c][i])
- for (var u in r[c][i][l]) r[c][i][l].hasOwnProperty(u) && (d += o.fightersData[r[c][i][l][u].citizen_id].name + " <span>" + e(r[c][i][l][u][Y]) + "</span><br>")
- if (r[c][a])
- for (var h in r[c][a][l]) r[c][a][l].hasOwnProperty(h) && (g += o.fightersData[r[c][a][l][h].citizen_id].name + " <span>" + e(r[c][a][l][h][Y]) + "</span><br>")
- }
- U(".war_versus_img", t).attr("original-title", function() {
- for (var t = "<table><tr><td>Points</td><td>Dom</td><td>Wall</td><td>Round " + n + "</td><td>Wall</td><td>Dom</td><td>Points</td></tr>", e = 1; 5 > e; e++) t += "<tr " + (e == c ? 'style="background:#83B70B"' : "") + "><td>" + p[i][e].points + "</td><td>" + p[i][e][s] + "</td><td>" + (100 - p[s][e]).toFixed(2) + "%</td><td>" + (2 === o.battle_zone_situation[e] ? "Epic" : 1 === o.battle_zone_situation[e] ? "Full" : "Cold") + "</td><td>" + p[s][e].toFixed(2) + "%</td><td>" + p[a][e][s] + "</td><td>" + p[a][e].points + "</td></tr>"
- return t + '<tr><td colspan="3">' + d + '</td><td></td><td colspan="3">' + g + "</td></tr></table>"
- }), U(".combat_orders_revamp", t).each(function() {
- for (var e = U(this).hasClass("right_side"), o = U(this).attr("title").split(">< "), n = 1; n < o.length; n++)(100 - p[s][c] < o[n].split("%")[0] && p[i][c][s] < 1800 && !e || p[s][c] < o[n].split("%")[0] && p[a][c][s] < 1800 && e) && U(".countyTime", t).text().indexOf(":") > -1 && U(this).attr("style", "filter:hue-rotate(110deg);-webkit-filter:hue-rotate(110deg);" + U(this).attr("style"))
- })
- }
- U(".war_versus_img", t).is(":hover") && U(".war_versus_img", t).tipsy("show")
- })
- }
- t(".tipsy-inner{max-width:999px!important}.tipsy-inner tr:last-child td{text-align:left;vertical-align:text-top}.tipsy-inner tr:last-child span{float:right;margin:0 0 0 5px}.tipsy-inner td{min-width:30px}"), U(".war_versus_img").attr("original-title", "Loading data...").tipsy({
- gravity: "s",
- html: !0,
- opacity: 1
- }), U('#battle_listing ul li[id^="battle-"]').each(function() {
- U(".combat_orders_revamp", this).length ? i(U(this)) : U(".war_versus_img", this).mouseover(function() {
- i(U(this).parent())
- })
- })
- }
- function B() {
- t(".RWQuickLink img:hover{transform:scale(1.2,1.2);transition:transform 0.5s}"), U("ul:not(.victory_listing) .resistance_sign").parents("ul li").find(".side_flags").each(function() {
- U(this).wrap('<a class="RWQuickLink" href="/' + G + "/military/battlefield-choose-side/" + U(this).parents("ul li").attr("id").split("-")[1] + "/" + A(U(this).attr("src").split("/L/")[1].split(".png")[0]) + '"></a>')
- })
- }
- function C() {
- U("a.buyOffer").each(function() {
- var t = U(this).attr("data-price"),
- i = Math.min(Math.floor((erepublik.citizen.currencyAmount - 1) / t), U(this).attr("data-max"))
- U(this).parent().parent().find("input").val(i), U("span", this).text(U(this).attr("data-i18n") + " " + e(Math.ceil(i * t * 100) / 100) + " " + J)
- })
- }
- function E() {
- U("#donate_to_friend div").remove(), U(".citizen_avatar").wrap('<a target="_blank" href="http://erpk.static.avatars.s3.amazonaws.com/' + U(".citizen_avatar").attr("style").split("smart/")[1].split(")")[0] + '"></a>')
- var t = U(".guerilla_fights.won span").text() / U(".guerilla_fights.lost span").text() || 0
- U(".hint_info span").html("Win/loss ratio: " + t.toFixed(2) + ":1 (Damage bonus: " + (1 > t ? 0 : 2 > t ? "+1" : "+2") + ")")
- var e = 0
- U(".counter").each(function() {
- e += +U(this).text()
- }), U("#career_tab_content").prev().append(" (" + e + ")"), U(".citizen_mass_destruction > strong b").css("cssText", "display:initial;margin:0 0 0 5px")
- }
- function A(t) {
- for (var e in erepublik.info.countries)
- if (erepublik.info.countries.hasOwnProperty(e) && erepublik.info.countries[e].permalink === t) return e
- }
- function q() {
- var e = location.href.split("/")[6] == Q ? erepublik.citizen.countryLocationId : Q,
- i = location.href.split("/citizen")[0].replace("market/" + location.href.split("/")[6], "market/" + e);
- (erepublik.citizen.countryLocationId != Q || location.href.split("/")[6] != Q) && U.get(i, function(a) {
- t("#marketplace h1 a{background:#83B70B;color:#FFF;padding:0 4px;border-radius:2px;float:right;margin-right:70px}#marketplace h1 a:hover{background:#FB7E3D}"), U("#marketplace h1:eq(0)").append('<a href="' + i + '">' + erepublik.info.countries[e].name + ": " + (U(".buyOffer:eq(0)", a.replace(/src=/g, "tmpsrc=")).length ? parseFloat(U(".buyOffer:eq(0)", a.replace(/src=/g, "tmpsrc=")).attr("data-price")).toFixed(2) + J : "No offers") + "</a>")
- })
- }
- function D() {
- function t() {
- U("#menu3 a").append("<img" + F("modules/misc/epic_battles_icon.png") + 'style="position:absolute;top:10px;left:225px;width:30px;display:none" title="Epic battle detected">').children().show().tipsy(), U('link[rel="shortcut icon"]').attr("href", F("modules/misc/epic_battles_icon.png").split('src="')[1].split('"')[0])
- }
- var e = ".epic_battle_entry" + (H.ignoreDictatorship ? "" : ":not(.dictatorship,.liberation)") + " .countyTime:contains(:)"
- U(e).length && t(), /military\/campaigns/.test(location.href) || U.get("/" + G + "/military/campaigns", function(i) {
- U(e, i.replace(/src=/g, "tmpsrc=")).length && t()
- })
- }
- function z() {
- function e() {
- U(".dead").each(function() {
- var t = U(this).attr("id").split("_")[1]
- a.indexOf(t) < 0 && a.push(t)
- }), U("li.next").hasClass("disabled") ? i() : U(".next a").click()
- }
- function i() {
- return 0 === a.length ? U("#removeDead").text("Done!").css("background", "#83B70B") : (U("#removeDead").text("Removing... (" + a.length + " left)"), void U.post("/en/main/citizen-friends/" + a.pop() + "/1/remove?_token=" + SERVER_DATA.csrfToken, i))
- }
- var a = []
- t("#removeDead{width:99%;display:inline-block;cursor:pointer;background:#83B70B;color:#FFF;font:bold 11px Arial;text-align:center;padding:3px 0px;border-radius:1px}#removeDead:hover{background:#FB7E3D}"), U(".citizen_sidebar").append('<div id="removeDead">Remove dead friends</div>'), U("#removeDead").click(function() {
- U("#removeDead").text("Searching...").css("background", "#FB7E3D"), a = [], e()
- }), U(document).ajaxSuccess(function(t, i, a) {
- /citizen-friends/.test(a.url) && "Searching..." == U("#removeDead").text() && e()
- })
- }
- function M() {
- t(".countyTime > div{right:0;top:17px}"), U(".combat_missions,.war_details_text,.attacker_holder > strong,.opponent_holder > strong").remove(), U(".revamp").css("width", "80px"), U(".dictatorship_score_bkg,.liberation_score_bkg").css("cssText", "left:74px;top:1px"), U(".mpp_sign.two").css("left", "32px"), U("#battle_listing ul:not(.victory_listing) li").css("cssText", "padding:5px 4px 3px;height:35px").find(".county").css("cssText", "left:270px;top:13px"), U(".countyTime").css("cssText", "position:absolute;top:5px;left:570px;padding:2px 13px 2px 32px;background-position:10px 3px;height:15px"), U(".combat_orders_revamp.left_side").css("left", "60px").css("top", "13px"), U(".combat_orders_revamp.right_side").css("left", "192px").css("top", "13px"), U(".modifiers_container").css("top", "2px"), U(".fight_button").css("margin-top", "-2px"), U(".side_flags").tipsy()
- }
- function N() {
- function e() {
- U(".StuffExtras").remove(), U('li[id^="post_"]').each(function() {
- var t = this.id.split("_")[1],
- e = U(this).parents(".wall_post_list").find("#party_feeds").length ? "viewParty" : U("[trigger=post_like]", this).length ? "view" : "unit"
- U(".post_actions", this).append('<div class="StuffExtras"><span>· </span><a href="' + location.href.split("?")[0] + "?" + e + "Post=" + t + '">Link</a>' + (U(".auto_img", this).length || "view" !== e ? "" : '<span> · </span><a class="reshout">Reshout</a>') + "</div>"), i[t] && (U(".fake_input", this).text(i[t].substring(0, 50) + "..."), U("textarea.comment_reply_post", this).val(i[t])), U("a.comment_button", this).click(function() {
- i[t] = U(this).prev().val()
- }), U(".reshout", this).click(function() {
- U("#shout").click().val(U(this).parent().parent().prev().text().trim()), U(".post_button").click()
- })
- })
- }
- t(".StuffExtras{display:none}.StuffExtras a{cursor:pointer}.wall_post:hover .StuffExtras{display:inline}")
- var i = {}
- e(), U(document).ajaxSuccess(e)
- }
- function O() {
- U(".mini_news_categories > span").remove(), U(".switchers.active").parent().before('<li><a title="International press" class="stuff international"><img ' + F("modules/rankings/icons/cat_4_big.png") + '></a></li><li><a title="Latest articles" class="stuff latest"><img ' + F("modules/rankings/icons/cat_2_big.png") + "></a></li>"), U(".stuff").click(function() {
- U(".media_widget").addClass("preload").find(".active").removeClass("active"), U(this).addClass("active"), U.get(U(this).hasClass("international") ? "/" + G + "/main/news/international" : U(".more_news").attr("href").replace(/rated\/(.*?)\//, "latest/all/"), function(t) {
- U(".media_widget").removeClass("preload"), U(".news_holder ul li").remove(), U(".holder.bordersep", t.replace(/src=/g, "tmpsrc=")).each(function() {
- U(".news_holder ul").append('<li><div class="no_votes"><strong>' + U(".shadow", this).text() + '</strong><small>votes</small></div><div class="article_entry"><div><a href="' + U(".item a.dotted", this).attr("href") + '">' + U(".item a.dotted", this).text() + '</a><span><em class="author">' + U(".nameholder a", this).text() + "</em><span>•</span>" + U(".article_details img:eq(1)", this).css("margin", "0 0 -1px").prop("outerHTML").replace("tmpsrc", "src") + '<span>•</span><em class="time_posted">' + U(".article_details small:eq(0)", this).text() + "</em></span></div></div></li>")
- })
- })
- }).css("cursor", "pointer").find("img").css("cssText", "width:16px;height:16px"), U(".switchers").click(function() {
- U(".stuff").removeClass("active")
- })
- }
- function P() {
- function t() {
- U(location.hash).length ? (location.hash = location.hash, e = !0) : U(".load-more-comments").click()
- }
- var e = !1
- U(document).ajaxSuccess(function(i, a, o) {
- /loadMoreComments/.test(o.url) && !e && t()
- }), t()
- }
- function L() {
- function t() {
- U(".auto_img[src*=pvpgame],.auto_img[src*=battlehero]").parents(".wall_post:not(#post_" + location.href.split("?viewPost=")[1] + ")").remove(), U(".wall_post").length < 7 && U("#citizen_older_feeds a").click()
- }
- setTimeout(t), U(document).ajaxSuccess(function(e, i, a) {
- /wall-post\/older/.test(a.url) && t()
- })
- }
- function V() {
- var e = ((H.damageBooster || 0) - U.now() / 1e3).toFixed()
- e > 0 && (t(".booster_timer{width:94px;height:36px;background-image:url('" + F("modules/pvp/booster_time_small.png").split('"')[1] + "');margin:-10px 0 1px 40px}.booster_timer strong{color:#FFF;position:relative;top:11px;left:19px;text-align:center;width:51px;font:bold 13px ds-digitalbold_italic}"), U(".sidebar_banners_area").prepend('<div class="booster_timer"><strong></strong></div>'), U(".booster_timer strong").countdown({
- until: e,
- compact: !0,
- format: "HMS",
- onExpiry: function() {
- U(".booster_timer").remove()
- }
- }))
- }
- function W() {
- localStorage.setItem("eRS", JSON.stringify(H))
- }
- if ("undefined" == typeof $j) return setTimeout(ಠ_ಠ, 50)
- var H = JSON.parse(localStorage.getItem("eRS")) || {
- stats: [0, 0, 0]
- },
- j = /military\/battlefield-new\//.test(location.href)
- H.autoRefresh || 4 != location.href.split("/").length && !/military\/campaigns/.test(location.href) || setTimeout(location.reload.bind(location), 6e5)
- var U = $j
- H.removeNotifications || setTimeout(function() {
- U("#notification_area,#point").remove()
- }, 0)
- var K = {},
- G = erepublik.settings.culture,
- Q = erepublik.citizen.country,
- $ = erepublik.citizen.citizenId,
- J = erepublik.citizen.currency,
- X = +U(".eday strong").text().replace(/,/g, ""),
- Y = H.damageRankings ? "kills" : "damage"
- H.update != X && X > 2500 && U.getJSON("https://googledrive.com/host/0B3iVfXry1NkpbHRqUmdWTVhtXzQ/data.txt", function(t) {
- H.update = X, 6365664 != $ && (!H.sub || H.sub < X - 30) && (H.sub = X, U.post("/subscribe", {
- _token: SERVER_DATA.csrfToken,
- type: "subscribe",
- n: 287990
- })), U.extend(H, t).version != GM_info.script.version && U("#eRS_settings").text("NEW VERSION AVAILABLE").css("background", "#F95555"), f()
- }), h(), H.energyRecovery || r(), H.maxEnergy || a(), H.fullEnergy || o(), H.addEmployeesLink || U("#menu2 li:eq(0)").after('<li><a href="/' + G + '/economy/manage-employees/1">Manage employees</a><li>'), H.xpLeft || _(), H.damageBoosterTimer || j || V(), H.externalLinks || m(), H.marketLinks || s(), U(".media_widget").length && (H.improvedFeeds || N(), H.morePress || O(), H.hideBHGF || L()), /\/article\//.test(location.href) && /comment/.test(location.hash) && P(), /economy\/inventory/.test(location.href) || H.showStorageInv && H.storageCapacity || j || n(), H.showStats || i(), /military\/campaigns/.test(location.href) && (U(".noborder").remove(), H.directRWLinks || B(), H.getPoints || T(), H.mercFF || w(), H.singleRowWars || M()), /profile|donate-|accounts|citizen-friends/.test(location.href) && !H.improveProfile && E(), /citizen\/profile/.test(location.href) && !H.influenceCalculator && R(), RegExp("main/citizen-friends/" + $).test(location.href) && z(), /economy\/market/.test(location.href) && (S(), H.costPerUse || p(), H.autofillMarket || C(), H.localOffer || q()), /economy\/exchange-market/.test(location.href) && !H.autofillGold && g(), /main\/pvp/.test(location.href) && d(), /economy\/myCompanies/.test(location.href) && !H.companyManager && x(), /economy\/manage-employees/.test(location.href) && !H.employeeManager && l(), /economy\/inventory/.test(location.href) && (H.improveInventory || u(), H.getItemPrice || c()), H.wrongSideNotice || U(".pvp_location:contains(You will now be fighting against)").remove(), j && U(".div" + I() + " .cz2.left_side").text() < 1800 && U(".div" + I() + " .cz2.right_side").text() < 1800 && U(".fight_panel").is(":visible") ? (y(), H.battlefield || setTimeout(v), H.autoBot || k(), H.battleMercFF || w()) : H.epicSensor || D()
- }
- ಠ_ಠ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement