Created
April 3, 2009 11:40
-
-
Save fsvehla/89717 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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