PageSourceSearch

https://fae.edu/_assets/js/main.js?v=1.1.3

js fae.edu collected 2026-10-03 17:35:06 UTC 13,376 bytes, 426 lines download raw bytes

1// Função que remove os acentos e demais caracteres especiais de uma String
2  function removerAcentos( newStringComAcento ) {
3    var string = newStringComAcento;
4    var mapaAcentosHex   = {
5      a : /[\xE0-\xE6]/g,
6      e : /[\xE8-\xEB]/g,
7      i : /[\xEC-\xEF]/g,
8      o : /[\xF2-\xF6]/g,
9      u : /[\xF9-\xFC]/g,
10      c : /\xE7/g,
11      n : /\xF1/g
12    };
13
14    for ( var letra in mapaAcentosHex ) {
15      var expressaoRegular = mapaAcentosHex[letra];
16      string = string.replace( expressaoRegular, letra );
17    }
18
19    return string;
20  }
21// FIM da Função que remove os acentos e demais caracteres especiais de uma String
22
23// Função para acessar os parâmetros da URL
24  function getParameterByName(name, url) {
25    if (!url) {
26      url = window.location.href;
27    }
28    name = name.replace(/[\[\]]/g, "\\$&");
29    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
30        results = regex.exec(url);
31    if (!results) return null;
32    if (!results[2]) return '';
33    return decodeURIComponent(results[2].replace(/\+/g, " "));
34  }
35// FIM da função para acessar os parâmetros da URL
36
37// Variável para testes AB
38  var ab = function(c){
39    if(c === undefined || c === null){
40      c="?";
41    }
42
43    return (getParameterByName("ab") != null ? c+"ab="+getParameterByName("ab") : "");
44  };
45// FIM da Variável para testes AB
46
47// CLEAR ALL COOKIES
48function deleteAllCookies() {
49  const cookies = document.cookie.split(";");
50
51  for (let i = 0; i < cookies.length; i++) {
52    let cookie = cookies[i]
53    let eqPos = cookie.indexOf("=");
54    let name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
55    document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
56  }
57}
58
59// Procura pelo perfil no Cookie, localStorage e sessionStorage - quando se está em uma página interna
60function getPerfilFromCookies(){
61  if(
62    Cookies.get("perfil_2018") !== "" &&
63    Cookies.get("perfil_2018") !== undefined &&
64    Cookies.get("perfil_2018") !== null &&
65    Cookies.get("perfil_2018").length === 1
66  ){
67    $("#trocarperfil,#trocarperfil_mobile").html(Cookies.get("perfil_nome"));
68  } else if(
69    localStorage.getItem("perfil_2018") !== "" &&
70    localStorage.getItem("perfil_2018") !== undefined &&
71    localStorage.getItem("perfil_2018") !== null &&
72    localStorage.getItem("perfil_2018").length === 1
73  ){
74    $("#trocarperfil,#trocarperfil_mobile").html(localStorage.getItem("perfil_nome"));
75  } else if(
76    sessionStorage.getItem("perfil_2018") !== "" &&
77    sessionStorage.getItem("perfil_2018") !== undefined &&
78    sessionStorage.getItem("perfil_2018") !== null &&
79    sessionStorage.getItem("perfil_2018").length === 1
80  ){
81    $("#trocarperfil,#trocarperfil_mobile").html(sessionStorage.getItem("perfil_nome"));
82  } else {
83    // Set variável com a URL
84    let loc = (window.location).toString()
85
86    // Função que verifica se existe "string" na URL
87    const existe = s => loc.indexOf(s)  > -1
88
89    // Graduação
90    if( existe('/vestibular/') || existe('/graduacao') ){
91      setPerfilOnCookie(1, "Graduação")
92    }
93    // Pós-Graduação
94    else if( existe('/pos-graduacao-e-mba') ){
95      setPerfilOnCookie(2, "Pós-Graduação")
96    }
97    // Cursos de curta duração
98    else if( existe('/cursos-curta-duracao') ){
99      setPerfilOnCookie(4, "Cursos de curta duração")
100    } else {
101      $('#escolher_perfil_master > .close').hide()
102      $("#escolher_perfil_master").modal({
103        backdrop: 'static',
104        keyboard: false
105      });
106      $("#escolher_perfil_master").modal("show");
107    }
108  }
109}
110
111// Salva o perfil escolhido no Cookie, localStorage e sessionStorage - quando se está em uma página interna
112function setPerfilOnCookie(perfil, perfil_nome){
113  Cookies.set("perfil_2018", perfil);
114  Cookies.set("perfil_nome", perfil_nome);
115  if(localStorage){
116    localStorage.setItem("perfil_2018", perfil);
117    localStorage.setItem("perfil_nome", perfil_nome);
118  }
119  if(sessionStorage){
120    sessionStorage.setItem("perfil_2018", perfil);
121    sessionStorage.setItem("perfil_nome", perfil_nome);
122  }
123  $("#trocarperfil,#trocarperfil_mobile").html(perfil_nome);
124}
125
126// Salva o cookies da página, por meio da mensagem de topo de alerta de cookies
127function setOnCookie(){
128    document.cookie = "cookies=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
129  // Cookies.set("cookies", true, "expires=Fri, 31 Dec 2019 23:59:59 GMT");
130  if(localStorage){
131    localStorage.setItem("cookies", true);
132  }
133  if(sessionStorage){
134    sessionStorage.setItem("cookies", true);
135  }
136}
137// Verifica se o parâmetro "cookies" existe nos cookies
138function getCookie(){
139  // if(!Cookies.get("cookies") == 1){
140  //   $("#cookies_alerta").show();
141  // }
142  // else if(!localStorage.getItem("cookies") == true){
143  //   $("#cookies_alerta").show();
144  // }
145  // else if(!sessionStorage.getItem("cookies") == true){
146  //   $("#cookies_alerta").show();
147  // }
148  if (document.cookie.replace(/(?:(?:^|.*;\s*)cookies\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== "true") {
149	     $("#cookies_alerta").show();
150	   }
151}
152
153// Função para balancear a altura das COLUNAS dentro de ROWS que possuem a classe "balance_height"
154  function balanceHeights(){
155    if(navigator.userAgent.indexOf("Safari") != -1)
156    {
157      //console.log(navigator.appVersion);
158    }
159    else{
160      if($(window).width() > 768 && $(".balance_height").length > -1){
161        $(".balance_height").each(function(){
162          var colsHeight = new Array();
163          $(".balance_height > div[class^='col-']").each(function(){
164            colsHeight.push($(this).outerHeight());
165          });
166
167          var trueHeight = Math.max.apply(null,colsHeight);
168          $(".balance_height > div[class^='col-']").each(function(){
169            $(this).outerHeight() < trueHeight && $(this).height(trueHeight).css({paddingTop:0,paddingBottom:0,position:"relative"});
170          });
171        });
172      }
173    }
174
175  }
176// FIM Função para balancear a altura das COLUNAS dentro de ROWS que possuem a classe "balance_height"
177
178// Botão para abrir o modal de Troca de Perfil
179var backToHome = false,
180    mudaPerfil = false;
181$("#trocarperfil, .trocaperfil, .trocaperfil_new").on("click", function(e) {
182  e.preventDefault();
183  $('#escolher_perfil_master > .close').is(":hidden") && $('#escolher_perfil_master > .close').show();
184  $("#escolher_perfil_master").modal({
185    backdrop: true,
186    keyboard: true
187  });
188  backToHome = true;
189  mudaPerfil = true;
190  $("#escolher_perfil_master").modal("show");
191});
192
193/**/
194
195// $('body:not(.index) #escolher_perfil_master').on('hidden.bs.modal', function (e) {
196//
197//   if(!(Cookies.get("perfil_2018") !== "" && Cookies.get("perfil_2018") !== undefined && Cookies.get("perfil_2018") !== null && Cookies.get("perfil_2018").length === 1))
198//   {
199//     setPerfilOnCookie("7", "Institucional");
200//   }
201// });
202
203// Ação dos botões de escolha de perfil
204$(".btn_perfil").on("click", function(e){
205  e.preventDefault();
206  let normal = false;
207
208  if($(this).hasClass('close-x')){
209    if(
210      !(Cookies.get("perfil_2018") !== "" &&
211      Cookies.get("perfil_2018") !== undefined &&
212      Cookies.get("perfil_2018") !== null &&
213      Cookies.get("perfil_2018").length === 1)
214    ){
215      normal = true;
216    }
217  }
218  else{
219    normal = true;
220  }
221
222
223  if(!!normal){
224    if(Cookies.get("perfil") != $(this).data("perfil")){
225      setPerfilOnCookie( $(this).data("perfil") , $(this).data("perfil-nome") );
226
227      if($("body[class*='home']").length === 0){
228        if(mudaPerfil === true){
229          backToHome = true;
230        }else{
231          if(document.referrer.indexOf("fae.edu") > -1){
232            backToHome = true;
233          } else {
234            backToHome = false;
235          }
236        }
237      }else{
238        backToHome = false;
239      }
240    } else {
241      backToHome = false;
242    }
243
244    if(backToHome === true){
245      window.location.replace("//fae.edu");
246    }else if(backToHome === false){
247      $("#escolher_perfil_master").modal("hide");
248    }
249  }
250
251});
252
253// Botões de Acessibilidade
254  $(".btn_contrast").on('click',function(){
255    if($(this).hasClass("btn_contrast_black")){
256      $("body").addClass("alto_contraste");
257      Cookies.set("alto_contraste", "on");
258    } else {
259      $("body").removeClass("alto_contraste");
260      Cookies.set("alto_contraste", "off");
261    }
262  });
263
264  // Botão GoTo Top!
265  $(".gototop").on("click",function(e){
266    e.preventDefault();
267    $("html,body").animate({scrollTop: 0}, 1500, "swing");
268  });
269
270  // Botão GoTo Anchor!
271  $('a[data-scrollit=true]').on('click',function (e) {
272    var current = window.location.href.split('#')[0];
273    var goto = $(this).attr('href').split('#')[0];
274
275    if ((current == goto || goto == "") && this.hash) {
276      e.preventDefault();
277
278      var target = this.hash;
279      var $target = $(target);
280
281      if($target.length){
282        $('html,body').stop().animate({
283          'scrollTop': $target.offset().top
284        }, 1000, 'swing');
285      }
286    }
287  });
288
289  // Funções para aumentar ou diminuir o tamanho da font
290  function aumentarFonte(elem, aumentar, limite){
291    var fsa = parseInt(elem.css('font-size').split("px")[0]);
292    // console.log(elem, fsa);
293    fsa < limite && elem.animate({'font-size': (fsa+aumentar)+'px'},300);
294    Cookies.set("tamanho_font", (fsa+aumentar)+"px");
295  }
296  function diminuirFonte(elem, diminuir, limite){
297    var fsd = parseInt(elem.css('font-size').split("px")[0]);
298    // console.log(fsd);
299    fsd > limite && elem.animate({'font-size': (fsd-diminuir)+'px'},300);
300    Cookies.set("tamanho_font", (fsd-diminuir)+"px");
301  }
302  $("#controls a.btns-font-size").on('click',function(event) {
303    event.preventDefault();
304    $(this).data("size") === "small" && diminuirFonte($("body"), 3, 16);
305    $(this).data("size") === "large" && aumentarFonte($("body"), 3, 22);
306  });
307// Fim das ações de acessibilidade
308
309// Função para corrigir altura do "::before" dos combos customizados
310function fixLgCombos(){
311  $(".select-wrapper > .input-lg").each(function(){
312    $(this).parent().addClass("wrapper-lg");
313  });
314}
315// Fim da Função para corrigir altura do "::before" dos combos customizados
316
317// Função para ajustar o espaçamento entre rodapé e conteúdo
318function setBodyPaddingBottom(){
319  /*
320    if( $("body > footer").length === 1 ){
321      var bP = parseInt($("body").css("padding-bottom").split("px")[0]),
322          bPos = $("body").css("position");
323          fH = $("body > footer").height();
324      if(bP !== fH){
325        $("body").css("padding-bottom", $("body > footer").height());
326
327        setTimeout(function(){
328          setBodyPaddingBottom();
329        }, 100)
330
331      }
332      if(bPos !== "relative"){
333        $("body").css("position", "relative");
334
335        setTimeout(function(){
336          setBodyPaddingBottom();
337        }, 100)
338
339      }
340    }
341  */
342}
343// Fim da função para ajustar o espaçamento entre rodapé e conteúdo
344
345if(MutationObserver != undefined){
346  // Observador para o elemento BODY
347    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
348
349    var element = document.querySelector('body');
350    var observer = new MutationObserver(function(mutations) {
351      mutations.forEach(function(mutation) {
352        if (mutation.type == "attributes") {
353          setBodyPaddingBottom();
354        }
355      });
356    });
357    observer.observe(element, {
358      attributes: true //configure it to listen to attribute changes
359    });
360  // FIM do Observador para o elemento BODY
361}
362
363// Swipe nos "carouseis"
364if ($('.carousel').length) {
365  $(".carousel").swipe({
366    swipe: function (event, direction, distance, duration, fingerCount, fingerData) {
367      if (direction == 'left') $(this).carousel('next');
368      if (direction == 'right') $(this).carousel('prev');
369    },
370    allowPageScroll: "vertical"
371  });
372}
373
374
375// DOM Ready
376$(document).ready(function() {
377  // getPerfilFromCookies();
378  setBodyPaddingBottom();
379  balanceHeights();
380  fixLgCombos();
381  getCookie();
382
383  // Rola o scroll da página até o conteúdo se caso existir conteúdo com o mesmo ID que a HASH da URL
384  // Exemplo: <div id="curso_2"></div>  ...  ".com.br/pagina.vm#curso_2"
385  if(window.location.hash != undefined && window.location.hash != "" && window.location.hash.indexOf('=') === -1 && $(window.location.hash).length == 1){
386    $("html,body").animate({scrollTop: ($(window.location.hash).offset().top - 15)+"px" }, 1000);
387  }
388
389  // Alto Contraste
390  Cookies.get("alto_contraste") === "on" && $("body").addClass("alto_contraste");
391  // Setar o tamanho da fonte
392  Cookies.get("tamanho_font") !== "" && $("body").css("font-size",Cookies.get("tamanho_font"));
393
394  // FORCE NOCACHE
395  /*
396  if(
397    window.location.search.indexOf('nocache') === -1 && (
398      window.location.pathname.indexOf('graduacao.vm') > -1 ||
399      window.location.pathname.indexOf('pos-graduacao-e-mba.vm') > -1 ||
400      window.location.pathname.indexOf('educacao-executiva-empresarial.vm') > -1 ||
401      window.location.pathname.indexOf('cursos-curta-duracao.vm') > -1 ||
402      window.location.pathname === '/'
403    )
404  ){
405    window.location = location.href + (location.search.indexOf('?') > -1 ? '&' : '?') + 'nocache'
406  }
407  else{
408    deleteAllCookies()
409  }
410  */
411});
412
413// Window LOAD & RESIZE
414var scrolled = 0;
415$(window).load(function(){
416  setBodyPaddingBottom();
417}).resize(function() {
418  setBodyPaddingBottom();
419}).scroll(function(){
420  if(scrolled < 3){
421    setBodyPaddingBottom();
422    scrolled++;
423  }
424});
425
426

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.