1/* In main.js */ 2if ('serviceWorker' in navigator) { 3 navigator.serviceWorker.register('/sw.js') 4 .then(function (registration) { 5 console.log("Service Worker Registered"); 6 }) 7 .catch(function (err) { 8 console.log("Service Worker Failed to Register"); 9 }) 10} 11// // Detecta se o dispositivo está no iOS 12// const isIos = () => { 13// const userAgent = window.navigator.userAgent.toLowerCase(); 14// return /iphone|ipad|ipod/.test(userAgent); 15// } 16// // Detects if device is in standalone mode 17// const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone); 18// // Verifica se deve exibir notificação popup de instalação: 19// if (isIos() && !isInStandaloneMode()) { 20// this.setState({showInstallMessage: true}); 21// } 22var PostContentManager = (function () { 23 function PostContentManager(initElement) { 24 this._epTwitter = 'https://publish.twitter.com/oembed?url='; 25 this._epIntagram = 'https://api.instagram.com/oembed?url='; 26 var thisClass = this; 27 $(initElement).each(function (i) { 28 thisClass.extractDataElement($(this)); 29 var ObjAtual = $(this).parent(); 30 ObjAtual.addClass("social-embed"); 31 if (thisClass.dataElement.fonte == "facebook") { 32 var embed = document.createElement('div'); 33 embed.className = 'fb-' + thisClass.dataElement.tipo; 34 embed.setAttribute('data-href', thisClass.dataElement.src); 35 embed.setAttribute('data-width', '489'); 36 embed.setAttribute('data-allowfullscreen', 'false'); 37 embed.setAttribute('data-show-text', 'true'); 38 var iframe = document.createElement('embed'); 39 iframe.src = "https://www.facebook.com/plugins/post.php?href=" + encodeURI(thisClass.dataElement.src_ref) + "&width=489&show_text=true"; 40 iframe.width = '489'; 41 iframe.height = '489'; 42 iframe.setAttribute("style", "border:none;overflow:hidden"); 43 iframe.setAttribute("target", "_top"); 44 iframe.setAttribute('scrolling', 'no'); 45 iframe.setAttribute('allowfullscreen', 'false'); 46 iframe.setAttribute('allowTransparency', 'true'); 47 embed.appendChild(iframe); 48 thisClass.factoryEmbed(ObjAtual, embed); 49 } 50 else if (thisClass.dataElement.fonte == "pdf") { 51 var object = document.createElement('object'); 52 object.data = thisClass.dataElement.src; 53 object.type = 'application/pdf'; 54 if (thisClass.checkSuportPDF()) { 55 object.className = 'box_post-pdf'; 56 } 57 var objectP = document.createElement('p'); 58 var objectPStrong = document.createElement('strong'); 59 var objectPStrongText = document.createTextNode('Seu navegador não suporta a exibição do PDF. '); 60 objectPStrong.appendChild(objectPStrongText); 61 var objectA = document.createElement('a'); 62 objectA.href = thisClass.dataElement.src; 63 objectA.target = '_blank'; 64 var objectAText = document.createTextNode('Clique aqui para fazer o download/baixar o PDF.'); 65 objectA.appendChild(objectAText); 66 objectPStrong.appendChild(objectA); 67 objectP.appendChild(objectPStrong); 68 object.appendChild(objectP); 69 thisClass.factoryEmbed(ObjAtual, object); 70 } 71 else if (thisClass.dataElement.fonte == "twitter") { 72 thisClass.getResultAjax(ObjAtual, thisClass.factoryEndPoint(thisClass.dataElement.src)); 73 } 74 else if (thisClass.dataElement.fonte == "instagram") { 75 thisClass.getResultAjax(ObjAtual, thisClass.factoryEndPoint(thisClass.dataElement.src)); 76 } 77 }); 78 } 79 PostContentManager.prototype.checkSuportPDF = function () { 80 var isIE = function () { 81 return !!(window.ActiveXObject || "ActiveXObject" in window); 82 }; 83 var supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"); 84 var supportsPdfActiveX = function () { 85 return !!(this.createAXO("AcroPDF.PDF") || this.createAXO("PDF.PdfCtrl")); 86 }; 87 return (supportsPdfMimeType || (isIE() && supportsPdfActiveX())); 88 }; 89 PostContentManager.prototype.createAXO = function (type) { 90 var ax; 91 try { 92 ax = new ActiveXObject(type); 93 } 94 catch (e) { 95 ax = null; 96 } 97 return ax; 98 }; 99 ; 100 PostContentManager.prototype.getEndPointTwitter = function () { 101 return this._epTwitter; 102 }; 103 PostContentManager.prototype.getEndPointInstagram = function () { 104 return this._epIntagram; 105 }; 106 PostContentManager.prototype.factoryEndPoint = function (add) { 107 var url; 108 if (this.dataElement.fonte == 'twitter') { 109 url = this.getEndPointTwitter(); 110 } 111 else if (this.dataElement.fonte == 'instagram') { 112 url = this.getEndPointInstagram(); 113 } 114 return url + encodeURI(add); 115 }; 116 PostContentManager.prototype.extractDataElement = function (element) { 117 this.dataElement = { 118 fonte: element.attr('data-fonte'), 119 tipo: element.attr('data-tipo'), 120 src: element.attr('src'), 121 src_ref: element.attr('data-src') 122 }; 123 }; 124 PostContentManager.prototype.getResultAjax = function (local, url) { 125 if (url) { 126 var thisClass = this; 127 $.ajax({ 128 url: url, 129 dataType: 'jsonp', 130 async: false, 131 success: function (e) { 132 thisClass.factoryEmbed(local, e.html); 133 } 134 }); 135 } 136 }; 137 PostContentManager.prototype.factoryEmbed = function (local, embed) { 138 if (embed) { 139 local.html(embed); 140 } 141 }; 142 return PostContentManager; 143}()); 144$(function ($) { 145 "use strict"; 146 $('[data-toggle="tooltip"]').tooltip(); 147 $(".back-to-top").on('click', function (event) { 148 event.preventDefault(); 149 $('html, body').animate({ scrollTop: 0 }, 'slow'); 150 }); 151 if (typeof $.fn.inputmask == 'function') { 152 $("[data-mask]").each(function (i, el) { 153 var $this = $(el); 154 var mask = $this.data('mask').toString(); 155 var opts = { 156 numericInput: attrDefault($this, 'numeric', false), 157 radixPoint: attrDefault($this, 'radixPoint', ''), 158 rightAlignNumerics: attrDefault($this, 'numericAlign', 'left') == 'right', 159 regex: '' 160 }; 161 var placeholder = attrDefault($this, 'placeholder', ''); 162 var is_regex = attrDefault($this, 'isRegex', ''); 163 if (placeholder.length) { 164 opts[placeholder] = placeholder; 165 } 166 switch (mask.toLowerCase()) { 167 case "cpf": 168 mask = "999.999.999-99"; 169 break; 170 case "cnpj": 171 mask = "99.999.999/9999-99"; 172 break; 173 case "phone": 174 mask = "(999) 9999-9999"; 175 break; 176 case "celphone": 177 mask = "(999) 999999-9999"; 178 break; 179 case "contato_telefone": 180 mask = ['(99) 9999-9999', '(99) 99999-9999']; 181 break; 182 case "cpf_cnpj": 183 mask = ['999.999.999-99', '99.999.999/9999-99']; 184 break; 185 case "currency": 186 case "rcurrency": 187 var sign = attrDefault($this, 'sign', '$'); 188 mask = "999.999.999,99"; 189 if ($this.data('mask').toLowerCase() == 'rcurrency') { 190 mask += ' ' + sign; 191 } 192 else { 193 mask = sign + ' ' + mask; 194 } 195 opts.numericInput = true; 196 opts.rightAlignNumerics = false;
197 opts.radixPoint = '.'; 198 break; 199 case "email": 200 mask = 'Regex'; 201 opts.regex = "[a-zA-Z0-9._%-]+@[a-zA-Z0-9-\.]+\\.[a-zA-Z]{2,4}"; 202 break; 203 case "number": 204 mask = 'Regex'; 205 opts.regex = "[0-9]+"; 206 break; 207 case "fdecimal": 208 mask = 'decimal'; 209 $.extend(opts, { 210 autoGroup: true, 211 groupSize: 3, 212 radixPoint: attrDefault($this, 'rad', '.'), 213 groupSeparator: attrDefault($this, 'dec', ',') 214 }); 215 } 216 if (is_regex) { 217 opts.regex = mask; 218 mask = 'Regex'; 219 } 220 $this.inputmask(mask, opts); 221 }); 222 } 223}); 224function attrDefault($el, data_var, default_val) { 225 if (typeof $el.data(data_var) != 'undefined') { 226 return $el.data(data_var); 227 } 228 return default_val; 229} 230$('.menu-topo-nav ul.navbar-nav li.dropdown').hover(function () { 231 var $this = $(this); 232 var largura = $(window).width(); 233 if (largura > 1350) { 234 $this.find('.dropdown-menu').stop(true, true).delay(100).fadeIn(300); 235 $this.stop(true, true).delay(200).addClass('show'); 236 $this.find('.dropdown-toggle').stop(true, true).delay(100).attr('aria-expanded', 'true'); 237 } 238}, function () { 239 var $this = $(this); 240 var largura = $(window).width(); 241 if (largura > 1350) { 242 $this.find('.dropdown-menu').stop(true, true).delay(100).fadeOut(300); 243 $this.stop(true, true).delay(200).removeClass('show'); 244 $this.find('.dropdown-toggle').stop(true, true).delay(100).attr('aria-expanded', 'false'); 245 } 246}); 247$(window).scroll(function () { 248 if ($(window).scrollTop() > 200) { 249 $("#back-to-top").addClass('show'); 250 } 251 else { 252 $("#back-to-top").removeClass('show'); 253 } 254}); 255var btn = $('#back-to-top-acessibilidade'); 256btn.on('click', function (e) { 257 e.preventDefault(); 258 $('html, body').animate({ scrollTop: 0 }, '300'); 259}); 260$("select[rel='select_link']").change(function (e) { 261 $(this).find("option:selected").each(function () { 262 var url = $(this).attr('data-link'); 263 if (url != "" && url != "#") { 264 location.href = url; 265 } 266 }); 267}); 268var embedSocialPost = new PostContentManager(".box_post p embed"); 269$('#btn-contraste').on('click', function (e) { 270 if ($('body').hasClass('contraste')) { 271 $('body').removeClass('contraste'); 272 } 273 else { 274 $('body').addClass('contraste'); 275 } 276}); 277$(document).ready(function () { 278 $('.corpo')[0].setAttribute('id', 'irConteudo'); 279}); 280var FuncAcessibilidade = { 281 init: function (alt, key, text) { 282 var _thisClass = this; 283 if (alt) { 284 switch (key) { 285 case 48: 286 if (_thisClass.checkShowMenu()) { 287 _thisClass.hideMenu(); 288 } 289 else { 290 _thisClass.showMenu(); 291 } 292 break; 293 case 49: 294 location.href = "#irConteudo"; 295 break; 296 case 50: 297 location.href = "#irMenu"; 298 break; 299 case 51: 300 _thisClass.sendToTop(); 301 $("#input-busca").focus(); 302 break; 303 case 52: 304 location.href = "#irRodape"; 305 break; 306 case 53: 307 location.href = "/texto/5/acessibilidade"; 308 break; 309 case 54: 310 location.href = "/mapa"; 311 break; 312 case 55: 313 location.href = "/informacao"; 314 break; 315 case 56: 316 $('body').removeClass('contraste'); 317 break; 318 case 57: 319 $('body').addClass('contraste'); 320 break; 321 } 322 } 323 else { 324 switch (text) { 325 case "+": 326 _thisClass.addZoom(); 327 break; 328 case "-": 329 _thisClass.removeZoom(false); 330 break; 331 case "=": 332 _thisClass.removeZoom(true); 333 break; 334 } 335 } 336 }, 337 getElement: function () { 338 return $("#box_acessibilidade"); 339 }, 340 sendToTop: function () { 341 $("html, body").animate({ scrollTop: 0 }, 300); 342 }, 343 getMenuAltura: function () { 344 var largura = $(window).width(); 345 if (largura >= 769 && largura <= 991) { 346 return 620; 347 } 348 else if (largura < 769) { 349 return 1050; 350 } 351 else { 352 return 580; 353 } 354 }, 355 showMenu: function () { 356 this.getElement().animate({ marginTop: '0px' }, 200); 357 this.getElement().attr('data-isshow', 'yes'); 358 }, 359 hideMenu: function () { 360 this.getElement().animate({ marginTop: '-' + this.getMenuAltura() + 'px' }, 200); 361 this.getElement().attr('data-isshow', 'no'); 362 }, 363 checkShowMenu: function () { 364 if (this.getElement().attr('data-isshow') == 'yes') { 365 return true; 366 } 367 return false;
368 }, 369 getNivelZoom: function () { 370 return parseInt($('body').attr('data-zoom')); 371 }, 372 getLimiteZoom: function () { 373 return 5; 374 }, 375 addZoom: function () { 376 var nivelZoom = this.getNivelZoom(); 377 if (nivelZoom < this.getLimiteZoom()) { 378 var novoNivelZoom = nivelZoom + 1; 379 $('body').attr('data-zoom', novoNivelZoom); 380 } 381 }, 382 removeZoom: function (clear) { 383 var nivelZoom = this.getNivelZoom(); 384 if (nivelZoom > 0) { 385 var novoNivelZoom = 0; 386 if (!clear) { 387 novoNivelZoom = nivelZoom - 1; 388 } 389 $('body').attr('data-zoom', novoNivelZoom); 390 } 391 } 392}; 393function aumentarFonte() { 394 $("*").each(function () { 395 var fonteAtual = 0; 396 var $this = $(this); 397 fonteAtual = parseInt($this.css("fontSize")); 398 if (fonteAtual != 0) { 399 $this.css({ "font-size": (fonteAtual + 1) + "px" }); 400 } 401 }); 402} 403function reduzirFonte() { 404 $("*").each(function () { 405 var fonteAtual = 0; 406 var $this = $(this); 407 fonteAtual = parseInt($this.css("fontSize")); 408 if (fonteAtual != 0) { 409 $this.css({ "font-size": (fonteAtual - 1) + "px" }); 410 } 411 }); 412} 413function initMapa(mapId, options) { 414 if (options.gps.lat && options.gps.lng) { 415 var myLatlng = new google.maps.LatLng(options.gps.lat, options.gps.lng); 416 var myOptions = { 417 zoom: 15, 418 center: myLatlng, 419 mapTypeId: google.maps.MapTypeId.ROADMAP, 420 mapTypeControl: true, 421 mapTypeControlOptions: { 422 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, 423 position: google.maps.ControlPosition.BOTTOM_CENTER 424 } 425 }; 426 var contentHtml = options.titulo + "</br>" + options.endereco; 427 if (options.complemento != "") { 428 contentHtml += options.complemento; 429 } 430 contentHtml += "</br>" + options.cidade + " - " + options.estado + " - " + options.bairro + "</br>CEP: " + options.cep + "</br>" + options.email + "</br>" + options.telefone; 431 var map_1 = new google.maps.Map(document.getElementById(mapId), myOptions); 432 var infowindow_1 = new google.maps.InfoWindow({ content: contentHtml }); 433 var marker_1 = new google.maps.Marker({ 434 position: myLatlng, 435 map: map_1, 436 icon: options.icon, 437 title: options.titulo 438 }); 439 google.maps.event.addListener(marker_1, 'click', function () { 440 infowindow_1.open(map_1, marker_1); 441 }); 442 } 443} 444var thisUrlAlert = window.location.href.split("#"); 445var modalAlerta = null; 446if (thisUrlAlert[1]) { 447 switch (thisUrlAlert[1]) { 448 case 'newsletter_inscrito': 449 modalAlerta = "NewsletterInscricao"; 450 break; 451 case 'newsletter_confirmado': 452 modalAlerta = "NewsletterConfirmada"; 453 break; 454 case 'newsletter_invalido': 455 modalAlerta = "NewsletterInvalido"; 456 break; 457 case 'contato_enviado': 458 modalAlerta = "ContatoEnviado"; 459 break; 460 case 'curriculo_enviado': 461 modalAlerta = "CurriculoEnviado"; 462 break; 463 case 'voto_computado': 464 modalAlerta = "VotoComputado"; 465 break; 466 } 467 if (modalAlerta) { 468 $("#alerta" + modalAlerta).modal('show'); 469 location.href = '#'; 470 } 471} 472$('form[data-no-submit-enter="s"]').on('keyup keypress', function (e) { 473 var keyCode = e.keyCode || e.which; 474 var $this = $(this); 475 if (keyCode === 13) { 476 e.preventDefault(); 477 if ($this.attr('data-init-recaptcha') == 's') { 478 grecaptcha.execute(); 479 } 480 return false; 481 } 482}); 483function previewImage(obj) { 484 var $this = $(obj); 485 var localPreview = $this.attr('data-preview'); 486 var idInput = $this.attr('id'); 487 if (obj.files && obj.files[0]) { 488 var reader = new FileReader(); 489 reader.onload = function (e) { 490 $("#" + idInput + "_" + localPreview).attr('src', e.target.result); 491 };
492 reader.readAsDataURL(obj.files[0]); 493 $("button[data-action='previewCancel'][data-input-file='" + idInput + "']").show(); 494 } 495} 496$("input[type='file']").change(function () { 497 if ($(this).attr('data-preview')) { 498 previewImage(this); 499 } 500}); 501$("button[data-action='previewCancel']") 502 .hide() 503 .on('click', function () { 504 var idInput = $(this).attr('data-input-file'); 505 var localPreview = $(this).attr('data-preview'); 506 var objImage = $('#' + idInput + '_' + localPreview); 507 $("#" + idInput).val(''); 508 objImage.attr('src', $(this).attr('data-atual')); 509 $(this).hide(); 510}); 511 512function eventoBannerLgpd() { 513 var storageTermoAceito = "lgpd-aceito"; 514 var termoAceito = localStorage.getItem(storageTermoAceito); 515 var bannerLgpd = document.getElementById("lgpd-banner"); 516 var bannerLgpdBotao = document.getElementById("lgpd-banner-botao"); 517 bannerLgpdBotao.addEventListener("click", function (e) { 518 localStorage.setItem(storageTermoAceito, true); 519 bannerLgpd.classList.remove("show"); 520 }); 521 if (!termoAceito || termoAceito != "true") { 522 bannerLgpd.classList.add("show"); 523 } 524} 525window.addEventListener("load", eventoBannerLgpd); 526 527function eventoAcessoRapido() { 528 var btn = document.getElementById("acesso-rapido-servicos-btn"); 529 var obj = document.getElementsByClassName("acesso-rapido-servicos")[0]; 530 if (btn) { 531 btn.addEventListener("click", function (e) { 532 if (obj.classList.contains("open")) { 533 obj.classList.remove("open"); 534 } else { 535 obj.classList.add("open"); 536 } 537 }); 538 } 539} 540eventoAcessoRapido(); 541 542function abrirBusca() { 543 $("#modalBusca").modal("toggle"); 544}
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.