Guest User

Untitled

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