1/*1770813134000*/ 2/**COoKIES NUEVA**/ 3function getCookieValue(cookieName) { 4 5 var name = cookieName + "="; 6 var decodedCookie = decodeURIComponent(document.cookie); 7 var ca = decodedCookie.split(';'); 8 for(var i = 0; i <ca.length; i++) { 9 var c = ca[i]; 10 while (c.charAt(0) == ' ') { 11 c = c.substring(1); 12 } 13 if (c.indexOf(name) == 0) { 14 //console.log(c.substring(name.length, c.length)) 15 return c.substring(name.length, c.length); 16 } 17 } 18 return ""; 19 } 20 function getCookie(nombre) { 21 var cookies = document.cookie; 22 var cookieArr = cookies.split("; "); 23 24 for (var i = 0; i < cookieArr.length; i++) { 25 var parArr = cookieArr[i].split("="); 26 27 if (parArr[0] === nombre) { 28 return unescape(parArr[1]); 29 } 30 } 31 32 return undefined; 33 } 34 35/**FUNCIONES PARA SUBIR PAGINA EN TODA LA WEB**/ 36$("#back-top").hide(); 37 38//fade in #back-top 39$(window).scroll(function() { 40if ($(this).scrollTop() > 200) { 41$('#back-top').fadeIn(); 42} else { 43$('#back-top').fadeOut(); 44} 45}); 46 47//scroll body to 0px on click 48$('#back-top a').click(function(e) { 49e.preventDefault(); 50$('body,html').animate({ 51scrollTop: 0 52}, 300); 53}); 54 55/**FUNCIONES PARA LOS COMBOS CUSTOMIZADOS**/ 56 57/**SELECT PREDICTIVO DATALIST**/ 58 59(function($) { 60 61 $.fn.customDatalist = function(params) { 62 return this.each(function(count) { 63 var $inputList = $(this); // the original <input> element 64 var inputListID = $inputList.attr('id'); // ID of the original <input> input 65 var dataListID = inputListID + "_" + "datalist"; // ID of the original <datalist> input 66 var metodoComprobar = inputListID + "_" + "comprobar"; // metodo comprobar 67 var data = "data" + count; 68 window[data] = {}; 69 70 71 $("#" + dataListID+" option").each(function(i,el) { 72 window[data][$(el).data("value")] = $(el).val(); 73 }); 74 75 $('#' + inputListID).focus(function() { 76 $('#' + dataListID).css("display","block"); 77 }); 78 79 $('#' + inputListID).on('focusout', function(e) { 80 if ($('#'+ dataListID + ':hover').length) { 81 return; 82 } 83 $('#' + dataListID).hide(); 84 }); 85 86 $("#" + dataListID +" > option").each(function() { 87 this.onclick = function() { 88 $('#' + inputListID).val(this.value); 89 $('#' + dataListID).hide(); 90 } 91 }); 92 93 $('#' + inputListID).bind('input', function() { 94 window[currentFocus] = -1; 95 var text = $('#' + inputListID).val().toUpperCase(); 96 var esVisible = false; 97 $("#" + dataListID +" > option").each(function() { 98 if (this.value.toUpperCase().indexOf(text) > -1) { 99 this.style.display = "block"; 100 esVisible = true; 101 } else { 102 this.style.display = "none"; 103 } 104 }); 105 106 if(esVisible){ 107 $('#' + dataListID).removeClass("jjggg_datalist_container"); 108 }else{ 109 $('#' + dataListID).addClass("jjggg_datalist_container"); 110 } 111 112 if (typeof window[metodoComprobar] === "function") { 113 window[metodoComprobar](); 114 } 115 }); 116 117 var currentFocus = "currentFocus" + count; 118 window[currentFocus] = -1; 119 $('#' + inputListID).keydown(function(event) { 120 if (event.keyCode == 40) { 121 window[currentFocus]++ 122 123 if (!document.querySelector("#" + dataListID).options) return false; 124 125 for (var i = 0; i < document.querySelector("#" + dataListID).options.length; i++) { 126 document.querySelector("#" + dataListID).options[i].classList.remove("active"); 127 } 128 129 if (window[currentFocus] >= document.querySelector("#" + dataListID).options.length) window[currentFocus] = 0; 130 if (window[currentFocus] < 0) window[currentFocus] = (document.querySelector("#" + dataListID).options.length - 1); 131 document.querySelector("#" + dataListID).options[window[currentFocus]].classList.add("active"); 132 133 134 } else if (event.keyCode == 38) { 135 window[currentFocus]-- 136 137 if (!document.querySelector("#" + dataListID).options) return false; 138 139 for (var i = 0; i < document.querySelector("#" + dataListID).options.length; i++) { 140 document.querySelector("#" + dataListID).options[i].classList.remove("active"); 141 } 142 143 if (window[currentFocus] >= document.querySelector("#" + dataListID).options.length) window[currentFocus] = 0; 144 if (window[currentFocus] < 0) window[currentFocus] = (document.querySelector("#" + dataListID).options.length - 1); 145 document.querySelector("#" + dataListID).options[window[currentFocus]].classList.add("active"); 146 147 } else if (event.keyCode == 13) { 148 event.preventDefault(); 149 if (window[currentFocus] > -1) { 150 if (document.querySelector("#" + dataListID).options) document.querySelector("#" + dataListID).options[window[currentFocus]].click(); 151 } 152 } 153 }); 154 155 }); 156 } 157 158})(jQuery); 159 160 161 162/**SELECT BASICO**/ 163(function($) { 164 $.fn.customA11ySelect = function(params) { 165 166 var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Silk|Opera Mini/i.test(navigator.userAgent); 167 var keyTimeout; 168 var keyMap = ''; 169 var down = 40; 170 var up = 38; 171 var spacebar = 32; 172 var enter = 13; 173 var escape = 27; 174 var pageUp = 33; 175 var pageDown = 34; 176 var endKey = 35; 177 var homeKey = 36; 178 var tabKey = 9; 179 180 return this.each(function() { 181 182 var $menu = $(this); // the original <select> element 183 var menuID = $menu.attr('id'); // ID of the original <select> input 184 185 // creates the dropdown menu 186 function menuConstructor() { 187 188 var $label = $('label[for="'+menuID+'"]'); 189 $label.attr('id',menuID+'-label'); 190 191 // create the new custom-a11yselect HTML
192 var selectMenu = $('<div class="custom-a11yselect-container">'); 193 buildMenu(selectMenu); 194 } 195 196 function setParams(list) { 197 // if overlay parameter is defined, set overlay scroll on dropdown menu 198 if (params.overlay) { 199 var overlaySize = params.overlay+'px'; 200 list.addClass('custom-a11yselect-overflow').css('max-height',overlaySize); 201 } 202 } 203 204 function buildMenu(selectMenu) { 205 206 // put all <option>'s in an array 207 var options = new Array; 208 $menu.find('option').each(function() { 209 options.push($(this)); 210 }); 211 212 var button = $('<button type="button" id="'+menuID+'-button" class="custom-a11yselect-btn" aria-expanded="false" aria-haspopup="true"><span class="custom-a11yselect-text" id="'+menuID+'-selected"></span><i class="custom-a11yselect-icon icon-carrat-down"></i></button>'); 213 var list = $('<ul class="custom-a11yselect-menu" id="'+menuID+'-menu" role="menu">'); 214 215 // create each option <li> for the custom-a11yselect 216 for (i=0;i<options.length;i++) { 217 // add an image to the option text if the data-iconurl attribute is present 218 var optionText = (options[i].attr('data-iconurl')) ? '<i class="custom-a11yselect-img" style="background-image:url('+options[i].attr('data-iconurl')+')"> </i>'+options[i].text() : options[i].text(); 219 // if the current option is selected 220 if (options[i].is(':selected')) { 221 list.append('<li id="'+menuID+'-option-'+i+'" class="custom-a11yselect-option custom-a11yselect-focused custom-a11yselect-selected" data-val="'+options[i].val()+'"><button type="button" role="menuitem">'+optionText+'</button></li>'); 222 button.attr('aria-labelledby',menuID+'-selected '+menuID+'-label').attr('aria-activedescendant','custom-a11yselect-'+i); 223 button.find('.custom-a11yselect-text').text(options[i].text()); 224 // if the current option is disabled 225 } else if (options[i].is(':disabled')) { 226 list.append('<li id="'+menuID+'-option-'+i+'" class="custom-a11yselect-option custom-a11yselect-disabled" data-val="'+options[i].val()+'" aria-disabled="true"><button type="button" role="menuitem">'+optionText+'</button></li>'); 227 // normal options 228 } else { 229 list.append('<li id="'+menuID+'-option-'+i+'" class="custom-a11yselect-option" data-val="'+options[i].val()+'"><button type="button" role="menuitem">'+optionText+'</button></li>'); 230 } 231 } 232 // if there are more than 5 options, set an overflow class 233 if (options.length > 5) { 234 list.addClass('custom-a11yselect-overflow'); 235 } 236 237 selectMenu.append(button,list); // append the button and option list to the custom-a11yselect-container 238 239 if (!$menu.is('[data-custom-a11yselect]')) { 240 $menu.after(selectMenu); // insert the custom-a11yselect after the original <select> element 241 $menu.attr('data-custom-a11yselect',menuID+'-menu'); // apply data attribute to original select element 242 } 243 244 // if on mobile or tablet, use native mobile OS select controls by inserting original <select> inside button 245 if (isMobile) { 246 $menu.appendTo(selectMenu).addClass('custom-a11yselect-mobile'); 247 list.addClass('custom-a11yselect-hidden'); 248 mobileEventHandlers(button,$menu); 249 // if on desktop, hide original <select> 250 } else { 251 $menu.hide(); 252 eventHandlers(selectMenu); // set eventHandlers for this custom-a11yselect 253 // if special parameters are defined 254 if (typeof params != 'undefined') { 255 setParams(list); 256 } 257 } 258 } 259 260 // refresh options within an existing custom select menu 261 function refreshOptions() { 262 var selectMenu = $('#'+$menu.attr('data-custom-a11yselect')).parent('.custom-a11yselect-container'); 263 selectMenu.find('.custom-a11yselect-btn, .custom-a11yselect-menu').remove(); // remove the existing button and dropdown list 264 buildMenu(selectMenu); 265 } 266 267 // if the select does not already have a custom select menu applied 268 if (!$menu.is('[data-custom-a11yselect]')) { 269 menuConstructor(); 270 } 271 272 // if the select already has a custom select menu AND the 'refresh' parameter is passed AND it's not a mobile device 273 // if the select already has a custom select menu AND the 'refresh' parameter is passed 274 if ($menu.is('[data-custom-a11yselect]') && params == 'refresh') { 275 // if mobile, then only update the button text 276 if (isMobile) { 277 var $btn = $('button#'+menuID+'-button'); 278 var valText = $menu.find('option:selected').text(); 279 $btn.find('.custom-a11yselect-text').text(valText); 280 // if not mobile, then rebuild the select dropdown 281 } else { 282 refreshOptions(); 283 } 284 } 285 });
286 287 function eventHandlers(selectMenu) { 288 var $button = selectMenu.find('.custom-a11yselect-btn'); 289 var $option = selectMenu.find('.custom-a11yselect-option > button'); 290 var $original = selectMenu.prev('select'); 291 292 // clicking the menu button opens/closes the dropdown 293 $button.on('click',function(e){ 294 e.preventDefault(); 295 e.stopPropagation(); 296 // if the keyMap variable from the keySearch function is empty, toggle the dropdown 297 if (keyMap == '') { 298 toggleDropdown($(this)); 299 $(this).siblings('.custom-a11yselect-menu').find('.custom-a11yselect-focused > button').trigger('focus'); 300 } 301 }); 302 303 // key event handlers for the main dropdown button 304 $button.on('keydown',function(e) { 305 var $dropdown = $(this).siblings('.custom-a11yselect-menu'); 306 switch(e.keyCode) { 307 // escape key closes the dropdown 308 case escape: 309 e.preventDefault(); 310 closeDropdown($dropdown); 311 break; 312 // up and down arrow keys open/close the dropdown 313 case up: 314 case down: 315 e.preventDefault(); 316 e.stopPropagation(); 317 toggleDropdown($(this)); 318 $(this).siblings('.custom-a11yselect-menu').find('.custom-a11yselect-focused > button').trigger('focus'); 319 break; 320 } 321 }); 322 323 // Keypress event handlers to support searching for select options by typing in option text 324 $button.on('keypress',function(e) { 325 var keyp = e.keyCode; 326 var dropdown = $(this).siblings('.custom-a11yselect-menu'); 327 keySearch(keyp,dropdown); 328 }); 329 $option.on('keypress',function(e) { 330 var keyp = e.keyCode; 331 var dropdown = $(this).parents('.custom-a11yselect-menu'); 332 keySearch(keyp,dropdown); 333 }); 334 335 // key event handlers for option buttons within the dropdown 336 $option.on('keydown',function(e) { 337 var $li = $(this).parent('.custom-a11yselect-option'); 338 switch(e.keyCode) { 339 // up arrow key focuses to previous option 340 case up: 341 e.preventDefault(); 342 e.stopPropagation(); 343 $li.prev('.custom-a11yselect-option').children('button').trigger('focus'); 344 break; 345 // down arrow key focuses on next option 346 case down: 347 e.preventDefault(); 348 e.stopPropagation(); 349 $li.next('.custom-a11yselect-option').children('button').trigger('focus'); 350 break; 351 // page up and home keys focus on first option 352 case pageUp: 353 case homeKey: 354 e.preventDefault(); 355 e.stopPropagation(); 356 $li.siblings('.custom-a11yselect-option:first').children('button').trigger('focus'); 357 break; 358 // page down and end keys focus on last option 359 case pageDown: 360 case endKey: 361 e.preventDefault(); 362 e.stopPropagation(); 363 $li.siblings('.custom-a11yselect-option:last').children('button').trigger('focus'); 364 break; 365 case escape: 366 e.preventDefault(); 367 closeDropdown($(this).parents('.custom-a11yselect-menu')); 368 break; 369 // tab key is disabled when focused on any option 370 case tabKey: 371 e.preventDefault(); 372 break; 373 } 374 }); 375 376 // hover & focus on menu options toggles active/hover state 377 $option.on('mouseover focus',function(e) { 378 var $dropdown = $(this).parents('.custom-a11yselect-menu'); 379 $dropdown.find('.custom-a11yselect-option.custom-a11yselect-focused').removeClass('custom-a11yselect-focused'); 380 $(this).parent('.custom-a11yselect-option').addClass('custom-a11yselect-focused'); 381 $dropdown.siblings('.custom-a11yselect-btn').attr('aria-activedescendant',$(this).attr('id')); 382 }); 383 384 // clicking on menu option sets option as selected 385 $option.on('click',function(e) { 386 e.preventDefault(); 387 e.stopPropagation(); 388 var $li = $(this).parent('.custom-a11yselect-option'); 389 if (!$li.hasClass('custom-a11yselect-disabled')) { 390 selectOption($li, true); 391 // if the keyMap variable from the keySearch function is empty, close the dropdown 392 if (keyMap == '') { 393 closeDropdown($(this).parents('.custom-a11yselect-menu')); 394 } 395 } 396 }); 397 398 // clicking outside the dropdown closes it 399 $('body').on('click',function() { 400 closeDropdown(); 401 }); 402 // if the original/hidden <select> value is changed, update the selected option in the custom select 403 $original.change(function() { 404 var selectedOptionIndex = $(this).find('option:selected').index(); 405 var customSelectedOption = selectMenu.find('.custom-a11yselect-option').eq(selectedOptionIndex); 406 selectOption(customSelectedOption, false); 407 }); 408 } 409 410 // Search for select options matching a string of characters typed while focused on the element 411 function keySearch(keyp,dropdown) { 412 var $options = dropdown.find('.custom-a11yselect-option'); 413 var $currOption = dropdown.find('.custom-a11yselect-selected'); 414 415 if (keyp !== down && 416 keyp !== up && 417 keyp !== enter && 418 keyp !== escape && 419 keyp !== pageUp && 420 keyp !== pageDown && 421 keyp !== homeKey && 422 keyp !== endKey && 423 keyp !== tabKey) { 424 425 var character = String.fromCharCode(keyp).toLowerCase(); 426 427 // if the first key is spacebar and keyMap is empty, don't do anything (to prevent conflict with click event) 428 if (keyp == spacebar && keyMap == '') { 429 return; 430 } 431 432 if (keyMap === '') { 433 keyMap = character; 434 } else { 435 keyMap += character; 436 } 437 438 // timeout to wait until user has finished typing to check for option matching keyMap string 439 clearTimeout(keyTimeout); 440 keyTimeout = setTimeout(function() { 441 442 keyMap = keyMap.trim(); 443 444 var $nextOpt = $currOption.nextAll('.custom-a11yselect-option').filter(function() { 445 return $(this).text().toLowerCase().indexOf(keyMap) == 0;
446 }); 447 448 // if one of the options after the currently-selected option is a match, select it 449 if ($nextOpt.length) { 450 selectOption($nextOpt.first(), true); 451 // close the dropdown if a match is found 452 if ($nextOpt.first().length) { 453 closeDropdown(dropdown); 454 } 455 // otherwise, check all of the options for a match 456 } else { 457 var $theOption = $options.filter(function() { 458 return $(this).text().toLowerCase().indexOf(keyMap) == 0; 459 }); 460 selectOption($theOption.first(), true); 461 // close the dropdown if a match is found 462 if ($theOption.first().length) { 463 closeDropdown(dropdown); 464 } 465 } 466 467 // reset keyMap to empty string 468 keyMap = ''; 469 }, 300); 470 471 } 472 } 473 474 // mobile-specific event handlers 475 function mobileEventHandlers($button,$menu) { 476 // changing the selected option in the native mobile OS controls updates the custom button text 477 $menu.on('change',function() { 478 var selectedText = $(this).find(':selected').text(); 479 $button.find('.custom-a11yselect-text').text(selectedText); 480 $button.trigger('focus'); 481 }); 482 $button.on('click',function(e) { 483 e.preventDefault(); 484 $menu.trigger('focus'); 485 }) 486 } 487 // sets a menu option to be selected 488 function selectOption($option, updateOriginal) { 489 var selectedOption = $option.attr('data-val'); 490 var optionID = $option.attr('id'); 491 var optionText = $option.text(); 492 var $dropdown = $option.parents('.custom-a11yselect-menu'); 493 var $button = $dropdown.siblings('.custom-a11yselect-btn'); 494 var $original = $option.parents('.custom-a11yselect-container').prev('select'); 495 $dropdown.find('.custom-a11yselect-option.custom-a11yselect-selected').removeClass('custom-a11yselect-selected custom-a11yselect-focused'); 496 $option.addClass('custom-a11yselect-focused custom-a11yselect-selected'); 497 $button.attr('aria-activedescendant',optionID); 498 $button.find('.custom-a11yselect-text').text(optionText); 499 if (updateOriginal) { 500 $original.val(selectedOption).change(); 501 } 502 } 503 // opens/closes the dropdown 504 function toggleDropdown($button) { 505 var $dropdown = $button.siblings('.custom-a11yselect-menu'); 506 var $icon = $button.children('.custom-a11yselect-icon'); 507 $('.custom-a11yselect-menu').not($dropdown).removeClass('opened'); 508 if ($dropdown.hasClass('opened')) { 509 $button.attr('aria-expanded','false'); 510 } else { 511 $button.attr('aria-expanded','true'); 512 // if select button is scrolled more than halfway down page, open on top of button, not below 513 if (!isMobile) { 514 var scrollTop = $(window).scrollTop(); 515 var topOffset = $button.offset().top; 516 var relativeOffset = topOffset-scrollTop; 517 var winHeight = $(window).height(); 518 if (relativeOffset > winHeight/2) { 519 $dropdown.addClass('custom-a11yselect-reversed'); 520 } else { 521 $dropdown.removeClass('custom-a11yselect-reversed'); 522 } 523 } 524 } 525 $icon.toggleClass('icon-carrat-down').toggleClass('icon-carrat-up'); 526 $dropdown.toggleClass('opened'); 527 // if dropdown has overflow, scroll to the selected option 528 if ($dropdown.hasClass('custom-a11yselect-overflow') && !isMobile) { 529 var $selectedOption = $dropdown.find('.custom-a11yselect-selected').index(); 530 if ($selectedOption > 0) { 531 var selectedScrollPos = ($selectedOption * 40) + 16; // each option is ~40px tall, with 16px top padding on dropdown 532 $dropdown.scrollTop(selectedScrollPos); 533 } 534 } 535 } 536 // closes the dropdown 537 function closeDropdown($menu) { 538 var $openMenu = ($menu) ? $menu : $('.custom-a11yselect-menu.opened'); 539 var $button = $openMenu.siblings('.custom-a11yselect-btn'); 540 var $icon = $button.children('.custom-a11yselect-icon'); 541 var $currentlySelected = $openMenu.find('.custom-a11yselect-selected'); 542 $openMenu.find('.custom-a11yselect-option.custom-a11yselect-focused').removeClass('custom-a11yselect-focused'); 543 $openMenu.find('.custom-a11yselect-selected').addClass('custom-a11yselect-focused'); 544 $button.attr('aria-activedescendant',$currentlySelected.attr('id')); 545 $button.find('.custom-a11yselect-text').text($currentlySelected.text()); 546 $icon.removeClass('icon-carrat-up').addClass('icon-carrat-down'); 547 $button.trigger('focus').attr('aria-expanded','false'); 548 $openMenu.removeClass('opened'); 549 } 550 551 }; 552 $.fn.customA11ySelect.closeAllDropdowns = function() { 553 if ($('.custom-a11yselect-menu.opened').length) { 554 var $openMenu = $('.custom-a11yselect-menu.opened'); 555 var $button = $openMenu.siblings('.custom-a11yselect-btn'); 556 var $icon = $button.children('.custom-a11yselect-icon'); 557 var $currentlySelected = $openMenu.find('.custom-a11yselect-selected'); 558 559 $openMenu.find('.custom-a11yselect-option.custom-a11yselect-focused').removeClass('custom-a11yselect-focused'); 560 $openMenu.find('.custom-a11yselect-selected').addClass('custom-a11yselect-focused'); 561 $button.attr('aria-activedescendant',$currentlySelected.attr('id')); 562 $button.find('.custom-a11yselect-text').text($currentlySelected.text()); 563 $icon.removeClass('icon-carrat-up').addClass('icon-carrat-down'); 564 $button.attr('aria-expanded','false'); 565 $openMenu.removeClass('opened'); 566 } 567 }; 568})(jQuery); 569 570 571 572 573/**FUNCION DE CALENDARIO**/ 574/* 575$( function() { 576 577 578 579$( "#datepickerDesde" ).datepicker({ 580dateFormat: 'd/mm/yy', 581beforeShow: function(){ 582$("#ui-datepicker-div").addClass("jjgg-datepicker-modal"); 583} 584}); 585 586 587 588$( "#datepickerHasta" ).datepicker({ 589dateFormat: 'd/mm/yy', 590beforeShow: function(){ 591$("#ui-datepicker-div").addClass("jjgg-datepicker-modal"); 592} 593}); 594} ); 595 596*/
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.