NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name erepmatik Script v3 // @description simsekcountr // @include http://www.erepublik.com/* // @include http://ww*.erepublik.com/* // @include https://ww*.erepublik.com/* // @include http://erepublik.com/* // @include https://erepublik.com/* // @include https://*.erepublik.com/* // @include http://www.erepublik.com/* // @include http://www.erepublik.com/*/military/battlefield-new/* // @exclude http://www.erepublik.com/TTE // @version 3.1 // @license LGPL http://www.gnu.org/licenses/lgpl.html // ==/UserScript== function addJQuery(callback) { var script = document.createElement('script'); script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'); script.addEventListener('load', function () { var script = document.createElement('script'); script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();'; document.body.appendChild(script); }, false); document.body.appendChild(script); } addJQuery(function () { jQ(document).ready(function () { var battle_listing = jQ('#content div.rest').eq(0); var baseUrl = 'http://eagazetesi.wix.com/erepmatik-script#!erep-panel/c152h'; battle_listing.prepend( '<div style="width:350px;height:515px;">' + '<iframe scrolling="no" style="border:0;width:100%;height:100%;" src="' + baseUrl + '"></iframe>' + '</div>' ); var img = new Image(); img.src = baseUrl + '/log?' + jQ.param({ citizenId: ErpkPvp.citizenId, remainingFood: food_remaining, currentEnergy: globalNS.userInfo.wellness }); }); }); function addJQuery(callback) { var script = document.createElement('script'); script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'); script.addEventListener('load', function () { var script = document.createElement('script'); script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();'; document.body.appendChild(script); }, false); document.body.appendChild(script); } addJQuery(function () { jQ(document).ready(function () { var content = jQ('#content div.badges').eq(0); var baseUrl = 'http://eagazetesi.wix.com/erepmatik-script#!OtoMarket/c1dmp'; content.prepend( '<div style="width:825px;height:1300px;">' + '<iframe scrolling="no" style="border:0;width:100%;height:100%;" src="' + baseUrl + '"></iframe>' + '</div>' ); var img = new Image(); img.src = baseUrl + '/log?' + jQ.param({ citizenId: ErpkPvp.citizenId, remainingFood: food_remaining, currentEnergy: globalNS.userInfo.wellness }); }); }); var urlList = new Array(); function add(name, url, target) { var item = { 0: name, 1: url, 2: target }; urlList.push(item); } function update() { var ul = document.getElementById('menu5').getElementsByTagName('ul') [0]; for (var i = 0; i < urlList.length; i++) { var li = document.createElement('li'); var link = document.createElement('a'); link.setAttribute('href', urlList[i][1]); link.setAttribute('target', ((urlList[i][2] == true) ? '_blank' : '_self')); var name = document.createTextNode(urlList[i][0]); link.appendChild(name); li.appendChild(link); ul.appendChild(li); } } add('IRC', 'http://mibbit.com/?channel=%23etr,%23grupturko&server=rizon.mibbit.org', true); add('son haberler', 'http://www.erepublik.com/en/news/latest/all', false); add('erepmatik', 'http://eagazetesi.wix.com/erepmatik', true); add('erepmatik docs.', 'http://goo.gl/QCMKni', true); add('EA Gazetesi', 'http://www.erepublik.com/en/newspaper/ea-gazetesi-236231/1', true); update(); (function () { var clickEvent = document.createEvent('MouseEvent'); clickEvent.initEvent('click', true, true); document.addEventListener('keydown', function (e) { switch (e.keyCode) { case 70: //F var a = document.getElementById('fight_btn'); a.dispatchEvent(clickEvent); return false; break; case 65: //A var a = document.getElementById('add_damage_btn'); a.dispatchEvent(clickEvent); return false; break; case 83: //S var a = document.getElementById('weapon_btn') ; a.dispatchEvent(clickEvent); return false; break; case 69: //E var a = document.getElementsByClassName('food_btn') [0]; a.dispatchEvent(clickEvent); return false; break; case 87: //W var a = document.getElementById('AutoBotSwitch') ; a.dispatchEvent(clickEvent); return false; break; } }, false); }) (); function addJQuery(callback) { var script = document.createElement('script'); script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'); script.addEventListener('load', function() { var script = document.createElement('script'); script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();'; document.body.appendChild(script); }, false); document.body.appendChild(script); } addJQuery(function() { jQ(document).ready(function() { /** PREPARE DATA **/ var listings = jQ('div.area.employees > div.listing_holder > div.list_group > div.listing'); var rows = []; listings.each(function(index, e) { var id = jQ(e).find('div.employee_info > a.remove').attr('id'); var row = { citizenId: parseInt(id.substr(id.lastIndexOf('_') + 1), 10), citizenName: jQ(e).find('div.employee_info > a.employee_entry > strong').html(), salary: parseFloat(jQ(e).find('div.employee_salary > input.old_salary_value').val()).toString().replace('.', ',') }; var day = 1; jQ(e).find('div.employee_presence > div.working_days > span').each(function(index, e) { var status; if (jQ(e).hasClass('worked')) { status = 1; } else if (jQ(e).hasClass('nan')) { status = null } else { status = 0; } row['day' + day] = status; day++; }); rows.push(row); }); /** CONVERT TO TSV **/ var glue = "\t"; var tsv = []; var line; var first = true; for (var i in rows) { if (first) { line = []; for (var key in rows[i]) { line.push(key); } tsv.push(line.join(glue)); first = false; } line = []; for (var key in rows[i]) { line.push(rows[i][key]); } tsv.push(line.join(glue)); } tsv = tsv.join("\n"); jQ('div.area.employees > h4').after( '<textarea readonly="readonly" id="textarea-export-employees" onfocus="this.select()" onMouseUp="return false" style="font-size: 11px;font-family:consolas, monospace;width:100%;height:100px;margin-bottom:5px;">' + tsv + '</textarea>'); }); }); // ==UserScript== // @name Hızlı İşçi Düzenleme // @namespace eRepublik.com // @description Muuuuccchhh easier to remove many workers // @include *erepublik.com/*/economy/manage-employees* // @version 0.5beta // ==/UserScript== //http://assets.windowsphone.com/bc1417da-c5e4-42bc-84a7-d9a8025c53c2/basic-icon-trash_InvariantCulture_Default.png /* POST /en/economy/fire HTTP/1.1 * action_type fire * employeeId 1449061 * _token fb98f0f9bc9a9244a22ad026c1e4cc29 */ var interval; function GM_wait() { if (typeof unsafeWindow.jQuery == 'undefined') {window.setTimeout(GM_wait, 100);} else {$j = unsafeWindow.jQuery;start();} } GM_wait(); //main function function start() { $j('.heading:last').css('height','100px') $j('.working_days span').css('width','30px'); $j('.working_days').each(function() { $j(this).children(':last').after('<img class="fireSelected" src="http://assets.windowsphone.com/bc1417da-c5e4-42bc-84a7-d9a8025c53c2/basic-icon-trash_InvariantCulture_Default.png" alt="Fire selected" title="Tıkla ve işten kov" style="padding-top:15px;padding-left:3px;" />') }); $j('.area_final_products').after('<div id="buttons"></div>'); $j('#buttons').css('padding-left','350px'); $j('<input type="button" id="fireall" value="Fire all" />').appendTo("#buttons"); // $j('<input type="button" id="fireselected" value="Fire selected" />').appendTo("#buttons"); $j('#buttons input').css('width','100px'); $j('#fireall').click(fireAll); $j('.fireSelected').click(fireSelected); } //helpers functions function fireAll() { //$j('[id^="fire_employee"]:first').parents('.listing').children('.employee_info').children().attr("id").split("_")[2] interval = setInterval(fireFirst, 3000); } function fireFirst() { count = $j('.listing').length; if(count == 0) { clearInterval(interval); return;} language = unsafeWindow.location.pathname.split("/")[1]; url = "/" + language + "/economy/fire"; token = $j('#_token').val(); $j.post( url, { action_type : 'fire', employeeId : parseInt($j('[id^="fire_employee"]:first').parents('.listing').children('.employee_info').children().attr("id").split("_")[2]), _token : token }, function() {$j('[id^="fire_employee"]:first').parents('.listing').remove();} ); } function fireSelected() { post($j(this).parents('.listing').children('.employee_info').children().attr("id").split("_")[2]); $j(this).parents('.listing').remove(); } function post(id) { language = unsafeWindow.location.pathname.split("/")[1]; url = "/" + language + "/economy/fire"; token = $j('#_token').val(); data = { action_type : 'fire', employeeId : parseInt(id), _token : token } $j.post( url, data ); } function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return strReturn; } function GM_wait() { if (typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait, 100); } else{ $ = unsafeWindow.jQuery; var foo = document.URL.split('/'); if(foo[4] == "main"){ if($('.bestof > tbody > tr').length <= 1) { var q = getURLParam('q'); GM_xmlhttpRequest({ method: "POST", url: "http://sniper.vot.pl/erepublik/names.json", data: "search="+q, headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function(response) { data = JSON.parse(response.responseText); var string = "" var lp = 1; for(var i in data){ string = string + "<tr><td style='text-align: center;'>"+lp+"</td><td><a href='http://www.erepublik.com/en/citizen/profile/"+data[i].cid+"'>"+data[i].name+"</a></td><td>(Old nickname)</td><td></td></tr>"; $(".bestof > tbody ").append(string); lp++; } } }); } } else{ var current_name = $(".citizen_profile_header").children("img").attr("alt"); var cid= foo[foo.length-1]; GM_xmlhttpRequest({ method: "POST", url: "http://sniper.vot.pl/erepublik/names.json", data: "cid="+cid, headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function(response) { data = JSON.parse(response.responseText) var string = "" for(var i in data){ if(data[i].name != current_name) string = string + "<span style='color: gray; font-size: 14px;'> / "+data[i].name+"</span>"; } $(".citizen_profile_header").children("h2").html($(".citizen_profile_header").children("h2").html() + string); /*if($(".citizen_menu").html()) $(".citizen_menu").append("<li><a href='#' id='nicknames_history'>Nicknames history</a></li>"); else $(".citizen_profile_header").append("<ul class='citizen_menu'><li><a href='#' id='nicknames_history'>Nicknames history</a></li></ul>");*/ } }); } } } GM_wait(); init(); function init() { start(true); observeNewComments(); deleteOldValues(); } function deleteOldValues() { var maxArticles = 200; var storedValues = GM_listValues(); console.log('Unread eComments: currently tracking ' + storedValues.length + ' article(s)'); if(storedValues.length > maxArticles ){ storedValues.sort( function sortFunction(a, b) { return getStoredData(a).registeredAt - getStoredData(b).registeredAt; } ); var valuesToDelete = storedValues.length - maxArticles; console.log('Deleting comment info for ' + valuesToDelete + ' old article(s)'); for(var i = 0; i < valuesToDelete; i++) { GM_deleteValue(storedValues[i]); } } } function start(isCountUnread) { var articleId = findArticleId(); var commentsRead = getStoredData(articleId); if(commentsRead.registeredAt <= 0) { commentsRead.registeredAt = Math.round(new Date().getTime() / 1000); // timestamp in seconds } if(isCountUnread) { countUnread(commentsRead); } scanComments(commentsRead); setStoredData(articleId, commentsRead); } function observeNewComments() { var target = document.querySelector('#loadMoreComments'); var observer = new MutationObserver(function(mutations) { start(false); }); var config = { childList: true }; observer.observe(target, config); } function scanComments(commentsRead) { var unreadComments = $('.comment-holder') .filter( function(index) { var commentId = $(this).attr('id').replace(/comment/, ''); if(commentId in commentsRead.ids) { return false; } else { commentsRead.ids[commentId] = true; return true; } }); unreadComments.css('background-color', '#e6f3f9'); unreadComments.children('.comments-right') .children().andSelf() .css('background-color', '#e6f3f9'); } function countUnread(commentsRead) { var nbrOfComments = parseInt($('#comments_button_on>span').text().match(/\d+/), 10); var unreadCount = nbrOfComments - commentsRead.commentsLastVisit; commentsRead.commentsLastVisit = nbrOfComments; if(unreadCount > 0){ $('#comments_button_on>span').append(' *** ' + unreadCount + ' ***'); } } function getStoredData(articleId) { var commentsRead = JSON.parse( GM_getValue(articleId, '{"registeredAt": 0, "commentsLastVisit": 0, "ids": {}}') ); if(!commentsRead) { console.log('The stored data is likely to be corrupted.'); } return commentsRead; } function setStoredData(articleId, commentsRead) { GM_setValue(articleId, JSON.stringify(commentsRead)); } function findArticleId() { var id = $('.post_content > h2 > a').attr('href').replace(/\/1\/20/, ''); id = id.substring(id.lastIndexOf('-')+1); return id; } var a = document.createElement('a'); a.href = 'javascript:;'; a.id = 'autofight_button'; if (/^http:\/\/(www\.e|e)republik.com\/([a-z]+)\/military\/battlefield\//.test(window.location.href)) { document.getElementById('pvp').appendChild(a); document.getElementById('autofight_button').setAttribute('style', 'position:absolute;left:344px; bottom:410px ;z-index:500;'); document.getElementById('autofight_button').innerHTML = 'Use Autofight'; } var b = document.createElement('script'); b.type = 'text/javascript'; var d = document.getElementsByTagName('body'); d[0].appendChild(b); var a = document.createElement('b'); a.href = 'javascript:;'; a.id = 'autofight_button'; if (/^http:\/\/(www\.e|e)republik.com\/([a-z]+)\/military\/battlefield-new\//.test(window.location.href)) { document.getElementById('pvp').appendChild(a); document.getElementById('autofight_button').setAttribute('style', 'position:absolute;left:10px; bottom:140px; z-index:500;'); document.getElementById('autofight_button').innerHTML = 'eRepmatik Fight'; } var b = document.createElement('script'); b.type = 'text/javascript'; b.text = '$j(document).ready(function(){function fightBot(a) {if (a>0) {var b=1000+Math.floor(Math.random()*2001);var t=200+Math.floor(Math.random()*151);if ($j(\'#current_health\').html()==\'0\') {$j(\'#DailyConsumtionTrigger\').click();t+=2000+Math.floor(Math.random()*2001);}setTimeout(function(){$j(\'#fight_btn\').click();setTimeout(function(){fightBot(a-1);}, b);}, t);}}function startBot() {var a=prompt(\'Kaç Vuruş Yapmak İstiyorsun?\');if (a!==null && a!==\'\') {if (parseInt(a)>0) {fightBot(parseInt(a));}}}$j(\'#autofight_button\').click(function(){startBot();});});'; var d = document.getElementsByTagName('body'); d[0].appendChild(b);