Omegle Enhanced

Adds features to Omegle: timestamps, interest-only chats

目前為 2023-04-30 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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.');
  })

})();