Techious http://www.techious.com/forums/ |
|
Random code of the week http://www.techious.com/forums/viewtopic.php?f=8&t=12741 |
Page 1 of 1 |
Author: | azcn2503 [ Wed Jul 24, 2013 11:51 am ] |
Post subject: | Random code of the week |
Show % savings on Overclockers UK 'this week only' page. Put the following code in console and run: Code: $prices = $('td tr:has(span.oldprice)');
$prices.each( function() { $priceCell = $(this).find('td:has(span.oldprice)'); var oldPrice = parseFloat($priceCell.find('span.oldprice').text().replace(/£/, '')); var newPrice = parseFloat($priceCell.find('span.price').text().replace(/£/, '')); var percentSaving = Math.round(100 - (100 / oldPrice * newPrice)); $priceCell.append($(document.createElement('div')).css('font-size', '16pt').css('color', 'red').text(percentSaving + '%')); }); |
Author: | azcn2503 [ Mon Nov 11, 2013 11:43 am ] |
Post subject: | Re: Random code of the week |
This turned in to quite a lengthy and awesome thread on the OCUK forums! |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |