![]() |
Convert LBS to Kilo, gallons to liters, miles to km... (and the other way around)
Create a new bookmark with this javascript in the URL, when you click the bookmark it will convert the stuff on the page.
Code:
javascript:(function(){regex=/(\.?\d+(?:\.\d*)?)\s*?(lb|pound|#|kg|stone|gallon|gal|liter|litre|l|oz|fl oz|cup|mile|km|meter|m|cm)s?(?!\w)/ig;lbs_kg_factor=2.20462262;stone_kg_factor=6.35029318;l_gal_factor=3.78541178;floz_l_factor=0.0295735296;cup_l_factor=0.236588236;mile_km_factor=1.609344;function format(a,b){return a+' <em style="color:#999;">('+b+')</em>'}function convert(a,b,c,d){if(d==null)d=10;a=a/b;return Math.round(d*a)/d+" "+c}function convert_cm_to_feet_and_inches(a){feet=Math.floor(a/30.48);inches=Math.floor(a%(30.48/2.54));return feet+"′"+inches+'″'}function replace(a,b,d,e,s){b=parseFloat(b);d=d.toLowerCase();var c=0;switch(d){case'lb':case'pound':case'#':c=convert(b,lbs_kg_factor,'kg');break;case'kg':c=convert(b,1/lbs_kg_factor,'lbs',2.0);break;case'stone':c=convert(b,1/stone_kg_factor,'kg');break;case'gallon':case'gal':c=convert(b,1/l_gal_factor,'l');break;case'liter':case'litre':case'l':c=convert(b,l_gal_factor,'gal');break;case'oz':case'fl oz':c=convert(b,1/floz_l_factor,'l');break;case'cup':c=convert(b,1/cup_l_factor,'l');break;case'mile':c=convert(b,1/mile_km_factor,'km');break;case'km':c=convert(b,mile_km_factor,'miles');break;case'meter':case'm':c=convert_cm_to_feet_and_inches(b*100);break;case'cm':c=convert_cm_to_feet_and_inches(b);break}return format(a,c)}document.body.innerHTML=document.body.innerHTML.replace(regex,replace)})(); 150 kg 4.3 miles 900 lbs 5.4 stone 7 litre 2 gallon |
That is perhaps the coolest thing ever!
|
Edit: It fucks up gfy.
If you use it and then try and leave a quick comment you get a javascript popup (different to the gfy popup) informing you that the message is too short. Still cool though. |
All times are GMT -7. The time now is 09:20 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123