OWOT Extras

Improves & Adds more stuff to the menu (rainbow,paint,paste,teleport,js) and fixes a bug

目前為 2018-11-10 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// 0.2: Obfuscation removed (-4500 bytes), improved menu options
// 0.3: Added zoom seekbar, fix teleport X and Y being inverted
// 0.4: Added rainbow mode, fixed trackpad history scroll bug (an OWOP bug)
// 0.5.0: Switched to semantic versioning (semver)
// 0.5.1: Removed zoom (added to OWOT itself), added warning for execute code

// ==UserScript==
// @name         OWOT Extras
// @namespace    https://greasyfork.org/users/200700
// @version      0.5.1
// @description  Improves & Adds more stuff to the menu (rainbow,paint,paste,teleport,js) and fixes a bug
// @author       SuperOP535
// @match        *.ourworldoftext.com/*
// @grant        none
// ==/UserScript==

(function() {
    window.addEventListener('wheel', function (e) { e.preventDefault(); });
    var _writeChar = writeChar;
    function getRandomInt(min, max) {return Math.floor(Math.random() * (max - min)) + min;}
    writeChar = function(a, b) {
        if(rainbowmode) YourWorld.Color = getRandomInt(0, 16777216);
        _writeChar(a, b);
    };
    var paintmode = false, rainbowmode = false;
    var char = '█';
    document.addEventListener('mouseup', function(e) {
        if(!paintmode) return;
        writeChar(char, true);
    });
    var nav = document.getElementById('nav');
    nav.style.width = '150px';
    nav.style.textAlign = 'center';
    menu.addCheckboxOption(' Allow paste', function(){Permissions.can_paste = function(){return true;};},
                           function(){Permissions.can_paste = function(){return false;};});
    menu.addCheckboxOption(' Paint mode', function(){paintmode = true;}, function(){paintmode = false;});
    menu.addCheckboxOption(' Rainbow mode', function(){rainbowmode = true;}, function(){rainbowmode = false;});
    menu.addOption('Change paint char', function() {
        var c = prompt('Enter character', char);
        char = c.slice(0,1) || char;
    });
    menu.addOption('Teleport', function() {
        var x = +prompt('Enter X coordinate'), y = +prompt('Enter Y coordinate');
        if(isNaN(x)) return alert('Invalid X coordinate');
        if(isNaN(y)) return alert('Invalid Y coordinate');
        w.doGoToCoord(y, x);
    });
    menu.addOption('Execute code', function() {
        var code = prompt('Enter JavaScript code. **Don\'t paste anything random!**');
        if(!code) return;
        try {
            alert(eval(code));
        } catch(e) {
            alert('Error: ' + e);
        }
    });
})();