// ==UserScript== // @name Price Converter with Tax for Specific Websites // @namespace http://tampermonkey.net/ // @version 0.6 // @description Convert price tags on websites // @author Nears // @match *://*.newegg.ca/* // @match *://*.canadacomputers.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (async function() { 'use strict'; // Define the tax rate const TAX_RATE = 0.14975; // Fetch the Euro conversion rate async function fetchExchangeRate() { const requestURL = 'https://api.exchangerate.host/convert?from=CAD&to=EUR'; const response = await fetch(requestURL); const data = await response.json(); return data.result; } const CAD_TO_EURO = await fetchExchangeRate(); // Add CSS block const css = ` .price-container { position: relative; display: inline-block; } .price-info { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; border: 1px solid #ddd; padding: 12px; z-index: 1; } .price-container:hover .price-info { display: block; } .tax-included { color: red; } .base-price { color: #666; } .euro-price { color: #4CAF50; } `; const styleElement = document.createElement('style'); styleElement.textContent = css; document.head.appendChild(styleElement); // Define the websites and their price tag selectors const websites = [ { domain: 'newegg.ca', selectors: ['li.price-current', '.goods-price-current'], updatePrice: (element) => { const strongElement = element.querySelector('strong'); const supElement = element.querySelector('sup'); if (strongElement && supElement) { const price = parseFloat(`${strongElement.textContent.replace(',', '')}${supElement.textContent}`); const convertedPrice = convertPrice(price); const euroPrice = convertToEuros(convertedPrice); const priceInfo = `