iShout MOD

Mass Shout in erepublik for e-Iran MOD

  1. // ==UserScript==
  2. // @author iMan
  3. // @name iShout MOD
  4. // @namespace iShout for e-Iran MOD
  5. // @description Mass Shout in erepublik for e-Iran MOD
  6. // @version 1.0.0
  7. // @match http://www.erepublik.com/en
  8. // @match https://www.erepublik.com/en
  9. // @match http://www.erepublik.com/fa
  10. // @match https://www.erepublik.com/fa
  11. // @include http://www.erepublik.com/en
  12. // @include https://www.erepublik.com/en
  13. // @include http://www.erepublik.com/fa
  14. // @include https://www.erepublik.com/fa
  15. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
  16. // ==/UserScript==
  17.  
  18. var LANG = typeof unsafeWindow.erepublik.settings.culture == "undefined" ? unsafeWindow.culture : unsafeWindow.erepublik.settings.culture;
  19. var temp = $(".user_name").attr("href").split("/");
  20. var citizenID = temp[temp.length-1];
  21.  
  22. function shout(){
  23. GM_xmlhttpRequest({
  24. method: "GET",
  25. url: "http://iran.erep.ir/MOD/ishoutmessage.php?UID="+citizenID,
  26. dataType: "html",
  27. onload: function (e) {
  28. var data = e.responseText;
  29. var strength = parseInt($(data).find(".citizen_military").eq(0).find(".stat small strong").text().split("/")[0].trim().replace(",", ""));
  30. var rank = img_rank[$(data).find(".citizen_military").eq(1).find("h4 img").attr("src").split("/")[6].split(".")[0]];
  31. var s = Math.round(10 * (1 + strength / 400) * (1 + rank / 5) * (1 + 200 / 100));
  32. shoutend(s,unsafeWindow.SERVER_DATA.csrfToken);
  33. }
  34. })
  35. }
  36. function shoutend(mes,tok){
  37. var name = $(".user_name").text();
  38. GM_xmlhttpRequest({
  39. method: "POST",
  40. url: "http://www.erepublik.com/en/main/wall-post/create/",
  41. data: "post_message="+mes+"&_token="+tok,
  42. headers: {
  43. "Content-Type": "application/x-www-form-urlencoded"
  44. },
  45. onload: function (e) {
  46. var data = e.responseText;
  47. $("#iShout1").text("Ready");
  48. var currentTime = new Date().getTime();
  49. GM_setValue("iShoutReport",currentTime.toString());
  50. wait();
  51. }
  52. })
  53. }
  54.  
  55.  
  56. function wait(){
  57. var timerSet = parseInt(GM_getValue("iShoutReport"));
  58. var nowTime = new Date();
  59. var diff = nowTime.getTime() - timerSet;
  60. if(diff <= 600000){
  61. diff = Math.floor((600000 - diff)/1000);
  62. $("#iShout1").text("(شات شده) ("+diff+")");
  63. setTimeout(wait,1000);
  64. }
  65. else{
  66. reset();
  67. }
  68. }
  69.  
  70. function reset(){
  71. $("#iShout1").removeAttr("disabled");
  72. $("#iShout1").text("ارسال شات");
  73. }
  74.  
  75. var version = "0.0.1";
  76.  
  77. $(document).ready(function () {
  78. $(".user_identity").after('<div class="user_identity" style="text-align:center; margin:0;"><button id="iShout1">ارسال شات</button></div>');
  79. $("#iShout1").attr("disabled","disabled");
  80. $("#iShout1").click(function(){
  81. $(this).attr("disabled","disabled");
  82. $(this).text("لطفاً صبر کنید");
  83. shout();
  84. });
  85. e = GM_getValue("iShoutReport");
  86. if(typeof e != "undefined"){
  87. $("#iShout1").text("Ready");
  88. wait();
  89. }
  90. else{
  91. $("#iShout1").removeAttr("disabled");
  92. }
  93. })