5ch_nanashi_auto2

5ちゃんねるのデフォルトの名前を自動入力する。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        5ch_nanashi_auto2
// @namespace   https://catherine.v0cyc1pp.com/5ch_nanashi_auto2.user.js
// @include     http://*.5ch.net/*
// @include     https://*.5ch.net/*
// @author      greg10
// @run-at      document-idle
// @license     GPL 3.0
// @version     2.0
// @grant       none
// @description 5ちゃんねるのデフォルトの名前を自動入力する。
// ==/UserScript==
console.log("5ch_nanashi_auto2 start");

function main() {
    var str = document.location + "";
    //console.log("str=" + str);

    document.querySelectorAll("input[name='FROM']").forEach(function(elem) {
        elem.style.borderColor = "red";

        var classname = elem.className;
        //console.log("classname=" + classname);


        // 板のHTMLでは、クッキーが反映されて名前が自動入力されるので、ここでは処理不要
        // https://matsuri.5ch.net/morningcoffee/
        // スレッドのHTML(classname === "formelem maxwidth")ではクッキーが反映されないので、ここで設定する。
        // https://matsuri.5ch.net/test/read.cgi/morningcoffee/1550444800/l50
        if (classname === "formelem maxwidth") {
            if (str.indexOf("morningcoffee") != -1) {
                elem.value = "名無し募集中。。。";
            } else if (str.indexOf("livejupiter") != -1) {
                elem.value = "風吹けば名無し";
            } else if (str.indexOf("kitchen") != -1) {
                elem.value = "北風 #vZp6OYj3";
            } else {}
        }

    });

}

main();


var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe(document, config);
});

var config = {
    attributes: false,
    childList: true,
    characterData: false,
    subtree: false
};

observer.observe(document, config);