echou

你打字带空格

Stan na 31-08-2019. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         echou
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  你打字带空格
// @author       relic
// @match        https://bbs.sgamer.com/forum.php?mod=post*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    window.replace = function (text){
        text=text.replace(/\s*/g,"");
        var txt_split=text.split('');
        var arr = new Array();
        for(var index=0 ; index < txt_split.length;index++){
            arr.push(txt_split[index]);
            var reg=new RegExp("[\\u4E00-\\u9FFF]+","g");
            if(reg.test(txt_split[index])){
                arr.push(' ');
            }
        }
        var txt_new=arr.join('');
        return txt_new;
    }

    var z = document.getElementsByClassName("z");
    z[2].innerHTML+= "&nbsp;&nbsp;<a href='javascript:void(0);' onclick='echou()' > 恶臭</a>";

    window.echou=function () {
        var title = document.getElementById("subject");
        title.value=window.replace(title.value);
        var msg = document.getElementById('e_iframe').contentWindow.document.getElementsByTagName('body')[0];
        var str = msg.innerHTML;
        //str = str.replace(/<\/?[^>]*>/g,'');
        str=str.replace(/&nbsp;/ig,'');
        msg.innerHTML= window.replace(str);
    }
})();