-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy.js
26 lines (23 loc) · 1.09 KB
/
my.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// PDeveloper custom script, included in index.html
var currency = ["AED", "AUD", "CHF", "GBP", "INR", "JPY", "KWD", "QAR", "RUB", "SAR", "SGD", "USD"];
//localStorage.clear();
$.each(currency, function(key, val) {
$.getJSON(
"http://rate-exchange.appspot.com/currency?from=USD&to="+val+"&callback=?",
function(data) {
localStorage.setItem( val, data.rate );
localStorage.setItem('USD',1);
});
});
$('#c1').change(function() {
$('#s_tb').val(($('#f_tb').val()*localStorage.getItem($('#c2').val()))/localStorage.getItem($('#c1').val()));
});
$('#c2').change(function() {
$('#s_tb').val(($('#f_tb').val()*localStorage.getItem($('#c2').val()))/localStorage.getItem($('#c1').val()));
});
$('#f_tb').change(function() {
$('#s_tb').val(($('#f_tb').val()*localStorage.getItem($('#c2').val()))/localStorage.getItem($('#c1').val()));
});
$('#s_tb').change(function() {
$('#f_tb').val(($('#s_tb').val()*localStorage.getItem($('#c1').val()))/localStorage.getItem($('#c2').val()));
});