Skip to content

Instantly share code, notes, and snippets.

@Calvein
Created June 14, 2012 20:06
Show Gist options
  • Save Calvein/2932607 to your computer and use it in GitHub Desktop.
Save Calvein/2932607 to your computer and use it in GitHub Desktop.
£ in € for the English sales

It's the English sales !!§!

Just create a new bookmark in your toolbar and paste the following code as URL (because we can't make bookmarlet links with GitHub markdown) :

javascript:!function(){s=document.createElement('script'),s.src='https://raw.github.com/gist/2932607/ddb79d0d67f5aea20083aa08dd6e056a927a5d66/bookmarklet.min.js?v='+~~(new Date),document.body.appendChild(s)}();
!function() {
var fuckingEnglishSales = function($) {
$('*').each(function() {
var $this = $(this)
, text = $this.clone().children().remove().end().text()
// If it contains more than a £ or string, it will be 0, so, no parseInt here
, pounds = ~~text.replace(/£/, '')
if (
/£/.test(text) &&
!!pounds
) {
// https://www.google.fr/search?q=£+in+€
$this.text((pounds * 1.23199556).toFixed(2) + ' €')
}
})
}
if (jQuery) {
fuckingEnglishSales(jQuery)
} else {
s = document.createElement('script')
s.src = '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'
document.body.appendChild(s)
s.addEventListener('load', function() {
fuckingEnglishSales(jQuery)
})
}
}()
!function(){var e=function(e){e("*").each(function(){var t=e(this),n=t.clone().children().remove().end().text(),r=~~n.replace(/£/,"");/£/.test(n)&&!!r&&t.text((r*1.23199556).toFixed(2)+" €")})};jQuery?e(jQuery):(s=document.createElement("script"),s.src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",document.body.appendChild(s),s.addEventListener("load",function(){e(jQuery)}))}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment