Advertisement
dezindzer

mala moja u paraboličnim štiklama

May 10th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. // ==UserScript==
  2. // @run-at document-start
  3. // @author www.dezindzer.com
  4. // @name RW dizach
  5. // @description Skripta za dizanje RW-ova
  6. // @version 1.0
  7. // @include http://www.erepublik.com/*
  8. // @include http://economy.erepublik.com/*
  9. // @include http://static.erepublik.com/*
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
  11. // @require http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js
  12. // ==/UserScript==
  13.  
  14. var ResistanceForceInsert = function($, window, undefined) {
  15. function rwHelper() {
  16. if(!alreadyFunder && !$(this).hasClass('disabled')){
  17. $.post('/en/military/rw-support', {type : 'fund', _token: SERVER_DATA.csrfToken}, function(response){
  18. if(!response.error){
  19. alreadySupporter = true;
  20. alreadyFunder = true;
  21. if(SERVER_DATA.funders_count + 1 == 10){
  22. $("div.fighters_needed p").html("The resistance war will start any minute now!");
  23. }
  24. financeIt();
  25. if(SERVER_DATA.is_citizen){
  26. var ca;
  27. ca = $('.citizenship_currency_amount strong');
  28. var currency_ammount = parseInt(ca.html())
  29. ca.html(currency_ammount - 1000);
  30. }
  31. $('#funders_count_small').text(SERVER_DATA.funders_count + 1);
  32. $('#funders_count').text(10 - SERVER_DATA.funders_count - 1);
  33. $("#fundRW_btn").addClass('disabled')
  34. .attr("title", SERVER_DATA.messages["already_funder"])
  35. .tipsy({gravity: 's'});
  36. $("#supportRW_btn").addClass('disabled')
  37. .attr("title", SERVER_DATA.messages['confirm_supporter'])
  38. .tipsy({gravity: 's'});
  39. }else{
  40. if(response.message == "ALREADY_FUNDED"){
  41. alreadySupporter = true;
  42. alreadyFunder = true;
  43. $("#fundRW_btn").addClass('disabled')
  44. .attr("title", SERVER_DATA.messages["already_funder"])
  45. .tipsy({gravity: 's'});
  46. $("#supportRW_btn").addClass('disabled')
  47. .attr("title", SERVER_DATA.messages['confirm_supporter'])
  48. .tipsy({gravity: 's'});
  49. }else if(response.message == "RECENTLY_CONQUERED"){
  50. rwError(SERVER_DATA.messages['err_too_early']+response.time);
  51. }else if(response.message == "ONGOING_RW_CAMPAIGN"){
  52. rwError(SERVER_DATA.messages['err_ongoing_rw']+response.region);
  53. }else if(response.message == "ONGOING_CAMPAIGN"){
  54. rwError(SERVER_DATA.messages['err_ongoing']);
  55. }else if(response.message == "INSUFFICIENT_FUNDS"){
  56. rwError(SERVER_DATA.messages['err_funds']);
  57. }
  58. }
  59. }, 'json');
  60. }else{
  61. rwError(SERVER_DATA.messages['already_funder']);
  62. }
  63. };
  64. $(document).ready(function () {
  65. if (location.href == 'http://www.erepublik.com/en') {
  66. if ($('#fundRW_btn').length > 0) {
  67. rwHelper();
  68. } else {
  69. // autoRefresh
  70. }
  71. }
  72. });
  73. };
  74. // Script Insert
  75. var script = document.createElement('script');
  76. script.textContent = '(' + ResistanceForceInsert + ')(jQuery, window);';
  77. document.body.appendChild(script);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement