Created
July 16, 2019 15:53
-
-
Save wolph/c1861b972708d2349d7b97ab4350bfe3 to your computer and use it in GitHub Desktop.
Show ibood prices for expired deals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ibood old prices | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description add prices to old/expired ibood deals | |
// @author You | |
// @match https://www.ibood.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var script = null; | |
console.log('running script'); | |
$('script').each((i, s) => {script = s.innerHTML; if(script.match(/price: /))return false;}); | |
var price = script.match(/price: '([^']+)'/)[1] * 1; | |
console.log('price', price); | |
var discount = eval(script.match(/discount: (.+),/)[1]) * 1; | |
console.log('discount', discount); | |
// Your code here... | |
var title = $('div.summary>h2')[0]; | |
var old_price = (price / (1 - discount * 0.01)).toFixed(2); | |
title.innerHTML += '<br>€ ' + price + ' :: ' + discount + '% <s>€ ' + old_price + '</s>'; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment