Greasy Fork

Greasy Fork is available in English.

自由帳定期作成(Feederチャット)

Feederチャットの自由帳を定期的に作り続けるスクリプトです。

当前为 2020-05-04 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         自由帳定期作成(Feederチャット)
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Feederチャットの自由帳を定期的に作り続けるスクリプトです。
// @author       You
// @match        *.x-feeder.info/*/
// @exclude      *.x-feeder.info/*/sp/
// @exclude      *.x-feeder.info/*/settings/**
// @require      http://greasyfork.icu/scripts/396472-yaju1919/code/yaju1919.js?version=798050
// @grant        GM.setValue
// @grant        GM.getValue
// ==/UserScript==

(function() {
    'use strict';
    let inputCreateBoolBtn, inputFolderId, inputNoteTitle, inputNotePassword, inputNoteText, inputCreateInterval;
    // 自由帳を作成する関数
    const addNote = (title, folderId, password, text) => { // タイトル, 作成先のフォルダのID, パスワード, 本文
        let elm = $("#folder_navi_area").length;
        if (!elm) { // 自由帳を既に開いているかチェック
            $("#sub_note_icn").click(); // 自由帳を開く
        };
        setTimeout(() => {
            createNote(title, password, password, folderId);
            setTimeout(() => {
                $("#note_contents").val(text);
                setTimeout(() => {
                    $("#note_save_button").click();
                }, 250);
            }, 500);
        }, 250);
    };
    //---------------------
    const holder = $("<div>").css("background-color", "gray").prependTo("#main_right")
        .append("自由帳定期作成(Feederチャット)<BR><BR>");
    let start_flag = false;
    let exeMain = () => start_flag ? main() : null;
    inputCreateBoolBtn = yaju1919.addInputBool(holder, {
        title: "定期作成",
        value: false,
        change: exeMain,
    });
    inputFolderId = yaju1919.addInputNumber(holder, {
        title: "作成先のフォルダID(必須)",
        placeholder: "作成先のフォルダIDを入力(空の場合は0になる)",
        save: "AM_inputFolderId",
        width: "100%",
        value: 0,
        min: 0,
        max: Infinity,
        change: exeMain,
    });
    inputNoteTitle = yaju1919.addInputText(holder, {
        title: "自由帳のタイトル(必須)",
        placeholder: "自由帳のタイトルを入力してください",
        save: "AM_inputNoteTitle",
        width: "100%",
        change: exeMain,
    });
    inputNotePassword = yaju1919.addInputText(holder, {
        title: "自由帳のパスワード(任意)",
        placeholder: "自由帳のパスワードを入力",
        save: "AM_inputNotePassword",
        width: "100%",
        change: exeMain,
    });
    inputNoteText = yaju1919.addInputText(holder, {
        title: "自由帳の本文(任意)",
        placeholder: "自由帳の本文を入力",
        save: "AM_inputNoteText",
        width: "100%",
        textarea: true,
        change: exeMain,
    });
    inputCreateInterval = yaju1919.addInputNumber(holder, {
        title: "作成間隔",
        placeholder: "自由帳の作成間隔を入力(単位:秒)",
        save: "AM_inputCreateInterval",
        width: "100%",
        value: 10,
        min: 10,
        max: Infinity,
        change: exeMain,
    });
    holder.append("<br>");
    let result = $("<div>").css({
        "background-color": "pink",
        "color": "red",
    }).appendTo(holder);
    let si;
    const main = () => {
        const createBoolBtn = inputCreateBoolBtn();
        const folderId = inputFolderId();
        const noteTitle = inputNoteTitle();
        const notePassword = inputNotePassword();
        const noteText = inputNoteText();
        const createInterval = inputCreateInterval();
        if (noteTitle === "" && createBoolBtn) {
            result.text("× - 自由帳のタイトルを入力してください");
        } else {
            result.text("");
            clearInterval(si);
            if (createBoolBtn) {
                si = setInterval(() => {
                    addNote(noteTitle, folderId, notePassword, noteText);
                }, createInterval * 1000);
            };
        };
    };
    start_flag = true;
})();