1$(function () { 2 /******************START FUNÃÃES******************/ 3 4 /********************COMPORTAMENTO******************/ 5 6 // Toggle Menu 7 $('[js-toggle-menu]').on('click', function (e) { 8 e.preventDefault(); 9 e.stopPropagation(); 10 $('[js-menu]').toggleClass('ativo'); 11 $('body').toggleClass('noscroll'); 12 }); 13 14 15 $('body, html').on('click', function (e) { 16 $('[js-menu]').removeClass('ativo'); 17 $('body').removeClass('noscroll'); 18 $('[js-formulario-busca]').removeClass('ativo'); 19 $('[js-formulario-busca] input').blur(); 20 $('[js-botao-filtro-categorias]').removeClass('ativo'); 21 $('[js-lista-categorias]').removeClass('ativo'); 22 23 }); 24 25 // Voltar a página 26 $('[js-voltar]').on('click', function (e) { 27 e.preventDefault(); 28 history.go(-1); 29 }); 30 31 // Voltar para o topo 32 $('[js-ancora-topo]').on('click', function (e) { 33 e.preventDefault(); 34 $("html, body").animate({ scrollTop: 0 }, 600); 35 }); 36 37 $('[js-proximo-step]').on('click', function (e) { 38 e.preventDefault(); 39 40 let elemento = $(this); 41 let raiz = elemento.parents('[js-step-ativo]'); 42 let proximoStep = elemento.attr('js-proximo-step'); 43 let input = elemento.prev().val(); 44 45 if (input != '') { 46 raiz.attr('js-step-ativo', proximoStep); 47 raiz.find('.alerta-news--fail').addClass('hidden'); 48 } else { 49 raiz.find('.alerta-news--fail').removeClass('hidden'); 50 } 51 52 }); 53 54 $('[js-fechar-filtro]').on('click', function (e) { 55 e.preventDefault(); 56 $('[js-botao-filtro-categorias]').removeClass('ativo'); 57 $('[js-lista-categorias]').removeClass('ativo'); 58 }); 59 60 $('[js-exibir-busca]').on('click', function (e) { 61 e.preventDefault(); 62 e.stopPropagation(); 63 $('[js-formulario-busca]').addClass('ativo'); 64 $('[js-formulario-busca] input').focus(); 65 }); 66 67 $('[js-formulario-busca], .formulario-busca button[type=submit]').on('click', function (e) { 68 e.stopPropagation(); 69 }); 70 71 $('[js-botao-filtro-categorias]').on('click', function (e) { 72 e.preventDefault(); 73 e.stopPropagation(); 74 let elemento = $(this); 75 elemento.toggleClass('ativo'); 76 elemento.next().toggleClass('ativo'); 77 }); 78 79 $('[js-lista-categorias]').on('click', function (e) { 80 e.stopPropagation(); 81 }); 82 83 /**********************AÃÃO***********************/ 84 85 // Forms 86 87 $('[js-formulario-newsletter]').on('submit', function (e) { 88 e.preventDefault(); 89 let form = $(this); 90 let elemento = form.find('[type="submit"]'); 91 let raiz = elemento.closest('[js-form-newsletter]'); 92 93 raiz.find('.obrigatorio').removeClass('obrigatorio'); 94 95 $.each(raiz.find('[required]'), function () { 96 let campo = $(this); 97 if (campo.val() == '') { 98 campo.focus(); 99 campo.parent().addClass('obrigatorio'); 100 return false; 101 } 102 }); 103 104 if (raiz.find('.obrigatorio').length > 0) { 105 return false; 106 } 107 108 var ajaxurl = $('#url_ajax').val(); 109 110 var data = form.serializeArray(); 111 112 $.ajax({
113 url: 'https://www.univates.br/web-services/rd-station-lead', 114 type: 'post', 115 data: data, 116 beforeSend: function () { 117 elemento.attr('disabled', 'disabled').data('original', elemento.text()).text('...'); 118 }, 119 success: function (retorno) { 120 console.log(retorno); 121 if (retorno != '1') { 122 elemento.removeAttr('disabled').text(elemento.data('original')); 123 raiz.find('[js-form-erro]').removeClass('hidden'); 124 } else { 125 elemento.text(elemento.data('original')) 126 form.find('input').attr('readonly', 'readonly'); 127 raiz.find('[js-form-sucesso]').removeClass('hidden'); 128 } 129 } 130 }); 131 }); 132 133 $('input, textarea').on('focus', function (e) { 134 $(this).parent().removeClass('obrigatorio'); 135 }); 136 137 $('input, textarea').on('blur', function (e) { 138 let elemento = $(this); 139 if (elemento.val() != '') { 140 elemento.parent().removeClass('obrigatorio'); 141 } 142 }); 143 144 $('.alerta-news__fechar').on('click', function (e) { 145 e.preventDefault(); 146 $(this).closest('.alerta-news').fadeOut(); 147 }); 148 149 150 // Fim forms 151 152 153 /******************INICIALIZAÃÃO******************/ 154 155 if ($(window).width() >= 1200) { 156 var sticky = new Sticky('[js-sticky]'); 157 } 158 159 160 // Swiper Home 161 var swiper = new Swiper(".swiper-home", { 162 spaceBetween: 30, 163 effect: 'slide', 164 loop: false, 165 speed: 800, 166 autoplay: { 167 delay: 3000, 168 disableOnInteraction: true, 169 }, 170 pagination: { 171 el: ".swiper-pagination", 172 clickable: true, 173 }, 174 }); 175 176 new Swiper(".swiper-webstories", { 177 slidesPerView: 1.2, 178 spaceBetween: 30, 179 observer: true, 180 observeParents: true, 181 observeSlideChildren: true, 182 // loop: true, 183 navigation: { 184 nextEl: ".swiper-next-webstories", 185 }, 186 breakpoints: { 187 768: { 188 slidesPerView: 3, 189 spaceBetween: 30, 190 }, 191 1200: { 192 slidesPerView: 3, 193 spaceBetween: 30, 194 }, 195 1440: { 196 slidesPerView: 4, 197 spaceBetween: 30, 198 }, 199 } 200 }); 201 202 // Inicializa o Fancybox 203 Fancybox.bind('[data-fancybox]', { 204 lang: 'pt', 205 animated: 'fade', 206 Thumbs: false, 207 Toolbar: true, 208 autoFocus: false, 209 trapFocus: false, 210 placeFocusBack: false, 211 mainClass: 'modal-bravo', 212 dragToClose: false, 213 click: false, 214 215 Image: { 216 zoom: false, 217 click: false, 218 wheel: "slide", 219 }, 220 221 l10n: { 222 CLOSE: 'Fechar', 223 THUMBS: 'Miniaturas', 224 FULLSCREEN: 'Tela cheia', 225 PLAY_START: 'Transição automática', 226 NEXT: 'Próximo', 227 PREV: 'Anterior', 228 }, 229 }); 230 231 Fancybox.bind('[data-fancybox-webstories]', { 232 lang: 'pt', 233 animated: 'fade', 234 Thumbs: false, 235 Toolbar: true, 236 autoFocus: false, 237 trapFocus: false, 238 placeFocusBack: false, 239 mainClass: 'modal-webstory', 240 dragToClose: false, 241 groupAll: true, 242 click: false, 243 244 Image: { 245 zoom: false, 246 click: false, 247 wheel: "slide", 248 }, 249 250 l10n: { 251 CLOSE: 'Fechar', 252 THUMBS: 'Miniaturas', 253 FULLSCREEN: 'Tela cheia', 254 PLAY_START: 'Transição automática', 255 NEXT: 'Próximo', 256 PREV: 'Anterior', 257 }, 258 259 video: { 260 ratio: 9 / 16, 261 autoplay: false, 262 }, 263 264 youtube: { 265 autohide: 1, 266 fs: 1, 267 rel: 1, 268 hd: 1, 269 wmode: "transparent", 270 enablejsapi: 1, 271 html5: 1, 272 modestbranding: 1, 273 showinfo: 1, 274 iv_load_policy: 3, 275 playsinline: 1, 276 } 277 });
278 279 // Fução para fechar o modal (pode ser colocar em <a> ou <button>) 280 // utilizado $(document) porque funcionará dentro de um ajax também 281 $(document).on('click', '[js-fechar-fancybox]', function (e) { 282 e.preventDefault(); 283 Fancybox.close(); 284 }); 285 286 $(document).on('click', '[data-fancybox-sibling]', function (e) { 287 e.preventDefault(); 288 $.fancybox.open($(this).siblings().first()); 289 }); 290 291 292 293 /*MÃSCARA*/ 294 var SPMaskBehavior = function (val) { 295 return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009'; 296 }, spOptions = { 297 onKeyPress: function (val, e, field, options) { 298 field.mask(SPMaskBehavior.apply({}, arguments), options); 299 } 300 }; 301 $('[mascara="telefone"]').mask(SPMaskBehavior, spOptions); 302 $('[mascara="cnpj"]').mask('00.000.000/0000-00'); 303 $('[mascara="cpf"]').mask('000.000.000-00'); 304 $('[mascara="data"]').mask('00/00/0000'); 305 $('[mascara="dinheiro"]').mask('#.##0,00', { reverse: true }); 306 307}); 308 309 310var form = document.getElementById('blog-masterclass-0f7e5a9800b4a14f15d1'); 311var cardMasterclass = document.querySelectorAll('[js-card-masterclass]'); 312if (form != null) { 313 cardMasterclass.forEach(card => { 314 card.addEventListener('click', function (e) { 315 form.addEventListener('submit', function (event) { 316 event.preventDefault(); 317 linkCard = card.getAttribute('js-card-masterclass'); 318 card.removeAttribute('data-fancybox', ''); 319 // card.setAttribute('href', linkCard); 320 // setTimeout(() => { 321 // window.location.href = linkCard; 322 // }, 2000); 323 let nome = form.querySelector('[name="name"]').value; 324 let email = form.querySelector('[name="email"]').value; 325 let interesse = form.querySelector('[name="cf_referente_ao_curso"]').value; 326 327 328 if (nome && email && interesse) { 329 card.setAttribute('href', linkCard); 330 setTimeout(() => { 331 window.location.href = linkCard; 332 console.log('passou'); 333 }, 1000) 334 } 335 336 if (nome && email && interesse) { 337 sessionStorage.setItem('formulario_preenchido', 'true'); 338 } 339 }); 340 }); 341 }); 342} 343 344window.addEventListener('load', function () { 345 const formularioPreenchido = sessionStorage.getItem('formulario_preenchido'); 346 console.log(formularioPreenchido); 347 if (formularioPreenchido === 'true') { 348 cardMasterclass.forEach(card => { 349 linkCard = card.getAttribute('js-card-masterclass'); 350 card.removeAttribute('data-fancybox', ''); 351 card.setAttribute('href', linkCard); 352 }); 353 } else { 354 cardMasterclass.forEach(card => { 355 card.setAttribute('data-fancybox', ''); 356 card.setAttribute('href', '#modal-lead-masterclass'); 357 }); 358 } 359}); 360 361 362let multicheckForm = document.querySelectorAll('[js-multicheck-form]'); 363if (multicheckForm.length > 0) { 364 multicheckForm.forEach(form => { 365 let inputs = form.querySelectorAll('input'); 366 if (inputs.length > 0) { 367 inputs.forEach(input => { 368 input.addEventListener('input', () => { 369 form.submit(); 370 }) 371 }); 372 } 373 }); 374} 375
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.