Mercurial > titip
annotate index.html @ 17:9c94b49fe83c
Update email
author | nanaya <me@nanaya.pro> |
---|---|
date | Fri, 08 Jun 2018 22:25:21 +0900 |
parents | 1f999668080f |
children | aef027838046 |
rev | line source |
---|---|
0 | 1 <!doctype html> |
2 <head> | |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
3 <title>Kalkulator</title> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
4 <meta name="viewport" content="width=device-width"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
6 <style type="text/css"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
7 * { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
8 box-sizing: border-box; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
9 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
10 body { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
11 font-size: 12px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
12 font-family: Arial, sans-serif; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
13 line-height: 1.5; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
14 margin: 0; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
15 background-color: #eee; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
16 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
17 .content { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
18 width: 100%; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
19 max-width: 500px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
20 min-height: 100vh; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
21 padding: 10px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
22 margin: auto; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
23 background-color: #fff; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
24 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
25 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
26 input, button, select, option, .js { font-size: 150%; } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
27 .input { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
28 font-size: 16px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
29 width: 100%; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
30 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
31 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
32 .button { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
33 font-size: 16px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
34 padding: 5px 10px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
35 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
36 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
37 .result { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
38 font-size: 16px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
39 padding: 10px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
40 background-color: #eee; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
41 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
42 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
43 .result__title { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
44 padding: 0; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
45 margin: 0 0 10px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
46 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
47 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
48 .result__list { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
49 margin: 0; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
50 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
51 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
52 .list { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
53 padding-left: 20px; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
54 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
55 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
56 .u-hidden { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
57 display: none !important; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
58 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
59 </style> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
60 <script src="jquery-3.3.1.min.js"></script> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
61 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
62 <script> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
63 $(document).ready(function () { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
64 var $loading = $(".js-x-loading"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
65 var $ok = $(".js-x-ok"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
66 var $error = $(".js-x-error"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
67 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
68 var $form = $(".js-x-form"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
69 var $submit = $(".js-x-submit"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
70 var $reset = $(".js-x-reset"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
71 var $input = $(".js-x-input"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
72 var $rateEu = $(".js-x-rate-eu"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
73 var $resultEu = $(".js-x-result-eu"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
74 var $rateBni = $(".js-x-rate-bni"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
75 var $resultBni = $(".js-x-result-bni"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
76 var $resultPaypal = $(".js-x-result-paypal"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
77 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
78 var locks = {}; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
79 var rates = {}; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
80 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
81 var val = function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
82 return parseFloat($input.val()); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
83 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
84 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
85 var lock = function(isLoading) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
86 if (!isLoading && (locks.eu || locks.bni)) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
87 return; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
88 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
89 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
90 show(isLoading ? $loading : null); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
91 $submit.attr("disabled", isLoading); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
92 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
93 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
94 var displayResult = function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
95 if (rates.eu == null || rates.bni == null) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
96 return; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
97 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
98 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
99 var x = val(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
100 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
101 var resultEu = (Math.ceil(x * 1.07 * rates.eu / 1000) * 1000).toLocaleString(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
102 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
103 $rateEu.text(rates.eu.toLocaleString()); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
104 $resultEu.text(resultEu); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
105 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
106 var resultBni; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
107 var rateBni; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
108 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
109 if (rates.bni !== 0) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
110 rateBni = rates.bni.toLocaleString(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
111 resultBni = (Math.ceil(x * 1.04 * rates.bni / 1000) * 1000 + (25000 * Math.ceil(x / 35000))).toLocaleString(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
112 } else { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
113 rateBni = "x"; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
114 resultBni = "x"; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
115 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
116 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
117 $rateBni.text(rateBni); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
118 $resultBni.text(resultBni); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
119 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
120 $resultPaypal.text((Math.round(x * 1.05)).toLocaleString()); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
121 lock(false); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
122 show($ok); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
123 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
124 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
125 var fetchEu = function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
126 if (rates.fixer != null) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
127 return; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
128 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
129 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
130 lock(true); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
131 locks.fixer = true; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
132 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
133 $.get("eu-daily.xml") |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
134 .always(function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
135 locks.fixer = false; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
136 lock(false); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
137 }).done(function(data) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
138 var $data = $(data); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
139 var idrEur = parseFloat($data.find("[currency=IDR]").attr("rate")); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
140 var jpyEur = parseFloat($data.find("[currency=JPY]").attr("rate")); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
141 rates.eu = idrEur / jpyEur; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
142 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
143 displayResult(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
144 }).fail(function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
145 error("connection"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
146 }); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
147 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
148 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
149 var fetchBni = function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
150 if (rates.bni != null) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
151 return; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
152 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
153 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
154 lock(true); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
155 locks.bni = true; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
156 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
157 $.get("bni-jpyidr.txt") |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
158 .always(function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
159 locks.bni = false; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
160 lock(false); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
161 }).done(function(data) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
162 if (data === "") { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
163 rates.bni = 0; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
164 } else { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
165 rates.bni = parseFloat(data); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
166 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
167 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
168 displayResult(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
169 }).fail(function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
170 error("connection"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
171 }); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
172 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
173 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
174 var error = function(err) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
175 var message; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
176 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
177 if (err === "connection") { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
178 message = "Koneksi ke server nilai tukar bermasalah."; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
179 } else if (err === "missing") { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
180 message = "Masukkan jumlah."; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
181 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
182 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
183 $error.text(message); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
184 show($error); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
185 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
186 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
187 var show = function($el) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
188 $error.toggleClass("u-hidden", $el !== $error); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
189 $ok.toggleClass("u-hidden", $el !== $ok); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
190 $loading.toggleClass("u-hidden", $el !== $loading); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
191 } |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
192 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
193 var action = function(e) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
194 e.preventDefault(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
195 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
196 show(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
197 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
198 if (!isFinite(val())) { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
199 error("missing"); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
200 return; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
201 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
202 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
203 fetchEu(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
204 fetchBni(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
205 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
206 displayResult(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
207 }; |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
208 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
209 $form.submit(action) |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
210 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
211 $reset.click(function() { |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
212 $input.focus(); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
213 }); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
214 }); |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
215 </script> |
0 | 216 </head> |
217 <body> | |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
218 <div class="content"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
219 <h1>Konversi buat nitip</h1> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
220 <form class="js-x-form"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
221 <label> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
222 <p> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
223 Jumlah dalam yen: |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
224 <br> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
225 <input class="input js-x-input" type="number" autofocus> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
226 </p> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
227 </label> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
228 <p> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
229 <button type="submit" class="button js-x-submit">Hitung</button> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
230 <button type="reset" class="button js-x-reset">Hapus</button> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
231 </p> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
232 </form> |
4 | 233 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
234 <div class="result js-x-loading u-hidden"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
235 Memuat data nilai tukar... |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
236 </div> |
0 | 237 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
238 <div class="result js-x-ok u-hidden"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
239 <p class="result__title"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
240 Biaya: |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
241 </p> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
242 <ul class="result__list"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
243 <li> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
244 Bank transfer: |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
245 <strong><span class="js-x-result-eu"></span> IDR</strong> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
246 (<span class="js-x-rate-eu"></span> IDR/JPY) |
4 | 247 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
248 <li> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
249 Bank transfer (alt): |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
250 <strong><span class="js-x-result-bni"></span> IDR</strong> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
251 (<span class="js-x-rate-bni"></span> IDR/JPY) |
4 | 252 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
253 <li> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
254 PayPal: |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
255 <strong><span class="js-x-result-paypal"></span> JPY</strong> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
256 </ul> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
257 </div> |
12 | 258 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
259 <div class="result js-x-error u-hidden"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
260 </div> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
261 |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
262 <hr> |
12 | 263 |
16
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
264 <ul class="list"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
265 <li>Ongkir, cukai, dll tidak termasuk. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
266 <li>Berhubung sudah punya timbangan, ongkir (estimasi) bisa dihitung sebelum dikirim. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
267 <li><a href="http://www.post.japanpost.jp/int/charge/list/ems1_en.html">Tabel ongkir EMS</a>. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
268 <li>Perhitungan: |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
269 <ul class="list"> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
270 <li>Bank: <code>jumlah × 1.07 × nilai_tukar</code>, dibulatkan ke seribuan terdekat. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
271 <li>Bank (alt): <code>jumlah × 1.04 × nilai_tukar + (25000 * ceil(jumlah / 35000))</code>, dibulatkan ke seribuan terdekat. Rekeningnya sama. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
272 <li>PayPal: <code>jumlah × 1.05</code>, dibulatkan ke satuan terdekat. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
273 </ul> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
274 <li>Jangan lupa memastikan jumlah setelah pajak dan ongkir (lokal). |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
275 <li>Data nilai tukar didapat dari <a href="https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html">Bank Sentral Eropa</a>. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
276 <li>Data nilai tukar "(alt)" didapat dari <a href="http://bni.co.id/informasivalas.aspx">BNI</a>. |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
277 </ul> |
1f999668080f
Migrate to eu central bank data and use local jquery
nanaya <me@nanaya.pro>
parents:
14
diff
changeset
|
278 </div> |
0 | 279 </body> |