PageSourceSearch

https://www.tim.com.br/sites/default/files/js/js_lsCXTQdG6GYAUu5zz…aT9wHUvCMX3C1R7-7PnPii7C-Eox_l5gBNc_wG6M-dT

js tim.com.br collected 2026-10-01 10:13:06 UTC 9,144 bytes, 3 lines download raw bytes

1/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */
2(function(Drupal){'use strict';function copyText(text){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(text);var ta=document.createElement('textarea');ta.value=text;ta.style.position='fixed';ta.style.left='-9999px';document.body.appendChild(ta);ta.focus();ta.select();try{document.execCommand('copy');}catch(e){}document.body.removeChild(ta);return Promise.resolve();}Drupal.behaviors.timFormsCopyLink={attach:function(context){Array.prototype.forEach.call(context.querySelectorAll('.js-tim-copy'),function(btn){if(btn.dataset.timCopyBound)return;btn.dataset.timCopyBound='1';btn.addEventListener('click',function(){var sel=btn.getAttribute('data-copy-target');var input=sel?document.querySelector(sel):null;var text=input?input.value:'';copyText(text).then(function(){var old=btn.textContent;btn.textContent=Drupal.t('Copiado!');setTimeout(function(){btn.textContent=old||Drupal.t('Copiar link');},1500);});});});}};})(Drupal);;
3(function($,Drupal){"use strict";const geoResolutionFailedKey='geoResolutionFailed';let isInitialized=false;let shardIndexPromise;Drupal.behaviors.tim_geolocalization={attach:function(context,settings){const $geolocation_blocker=$('#geolocation-blocker');if($geolocation_blocker&&$geolocation_blocker.length>0)return;if(context!==document||isInitialized)return;isInitialized=true;const _base32='0123456789bcdefghjkmnpqrstuvwxyz';function encodeGeohash(lat,lon,precision=5){let idx=0;let bit=0;let evenBit=true;let geohash='';let latMin=-90,latMax=90;let lonMin=-180,lonMax=180;while(geohash.length<precision){if(evenBit){const lonMid=(lonMin+lonMax)/2;if(lon>=lonMid){idx=idx*2+1;lonMin=lonMid;}else{idx=idx*2;lonMax=lonMid;}}else{const latMid=(latMin+latMax)/2;if(lat>=latMid){idx=idx*2+1;latMin=latMid;}else{idx=idx*2;latMax=latMid;}}evenBit=!evenBit;if(++bit===5){geohash+=_base32.charAt(idx);bit=0;idx=0;}}return geohash;}function setDddLocalStorage(ddd,city,uf){localStorage.setItem('ddd',ddd);localStorage.setItem('uf',uf);localStorage.setItem('city',city);localStorage.setItem('redirect','true');}function getDddLocalStorage(){return localStorage.getItem('ddd')&&localStorage.getItem('uf')&&localStorage.getItem('city');}function getShardDataUrl(file){const url=settings.tim_geolocalization.path+`/data/shards/${file}`;const dataVersion=settings.tim_geolocalization.dataVersion;if(dataVersion===undefined||dataVersion===null||dataVersion==='')return url;return `${url}?v=${encodeURIComponent(dataVersion)}`;}async function setRedirectUrl(uf){const ufPath=`/${uf}`;if(window.location.pathname.startsWith(ufPath))return;const regexParams=/([^?]+)(\?.*)?/;const [,urlWithoutParams,queryParams='']=window.location.href.match(regexParams);const urlParts=new URL(urlWithoutParams).pathname.split('/').filter((part)=>part);const regexRegionalizacao=/^([a-z]{2}|sp-interior)$/;if(regexRegionalizacao.test(urlParts[0]))urlParts[0]=uf;else urlParts.unshift(uf);window.location.href=`${window.location.origin}/${urlParts.join('/')}${queryParams}`;}function getShardIndex(){if(!shardIndexPromise){const url=getShardDataUrl('index.json');shardIndexPromise=fetch(url,{cache:"force-cache"}).then((resp)=>{if(!resp.ok)throw new Error(`Manifesto de shards indisponível: HTTP ${resp.status}.`);return resp.json();}).then((index)=>{if(!index||typeof index.prefix_index!=='object'||index.prefix_index===null)throw new Error('Manifesto de shards inválido.');return index;}).catch((error)=>{shardIndexPromise=undefined;throw error;});}return shardIndexPromise;}function findShardFile(userGeohash,index){for(let len=userGeohash.length;len>=1;len--){const prefix=userGeohash.slice(0,len);const shard=index.prefix_index[prefix];if(!shard||Number(shard.count)<=0||typeof shard.file!=='string')continue;if(!/^[0-9bcdefghjkmnpqrstuvwxyz]+\.json$/.test(shard.file))throw new Error('Manifesto de shards contém um nome de arquivo inválido.');return shard.file;}return null;}async function fetchShard(shardFile){const url=getShardDataUrl(shardFile);const resp=await fetch(url,{cache:"force-cache"});if(!resp.ok)throw new Error(`Shard indisponível: HTTP ${resp.status}.`);return resp.json();}async function fetchBestShardLegacy(userGeohash){for(let len=Math.min(userGeohash.length,6);len>=1;len--){const prefix=userGeohash.slice(0,len);const url=getShardDataUrl(`${prefix}.json`);try{const resp=await fetch(url,{cache:"force-cache"});if(resp.ok)return await resp.json();}catch(_){}}throw new Error("Shard não encontrado para este geohash.");}async function fetchBestShard(userGeohash){let index;try{index=await getShardIndex();}catch(error){console.warn('Não foi possível consultar o manifesto de shards. Usando descoberta por prefixo.',error);return fetchBestShardLegacy(userGeohash);}let shardFile;try{shardFile=findShardFile(userGeohash,index);}catch(error){console.warn('O manifesto de shards é inconsistente. Usando descoberta por prefixo.',error);return fetchBestShardLegacy(userGeohash);}if(!shardFile)return null;try{return await fetchShard(shardFile);}catch(error){console.warn('O shard indicado pelo manifesto não pôde ser carregado. Usando descoberta por prefixo.',error);return fetchBestShardLegacy(userGeohash);}}function hasGeoResolutionFailed(){try{return sessionStorage.getItem(geoResolutionFailedKey)==='true';}catch(_){return false;}}
3function setGeoResolutionFailed(){try{sessionStorage.setItem(geoResolutionFailedKey,'true');}catch(_){}}function clearGeoResolutionFailed(){try{sessionStorage.removeItem(geoResolutionFailedKey);}catch(_){}}function handleGeoResolutionFailure(reason){console.warn(`Não foi possível resolver a região do usuário: ${reason}.`);if(hasGeoResolutionFailed())return;setGeoResolutionFailed();showRegionModal(true);}async function resolveCityByGeohash(latitude,longitude){try{const geohash=encodeGeohash(latitude,longitude,5);const geohashMap=await fetchBestShard(geohash);if(!geohashMap){handleGeoResolutionFailure('nenhum shard corresponde ao geohash');return;}const data=geohashMap[geohash];if(!data){handleGeoResolutionFailure('geohash ausente no conjunto de dados');return;}clearGeoResolutionFailed();const uf=data.estado.toLowerCase();const ddd=String(data.ddd);const municipio=data.cidade.toLowerCase();setDddLocalStorage(ddd,municipio,uf);if(uf==='sp'&&parseInt(ddd)!==11)await setRedirectUrl('sp-interior');else await setRedirectUrl(uf);}catch(error){console.error("Erro ao resolver cidade via geohash:",error);handleGeoResolutionFailure('falha técnica ao carregar os dados');}}async function showPosition(position){if(position){const currentLanguage=settings.path.currentLanguage;const storedUf=localStorage.getItem('uf');if((currentLanguage==='sp-interior'&&storedUf==='sp')||(currentLanguage===storedUf))return;if(localStorage.getItem('redirect')===null||localStorage.getItem('redirect')===undefined)localStorage.setItem('redirect','false');else{if(localStorage.getItem('redirect')==='true')return;}const latitude=position.coords.latitude;const longitude=position.coords.longitude;await resolveCityByGeohash(latitude,longitude);}}function showRegionModal(force=false){const geoPermission=localStorage.getItem('geoPermission');if(force||geoPermission!=='allow'){const divGeolocalizacao=document.querySelector('.div__geolocalizacao');const regionInputWrapper=document.querySelector('.region-input-wrapper');const buttonMenuMobile=document.querySelector('.header-zone .header-bottom button.mobile-menu-button');const regionSelectorEvent=new CustomEvent('select-region');divGeolocalizacao?.classList.remove('hide-geolocalizacao');regionInputWrapper?.classList.add('geolocalizacao-style');setTimeout(()=>{window.dispatchEvent(regionSelectorEvent);if(window.innerWidth<=768)buttonMenuMobile?.click();localStorage.setItem('geoPermission','allow');},300);}}function showError(error){switch(error.code){case error.PERMISSION_DENIED:console.log("Usuário negou a solicitação de geolocalização.");break;case error.POSITION_UNAVAILABLE:console.log("Informações de localização não estão disponíveis.");break;case error.TIMEOUT:console.log("A solicitação para obter a localização do usuário expirou.");break;case error.UNKNOWN_ERROR:console.log("Ocorreu um erro desconhecido.");break;}showRegionModal();}const geoOptions={enableHighAccuracy:false,timeout:20000,maximumAge:600000};function getLocation(){if(hasGeoResolutionFailed())return;if(!('geolocation' in navigator)){showRegionModal();return;}if(window.isSecureContext!==true){console.warn('Geolocation blocked: insecure context. Showing region modal.');if(window.location.pathname.includes('/plano-anual'))return;showRegionModal();return;}if(navigator.permissions&&navigator.permissions.query)navigator.permissions.query({name:'geolocation'}).then(()=>{navigator.geolocation.getCurrentPosition(showPosition,showError,geoOptions);}).catch(()=>{navigator.geolocation.getCurrentPosition(showPosition,showError,geoOptions);});else navigator.geolocation.getCurrentPosition(showPosition,showError,geoOptions);}$(document).ready(function(){if(!!getDddLocalStorage())return;getLocation();});}};})(jQuery,Drupal);;

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.