Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        MountainCommenter
  3. // @namespace   odnoklassniki
  4. // @description tvoi mama ibalj
  5. // @include     http://www.odnoklassniki.ru/online
  6. // @include     http://odnoklassniki.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 = "14",    // >= 14
  19.     maxAge = "29",    // <= 99
  20.    
  21.     cityList = [ "Грозный", "Урус-Мартан", "Гудермес", "Хасавюрт", "Дербент", "Махачкала" ],
  22.     phraseList = [  "Э гандон, я твою маму ебал",
  23.                     "Сука, маму твою ебал",
  24.                     "Ну и пидрила",
  25.                     "Ну и урод!",
  26.                     "Ты че, пидор что ли?",
  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.           window.location.href = "http://odnoklassniki.ru/online";
  87.           setTimeout(doScript, reloadWaitTime);  
  88.         }
  89.       } else if (document.getElementById ("addPrivateProfileButton")) {
  90.         window.location.href = "http://odnoklassniki.ru/online";
  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.       window.location.href = "http://odnoklassniki.ru/online";
  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
Advertisement