PageSourceSearch

https://comsalamanca.es/Temas/canvas1/jQuery/plantilla.js

js comsalamanca.es collected 2026-10-01 15:19:01 UTC 5,858 bytes, 217 lines download raw bytes

1var addthis_share = {
2    pubid:"Colegio oficial de Médicos de Salamanca",
3     url_transforms : {
4          shorten: {
5               twitter: 'bitly'
6          }
7     }, 
8     shorteners : {
9          bitly : {} 
10     }
11}
12//--------------Funciones cookies----------------------//
13/*function setCookie(cname, cvalue, exdays) {
14    var d = new Date();
15    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
16    var expires = "expires=" + d.toGMTString();
17    document.cookie = cname + "=" + cvalue + "; " + expires;
18}
19
20function removeCookie(cname) {
21    var expires = "expires=Thu, 18 Dec 2013 12:00:00 GMT; path=/";
22    document.cookie = cname + "=; " + expires;
23}
24
25function getCookie(cname) {
26    var name = cname + "=";
27    var ca = document.cookie.split(';');
28    for (var i = 0; i < ca.length; i++) {
29        var c = ca[i].trim();
30        if (c.indexOf(name) === 0)
31            return c.substring(name.length, c.length);
32    }
33    return false;
34}
35
36function isCookie(cname) {
37    if (getCookie(cname) === false) {
38        return false;
39    }
40    return true;
41}
42
43function checkCookie() {
44    if (!isCookie("mostrarAviso")) {
45        leyCookies();
46        jQuery(window).bind("scroll.cookies", function () {
47            if (jQuery(window).scrollTop() > 600) {
48                jQuery("#avisoCookies").hide(300);
49                jQuery(window).unbind("scroll.cookies");
50                setCookie("mostrarAviso", "no", 365);
51            }
52        });
53    } else {
54        if (jQuery("#avisoCookies").length !== 0) {
55            jQuery("#avisoCookies").remove();
56        }
57    }
58    
59}
60
61function leyCookies() {
62    if (jQuery("#avisoCookies").length !== 0) {
63        jQuery("#avisoCookies").show(300);
64        jQuery("body").on("click", "#avisoCookies .btn", function (e) {
65            e.preventDefault();
66            jQuery("#avisoCookies").hide(300);
67            setCookie("mostrarAviso", "no", 365);
68        });
69    }
70}*/
71//--------------Fin funciones cookies------------------//
72//--------------Funciones Generales-------------------//
73function isMobile() {
74    return ('ontouchstart' in document.documentElement);
75}
76
77function convertirJson(datos) {
78    try {
79        return jQuery.parseJSON(jQuery.trim(datos));
80    } catch (exception) {
81        return false;
82    }
83}
84
85function convertirFloat(numero) {
86    if (numero.indexOf('.') !== -1) {
87        numero = numero.replace(',', '');
88        return parseFloat(numero);
89    }
90    numero = numero.replace(',', '.');
91    var veces = repetidos(numero, '.', 0);
92    if (veces > 1) {
93        return 0;
94    }
95    return parseFloat(numero);
96}
97
98function repetidos(cadena, busqueda, inicio) {
99    var contador = 0;
100    var posicion = cadena.indexOf(busqueda, inicio);
101    if (posicion !== -1) {
102        contador = repetidos(cadena, busqueda, posicion + 1);
103    }
104    return contador;
105}
106
107function redondear(numero, decimales) {
108    return numero.toFixed(decimales)
109}
110
111function moneda(numero) {
112    var DecimalSeparator = Number(1.2).toLocaleString().substr(1, 1);
113
114    var AmountWithCommas = numero.toLocaleString();
115    var arParts = String(AmountWithCommas).split(DecimalSeparator);
116    var intPart = arParts[0];
117    var decPart = (arParts.length > 1 ? arParts[1] : '');
118    decPart = (decPart + '00').substr(0, 2);
119    return 'EUR ' + intPart + DecimalSeparator + decPart;
120}
121
122function respuestaGenerica(datos) {
123    console.log("respuesta generica");
124    var json = convertirJson(datos);
125    if(!json){
126        json = datos;
127    }
128        //var json = datos;
129    console.log(json);
130    console.log(json.estado);
131    if (json === false) {
132        return;
133    }
134    if (json.estado === "Ok") {
135        if (json.descripcion !== "") {
136            toast(json);
137        }
138        callback(json);
139        return;
140    }
141    if (json.estado === "Error") {
142        ventanaEmergente(json.titulo, json.descripcion);
143    }
144    callback(json);
145}
146
147function callback(json) {
148    if (typeof json.callback == "undefined") {
149        return;
150    }
151    if (json.callback === "ninguno") {
152        return;
153    }
154    window[json.callback](convertirJson(json.argumentos), json);
155}
156//--------------Fin Funciones Generales-------------------//
157//
158//--------------Ventanas-------------------//
159/**
160 * Funcion que crea una ventana de dialogo y la muestra
161 * @titulo Titulo de la ventana
162 * @mensaje Texto del mensaje  * @author Juan Antonio <[email protected]>
163 * @date 08/06/2011
164 * @version 1.0
165 */
166function ventanaEmergente(titulo, mensaje) {
167    titulo = "<strong>"+titulo+"</strong> ";
168    var a = "<a data-notify-msg='<i class=\"icon-remove-sign\"></i> "+titulo+mensaje+"'\n\
169            data-notify-type='error'\n\
170            data-notify-close='true'></a>";
171    SEMICOLON.widget.notifications(a);
172    return false;
173}
174
175function toast(json) {
176    if (typeof json.titulo === null) {
177        json.titulo = "";
178    }else{
179        json.titulo = "<strong>"+json.titulo+"</strong> ";
180    }
181    var a = "<a data-notify-msg='<i class=\"icon-ok-sign\"></i> "+json.titulo+json.descripcion+"'\n\
182            data-notify-type='sucess'\n\
183            data-notify-close='true'></a>";
184    SEMICOLON.widget.notifications(a);
185    return false;
186}
187
188//--------------Fin Ventanas-------------------//
189//--------------Document ready-------------------//
190jQuery(document).ready(function() {
191   // checkCookie();
192    checkMenu();
193});
194
195function checkMenu(){
196    jQuery("#primary-menu").find("li.current").parents("li").addClass("current");
197}
198//-----------Iniciar controles jQueryUI-------------------//
199var accentMap = {
200    "á": "a",
201    "é": "e",
202    "í": "i",
203    "ó": "o",
204    "ú": "u",
205    "Á": "A",
206    "É": "E",
207    "Í": "I",
208    "Ó": "O",
209    "Ú": "U"
210};
211var normalize = function (term) {
212    var ret = "";
213    for (var i = 0; i < term.length; i++) {
214        ret += accentMap[ term.charAt(i) ] || term.charAt(i);
215    }
216    return ret;
217};

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.