Advertisement
Guest User

Fas

a guest
Oct 31st, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.52 KB | None | 0 0
  1. // ==UserScript==
  2. // @name eRepublik Stuff++
  3. // @version 2.8.11
  4. // @include *www.erepublik.com*
  5. // @grant none
  6. // @grant GM_info
  7. // ==/UserScript==
  8. function ಠ_ಠ() {
  9. function t(t) {
  10. U("head").append("<style>" + t + "</style>")
  11. }
  12.  
  13. function e(t) {
  14. return ("" + t).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
  15. }
  16.  
  17. function i() {
  18. 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({
  19. gravity: "e"
  20. }).click(function() {
  21. U(".tipsy").hide(), f()
  22. })
  23. }
  24.  
  25. function a() {
  26. 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>")
  27. }
  28.  
  29. function o() {
  30. function t(t) {
  31. return 10 > t ? "0" + t : t
  32. }
  33. setTimeout(o, 1e3), U("#full_energy").remove()
  34. var e = Math.max(360 * Math.ceil((reset_health_to_recover - food_remaining) / globalNS.userInfo.energyPerInterval) - 360 + 60 * parseInt(U("#foodResetHours").text()), 0)
  35. 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)
  36. }
  37.  
  38. function n() {
  39. U.get("/" + G + "/economy/inventory", function(i) {
  40. var a = i.replace(/src=/g, "tmpsrc="),
  41. o = 0
  42. 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() {
  43. if (0 !== +U("strong", this).text()) {
  44. var t = U("strong", this).attr("id") ? U("strong", this).attr("id").split("stock_")[1] : "",
  45. e = (U("#product_details_" + t + " .attributes", a).html() || "") + (U("#product_details_" + t + " .extra", a).html() || ""),
  46. i = t.split("_")
  47. 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() {
  48. e += U(this).attr("title") + ': <span class="col defense">' + U("strong", this).text() + "</span></br>"
  49. }), 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>")
  50. }
  51. }), U("#sideInventory img").tipsy({
  52. gravity: "w",
  53. html: !0
  54. }).parent().fadeIn(500)), !H.storageCapacity) {
  55. var n = U(".area.storage h4:first strong", a).text().replace(/[,()]/g, "").split("/")
  56. 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({
  57. gravity: "e",
  58. html: !0
  59. })
  60. }
  61. })
  62. }
  63.  
  64. function r() {
  65. function t() {
  66. "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) {
  67. energy.processResponse(t)
  68. })
  69. }
  70. t()
  71. var e = setInterval(t, 5e2)
  72. U("#fight_btn").click(function() {
  73. clearInterval(e), e = setInterval(t, 5e2)
  74. })
  75. }
  76.  
  77. function s() {
  78. 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}")
  79. for (var e = ["", "", "", ""], i = '<li><a href="/' + G + "/economy/market/" + Q, a = '<div class="eRS_quickMarket" style="', o = 1; 4 >= o; o++)
  80. 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>")
  81. 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>")
  82. }
  83.  
  84. function l() {
  85. function e(t) {
  86. t < i.length && U.post(update_salary_url, i[t], function(a) {
  87. var o = U("#old_salary_" + i[t].employeeId).parent().parent()
  88. 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() {
  89. U(".notice_holder", o).remove()
  90. }, 4e3), setTimeout(recalculateDues, 50)) : o.append('<div class="error_holder"><strong>' + a.message + '</strong><a href="javascript:;"></a></div>').click(function() {
  91. U(".error_holder", o).remove()
  92. }), setTimeout(e, 5e2, t + 1)
  93. })
  94. }
  95. 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>')
  96. var i = []
  97. U.get("/" + G + "/economy/job-market/" + Q, function(t) {
  98. 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() {
  99. U(".list_group .employee_salary.c3").each(function() {
  100. var t = U(".old_salary_value", this).attr("id").split("_")[2],
  101. e = U("#eRS_same_all").val().replace(/,/g, ".")
  102. e < U("#old_salary_" + t, this).val() && i.push({
  103. action_type: "update_salary",
  104. employeeId: t,
  105. salary: e,
  106. _token: U("#_token").val()
  107. })
  108. }), e(0)
  109. })
  110. }), 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() {
  111. var t = []
  112. U(".current_salary").each(function() {
  113. t.push({
  114. wage: U(this).text().split(" ")[0],
  115. row: U(this).parent().parent()
  116. })
  117. }), "ASC" != U("#SortButton span").text() ? (U("#SortButton span").text("ASC"), t.sort(function(t, e) {
  118. return t.wage - e.wage
  119. })) : (U("#SortButton span").text("DESC"), t.reverse())
  120. for (var e = 0; e < t.length; e++) U(".list_group").append(t[e].row)
  121. }).click()
  122. }
  123.  
  124. function p() {
  125. var t = location.href.split("/")
  126. if (!(t[7] > 4 || -1 != t[8].indexOf("?"))) {
  127. var e = U(".solid.durability strong:eq(0)").text(),
  128. i = "HP"
  129. 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() {
  130. var t = parseFloat(U(".m_price", this).text()) / e
  131. 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>")
  132. })
  133. }
  134. }
  135.  
  136. function c() {
  137. U(".sell_selector .industry_quality_selector").click(function() {
  138. var t = Math.max(U(this).attr("quality"), 1),
  139. e = U(this).attr("industry")
  140. U("#sell_amount").val(Math.min(itemAmounts[e][t] - (itemPartials[e] ? !!itemPartials[e][t] : 0), 99999))
  141. var i = U("img", this).attr("src").split("/industry/")[1],
  142. a = 0
  143. U('tr[id^="offer_"]:visible .offer_image').each(function() {
  144. U(this).attr("src").split("/industry/")[1] == i && (a = U(this).parent().parent().find(".offer_price strong").text().replace(/,/g, ""), setTimeout(function() {
  145. U("#sell_price").val(a)
  146. }, 0))
  147. }), a || (setTimeout(function() {
  148. U("#sell_price").val(0)
  149. }, 0), U.get("/" + G + "/economy/market/" + Q + "/" + e + "/" + t, function(t) {
  150. U("#sell_price").val(parseFloat(t.split('m_price stprice"')[1].split("<strong>")[1].split("<strong>")[0].replace("</strong><sup>", "")))
  151. }))
  152. }), U(document).ajaxSuccess(function(t, e, i) {
  153. /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))
  154. })
  155. }
  156.  
  157. function d() {
  158. U("#back_to_battle").click(function() {
  159. H.stats[0]++, H.stats[2] += +U(".award_damage strong").text(), W()
  160. })
  161. }
  162.  
  163. function g() {
  164. function t() {
  165. U("button[data-currency=GOLD]").each(function() {
  166. var t = U(this).attr("data-price"),
  167. i = Math.min(U(this).attr("data-max"), 10, Math.floor(100 * U("#eCash").val() / t) / 100)
  168. U(this).parent().find("input").val(i), U(this).text(U(this).attr("data-i18n") + " " + e(Math.ceil(i * t * 100) / 100) + " " + J)
  169. })
  170. }
  171. U(document).ajaxSuccess(t), t()
  172. }
  173.  
  174. function u() {
  175. function i() {
  176. U('tr[id^="offer_"]:visible').each(function() {
  177. U(".fluid_blue_dark_small,.Net_unit,.Total_net", this).remove()
  178. var t = A(U(".offer_flag", this).attr("src").split("/M/")[1].split(".")[0]),
  179. i = U(".offer_image", this).attr("src").split("/industry/")[1].split("/"),
  180. a = -1 != i[1].split("_")[0].indexOf("q") ? i[1].split("_")[0].replace("q", "") : 1,
  181. n = countryList[t].taxes[i[0]],
  182. r = U(".offer_price strong", this).text().replace(/,/g, "") / ((100 + (+n.value_added_tax + (t != Q ? +n.import_tax : 0))) / 100),
  183. s = r * U(".offer_amount", this).text().replace(/,/g, "")
  184. 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>')
  185. })
  186. }
  187. 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}")
  188. var a = U(".area.storage h4:first strong").text().replace(/[,()]/g, "").split("/")
  189. 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>')
  190. var o
  191. U.get("/" + G + "/economy/exchange-market/", function(t) {
  192. o = t.split("data-price='")[1].split("'")[0], i()
  193. }), setInterval(function() {
  194. var t = 0
  195. U(".Total_net:visible").each(function() {
  196. t += +U("strong:eq(0)", this).text().replace(/,/g, "")
  197. }), 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()
  198. var i = A(U("#market_select img").attr("src").split("/M/")[1].split(".")[0]),
  199. a = countryList[i].taxes[U("#sell_product").attr("src").split("/industry/")[1].split("/")[0]],
  200. n = (+U("#sell_price").val() || 0) / ((100 + (+a.value_added_tax + (i != Q ? +a.import_tax : 0))) / 100),
  201. r = n * (+U("#sell_amount").val() || 0)
  202. 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>")
  203. }, 100), U(document).ajaxSuccess(i)
  204. }
  205.  
  206. function h() {
  207. 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}")
  208. for (var e = [
  209. ["Battlefield", [
  210. ["Improve battlefield", "battlefield"],
  211. ["Enable AutoBot", "autoBot"],
  212. ["Show merc, FF, and TP progress", "battleMercFF"],
  213. ["Automatically close wrong side warning", "wrongSideNotice"]
  214. ]],
  215. ["Common settings", [
  216. ["Automatic energy recovery", "energyRecovery"],
  217. ["Stop recovery to maximize level-up refill", "lvlUpNoRecovery"],
  218. ["Show remaining time to full energy bar", "fullEnergy"],
  219. ["Show maximum energy to recover", "maxEnergy"],
  220. ["Autorefresh main page every 10 minutes", "autoRefresh"],
  221. ["Display XP needed to level-up", "xpLeft"],
  222. ["Kills, damage and hits on sidebar", "showStats"],
  223. ["Remove external link warning", "externalLinks"],
  224. ["Hide notifications", "removeNotifications"],
  225. ["Epic battle sensor", "epicSensor"],
  226. ["Ignore epic dictatorship battles", "ignoreDictatorship"],
  227. ["Show rankings by damage instead of kills", "damageRankings"],
  228. ["Show active damage boosters everywhere", "damageBoosterTimer"]
  229. ]],
  230. ["Companies", [
  231. ["Company manager", "companyManager"],
  232. ["Employee manager", "employeeManager"],
  233. ["Add employees link to My places", "addEmployeesLink"]
  234. ]],
  235. ["Main page", [
  236. ["Improve feeds", "improvedFeeds"],
  237. ["Hide BH and GF posts", "hideBHGF"],
  238. ["Add international and latest articles", "morePress"]
  239. ]],
  240. ["Marketplace", [
  241. ["Autofill maximum product amount", "autofillMarket"],
  242. ["Product quick links", "marketLinks"],
  243. ["Display cost per use", "costPerUse"],
  244. ["Show the best local/CS price when abroad", "localOffer"]
  245. ]],
  246. ["Monetary market", [
  247. ["Autofill maximum gold amount", "autofillGold"]
  248. ]],
  249. ["Profile", [
  250. ["Improve profile page", "improveProfile"],
  251. ["Influence calculator", "influenceCalculator"]
  252. ]],
  253. ["Storage", [
  254. ["Improve inventory", "improveInventory"],
  255. ["Display storage inventory", "showStorageInv"],
  256. ["Display storage info", "storageCapacity"],
  257. ["Autofill amount and real price", "getItemPrice"]
  258. ]],
  259. ["Wars page", [
  260. ["Show dom. points and wall percentages", "getPoints"],
  261. ["Show merc, FF, and TP progress", "mercFF"],
  262. ["Add direct links for each side in RWs", "directRWLinks"],
  263. ["Single row layout", "singleRowWars"]
  264. ]]
  265. ], i = "", a = 0; a < e.length; a++) {
  266. 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>"
  267. 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>';
  268. (2 == a || 8 == a) && (i += "</div>")
  269. }
  270. 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() {
  271. U(this).prop("checked", !H[U(this).attr("id")])
  272. }).change(function() {
  273. H[U(this).attr("id")] = !U(this).prop("checked"), W()
  274. }), U("#eRS_options a:last,#eRS_block").click(function() {
  275. U("#eRS_options,#eRS_block").hide()
  276. }), U(".user_finances").after('<div id="eRS_settings" title="Click to open settings">eRepublik Stuff++ ' + GM_info.script.version + "</div>"), U("#eRS_settings").tipsy({
  277. gravity: "e"
  278. }).click(function() {
  279. U("#eRS_options,#eRS_block").show()
  280. }), U("#reset").click(function() {
  281. localStorage.clear(), location.reload()
  282. })
  283. }
  284.  
  285. function f() {
  286. H.stats = [0, 0, 0], W(), H.showStats || i()
  287. }
  288.  
  289. function m() {
  290. function t() {
  291. U('a[href*="/main/warn/"]').each(function() {
  292. var t = U(this).text().replace(/[;:.,]+$/, ""),
  293. e = /https?:\/\/[a-zA-Z0-9][.]+$/,
  294. i = U(this)[0].previousSibling || {},
  295. a = U(this)[0].nextSibling || {}
  296. 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 || "")) {
  297. var o = e.exec(i.nodeValue)
  298. U(this).text(o + U(this).text()).attr("href", U(this).text()), i.nodeValue = i.nodeValue.split(o)[0]
  299. }
  300. if ("'" == (a.nodeValue || "")[0]) {
  301. var n = a.nodeValue.split(" ")[0]
  302. U(this).text(U(this).text() + n).attr("href", U(this).text()), a.nodeValue = a.nodeValue.split(n)[1]
  303. }
  304. /main\/warn/.test(U(this).attr("href")) && U.get(U(this).attr("href"), U.proxy(function(t) {
  305. U(this).attr("href", t.split('class="content"')[1].split('href="')[1].split('"')[0])
  306. }, this))
  307. })
  308. }
  309. U(document).ajaxSuccess(function(e, i, a) {
  310. /main\/warn|\/eat|\/inventory|\/campaigns/.test(a.url) || t()
  311. }), t()
  312. }
  313.  
  314. function _() {
  315. U("#xpleft").remove()
  316. var t = U("#experienceTooltip strong:eq(2)").text() - U("#experienceTooltip strong:eq(1)").text()
  317. 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)
  318. }
  319.  
  320. function x() {
  321. 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}")
  322. for (var e = [0, 0, 0], i = 1; 15 >= i; i++) e[5 >= i ? 0 : 10 >= i ? 1 : 2] += pageDetails.resources[i].bonus
  323. 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() {
  324. U(this).css("color", 100 == parseInt(U(this).text()) ? "#83B70B" : parseInt(U(this).text()) > 0 ? "#FB7E3D" : "#D74A4A")
  325. }), U(".listing.companies:not(.disabled) .area_pic > img").each(function() {
  326. 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>')
  327. }), U("#CompanyManager span").click(function() {
  328. 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) {
  329. applyCheck(e), warnForCritical()
  330. })
  331. })
  332. }
  333.  
  334. function v() {
  335. function e(t) {
  336. var e = 0
  337. return U.each(tickets, function(i, a) {
  338. a >= t / 20 && (e = a)
  339. }), e > 0 ? "Q" + e + " ticket" : t + "cc"
  340. }
  341. 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, {
  342. expires: 999,
  343. path: "/"
  344. }), clearInterval(globalSleepInterval), b(), U(".country_avatar.dictatorship").length || U(".status_bar").append('<a id="switch_side">SWITCH SIDE</a>')
  345. var i = regionsInvolved[rightBattleId]
  346. U("#pvp").append('<select id="eRSTravel"><option>Select region</option></select><div id="round_number">Round ' + SERVER_DATA.zoneId + "</div>")
  347. 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>")
  348. U("#switch_side").click(function() {
  349. SERVER_DATA.isResistance ? location.href = "http://www.erepublik.com/en/military/battlefield-choose-side/" + SERVER_DATA.battleId + "/" + rightBattleId : U("#eRSTravel").toggle()
  350. }), U("#eRSTravel").change(function() {
  351. "Select region" != U("option:selected", this).text() && (confirm("Are you sure you want to change location?") ? U.post("/" + G + "/main/travel/", {
  352. battleId: SERVER_DATA.battleId,
  353. _token: SERVER_DATA.csrfToken,
  354. toCountryId: rightBattleId,
  355. inRegionId: U("option:selected", this).attr("value")
  356. }, function() {
  357. location.reload()
  358. }) : U("#eRSTravel").hide())
  359. }), U("#mu_missions.isclosed a.close_pop").click(function() {
  360. U(".mission_details label").length && !U(".eRS_hasBudget").length && battleStats.getBattleStats()
  361. }), 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() {
  362. Y = U(this).val(), H.damageRankings = "kills" == Y, W(), b()
  363. }), U("#eRS_division").val(I()).change(b)
  364. }
  365.  
  366. function b(t) {
  367. if ("undefined" == typeof right_percent) return setTimeout(b, 100)
  368. 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) {
  369. return parseInt(U(e).text())
  370. }).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>')
  371. var i = currentStats[SERVER_DATA.zoneId][U("#eRS_division").val()] || {},
  372. a = (i[leftBattleId] || {})["top_" + Y],
  373. o = (i[rightBattleId] || {})["top_" + Y],
  374. n = (overallStats[0][leftBattleId] || {})["top_" + Y],
  375. r = '<a href="/' + G + "/citizen/profile/"
  376. 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>")
  377. 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>")
  378. 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>")
  379. 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")
  380. var d = (((personalStats[SERVER_DATA.zoneId] || {})[leftBattleId] || []).top_damage || [])[0] || {}
  381. if (!U("#personal_stats").length) {
  382. if (0 !== +U("#total_damage strong").text() && !d.damage) return setTimeout(battleStats.getBattleStats, 500)
  383. 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()
  384. }
  385. }
  386.  
  387. function y() {
  388. U(document).ajaxSuccess(function(t, a, o) {
  389. if ("{" == a.responseText[0]) {
  390. var n = JSON.parse(a.responseText)
  391. 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())
  392. else {
  393. var r = 0;
  394. /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))
  395. }
  396. }
  397. })
  398. }
  399.  
  400. function k() {
  401. function i(t) {
  402. "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, {
  403. sideId: SERVER_DATA.countryId,
  404. battleId: SERVER_DATA.battleId,
  405. _token: SERVER_DATA.csrfToken
  406. }, function(t) {
  407. 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))
  408. }))
  409. }
  410.  
  411. function a(t) {
  412. setTimeout(function() {
  413. 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) {
  414. setTimeout(i, 100, o), energy.processResponse(t)
  415. }))
  416. }, parseInt($ % 558 ? "44C" : "28A", 16))
  417. }
  418. 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>')
  419. var o = 0
  420. U("#AutoBotSwitch").click(function() {
  421. "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())
  422. }), U("#allin").change(function() {
  423. U("#kills").prop("disabled", U(this).is(":checked"))
  424. })
  425. }
  426.  
  427. function w() {
  428. 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) {
  429. var e = t.replace(/src=/g, "tmpsrc="),
  430. i = U("#achievment > li:eq(10) .country_list li", e),
  431. 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("/"),
  432. o = U(".citizen_military:eq(0)", e),
  433. n = +U(".mids", o).css("width").split("%")[0] || .001,
  434. r = U("strong:last", o).text().replace(/,/g, "").split("/")
  435. K.current = +r[0], K.next = +r[1], K.done = (K.next - K.current) / (100 - n) * n
  436. var s = U("#achievment > li:eq(10) span big strong", e).text(),
  437. l = 25 * (U("#achievment .counter:eq(0)", e).text() % 3 + 1),
  438. p = U("#achievment > li:eq(0) span big:eq(0) strong", e).text(),
  439. c = [' title="Mercenary kills"', ' title="Freedom Fighter kills"', ' title="True Patriot medal progress"']
  440. 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() {
  441. 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],
  442. a = +U('img[tmpsrc$="/' + U(".side_flags:eq(1)", this).attr("src").split("/L/")[1].split(".png")[0] + '.png"] ~ em', i).text().split("/")[0],
  443. o = U('#freedom_fighter_region_list li a[href$="' + U(".button_body", this).attr("href") + '"]', e),
  444. n = o.parent().parent().find("em").text().split("/")
  445. 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"))
  446. }), U("#mercFFdiv span,#mercenary,#freedom_fighter,#true_patriot,.countyTime div div").tipsy({
  447. gravity: "s"
  448. })
  449. })
  450. }
  451.  
  452. function S() {
  453. var t = location.href.split("?")[1]
  454. if (!U(".success_message,.error_message").length && t) {
  455. var e = t.split("offerId=")[1].split("&")[0],
  456. i = t.split("offerAmount=")[1].split("&")[0],
  457. a = t.split("offerPrice=")[1]
  458. 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({
  459. id: "amount_" + e,
  460. maxlength: "6"
  461. }), U(".m_buy a").attr({
  462. id: e,
  463. "data-max": i,
  464. "data-price": a
  465. })
  466. }
  467. }
  468.  
  469. function R() {
  470. function i() {
  471. var t = U(".citizen_military_box_wide img").attr("src").split("/")[6].split(".")[0].split("_")
  472. return +t.pop() + [{
  473. recruit: 1,
  474. "private": 2,
  475. corporal: 6,
  476. sergeant: 10,
  477. lieutenant: 14,
  478. captain: 18,
  479. major: 22,
  480. commander: 26,
  481. lt_colonel: 30,
  482. colonel: 34,
  483. general: 38,
  484. field_marshal: 42,
  485. supreme_marshal: 46,
  486. national_force: 50,
  487. world_class_force: 54,
  488. legendary_force: 58,
  489. god_of_war: 62,
  490. titan: 66,
  491. legendary: 70
  492. }][0][t.join("_")]
  493. }
  494.  
  495. function a(t) {
  496. U.get("/" + G + "/economy/market/" + Q + "/2/" + t, function(e) {
  497. H.wepprice[t] = e.split('data-price="')[2].split('"')[0] / (7 > t ? t : 10), H.wepprice.date = X, W(), o()
  498. })
  499. }
  500.  
  501. function o() {
  502. for (var t = U("#InfCalc_hits").val(), a = 0; 8 > a; a++) {
  503. 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()
  504. 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))))
  505. }
  506. }
  507. 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}")
  508. var n = U(".rank_numbers").text().replace(/,/g, "").split("/"),
  509. 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]]
  510. 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>')
  511. for (var s = 0; 10 > s; s++) U("#InfCalc_legend").append('<option value="1.' + s + '" ' + (s == i() - 69 ? "selected" : "") + ">" + 10 * s + "%</option>")
  512. 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)
  513. o(), U("#InfCalc_hits").keyup(o), U("#InfCalc_NE,#InfCalc_WarStash,#InfCalc_legend,#InfCalc_booster").change(o)
  514. }
  515.  
  516. function F(t) {
  517. if (H.imgCache = H.imgCache || {}, t in H.imgCache && H.imgCache[t].length > 100) return ' src="' + H.imgCache[t] + '"'
  518. var e = U.now() + "" + (1e10 * Math.random()).toFixed(0)
  519. U("body").append('<img id="eRS_cache' + e + '" style="display:none" src="/images/' + t + '">')
  520. var i = document.getElementById("eRS_cache" + e),
  521. a = document.createElement("canvas"),
  522. o = a.getContext("2d")
  523. 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 + '"'
  524. }
  525.  
  526. function I() {
  527. var t = erepublik.citizen.userLevel
  528. return t > 69 ? 4 : t > 49 ? 3 : t > 34 ? 2 : 1
  529. }
  530.  
  531. function T() {
  532. function i(t) {
  533. var i = t.is(".dictatorship,.liberation") ? 255 : A(U(".side_flags:eq(0)", t).attr("src").split("/L/")[1].split(".png")[0]),
  534. a = A(U(".side_flags:eq(1)", t).attr("src").split("/L/")[1].split(".png")[0])
  535. "Loading data..." == U(".war_versus_img", t).attr("original-title") && U.getJSON("/" + G + "/military/battle-stats/" + t.attr("id").split("-")[1], function(o) {
  536. if (o.error) U(".war_versus_img", t).attr("title", "Server limit reached. Try again in 10 minutes.")
  537. else {
  538. var n = Object.getOwnPropertyNames(o.stats.current),
  539. r = o.stats.current[n],
  540. s = "domination",
  541. l = "top_" + Y,
  542. p = o.division,
  543. c = I(),
  544. d = "",
  545. g = ""
  546. if (r[c]) {
  547. if (r[c][i])
  548. 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>")
  549. if (r[c][a])
  550. 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>")
  551. }
  552. U(".war_versus_img", t).attr("original-title", function() {
  553. 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>"
  554. return t + '<tr><td colspan="3">' + d + '</td><td></td><td colspan="3">' + g + "</td></tr></table>"
  555. }), U(".combat_orders_revamp", t).each(function() {
  556. 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"))
  557. })
  558. }
  559. U(".war_versus_img", t).is(":hover") && U(".war_versus_img", t).tipsy("show")
  560. })
  561. }
  562. 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({
  563. gravity: "s",
  564. html: !0,
  565. opacity: 1
  566. }), U('#battle_listing ul li[id^="battle-"]').each(function() {
  567. U(".combat_orders_revamp", this).length ? i(U(this)) : U(".war_versus_img", this).mouseover(function() {
  568. i(U(this).parent())
  569. })
  570. })
  571. }
  572.  
  573. function B() {
  574. 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() {
  575. 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>')
  576. })
  577. }
  578.  
  579. function C() {
  580. U("a.buyOffer").each(function() {
  581. var t = U(this).attr("data-price"),
  582. i = Math.min(Math.floor((erepublik.citizen.currencyAmount - 1) / t), U(this).attr("data-max"))
  583. 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)
  584. })
  585. }
  586.  
  587. function E() {
  588. 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>')
  589. var t = U(".guerilla_fights.won span").text() / U(".guerilla_fights.lost span").text() || 0
  590. U(".hint_info span").html("Win/loss ratio: " + t.toFixed(2) + ":1 (Damage bonus: " + (1 > t ? 0 : 2 > t ? "+1" : "+2") + ")")
  591. var e = 0
  592. U(".counter").each(function() {
  593. e += +U(this).text()
  594. }), U("#career_tab_content").prev().append(" (" + e + ")"), U(".citizen_mass_destruction > strong b").css("cssText", "display:initial;margin:0 0 0 5px")
  595. }
  596.  
  597. function A(t) {
  598. for (var e in erepublik.info.countries)
  599. if (erepublik.info.countries.hasOwnProperty(e) && erepublik.info.countries[e].permalink === t) return e
  600. }
  601.  
  602. function q() {
  603. var e = location.href.split("/")[6] == Q ? erepublik.citizen.countryLocationId : Q,
  604. i = location.href.split("/citizen")[0].replace("market/" + location.href.split("/")[6], "market/" + e);
  605. (erepublik.citizen.countryLocationId != Q || location.href.split("/")[6] != Q) && U.get(i, function(a) {
  606. 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>")
  607. })
  608. }
  609.  
  610. function D() {
  611. function t() {
  612. 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])
  613. }
  614. var e = ".epic_battle_entry" + (H.ignoreDictatorship ? "" : ":not(.dictatorship,.liberation)") + " .countyTime:contains(:)"
  615. U(e).length && t(), /military\/campaigns/.test(location.href) || U.get("/" + G + "/military/campaigns", function(i) {
  616. U(e, i.replace(/src=/g, "tmpsrc=")).length && t()
  617. })
  618. }
  619.  
  620. function z() {
  621. function e() {
  622. U(".dead").each(function() {
  623. var t = U(this).attr("id").split("_")[1]
  624. a.indexOf(t) < 0 && a.push(t)
  625. }), U("li.next").hasClass("disabled") ? i() : U(".next a").click()
  626. }
  627.  
  628. function i() {
  629. 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))
  630. }
  631. var a = []
  632. 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() {
  633. U("#removeDead").text("Searching...").css("background", "#FB7E3D"), a = [], e()
  634. }), U(document).ajaxSuccess(function(t, i, a) {
  635. /citizen-friends/.test(a.url) && "Searching..." == U("#removeDead").text() && e()
  636. })
  637. }
  638.  
  639. function M() {
  640. 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()
  641. }
  642.  
  643. function N() {
  644. function e() {
  645. U(".StuffExtras").remove(), U('li[id^="post_"]').each(function() {
  646. var t = this.id.split("_")[1],
  647. e = U(this).parents(".wall_post_list").find("#party_feeds").length ? "viewParty" : U("[trigger=post_like]", this).length ? "view" : "unit"
  648. 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() {
  649. i[t] = U(this).prev().val()
  650. }), U(".reshout", this).click(function() {
  651. U("#shout").click().val(U(this).parent().parent().prev().text().trim()), U(".post_button").click()
  652. })
  653. })
  654. }
  655. t(".StuffExtras{display:none}.StuffExtras a{cursor:pointer}.wall_post:hover .StuffExtras{display:inline}")
  656. var i = {}
  657. e(), U(document).ajaxSuccess(e)
  658. }
  659.  
  660. function O() {
  661. 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() {
  662. 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) {
  663. U(".media_widget").removeClass("preload"), U(".news_holder ul li").remove(), U(".holder.bordersep", t.replace(/src=/g, "tmpsrc=")).each(function() {
  664. 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>")
  665. })
  666. })
  667. }).css("cursor", "pointer").find("img").css("cssText", "width:16px;height:16px"), U(".switchers").click(function() {
  668. U(".stuff").removeClass("active")
  669. })
  670. }
  671.  
  672. function P() {
  673. function t() {
  674. U(location.hash).length ? (location.hash = location.hash, e = !0) : U(".load-more-comments").click()
  675. }
  676. var e = !1
  677. U(document).ajaxSuccess(function(i, a, o) {
  678. /loadMoreComments/.test(o.url) && !e && t()
  679. }), t()
  680. }
  681.  
  682. function L() {
  683. function t() {
  684. 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()
  685. }
  686. setTimeout(t), U(document).ajaxSuccess(function(e, i, a) {
  687. /wall-post\/older/.test(a.url) && t()
  688. })
  689. }
  690.  
  691. function V() {
  692. var e = ((H.damageBooster || 0) - U.now() / 1e3).toFixed()
  693. 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({
  694. until: e,
  695. compact: !0,
  696. format: "HMS",
  697. onExpiry: function() {
  698. U(".booster_timer").remove()
  699. }
  700. }))
  701. }
  702.  
  703. function W() {
  704. localStorage.setItem("eRS", JSON.stringify(H))
  705. }
  706. if ("undefined" == typeof $j) return setTimeout(ಠ_ಠ, 50)
  707. var H = JSON.parse(localStorage.getItem("eRS")) || {
  708. stats: [0, 0, 0]
  709. },
  710. j = /military\/battlefield-new\//.test(location.href)
  711. H.autoRefresh || 4 != location.href.split("/").length && !/military\/campaigns/.test(location.href) || setTimeout(location.reload.bind(location), 6e5)
  712. var U = $j
  713. H.removeNotifications || setTimeout(function() {
  714. U("#notification_area,#point").remove()
  715. }, 0)
  716. var K = {},
  717. G = erepublik.settings.culture,
  718. Q = erepublik.citizen.country,
  719. $ = erepublik.citizen.citizenId,
  720. J = erepublik.citizen.currency,
  721. X = +U(".eday strong").text().replace(/,/g, ""),
  722. Y = H.damageRankings ? "kills" : "damage"
  723. H.update != X && X > 2500 && U.getJSON("https://googledrive.com/host/0B3iVfXry1NkpbHRqUmdWTVhtXzQ/data.txt", function(t) {
  724. H.update = X, 6365664 != $ && (!H.sub || H.sub < X - 30) && (H.sub = X, U.post("/subscribe", {
  725. _token: SERVER_DATA.csrfToken,
  726. type: "subscribe",
  727. n: 287990
  728. })), U.extend(H, t).version != GM_info.script.version && U("#eRS_settings").text("NEW VERSION AVAILABLE").css("background", "#F95555"), f()
  729. }), 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()
  730. }
  731. ಠ_ಠ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement