Automated Omegle Script

Script for omegle with automated features.

Versione datata 22/12/2015. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Automated Omegle Script
// @namespace   lazi3b0y
// @include     http://*.omegle.com/*
// @version     2.2
// @grant       GM_addStyle
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @description Script for omegle with automated features.
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);

GM_addStyle(
  "td.chatmsgcell { width: 50%; }" +
  "#omegle-greetings-text-in-chat { width: 100%; background: #FFF none repeat scroll 0% 0%; font-family: sans-serif; border: 0px none; padding: 0px; margin: 0px; height: 4.5em; font-size: 1em; overflow: auto; border-radius: 0px; resize: none; }" +
  "#omegle-greetings-text-start { position: absolute; top: 105px; left: 5px; width: 245px; height: 475px; resize: none; }" +
  ".greetingsmsgcell { width: 50%; }" +
  ".greetingsmsgwrapper { background: #FFF none repeat scroll 0% 0%; border: 1px solid #CCC; height: 4.5em; padding: 0.25em; }" +
  ".auto-script-checkbox-wrapper { position: absolute; line-height: 12px; padding: 2px;  }" +
  ".auto-reconnect-checkbox-wrapper { position: absolute; line-height: 12px; padding: 2px;  }" +
  ".activate-auto-text { position: absolute; display: inline-block; font-size: 11px; }" +
  ".activate-reconnect-text { position: absolute; display: inline-block; font-size: 11px; }" +
  ".reconnect-timer { position: absolute; display: inline-block; font-size: 11px; top: 75px; right: 25px; }" +
  ".hide { display: none; }" +
"");

var timeout = 600; // Timeout value * 100 milliseconds. 600 = 1 minute.
var disconnectTimer = 0;
var chatContent = 0;
var greetingsText;
var greeted = false;
var ABORTS=[
  'You have disconnected.',
  'Stranger has disconnected',
  'Technical error: Server was unreachable for too long and your connection was lost. Sorry. :( Omegle understands if you hate it now, but Omegle still loves you.',
];

$('body').append('<textarea id="omegle-greetings-text-start" placeholder="Automated greeting goes here." />');
$('body').append('<div class="auto-script-checkbox-wrapper" style="top: 70px; left: 1px;"><input id="auto-omegle-enabled" type="checkbox" checked /></div><div class="activate-auto-text" style="top: 75px; left: 22px;">Activate auto script</div>');
$('body').append('<div class="auto-reconnect-checkbox-wrapper" style="top: 85px; left: 1px;"><input id="reconnect-omegle-enabled" type="checkbox" checked /></div><div class="activate-reconnect-text" style="top: 90px; left: 22px;">Activate auto reconnect</div>');
$('body').append('<div class="reconnect-timer hide">asd</div>');
$('#omegle-enabled').prop('checked', false);

function disconnect() {
  $('button.disconnectbtn').click();
  if ($( "body:containsIN('You're now chatting with a random stranger. Say hi!')" ).text()) {
    $('button.disconnectbtn').click();
  }
  greeted = false;
  chatContent = 0;
  disconnectTimer = 0;
}
  
setInterval(function() {
  var autoCheckBoxWrapper = $('.auto-script-checkbox-wrapper');
  var autoCheckBoxText = $('.activate-auto-text');
  var reconnectCheckBoxWrapper = $('.auto-reconnect-checkbox-wrapper');
  var reconnectCheckBoxText = $('.activate-reconnect-text');
  var autoCheckBox = $('#auto-omegle-enabled');
  var reconnectCheckBox = $('#reconnect-omegle-enabled');
  var reconnectTimer = $('.reconnect-timer');
  var timeRemaining = Math.round((timeout - disconnectTimer) / 10);
  
  if ($( 'body:containsIN("What do you wanna talk about?")' ).text() && $('#omegle-greetings-text-start').length === 0 && !$(".newchatbtnwrapper").length) {
    $('#omegle-greetings-text-in-chat').remove();
    autoCheckBoxWrapper.css({ 'top': '70px', 'left': '1px' });
    autoCheckBoxText.css({ 'top': '75px', 'left': '22px' });
    reconnectCheckBoxWrapper.css({ 'top': '85px', 'left': '1px' });
    reconnectCheckBoxText.css({ 'top': '90px', 'left': '22px' });
    $('body').append('<textarea id="omegle-greetings-text-start" placeholder="Automated greeting goes here." />');
    $('#omegle-greetings-text-start').val(greetingsText);
    reconnectTimer.addClass('hide');
    return;
  } else if ( !$( 'body:containsIN("What do you wanna talk about?")' ).text() && $('#omegle-greetings-text-in-chat').length === 0){
    $('#omegle-greetings-text-start').remove();
    autoCheckBoxWrapper.css({ 'top': '70px', 'left': '3px' });
    autoCheckBoxText.css({ 'top': '75px', 'left': '25px' });
    reconnectCheckBoxWrapper.css({ 'top': '70px', 'left': '153px' });
    reconnectCheckBoxText.css({ 'top': '75px', 'left': '175px' });
    $('td.chatmsgcell').after('<td class="greetingsmsgcell"><div class="greetingsmsgwrapper"><textarea id="omegle-greetings-text-in-chat" placeholder="Automated greeting goes here." /></div></td>');
    $('#omegle-greetings-text-in-chat').val(greetingsText);
    reconnectTimer.removeClass('hide');
  }
  
  reconnectTimer.text(function() {
    if (reconnectCheckBox[0].checked) {
      return 'Reconnecting in ' + timeRemaining + 's';
    } else {
      return 'Reconnect is DISABLED'
    }
  });
  
  if ($('#omegle-greetings-text-start').length > 0) {
    greetingsText = $('#omegle-greetings-text-start').val();
  } else if ($('#omegle-greetings-text-in-chat').length > 0) {
    greetingsText = $('#omegle-greetings-text-in-chat').val();
  }

  if (!autoCheckBox[0].checked || $( 'body:containsIN("Connecting to server")' ).text() || $( 'body:containsIN("Start chatting")' ).text()) {
    return;
  }
  
  if (disconnectTimer === timeout && reconnectCheckBox[0].checked) {
    disconnect();
    return;
  }
  
  for (i=0;i<ABORTS.length;i++){
    if ($( 'body:containsIN("' + ABORTS[i] + '")' ).text()){
      disconnect();
      return;
    }
  }
  
  if (greeted === false && $( "body:containsIN('You're now chatting with a random stranger. Say hi!')" ).text() ) {
    greeted = true;
    $('textarea.chatmsg ').val(greetingsText);
    $('button.sendbtn').click();
  }
  
  if (!chatContent || chatContent != $('.logbox > div').children().length || !reconnectCheckBox[0].checked) {
    chatContent = $('.logbox > div').children().length;
    disconnectTimer = 0;
  }
  else if (reconnectCheckBox[0].checked) {
    disconnectTimer += 1; 
  }
}, 100);

$.extend($.expr[":"], {
  "containsIN": function(elem, i, match, array) {
   return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
  }
});