Skip to content

Instantly share code, notes, and snippets.

@WoLpH WoLpH/ibood.js
Created Jul 16, 2019

Embed
What would you like to do?
Show ibood prices for expired deals
// ==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>&euro; ' + price + ' :: ' + discount + '% <s>&euro; ' + old_price + '</s>';
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.