Skip to content

Instantly share code, notes, and snippets.

@khongi
Created March 1, 2020 17:26
Show Gist options
  • Save khongi/df5123d38da4a8d5f04f2ca55a6cd556 to your computer and use it in GitHub Desktop.
Save khongi/df5123d38da4a8d5f04f2ca55a6cd556 to your computer and use it in GitHub Desktop.
ridestore.com sales
// ==UserScript==
// @name Dope Sales
// @namespace https://www.ridestore.com/
// @version 0.1
// @description Lists the sale prices on ridestore.com
// @author https://github.com/khongi/
// @match https://www.ridestore.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let items = document.getElementsByClassName('cl2s');
for (let i=0; i<items.length; i++) {
let prices = items[i].innerText.split('€');
let salePrice = +prices[0].trim().replace(',','.');
let originalPrice = +prices[1].trim().replace(',','.');
let difference = originalPrice - salePrice;
console.log("=======================================");
console.log(items[i].closest('a').href);
console.log(items[i].parentNode.children[0].innerText);
console.log(items[i].innerText);
console.log('Save ' + difference + ' €');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment