HFR form

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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;
        }
    });


}