Skip to content

Instantly share code, notes, and snippets.

@wolph
Created July 16, 2019 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolph/c1861b972708d2349d7b97ab4350bfe3 to your computer and use it in GitHub Desktop.
Save wolph/c1861b972708d2349d7b97ab4350bfe3 to your computer and use it in GitHub Desktop.
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