Automated Omegle Script

Script for omegle with automated features.

目前為 2016-01-04 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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;
  }
});