HFR form

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
        }
    });


}