HFR form

Affiche un formulaire de réponse standardisé dans le champ réponse d'HFR

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         HFR form
// @namespace    HFR_form
// @include      https://forum.hardware.fr/message.php*
// @version      0.1
// @description  Affiche un formulaire de réponse standardisé dans le champ réponse d'HFR
// @grant         GM.xmlHttpRequest
// ==/UserScript==


if (document.URL.indexOf("post=110935") !== -1)
{

    var addFormButton = document.createElement('input');
    addFormButton.setAttribute('type', 'button');
    addFormButton.setAttribute('id', 'fuckYeah');
    addFormButton.setAttribute('value', 'Poster un rapport de make');

    var postButton = document.getElementById('addCommentMessage');
    postButton.parentNode.insertBefore(addFormButton, postButton);

    document.getElementById ("fuckYeah").addEventListener (
        "click", postShit, false
    );
}

function postShit()
{
    var tab = document.getElementById('pseudoform');
    var pseudo = tab.children[1].children[0].value;

    GM.xmlHttpRequest({
        method: "GET",
        url: "https://raw.githubusercontent.com/Niks4925/hfr-forms/master/make",
        onload: function(response) {
            var newContent = response.responseText.replace("$pseudo$", pseudo);
            var content = document.getElementById("content_form").value = newContent;
        }
    });


}