Forum Signature

Set your personal post signature for the forum - in v0.1 set value from signature in the script itself. Button on the website will follow in a future release.

目前為 2020-02-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Forum Signature
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Set your personal post signature for the forum - in v0.1 set value from signature in the script itself. Button on the website will follow in a future release.
// @author       Dominik Hirsch
// @include      https://de*.die-staemme.de/game.php?village=*&screen=forum&screenmode=view_thread&thread_id=*&answer=true*
// @include      https://de*.die-staemme.de/game.php?village=*&screen=forum&screenmode=view_thread&action=new_post&thread_id=*&answer=true*
// @match        https://de*.die-staemme.de/game.php?village=*&screen=forum&screenmode=view_thread&thread_id=*&answer=true*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var signature = "\n\n-----\n[i]Domi[/i]";
    var messageBox = document.getElementById("message");
    messageBox.value += signature;

    AddToLocalStorage("\n\n-----\n[i]Domi[/i]");

    /*
     * Saves a given string into the local storage.
     */
    function AddToLocalStorage(str) {
        if ("localStorage" in window)
        {
            console.log("Setting item UserSignature to " + str + " in localStorage");
            localStorage.setItem("UserSignature", str);
        }
        else
        {
            alert("no localStorage in window");
        }
    }
})();