'); scope.find('.bigSubmenu').prepend(divGray); divGray.css({width:widthElem, height: menuHeight + 20}) }else{ scope.find('.grayColor').css({width:widthElem, height: menuHeight + 20}) } scope.find('.bigSubmenu').height(menuHeight + 20); scope.find('.bigSubOptions').height(menuHeight + 20); scope.find('.menuOpContainer').height(optionHeight + 20); if(subOptions){ subOptions.each(function(index) { var subScope = $(this) subScope.find('.menuOpContainer').css('marginTop','-' + (subScope.position().top+5) + 'px'); }); } }); } } /*Without elements*/ var indUl = $('.singleDropDown'); indUl.each(function(){ var indLi = $(this).find('li'); if(indLi.length == 1 && indLi.find('a').text() == ""){ $(this).removeClass('singleDropDown'); } }) var addMenu = function(){ $('.addResponsive').remove(); $('.addMenu > a').each(function(i){ var containerAdd = $('
') var anchorL = $(''); var contenidoAn = $(this).text(); anchorL.text(contenidoAn); containerAdd.append(anchorL); $('.ulMenu').append(containerAdd); }) } $('.ulMenu > li').on('mouseenter', function(){ if($('body').hasClass('mobileV') == false ){ $('.bigSubOptions li:first-child').find('.menuOpContainer').css('display','inline-block'); }else{ /*$('.bigSubOptions li:first-child').find('.menuOpContainer').css('display','none');*/ } }) /*TIMING LATERAL MENU NOT CLOSE INMMEDIATLY*/ function hoveringMenu(){ $('.bigSubOptions > li').unbind('mouseenter') $('.bigSubOptions > li').unbind('mouseleave') $('.bigSubOptions > li').mouseenter(function(){ //console.log('entro') $('.bigSubOptions > li').find('.menuOpContainer').hide(); clearTimeout($(this).data('timeout')); $(this).find('.menuOpContainer').css('display','inline-block') }).mouseleave(function(){ var scope = $(this); var timing = setTimeout(function(){ scope.find('.menuOpContainer').hide() //console.log('salgo'); }, 1000) $(this).data('timeout', timing); }); } //hoveringMenu(); menuResponsive(); menuHeighting(); /*Select op*/ var winLocation = window.location.href; var winPrelast = winLocation.split('/'); $('.ulMenu li').find('a').each(function(e){ var scope = $(this); var link = scope.attr('href'); if(link != undefined){ link = link.split('/') if(link[link.length - 1] != ""){ if(link[link.length - 1] == winPrelast[winPrelast.length - 1]){ scope.closest('.firstLevel').addClass('selected'); } } } }); /*Menu hogar negocio empresa select - 240808 @AB */ const familyAnchor = $('.familyMenu a'); let currentSiteId = null; switch (winPrelast[winPrelast.indexOf("web") + 1]) { case "hogar": currentSiteId = 0; break; case "negocios": currentSiteId = 1; break; case "empresas": currentSiteId = 2; break; } if (currentSiteId != null) familyAnchor.eq(currentSiteId).addClass("current"); })$('.ulMenu > li ').each(function(){ var anclaVal = $(this).find('a').text(); if(anclaVal == 'Cámbiate a Telmex'){ $(this).find('a').addClass('azul1'); } });
') var sugerenciasList = $('
') for(var i in sugerencias.results){ var sugerencia = $('
') sugerenciasList.append(sugerencia); } sugerenciasBox.append(sugerenciasList); if(window.location.toString().indexOf('buscador') != -1){ $formValue.closest('form').parent().append(sugerenciasBox); }else{ $('.searchContainer').append(sugerenciasBox); } } $('.sugerencia').on('click', function(e){ e.preventDefault(); $('.sugerenciasBox').parent().find('input[type="text"]').val($(this).text()); $('.sugerenciasBox').parent().find('input[type="submit"]').trigger('click'); }) }) .fail(function(){ console.log('servicio no disponible'); }); } $('input.inputSearch').keyup(function(e){ var scope = $(this); var suggestOp = $('.sugerenciasBox li'); var itemSelected = suggestOp.filter('.selected'); var current; if (e.keyCode === 27){/*Esc*/ $('.sugerenciasBox').remove(); }else if(e.keyCode === 40){ /*Abajo*/ if($('.sugerenciasBox')){ if(itemSelected.length == 0 || itemSelected.is(':last-child')){ current = suggestOp.eq(0); }else{ current = itemSelected.next(); } } }else if(e.keyCode === 38){/*Arriba*/ if(itemSelected.length == 0 || itemSelected.is(':first-child')){ current = suggestOp.last(); }else{ current = itemSelected.prev(); } }else{ showSuggestions($(this), '_nuevo_telmex_todo') } if(current != undefined){ itemSelected.removeClass('selected'); current.addClass('selected'); scope.val(current.text()); } }) function clientCall($sitesValue){ switch($sitesValue) { case "claves_lada": clientValue = "_nuevo_telmex_claves_lada"; break; case "telmex_hogar|telmex_negocio|telmex_empresa": case "asistencia": case "telmex_tienda": default: clientValue = "_nuevo_telmex_todo"; break; } return clientValue; } function buscador(){ $('.sugerenciasBox').remove(); if($('#contenedor_resultados ol').length > 0){ $('.moreElem').show(); var placeContainer = $('.placeCont'); var parentLi = $('.placeCont').first().parent(); var latThis = Number(parentLi.find('.lat').text()); var lngThis = Number(parentLi.find('.long').text()); /*if it has map*/ if(placeContainer.length > 0){ boxPortlet.show(); var markerLetter = ['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']; var pinColorBlue = "|0f79ff|ffffff"; var pinColorRed = "|f7544c|000000"; var mapOptions = { zoom: 16, center: { lat: latThis, lng: lngThis } }; var map = new google.maps.Map(boxPortlet[0], mapOptions); var bounds = new google.maps.LatLngBounds(); var infoWindow = new google.maps.InfoWindow(); var infoWindowsArr =[]; $('.tiendas_fisicas').first().prepend('Tiendas Telmex'); $('.sitios_wifi').first().prepend('Sitios Wifi'); /*Creating marks for every place*/ $('.placeCont').each(function(index){ var markLatlng = new google.maps.LatLng( $(this).parent().find('.lat').text(), $(this).parent().find('.long').text() ); marker = new google.maps.Marker({ position: markLatlng, map: map }); infoWindowsArr.push(detailStore($(this).parent())); marker.setOptions({icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + markerLetter[index] + pinColorRed}); google.maps.event.addListener(marker, 'click', (function(marker, index){ return function(){ infoWindow.setContent(infoWindowsArr[index]); infoWindow.open(map, marker); }; })(marker, index)); bounds.extend(markLatlng); }) map.fitBounds(bounds); } }else{ console.log('no hay resultados'); $('.moreElem').hide(); } } function loadScript($textValue) { if(isMap == false){ /*var apiKey = "https://maps.googleapis.com/maps/api/js?key=AIzaSyDYOdEf18BjovQEyzpg1EZ7im_hOAFlLuU";*/ var apiKey = 'https://maps.googleapis.com/maps/api/js?client=gme-telefonosdemexico&sensor=true&'; var script = document.createElement('script'); script.type = 'text/javascript'; script.onload = function(){ buscador(); } script.src = apiKey; document.body.appendChild(script); isMap = true; }else{ if(actualSearch != previousSearch){ buscador(); } }; var textValue = $textValue; previousSearch = textValue; } /*Create de div with the store info*/ function detailStore($store){ var storeInfo = $('
') var title = $('
'); var address = $('
Dirección
'); var schedule = $('
Horario
'); var services = $('
Servicios
'); var phone = $('
'); var scheduleAuto = $('
Horario Autopago
'); title.text($store.find('.nombre').text()); address.find('span').text($store.find('.texto-original').text()); var horarioSem = $store.find('.horarioSem').text(); var horarioSab = $store.find('.horarioSab').text(); var cp = $store.find('.cp').text(); var autoSem = $store.find('.horarioAuto1').text(); var autorSab = $store.find('.horarioAuto2').text(); var textDir = ""; var textSchedule = ""; var textAutopago = ""; var textCajero = ""; phone.find('span').text($store.find('.telefono').text()); var nombredeTienda = $store.find('.nombreTienda').text(); var textoOriginal = $store.find('.texto-original').text(); var elTelefono = $store.find('.telefono').text(); var cajero = $store.find('.cajero').text(); var scCajero = $store.find('.horarioCajero').text(); if(jQuery.trim(nombredeTienda) != 'null' && nombredeTienda != ''){ storeInfo.append(title); } if(jQuery.trim(textoOriginal) != 'null' && textoOriginal != ''){ textDir = textoOriginal; storeInfo.append(address); } if(jQuery.trim(cp) != 'null' && cp != ''){ textDir = textDir + ' CP' + cp; } address.find('span').text(textDir); /*CAMBIOS PARA MOSTRAR HORARIOS EN BUEN FIN */ elTelefono=jQuery.trim(elTelefono); if(elTelefono == "" || elTelefono == "null" || elTelefono == null){ if(jQuery.trim(horarioSem) != 'null' && horarioSem !=''){ textSchedule = horarioSem; storeInfo.append(schedule); } if(jQuery.trim(horarioSab) != 'null' && horarioSab !=''){ textSchedule = textSchedule + ' ' + horarioSab; } schedule.find('span').text(textSchedule); }else{ storeInfo.append(phone); } if(jQuery.trim(autoSem) != 'null' && autoSem !='' && autoSem != "Servicio NO disponible"){ textAutopago = autoSem; storeInfo.append(scheduleAuto); } if(jQuery.trim(autorSab) != 'null' && autorSab !=''){ textAutopago = textAutopago + ' ' + autorSab; } scheduleAuto.find('span').text(textAutopago); if(jQuery.trim(cajero) != 'null' && jQuery.trim(cajero) == '1'){ storeInfo.append(services); textCajero = "Cajero automático" } if(jQuery.trim(scCajero) != 'null' && jQuery.trim(scCajero) != '' && scCajero != "Servicio NO disponible"){ textCajero = textCajero + '. Horario: ' + scCajero; } services.find('span').text(textCajero); return(storeInfo.html()); } $('.moreElem').click(function(e){ e.preventDefault() startValue = startValue + 10; $('input[data-search="search"]').each(function(){ var scope = $(this); if(scope.hasClass('functional')){ scope.trigger('click'); } }) }) $('.busMenuSearch a').click(function(){ $('.busMenuSearch a').each(function(){ $(this).removeClass('active'); }) $(this).addClass('active'); }) })