AmazonSE

proper swedish prices on amazon

  1. // ==UserScript==
  2. // @name AmazonSE
  3. // @namespace MrBrax
  4. // @description proper swedish prices on amazon
  5. // @include https://www.amazon.de/*
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. var ourPrice = document.getElementById("priceblock_ourprice");
  11.  
  12. if(ourPrice){
  13.  
  14. var pPrice = parseFloat( ourPrice.innerHTML.substr(4) );
  15.  
  16. var sweTax = pPrice + ( pPrice * 0.05 );
  17.  
  18. var rPrice = Math.round( sweTax * 100 ) / 100;
  19.  
  20. ourPrice.innerHTML = '<span style="color:#7899EC">SE EUR ' + rPrice + '</span> <small style="font-size: 80%">(DE EUR ' + pPrice + ')</span>';
  21.  
  22. }
  23.  
  24. var vatMsg = document.getElementById("vatMessage");
  25. if(vatMsg){
  26. var l = vatMsg.children[1];
  27. l.innerHTML += '<br>Prices have been modified to include Swedish VAT.';
  28. }
  29.  
  30. var q = "span.sc-price"; // regular price label
  31. q += ", span.p13n-sc-price"; // also bought
  32. q += ", div.acs_product-price span.a-color-price";
  33. q += ", div.s-item-container span.a-color-price";
  34. q += ", div.twisterSlotDiv span.a-color-price"; // current sel
  35. q += ", div.twisterSlotDiv span.a-color-secondary span.a-size-mini"; // other sel
  36. q += ", #olp_feature_div span.a-color-price"; // new/old
  37. q += ", #regularprice_savings .a-color-price"; // "you save"
  38.  
  39. var prices = document.querySelectorAll(q);
  40. for(var i = 0; i < prices.length; i++){
  41. var pPrice = parseFloat( prices[i].innerText.trim().substr(4) );
  42. var sweTax = pPrice + ( pPrice * 0.0532 );
  43. var rPrice = ( Math.round( sweTax * 100 ) / 100 );
  44.  
  45. prices[i].innerHTML = '<span style="color:#7899EC">EUR</span> ' + rPrice + ' <small style="font-size: 80%; opacity:.5;">(EUR ' + pPrice + ')</small>';
  46.  
  47. }