-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup_script.js
180 lines (146 loc) · 8.73 KB
/
popup_script.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g, '');
if (isNaN(num)) num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num * 100 + 0.50000000001);
cents = num % 100;
num = Math.floor(num / 100).toString();
if (cents < 10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
num = num.substring(0, num.length - (4 * i + 3)) + '.' + num.substring(num.length - (4 * i + 3));
return (((sign) ? '' : '-') + num + '.' + cents);
}
function calculate() {
var orig_amount = null;
orig_amount = document.getElementById("amount").value;
orig_amount = orig_amount.replace(/\./g, ',');
orig_amount = orig_amount.replace(/\,/g, '.');
orig_amount = orig_amount.replace(/[a-zA-Z\$]+/g, '');
var amount = parseFloat(orig_amount);
var select = document.getElementById("select");
var result = document.getElementById("result");
var result2 = document.getElementById("result2");
var result3 = document.getElementById("result3");
var result4 = document.getElementById("result4");
var resulttitle = document.getElementById("resulttitle");
var result2title = document.getElementById("result2title");
var result3itle = document.getElementById("result3itle");
var result4title = document.getElementById("result4title");
var fecha = document.getElementById("fecha");
// Cambio a Bolivar (de Pesos Colombianos)
var pesocompratotal = formatCurrency(amount / preciocucuta.COL.venta);
var pesoventatotal = formatCurrency(amount / preciocucuta.COL.compra);
var pesocompratotal2 = formatCurrency(amount / preciocucuta.COL2.venta);
var pesoventatotal2 = formatCurrency(amount / preciocucuta.COL2.compra);
fecha.value = preciocucuta._timestamp.fecha;
// Cambio a Pesos (de Bolivares Venezolanos)
var bolivarcompratotal = formatCurrency(amount * preciocucuta.BSF.venta);
var bolivarventatotal = formatCurrency(amount * preciocucuta.BSF.compra);
var bolivarcompratotal2 = formatCurrency(amount * preciocucuta.BSF2.venta);
var bolivarventatotal2 = formatCurrency(amount * preciocucuta.BSF2.compra);
fecha.value = preciocucuta._timestamp.fecha;
// Cambio a Dólares (en Bolivares y Pesos)
var dolarcompratotal = formatCurrency(amount * preciocucuta.USD.cucuta);
var dolarventatotal = formatCurrency(amount * preciocucuta.USD.venezuela);
var dolarcompratotal2 = formatCurrency(amount * preciocucuta.USD.colombia);
var dolarventatotal2 = formatCurrency(amount * preciocucuta.USD.dicom);
fecha.value = preciocucuta._timestamp.fecha;
// Cambio a Euros (en Bolivares y Pesos)
var eurocompratotal = formatCurrency(amount * preciocucuta.EUR.cucuta);
var euroventatotal = formatCurrency(amount * preciocucuta.EUR.venezuela);
var eurocompratotal2 = formatCurrency(amount * preciocucuta.EUR.colombia);
var euroventatotal2 = formatCurrency(amount * preciocucuta.EUR.dicom);
fecha.value = preciocucuta._timestamp.fecha;
if (select.value === "1") {
resulttitle.value = 'Dolares: $. ';
//result2title.value = 'Venta(E):';
result.value = pesocompratotal;
//result2.value = 'BsF. ' + pesoventatotal;
//result3itle.value = 'Compra(T):';
result4title.value = 'Venta(T):';
result3.value = pesocompratotal2;
result4.value = pesoventatotal2;
}
if (select.value === "2") {
resulttitle.value = 'Compra(E):';
result2title.value = 'Venta(E):';
result.value = 'COP. ' + bolivarcompratotal;
result2.value = 'COP. ' + bolivarventatotal;
result3itle.value = 'Compra(T):';
result4title.value = 'Venta(T):';
result3.value = 'COP. ' + bolivarcompratotal2;
result4.value = 'COP. ' + bolivarventatotal2;
}
if (select.value === "3") {
resulttitle.value = 'restante: Bs. ';
//result2title.value = 'Venezuela:';
result.value = dolarcompratotal;
//result2.value = 'BsF. ' + dolarventatotal;
//result3itle.value = 'Colombia:';
//result4title.value = 'DICOM:';
result3.value = dolarcompratotal2;
result4.value = dolarventatotal2;
}
if (select.value === "4") {
resulttitle.value = 'restante:';
//result2title.value = 'Venezuela:';
result.value = 'BsF. ' + eurocompratotal;
result2.value = 'BsF. ' + euroventatotal;
result3itle.value = 'Colombia:';
//result4title.value = 'DICOM:';
result3.value = 'COP. ' + eurocompratotal2;
result4.value = 'BsF. ' + euroventatotal2;
}
}
calculate();
var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
var preciocucuta={"COL":{"efectivo":0.00,"transfer":0.00,"compra":5000,"venta":5000},"BSF":{"efectivo":0.00,"transfer":0.00,"compra":5000,"venta":5000},"COL2":{"efectivo":0.00,"transfer":0.00,"compra":5000,"venta":5000},"BSF2":{"efectivo":0.00,"transfer":0.00,"compra":5000,"venta":5000},"_timestamp":{"fecha":"","fecha_corta":"HOY, 2017"},"USD":{"cucuta":12.66,"venezuela":12.66,"colombia":12.66,"dicom":12.66},"EUR":{"cucuta":5450,"venezuela":4671,"colombia":3270,"dicom":3733}}
}
/*
FILE ARCHIVED ON 06:47:15 Apr 15, 2019 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 12:11:45 Dec 06, 2022.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
*/
/*
playback timings (ms):
captures_list: 161.706
exclusion.robots: 0.068
exclusion.robots.policy: 0.062
cdx.remote: 0.058
esindex: 0.008
LoadShardBlock: 80.344 (3)
PetaboxLoader3.datanode: 76.213 (4)
CDXLines.iter: 18.458 (3)
load_resource: 68.572
PetaboxLoader3.resolve: 47.677
*/
var boton = document.getElementById("copiador");
boton.addEventListener("click", copiarAlPortapapeles, false);
function copiarAlPortapapeles() {
var enlace = document.getElementById("result");
//var inputFalso = document.createElement("input");
//inputFalso.setAttribute("value", enlace.innerHTML);
//document.body.appendChild(inputFalso);
//inputFalso.select();
enlace.select();
document.execCommand("copy");
//document.body.removeChild(enlace);
function botonArriba(){
$('[data-toggle="tooltip"]').tooltip('show')
var myToolTip = document.getElementById("copiador");
}
botonArriba()
myToolTip.innerHTML = "cuando esto funcione sera muy cool";
}