PageSourceSearch

https://reservas.sarayatours.es/Scripts/ofitourweb-comun.js.axd?es&version=v_10.115.3_test_2978

js sarayatours.es collected 2026-09-27 06:24:34 UTC 11,296 bytes, 321 lines download raw bytes

1/*************************/
2/* Traducciones Clientes */
3/*************************/
4function aplicarTraduccionesCliente(idiomaActual) {
5
6    if (typeof listaTraduccionesCliente != 'undefined') {
7        $.each(listaTraduccionesCliente, function (i, traduccion) {
8            $.each(traduccion.idiomas, function (j, idioma) {
9                if (idioma.codigo_idioma == idiomaActual) {
10                    if (traduccion.atributo) {
11                        $(traduccion.selector).attr(traduccion.atributo,idioma.valor);
12                    } else {
13                        if ($(traduccion.selector).is("input")) {
14                            $(traduccion.selector).val(idioma.valor);
15                        } else {
16                            $(traduccion.selector).html(idioma.valor);
17                        }
18                    }
19                    
20                    return false;
21                }
22            });
23        });
24    }
25}
26/**********************************/
27/* IsNullOrEmpty */
28/**********************************/
29
30function IsNullOrEmpty(string) {
31    return string == null || string == "";
32}
33
34
35
36function formatCurrencyCulture(valor, culture, cambio, mostrarCeroEnLugarDeTextoMasBarato) {
37
38    mostrarCeroEnLugarDeTextoMasBarato = mostrarCeroEnLugarDeTextoMasBarato || false;
39
40    if (cambio == undefined) {
41        cambio = 1;
42    }
43    var importe = Number(valor);
44
45    importe = isNaN(importe) || importe === '' || importe === null ? 0.00 : importe;
46    importe = parseFloat(importe * cambio).toString().replace(".", $.formatCurrency.regions[culture].decimalSymbol);
47    if (importe != 0) {
48        return $("<input/>").val(importe).formatCurrency({ region: culture }).val();
49    } else if (mostrarCeroEnLugarDeTextoMasBarato) {
50        return $("<input/>").val(importe).formatCurrency({ region: culture, roundToDecimalPlace: 0 }).val()
51    }
52    return TextoElMasBarato != undefined ? TextoElMasBarato() : "El mas barato";
53}
54
55function TextoElMasBarato() {
56    return 'The cheapest';
57}
58
59
60function getAmountWithExchange(valor, cambio) {
61    if (cambio == undefined) {
62        cambio = 1;
63    }
64    var importe = Number(valor);
65    importe = isNaN(importe) || importe === '' || importe === null ? 0.00 : importe;
66    return  parseFloat(importe) * cambio;
67}
68
69function formatCurrencyDifferenceAmountCulture(valor, culture, cambio, mostrarCeroEnLugarDeTextoMasBarato) {
70    mostrarCeroEnLugarDeTextoMasBarato = mostrarCeroEnLugarDeTextoMasBarato || false;
71    var importe = getAmountWithExchange(valor, cambio);
72    if (importe < 0) {
73        return  "- " + $("<input/>").val((importe * -1).toString().replace(".", $.formatCurrency.regions[culture].decimalSymbol)).formatCurrency({ region: culture }).val();
74    } else {
75        if (importe > 0 || mostrarCeroEnLugarDeTextoMasBarato) {
76            return "+ " + $("<input/>").val(importe.toString().replace(".", $.formatCurrency.regions[culture].decimalSymbol)).formatCurrency({ region: culture }).val();
77        }
78    }
79    return  TextoElMasBarato != null ? TextoElMasBarato() : "El mas barato";
80}
81
82function formatCurrencySupplementAmountCulture(valor, culture, cambio, mostrarCeroEnLugarDeTextoMasBarato) {
83    mostrarCeroEnLugarDeTextoMasBarato = mostrarCeroEnLugarDeTextoMasBarato || false;
84    var importe = getAmountWithExchange(valor, cambio);
85    if (importe < 0) {
86        return "Suplemento: - " + $("<input/>").val((importe * -1).toString().replace(".", $.formatCurrency.regions[culture].decimalSymbol)).formatCurrency({ region: culture }).val();
87    } else {
88        if (importe >= 0 || mostrarCeroEnLugarDeTextoMasBarato) {
89            return "Suplemento: " + $("<input/>").val(importe.toString().replace(".", $.formatCurrency.regions[culture].decimalSymbol)).formatCurrency({ region: culture }).val();
90        }
91    }
92    return TextoElMasBarato != null ? TextoElMasBarato() : "El mas barato";
93}
94
95function formatCurrencyIntegerWithoutCultureOnlyWithCurrencyCode(valor, culture, cambio) {
96    var importe = getAmountWithExchange(valor, cambio);
97    var symbol = importe >= 0 ? "+" : "-";
98    return symbol + parseInt(importe) + " " + $.formatCurrency.regions[culture].symbol;
99}
100function setImageNotFound(image) {
101    image.onerror = "";
102    image.src = "/Content/images/ImagenNoDisponible.png";
103    return true;
104}
105
106function descargaFicheros(listaFicheros) {   
107    var link = document.createElement('a');
108    link.style.display = 'none';
109    document.body.appendChild(link);
110    if (Array.isArray(listaFicheros)) {
111        for (var i = 0; i < listaFicheros.length; i++) {
112            link.setAttribute('href', listaFicheros[i]);
113            link.setAttribute('download', "");
114            link.click();
115        }
116    } else {
117        link.setAttribute('href', listaFicheros);
118        link.setAttribute('download', "");
119        link.click();
120    }
121
122    document.body.removeChild(link);
123}
124
125Date.prototype.addDays = function (days) {
126    var date = new Date(this.valueOf());
127    date.setDate(date.getDate() + days);
128    return date;
129}
130Date.fromString = function (value, delimiter) {
131    if (!value) return new Date();
132    var parts = value.split(delimiter);
133    return new Date(parts[2], parts[1] - 1, parts[0]);
134}
135Date.prototype.toFormatString = function (format) {
136    if (format == undefined) format = "dd/mm/yyyy";
137    var parts = format.split(/([.,\/ -TZ])/g);
138    var result = "";
139    for (var i = 0; i < parts.length; i++) {
140        result += this.getDateElementFromKey(parts[i]);
141    }
142    return result;
143}
144function pad(number) {
145    if (number < 10) {
146        return '0' + number;
147    }
148    return number;
149}
150Date.prototype.getDateElementFromKey = function (key) {
151    switch (key) {
152        case 'd': return this.getDate();
153        case 'dd': return pad(this.getDate());
154        case 'm': return this.getMonth() + 1;
155        case 'mm': return pad(this.getMonth() + 1);
156        case 'yyyy': return this.getFullYear();
157        case 'yy': return this.getYear() - 100;
158        case 'hh': return pad(this.getHours());
159        case 'i': return pad(this.getMinutes());
160        case 'ss': return pad(this.getSeconds());
161        default: return key;
162    }
163}
164
165const dateNames = {
166    'es': {
167        "monthNames": ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
168        "monthNamesShort": ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
169        "dayNames": ["Domingo", "Lunes", "Martes", "Mi&eacute;rcoles", "Jueves", "Viernes", "S&aacute;bado"],
170        "dayNamesShort": ["Dom", "Lun", "Mar", "Mi&eacute;", "Jue", "Vie", "S&aacute;b"],
171        "dayNamesMin": ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "S&aacute;"]
172    },
173    'en': {
174        "monthNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
174November", "December"],
175        "monthNamesShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
176        "dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
177        "dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
178        "dayNamesMin": ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
179    }
180}
181Date.prototype.getMesAbreviado = function () {
182    return dateNames['es'] && dateNames['es'].monthNamesShort[this.getMonth()];
183}
184Date.prototype.getDiaSemana = function () {
185    return dateNames['es'] && dateNames['es'].dayNamesShort[this.getDay()];
186}
187function getStringDate(dateString, format) {
188    return new Date(dateString).toFormatString(format);
189}
190function timeSession(ms) {
191    var resultado = '';
192    var sec = Math.floor(ms / 1000);
193    var min = Math.floor(sec / 60);
194    sec = sec % 60;
195    resultado = formattime(sec);
196    min = min % 60;
197    return formattime(min) + ":" + resultado;
198}
199function formattime(x) {
200    return ((x > 9) ? "" : "0") + x
201}
202
203function comparaHotelRecomendado(a, b) {
204    return a == b ? 0
205         : a ? -1
206         : +1;
207}
208function comparaHotelDiferenciaPrecio(a, b) {
209    return a == b ? 0
210         : a < b ? -1
211         : +1;
212}
213function comparaHotelRecomendadoDiferenciaPrecio(a, b) {
214    return comparaHotelRecomendado(a.Recomendado, b.Recomendado) || comparaHotelDiferenciaPrecio(a.DiferenciaPrecio, b.DiferenciaPrecio);
215}
216
217function esProductoHostelComoApartementos(idProducto, arrayIdsProductoHostelComoApartamentos) {
218    return arrayIdsProductoHostelComoApartamentos.split(";").indexOf(idProducto.toString());
219}
220
221String.prototype.format = function () {
222    a = this;
223    for (k in arguments) {
224        a = a.replace("{" + k + "}", arguments[k])
225    }
226    return a
227}
228String.prototype.toCapitalize = function() {
229    const newValue = this
230    const capital = newValue.charAt(0).toUpperCase()
231    return capital + newValue.slice(1)
232}
233
234function clamp (num, min, max) { return Math.min(Math.max(num, min), max)}
235
236/**
237 * Returns an array with arrays of the given size.
238 *
239 * @param chunkSize {Integer} Size of every group
240 */
241Array.prototype.chunk = function (chunk_size) {
242    myArray = this;
243    var results = [];
244
245    while (myArray.length) {
246        results.push(myArray.splice(0, chunk_size));
247    }
248
249    return results;
250}
251
252Array.prototype.groupBy = function (key) {
253    return this.reduce(function (rv, x) {
254        (rv[x[key]] = rv[x[key]] || []).push(x);
255        return rv;
256    }, {});
257}
258
259Set.prototype.intersection = function(b) {
260    return new Set([...this].filter(x => b.has(x)))
261}
262
263Set.prototype.union = function (b) {
264    return new Set([...this, ...b])
265}
266
267$(document).ready(function() {
268    $("img").error(function () {
269        setImageNotFound($(this)[0]);
270    });
271});
272
273/**********************************/
274/* Formatos de fecha */
275/**********************************/
276function GetDateFormat(jsonDate, format) {
277    var value = new Date(parseInt(jsonDate.substr(6)));
278
279    var dayNamesShort = $.datepicker.regional["dayNamesShort"];
280    var dayNames = $.datepicker.regional["dayNames"];
281    var monthNamesShort = $.datepicker.regional["monthNamesShort"];
282    var monthNames = $.datepicker.regional["monthNames"];
283
284    return $.datepicker.formatDate(format, value, { dayNamesShort: dayNamesShort, dayNames: dayNames, monthNamesShort: monthNamesShort, monthNames: monthNames });
285}
286
287if (!String.prototype.formatStringCsharp) {
288    String.prototype.formatStringCsharp = function (...args) {
289        return this.replace(/{([0-9]+)}/g, function (match, index) {
290            return typeof args[index] === 'undefined' ? match : args[index];
291        });
292    };
293}
294
295$(".toggle-link").live("click", function (e) {
296    var selector = $(this).attr("href");
297    var effect = $(this).data("toggle-effect");
298    switch (effect) {
299    case 'slide':
300        $(selector).slideToggle();
301        break;
302    case 'fade':
303        $(selector).fadeToggle();
304        break;
305    default:
306        $(selector).toggle();
307        break;
308    }
309    var oldTitle = $(this).attr("title");
310    var oldText = $(this).html();
311    var newTitle = $(this).data("toggle-title");
312    var newText = $(this).data("toggle-text");
313    $(this).attr("title", newTitle);
314    $(this).html(newText);
315    $(this).data("toggle-title", oldTitle);
316    $(this).data("toggle-text", oldText);
317    e.preventDefault();
318    e.stopPropagation();
319    return false;
320});
321

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.