Automated Omegle Script

Script for omegle with automated features.

Versione datata 04/01/2016. 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.4
// @grant       GM_addStyle
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @description Script for omegle with automated features.
// allow pasting
// ==/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; }" +
  ".script-checkbox-wrapper { position: absolute; line-height: 12px; padding: 2px;  }" +
  ".auto-disconnect-checkbox-wrapper { position: absolute; line-height: 12px; padding: 2px;  }" +
  ".activate-script-label { position: absolute; display: inline-block; font-size: 11px; }" +
  ".activate-auto-disconnect-label { position: absolute; display: inline-block; font-size: 11px; }" +
  ".auto-disconnect-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 Hi goes here..." />');
$('body').append('<div class="script-checkbox-wrapper" style="top: 70px; left: 1px;"><input id="auto-omegle-enabled" type="checkbox" checked /></div><div class="activate-script-label" style="top: 75px; left: 22px;">Activate auto script</div>');
$('body').append('<div class="auto-disconnect-checkbox-wrapper" style="top: 85px; left: 1px;"><input id="reconnect-omegle-enabled" type="checkbox" checked /></div><div class="activate-auto-disconnect-label" style="top: 90px; left: 22px;">Activate auto disconnect</div>');
$('body').append('<div class="auto-disconnect-timer hide"></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 scriptCheckBoxWrapper = $('.script-checkbox-wrapper');
  var scriptCheckBoxLabel = $('.activate-script-label');
  var autoDisconnectCheckBoxWrapper = $('.auto-disconnect-checkbox-wrapper');
  var autoDisconnectCheckBoxLabel = $('.activate-auto-disconnect-label');
  var scriptCheckBox = $('#auto-omegle-enabled');
  var autoDisconnectCheckBox = $('#reconnect-omegle-enabled');
  var autoDisconnectTimerDiv = $('.auto-disconnect-timer');
  var inChatGreetingsTextArea = $('#omegle-greetings-text-in-chat');
  var startPageGreetingsTextArea = $('#omegle-greetings-text-start');
  var timeRemaining = Math.round((timeout - disconnectTimer) / 10);
  
  var bodyContainsStartPage = $( 'body:containsIN("Omegle (oh·meg·ull)")' ).text();
  
  
  if (bodyContainsStartPage && startPageGreetingsTextArea.length === 0 && !$(".newchatbtnwrapper").length) {
    inChatGreetingsTextArea.remove();
    scriptCheckBoxWrapper.css({ 'top': '70px', 'left': '1px' });
    scriptCheckBoxLabel.css({ 'top': '75px', 'left': '22px' });
    autoDisconnectCheckBoxWrapper.css({ 'top': '85px', 'left': '1px' });
    autoDisconnectCheckBoxLabel.css({ 'top': '90px', 'left': '22px' });
    $('body').append('<textarea id="omegle-greetings-text-start" placeholder="Automated Hi goes here..." />');
    startPageGreetingsTextArea.val(greetingsText);
    autoDisconnectTimerDiv.addClass('hide');
    return;
  } else if (!bodyContainsStartPage && inChatGreetingsTextArea.length === 0){
    startPageGreetingsTextArea.remove();
    scriptCheckBoxWrapper.css({ 'top': '70px', 'left': '10px' });
    scriptCheckBoxLabel.css({ 'top': '75px', 'left': '32px' });
    autoDisconnectCheckBoxWrapper.css({ 'top': '70px', 'left': '153px' });
    autoDisconnectCheckBoxLabel.css({ 'top': '75px', 'left': '175px' });
    $('td.chatmsgcell').after('<td class="greetingsmsgcell"><div class="greetingsmsgwrapper"><textarea id="omegle-greetings-text-in-chat" placeholder="Automated Hi goes here..." /></div></td>');
    inChatGreetingsTextArea.val(greetingsText);
    autoDisconnectTimerDiv.removeClass('hide');
  }
  
  autoDisconnectTimerDiv.text(function() {
    if (autoDisconnectCheckBox[0].checked) {
      return 'Auto disconnecting from Stranger in ' + timeRemaining + 's';
    } else {
      return 'Auto disconnect is disabled';
    }
  });
  
  if (startPageGreetingsTextArea.length > 0) {
    greetingsText = startPageGreetingsTextArea.val();
  } else if (inChatGreetingsTextArea.length > 0) {
    greetingsText = inChatGreetingsTextArea.val();
  }

  if (!scriptCheckBox[0].checked || $( 'body:containsIN("Connecting to server")' ).text() || bodyContainsStartPage) {
    return;
  }
  
  if (disconnectTimer === timeout && autoDisconnectCheckBox[0].checked) {
    disconnect();
    return;
  }
  
  $(aborts).each(function() {
    if ($( 'body:containsIN("' + this + '")' ).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 || !autoDisconnectCheckBox[0].checked) {
    chatContent = $('.logbox > div').children().length;
    disconnectTimer = 0;
  }
  else if (autoDisconnectCheckBox[0].checked) {
    disconnectTimer += 1; 
  }

}, 100);

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