Skip to content

Instantly share code, notes, and snippets.

@fsvehla
Created April 3, 2009 11:40
Show Gist options
  • Save fsvehla/89717 to your computer and use it in GitHub Desktop.
Save fsvehla/89717 to your computer and use it in GitHub Desktop.
document.observe('dom:loaded', function() {
if(!document.location.href.match(/#podcenter_ch/)) {
return false;
}
var allElementsWithPrices = $$('*').select(function(e) {
return e.innerHTML.match(/^€/);
});
allElementsWithPrices.each(function(e) {
var captures = e.innerHTML.match(/€ (\d*)(,|\.)(\d*)/);
var i = parseInt(captures[1]);
var d = parseInt(captures[3]);
var price = i + (d / 100);
var sFr = Math.ceil(price * 1.4);
var sFrPrice = (sFr + "").replace('.', ',')
if(!(sFrPrice.match(/,/))) {
// Einkommentieren um ,00 anzuzeigen.
// sFrPrice = sFrPrice += ',00';
}
sFrPrice = sFrPrice += ' SFr';
Element.update(e, sFrPrice);
// Auskommentieren, um den Effekt zu entfernen
$(e).setStyle({
'background-color': 'rgba(200, 200, 200, 0.4)'
});
return true;
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment