// ==UserScript== // @name PCComponentes HDD Price per TB // @namespace http://tampermonkey.net/ // @version 0.1 // @description AltePCComponentesrnate HDD Price per TB // @author sergio.am // @match https://www.pccomponentes.com/discos-duros* // @icon https://www.google.com/s2/favicons?sz=64&domain=pccomponentes.com // @require https://code.jquery.com/jquery-3.6.0.min.js // @grant none // ==/UserScript== (function() { 'use strict'; const re = /\w+\s/g; $('head').append(""); $('div#product-grid a').each(function (idx, item) { var price = parseFloat($(item).data('product-price')); var name = $(item).data('product-name'); var tb = parseInt(name.match(/(\d+) ?TB/)[1]); var pricePerTb = price / tb; $(item).find('.product-card__price-container').append('' + pricePerTb.toFixed(1) + ' €/TB'); }); })();