Omegle Enhanced

Adds features to Omegle: timestamps, interest-only chats

当前为 2023-04-30 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Omegle Enhanced
// @version      0.21
// @description  Adds features to Omegle: timestamps, interest-only chats
// @author       penishaver666
// @namespace    penishaver666
// @match        *://*.omegle.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {

  function stickyInterests() { // only connect to people with common interests, will look for common interests indefinitely
    window.COMETBackend.prototype.stopLookingForCommonLikes = function(){}; // don't give up!!! ganbare!!!
    console.log('# sticky interests good!');
  }

  function getNiceTime() { // human readable timestamp, HH:MM
    const d = new Date();
    return d.getHours() + ":" + d.getMinutes().toString().padStart(2, "0");
  }

  function win(){ // use unsafeWindow if available
      try{return unsafeWindow;} catch(e) {return window;}
  }

  function timestampify() { // insert timestamps into chat msgs as they appear
    // copied most of this from stackoverflow so idk wtf half of this does desu (stackoverflow.com/questions/49115851)
    let window = win(); // needs to be from a named function else it breaks! idk why
    window.Timestamp$Element = window.Element;
    window.Element = function (a, b) {
      let elem = window.Timestamp$Element(a, b);
      if (typeof a == "string" && b && (b.class == "youmsg" || b.class == "strangermsg")) { // match user msgs
        let stamp = new window.Timestamp$Element("span", {"class": "msgsource"}); // give timestamp the same class as names, so same formatting
        stamp.appendText(getNiceTime() + " | "); // separator between time and name
        elem.grab(stamp);
      }
      return elem;
    };
    Object.assign(window.Element, window.Timestamp$Element);
    console.log('# timestamps good!');
  }

  window.addEventListener('load', function () {
    console.log('# starting...');
    stickyInterests();
    timestampify();
    console.log('# done.');
  })

})();