NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Rexel price
// @namespace http://tampermonkey.net/
// @version 0.0.8
// @description The price is visible
// @author Anubys
// @copyright 2023, Anubys (https://openuserjs.org/users/Anubys)
// @license MIT
// @match https://www.rexel.fr/frx/*
// @updateURL https://openuserjs.org/meta/Anubys/Rexel_price.meta.js
// @downloadURL https://openuserjs.org/install/Anubys/Rexel_price.user.js
// @grant none
// @run-at document-end
// ==/UserScript==
$(window).ready(() => {
//Récupération du popup.
var popup = document.querySelector('.price'),
infoPrice = document.querySelector('#pricingPopover');
//Exécuction du script si un pop-up avec une class price est détecté.
if (popup) {
//let TarifPrice = popup.querySelector('#popoverContentpricingPopover').getElementsByTagName('div')[2].getElementsByTagName('dd')[0].textContent;
//console.log(TarifPrice);
setTimeout(click, 1);
setTimeout(affiche, 1000);
}
//Fonctions :
function click() {
infoPrice.click();
}
function affiche() {
let input = document.querySelector('.rex-product-price'),
TarifPrice = document.querySelectorAll('.float-right.mb-0')[3].textContent,
Remise = document.querySelectorAll('.float-right.mb-0')[4].textContent,
Price = document.querySelectorAll('.float-right.mb-0')[5].textContent,
pop = document.querySelector('.popover'),
table = "<table><tbody><tr><td>Prix de base HT : </td><td>"+ TarifPrice +"</td></tr><tr><td>Remise :</td><td>"+ Remise +"</td></tr><tr><td>Prix net HT :</td><td>"+ Price +"</td></tr></tbody></table>";
console.log(TarifPrice);
let Newdiv = document.createElement('div');
input.appendChild(Newdiv);
Newdiv.innerHTML = table;
pop.style.display = "none";
Newdiv.style.float = 'right';
Newdiv.style.right = '0px';
Newdiv.style.width = '220px';
Newdiv.style.height = 'auto';
Newdiv.style.border = "solid"
}
//document.querySelector('.popover')
/* document.addEventListener("DOMContentLoaded", function(event) {
alert("test");
});*/
})