NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name GATHQ // @namespace Gatmaxx baby // @description GAT tisztek reszere keszult script // @author karaj22 // @contributor Xavinyo // @version 1.64 // @include /^https?://www\.erepublik\.com/\w{2}/military/battlefield/\d+$/ // @include /^https?://www\.erepublik\.com/\w{2}/military/battlefield-new/\d+$/ // @include /^https?://www\.erepublik\.com/\w{2}/citizen/profile/\d+$/ // @include /^https?://www\.erepublik\.com/\w{2}$/ // @updateURL https://gat.kelengye.hu/pulse/gathq.meta.js // @downloadURL https://gat.kelengye.hu/pulse/gathq.user.js // ==/UserScript== var $; var SERVER_DATA = unsafeWindow.SERVER_DATA; var version; function sendData(query_data, url, type) { sent_url = url; sent_query_data = query_data; //console.log(url + "?" + query_data); $.ajax({ type: type, url: url, cache: false, data: sent_query_data, timeout: 5000 }); } function updateBattle(battle, side){ var url = "https://www.erepublik.com/en/military/nbp-stats/" + battle; $.getJSON(url) .done(function (json) { if(json.zone_finished == true){ var query = ""; query += "battleId=" + battle + "&defenderId=" + side + "&active=0"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('a#prio_' + battle + ' > span').text('Lejárt!'); } else{ $('a#prio_' + battle + ' > span').text('Még fut!'); } }) .fail(function (jqxhr, textStatus, error) { var err = textStatus + ", " + error; console.log("Request Failed: " + err); }); } function updateDO(battle, side){ var url = "https://www.erepublik.com/en/military/nbp-stats/" + battle; $.getJSON(url) .done(function (json) { if(json.zone_finished == true){ var query = ""; query += "battleId=" + battle + "&do=1&active=0"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('a#do_' + battle + ' > span').text('Lejárt!'); } else{ $('a#do_' + battle + ' > span').text('Még fut!'); } }) .fail(function (jqxhr, textStatus, error) { var err = textStatus + ", " + error; console.log("Request Failed: " + err); }); } function renderButtons() { if (window.location.href.match('/citizen/profile/')) { var html = "<div id='kanoc_section' style=\"position: relative; padding: 5px; float: left; width: 580px; margin-bottom: 100px\">"; html += "<a id='kanoc_add_civil' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/kanoc_bg.jpg') repeat-x top left; color: white;\">Civilként felvesz</a>"; html += "<a id='kanoc_add_katona' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/kanoc_bg.jpg') repeat-x top left; color: white;\">Katonaként felvesz</a>"; html += "<a id='kanoc_add_szv' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/hk_bg.jpg') repeat-x top left; color: white;\">Szakaszvezetőként felvesz</a>"; html += "<a id='kanoc_add_tiszt' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/hk_bg.jpg') repeat-x top left; color: white;\">Tisztként felvesz</a>"; html += "<a id='kanoc_add_pkh' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/hk_bg.jpg') repeat-x top left; color: white;\">Parancsnokhelyettesként felvesz</a>"; html += "<a id='kanoc_add_pk' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/hk_bg.jpg') repeat-x top left; color: white;\">Parancsnokként felvesz</a>"; html += "<a id='kanoc_add_poszt' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/kanoc_bg.jpg') repeat-x top left; color: white;\">Poszthumuszként felvesz</a>"; html += "<a id='kanoc_del' href='javascript:;' style=\"margin: 0px 5px; border: 0; font-weight: bold; text-align: center; padding: 8px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; float: left; width: auto; background: url('https://gat.kelengye.hu/img/erepublik/kanoc_bg.jpg') repeat-x top left; color: white;\">Töröl</a>"; html += "</div>"; $(".citizen_sidebar").after(html); $(".citizen_profile_header.auth > h2 > a").remove(); var citizenId = window.location.href.split("/")[6]; var citizenName = $('.citizen_profile_header.auth > h2').text().trim(); var citizenAvatar = $('img.citizen_avatar').attr('style').substring(75, 118); var strength = parseInt($('.citizen_military:eq(0) > h4').text().trim().replace(",","")); var mrp = parseInt($('.citizen_military:eq(1) > div.stat > small > strong').text().split("/")[0].replace(",","").replace(",","").replace(",","")); var query = "citizenId=" + citizenId + "&citizenName=" + citizenName + "&citizenAvatar=" + citizenAvatar + "&strength=" + strength + "&mrp=" + mrp; $('#kanoc_add_civil').click(function () { query += "&citizenStatus=tag"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_civil').text('OK'); }); $('#kanoc_add_katona').click(function () { query += "&citizenStatus=katona"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_katona').text('OK'); }); $('#kanoc_add_szv').click(function () { query += "&citizenStatus=szakaszvezeto"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_szv').text('OK'); }); $('#kanoc_add_tiszt').click(function () { query += "&citizenStatus=tiszt"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_tiszt').text('OK'); }); $('#kanoc_add_poszt').click(function () { query += "&citizenStatus=poszthumusz tag"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_poszt').text('OK'); }); $('#kanoc_add_pk').click(function () { query += "&citizenStatus=parancsnok"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_pk').text('OK'); }); $('#kanoc_add_pkh').click(function () { query += "&citizenStatus=parancsnok helyettes"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_add_pkh').text('OK'); }); $('#kanoc_del').click(function () { query += "&delete=1"; sendData(query, "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#kanoc_del').text('OK'); }); } else if (window.location.href.match('/military/battlefield/') || window.location.href.match('/military/battlefield-new/')) { var defenderId = 0; var invaderId = 0; if (typeof (SERVER_DATA) != 'undefined') { var html = "<div id='priogombok' style='margin: 0px auto 55px; clear: both;'>\n" html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: -330px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió *</small>"; html += "<a id='priority_add_1' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: -230px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió **</small>"; html += "<a id='priority_add_2' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: -130px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió ***</small>"; html += "<a id='priority_add_3' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 60px;left: -200px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Eltüntet</small>"; html += "<a id='priority_add_4' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: 130px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió *</small>"; html += "<a id='priority_add_5' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: 230px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió **</small>"; html += "<a id='priority_add_6' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 20px;left: 330px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Prió ***</small>"; html += "<a id='priority_add_7' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 60px;left: 200px;width: auto;'><tbody><tr><td>"; html += "<div class='priority_add' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Eltüntet</small>"; html += "<a id='priority_add_8' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Küld</strong></a></div></td></tr></tbody></table>"; html += "</div>"; $("#pvp").after(html); var battleId = SERVER_DATA.battleId; var defenderId = SERVER_DATA.defenderId; var invaderId = SERVER_DATA.invaderId; if (window.location.href.match('/military/battlefield/')) { var region = $('#pvp_header > h2').text(); } else { var region = $('#region_name_link').text(); } var query = "battleId=" + battleId + "&defenderId=" + defenderId + "&invaderId=" + invaderId + "®ion=" + region; $('#priority_add_1').click(function() { sendData(query + "&priority=1", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_1 > strong').text('OK'); }); $('#priority_add_2').click(function() { sendData(query + "&priority=2", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_2 > strong').text('OK'); }); $('#priority_add_3').click(function() { sendData(query + "&priority=3", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_3 > strong').text('OK'); }); $('#priority_add_4').click(function() { sendData(query + "&active=0", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_4 > strong').text('OK'); }); $('#priority_add_5').click(function() { sendData(query + "&priority=1", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_5 > strong').text('OK'); }); $('#priority_add_6').click(function() { sendData(query + "&priority=2", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_6 > strong').text('OK'); }); $('#priority_add_7').click(function() { sendData(query + "&priority=3", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_7 > strong').text('OK'); }); $('#priority_add_8').click(function() { sendData(query + "&active=0", "https://gat.kelengye.hu/pulse/gathq.php", "GET"); $('#priority_add_8 > strong').text('OK'); }); } } else { var html = "<table width='100%' style='margin: 0 auto -25px;position: relative;top: 0px;left: 0px;width: auto;'><tbody><tr><td>"; html += "<div id='kanoc_prio_update' style='cursor: default;display: block;height: 25px;width: auto;' original-title='Kattints!'>"; html += "<small style='background-image: url(\"/images/modules/pvp/influence_left.png?1309432605\");background-position: left center;color: #FFFFFF;display: block;float: left;font-size: 11px;font-weight: bold;height: 25px;line-height: 25px;opacity: 0.7;padding: 0 5px;text-shadow: 0 1px 1px #333333;'>Lejárt csaták</small>"; html += "<a id='kanoc_prio' href='javascript:;'><strong style='color:#fff;text-shadow:#014471 0px 1px 0px;float:left;display:block;width:35px;height:25px;font-size:12px;line-height:25px;padding:0 5px;background-image:url(\"/images/modules/pvp/influence_right.png?1309432605\");background-position:right'>Frissít</strong></a></div></td></tr></tbody></table>"; // if ($('#orderContainer').length) { $("#battle_listing").after(html); // } $('#kanoc_prio').click(function () { $('li.prio_battle').each(function (){ var battle = $(this).attr('id'); var side = $(this).attr('side'); updateBattle(battle, side); }); $('li.do_battle').each(function (){ var battle = $(this).attr('id'); var side = $(this).attr('side'); updateDO(battle, side); }); $('#kanoc_prio > strong').text('OK'); }); } } function main() { version = 1.4; renderButtons(); } function waitJQuery() { if (typeof (unsafeWindow.jQuery) != 'function') { setTimeout(function () { waitJQuery(); }, 200); } else { $ = unsafeWindow.jQuery; main(); } } waitJQuery();