// ==UserScript== // @name Alternate HDD Price per TB // @namespace http://tampermonkey.net/ // @version 0.1 // @description Alternate HDD Price per TB // @author sergio.am // @match https://www.alternate.es/Discos-duros* // @icon https://www.google.com/s2/favicons?sz=64&domain=alternate.es // @grant none // ==/UserScript== (function() { 'use strict'; const re = /\w+\s/g; $('head').append(""); $('.grid-container.listing a.card').each(function (idx, item) { var price = parseFloat($(item).find('span.price').text().replace('€', '')); var name = $(item).find('div.product-name').text(); var cap = $(item).find('ul.product-info li:first-of-type').text(); var tb = parseInt(cap.match(/Capacidad: (\d+) TB/)[1]); var pricePerTb = price / tb; $(item).find('span.price').append('' + pricePerTb.toFixed(1) + ' €/TB'); }); })();