Guest User

oK

a guest
Jan 8th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. // ==UserScript==
  2. // @name SlavaUkraine
  3. // @namespace odnoklassniki
  4. // @description slava ukraine
  5. // @include http://www.ok.ru/online
  6. // @include http://ok.ru/online
  7. // @version 1.1
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var initialWaitTime = 5000,
  12. reloadWaitTime = 2000,
  13. popupWaitTime = 1000,
  14. photoLoadWaitTime = 2500,
  15. closeWaitTime = 1000,
  16. fetchWaitTime = 3000,
  17.  
  18. minAge = "18", // >= 18
  19. maxAge = "60", // <= 99
  20.  
  21. cityList = [ "Севастополь", "Ялта", "Алушта", "Донецк", "Луганск", "Симферополь" ],
  22. phraseList = [ "Слава Украине! Героям Слава!",
  23. "Русских будем ебать! Слава Украине!",
  24. "Хто не скаче, той москаль!!! Слава Украине!",
  25. "Путин - Хуйло! Слава Украине!",
  26. "Москаляку на гiляку! Слава Украине!",
  27. "Бей жидов, мочи кацапов, запасайся швыдче салом! Слава Украине!",
  28. "Будем ебать оккупантов украины! Слава Украине!",
  29. "Слава Украине!" ];
  30.  
  31. document.getElementsByClass = function(tagName, className) {
  32. var itemsfound = new Array,
  33. elems = document.getElementsByTagName(tagName),
  34. i;
  35. for(i = 0; i < elems.length; ++i) {
  36. if(elems[i].className === className) {
  37. itemsfound.push(elems[i]);
  38. }
  39. }
  40. return itemsfound;
  41. }
  42.  
  43. function processPhoto (photos) {
  44. var evObj;
  45. if (photos.length === 0) {
  46. setTimeout(doScript, reloadWaitTime);
  47. return;
  48. }
  49.  
  50. evObj = document.createEvent('MouseEvents');
  51. evObj.initEvent('mouseover', true, false);
  52. photos[0].children[0].children[0].dispatchEvent(evObj);
  53.  
  54. setTimeout(function () {
  55. var photoLink = document.getElementsByClass("a", "gwt-shortcutMenu-iconlink-item")[0].children[0];
  56. photoLink.click();
  57. }, popupWaitTime);
  58.  
  59. setTimeout(function () {
  60. var commentBlock = document.getElementById("plp_cmtHId"),
  61. commentEditField,
  62. commentButton,
  63. closeButton = document.getElementsByClass("div", "ic ic_i_close")[0],
  64. usersOnlineButton = document.getElementsByClass("a", "sm fo4c_h_live-link fs-15")[0],
  65. rand = Math.floor((Math.random()*phraseList.length));
  66.  
  67. photos.splice (0,1);
  68.  
  69. if (commentBlock) {
  70. commentEditField = commentBlock.children[1];
  71. commentEditField.focus ();
  72. commentEditField = commentBlock.children[0];
  73. if (commentEditField) {
  74. commentEditField.value = phraseList[rand];
  75. setTimeout (function () {
  76. commentButton = commentBlock.children[4].children[0];
  77. if (commentButton) {
  78. commentButton.click();
  79. }
  80. closeButton.click();
  81. setTimeout (function () {
  82. processPhoto (photos);
  83. }, closeWaitTime);
  84. }, popupWaitTime);
  85. } else {
  86. usersOnlineButton.click();
  87. setTimeout(doScript, reloadWaitTime);
  88. }
  89. } else if (document.getElementById ("addPrivateProfileButton")) {
  90. usersOnlineButton.click();
  91. setTimeout(doScript, reloadWaitTime);
  92. } else {
  93. closeButton.click();
  94. setTimeout (function () {
  95. processPhoto (photos);
  96. }, closeWaitTime);
  97. }
  98. }, photoLoadWaitTime);
  99. }
  100.  
  101. function fetchPhotos () {
  102. var photos = document.getElementsByClass("a", "photoWrapper"),
  103. usersOnlineButton = document.getElementsByClass("a", "sm fo4c_h_live-link fs-15")[0];
  104. if (photos.length === 0) {
  105. usersOnlineButton.click();
  106. setTimeout(doScript, reloadWaitTime);
  107. } else {
  108. processPhoto (photos);
  109. }
  110. }
  111.  
  112. function doScript() {
  113. var photos = document.getElementsByClass("a", "photoWrapper"),
  114. cityLink = document.getElementById ("onSiteNowCityLink"),
  115. cityEditField,
  116. ageSelect = document.getElementsByClass("select", "isl isl__res isl__2num"),
  117. minAgeSelect = ageSelect[0],
  118. maxAgeSelect = ageSelect[1],
  119. rand = Math.floor((Math.random()*cityList.length));
  120.  
  121. minAgeSelect.value = minAge;
  122. maxAgeSelect.value = maxAge;
  123.  
  124. cityLink.click ();
  125. cityEditField = document.getElementById ("field_city");
  126. cityEditField.value = cityList[rand];
  127.  
  128. checkbox = document.getElementById ("field_female");
  129. checkbox.click ();
  130. setTimeout(fetchPhotos, fetchWaitTime);
  131. }
  132.  
  133. setTimeout(doScript, initialWaitTime);
Advertisement
Add Comment
Please, Sign In to add comment