1let view_item_count = 0; 2let viewOriginalTop = 0; 3let visible_beneficios = false; 4let visible_excelencia = false; 5let visible_receber = false; 6let visible_leia = false; 7let digital_view = false; 8let userCRM = {}; 9let tpl_tipo = $(".template2").length > 0 ? true : false; 10 11$(".oferta-tabs .tabs div").click(function(e){ 12 e.preventDefault(); 13 14 $(".oferta-tabs .tabs div").removeClass("active"); 15 $(".contents .oferta-content, #destacado.oferta-content").removeClass("active"); 16 $(this).addClass("active"); 17 $(".oferta-tabs .oferta-content").hide(); 18 19 let abre = $(this).find("a").attr("href"); 20 $(abre).css("display", tpl_tipo ? "flex" : "grid").addClass("active"); 21 if(!tpl_tipo){ 22 $(".oferta-prod").removeClass("active"); 23 if ($(".oferta-content.active").find(".oferta-prod[data-melhor_oferta=yes]").length >= 1){ 24 $(".oferta-content.active").find(".oferta-prod[data-melhor_oferta=yes]").first().addClass("active"); 25 } else if (!tpl_tipo) { 26 $(".oferta-content.active").find(".oferta-prod").first().addClass("active"); 27 } 28 } 29 30 mostraSKU(); 31 fixedProd(); 32 equalizaOfertaTop(); 33 view_item_count++; 34 if(view_item_count <= 2){ 35 gaProductView(); 36 } 37 return; 38}); 39 40$(".oferta-tabs .oferta-prod, #destacado .oferta-prod").click(function(e){ 41 if(tpl_tipo) return; 42 43 $(".oferta-prod").removeClass("active"); 44 $(this).addClass("active"); 45 mostraSKU(); 46 fixedProd(); 47 return; 48}); 49 50$(".slider-pages a").click(function(e){ 51 e.preventDefault(); 52 $(".slider-pages a").removeClass("active"); 53 $(".slide").removeClass("active"); 54 let abre = $(this).attr("href"); 55 $(this).addClass("active"); 56 $(abre).addClass("active"); 57 return; 58}); 59 60$(".botoes .botao").click(function(e){ 61 e.preventDefault(); 62 63 if ($("#popup_oferta").length === 1) { 64 let popup = $(".oferta-prod.active").data("popup"); 65 if (popup == "yes") { 66 $("#popup_oferta").addClass("active"); 67 gaSendEvent({ 68 "category": "Funil assinatura", 69 "action": "Pop Combo View", 70 "label": "" 71 }); 72 return; 73 } 74 } 75 76 let label = $(".oferta-prod.active").find("h3").text(); 77 let link = $(".oferta-prod.active").data("link"); 78 comprarOfertaBloqueio(label, link); 79 return; 80}); 81 82$("#popup_oferta .close, #popup_oferta .naoquero").click(function(e){ 83 e.preventDefault(); 84 let label = $(".oferta-prod.active").find("h3").text(); 85 let link = $(".oferta-prod.active").data("data-popup_title"); 86 if(tpl_tipo){ 87 label = $(".template2-buttons .btn2.active").data("popup_title"); 88 link = $(".template2-buttons .btn2.active").attr("href"); 89 } 90 gaSendEvent({ 91 "category": "Funil assinatura", 92 "action": "Pop Combo Click", 93 "label": "digital" 94 }); 95 96 comprarOfertaBloqueio(label, link); 97 return; 98}); 99 100$("#popup_oferta2 .naoquero2, #popup_oferta2 .close2").click(function(e){ 101 e.preventDefault(); 102 $("#popup_oferta2").removeClass("active"); 103 return; 104}); 105 106$(".popup_oferta .oferta-fundo").click(function(e){ 107 e.preventDefault(); 108 $("#popup_oferta, #popup_oferta2, #popup_oferta3").removeClass("active"); 109 return; 110}); 111 112$("#popup_oferta .botao").click(function(e){ 113 e.preventDefault(); 114 gaSendEvent({ 115 "category": "Funil assinatura", 116 "action": "Pop Combo Click", 117 "label": "combo" 118 }); 119 120 let label = $("#popup_oferta").find("h3").text(); 121 let link = $("#popup_oferta .botao").attr("href"); 122 let tipo = $(".tabs div.active").text(); 123 124 link = link + '&tipo=' + tipo; 125 126 comprarOfertaBloqueio(label, link); 127 return; 128}); 129 130$("#popup_oferta2 .botao").click(function(e){ 131 e.preventDefault(); 132 gaSendEvent({ 133 "category": "Funil assinatura", 134 "action": "Pop Digital Click", 135 "label": "digital" 136 }); 137 138 let label = $("#popup_oferta2").find("h3").text(); 139 let link = $("#popup_oferta2 .botao").attr("href"); 140 141 link = link; 142 143 comprarOfertaBloqueio(label, link); 144 return; 145}); 146 147$(document).ready(function () { 148 if ($(".oferta-content.active").find(".oferta-prod[data-melhor_oferta=yes]").length >= 1){ 149 $(".oferta-content.active").find(".oferta-prod[data-melhor_oferta=yes]").first().addClass("active"); 150 } else if (!tpl_tipo) { 151 $(".oferta-content.active").find(".oferta-prod").first().addClass("active"); 152 } 153 154 mostraSKU(); 155 fixedProd(); 156 view_item_count++; 157 gaProductView(); 158 document.fonts.ready.then(equalizaOfertaTop); 159 160 let t2TabsBottom = tpl_tipo ? ($(".oferta-tabs").offset().top + $(".oferta-tabs").outerHeight()) : 0; 161 let t2FadeRange = 80; 162 163 $(document).scroll(function () { 164 if(tpl_tipo === true){ 165 let scrollTop = $(this).scrollTop(); 166 let fadeStart = t2TabsBottom - 42; 167 let opacity = Math.min(1, Math.max(0, (scrollTop - fadeStart) / t2FadeRange)); 168 $(".t2-sticky-bar").css("opacity", opacity); 169 $(".t2-sticky-bar").css("pointer-events", opacity > 0.5 ? "auto" : "none"); 170 } 171 if(tpl_tipo === false){ 172 let topo = $(this).scrollTop() + 42; 173 let $view = $(".oferta-content.active .view"); 174 if(!$view.hasClass("sticky_top")){ 175 viewOriginalTop = $view.offset().top; 176 } 177 if(topo >= viewOriginalTop){ 178 $view.addClass("sticky_top"); 179 $(".oferta-content.active").addClass("fixar"); 180 } else { 181 $view.removeClass("sticky_top"); 182 $(".oferta-content.active").removeClass("fixar"); 183 } 184 } 185 186 const box_beneficios = document.querySelector(".oferta-beneficios"); 187 if(estaVisivel(box_beneficios) === true){ 188 if(visible_beneficios === false){ 189 visible_beneficios = true; 190 gaSendEvent({ 191 "category": "Ofertas Viu", 192 "action": "Box1 BenefÃcios", 193 "label": "" 194 }); 195 } 196 } 197 198 const box_excelencia = document.querySelector(".oferta-excelencia"); 199 if(estaVisivel(box_excelencia) === true){ 200 if(visible_excelencia === false){ 201 visible_excelencia = true; 202 gaSendEvent({ 203 "category": "Ofertas Viu", 204 "action": "Box2 Excelência", 205 "label": "" 206 }); 207 } 208 } 209 210 const box_receber = document.querySelector(".oferta-receber"); 211 if(estaVisivel(box_receber) === true){ 212 if(visible_receber === false){ 213 visible_receber = true; 214 gaSendEvent({ 215 "category": "Ofertas Viu", 216 "action": "Box3 Revista Impressa", 217 "label": "" 218 }); 219 } 220 } 221 222 const box_leia = document.querySelector(".ofertas-leia"); 223 if(estaVisivel(box_leia) === true){ 224 if(visible_leia === false){ 225 visible_leia = true; 226 gaSendEvent({ 227 "category": "Ofertas Viu", 228 "action": "Box4 Todas Marcas App", 229 "label": "" 230 }); 231 } 232 } 233 }); 234}); 235 236$(document).one('scroll touchstart mousemove', function () { 237 if($("#popup_oferta2").length === 1){ 238 if(digital_view === false){ 239 $("#popup_oferta2").addClass("active"); 240 gaSendEvent({ 241 "category": "Funil assinatura", 242 "action": "Pop Digital View", 243 "label": "" 244 }); 245 digital_view = true; 246 } 247 } 248}); 249 250if ($("#popup_oferta3").length === 1) { 251 var mY = 0; 252 $(document).mousemove(function (e) { 253 let y = e.pageY - ($('.oferta-header').offset().top + 20); 254 if (e.pageY < mY) { 255 if (y < 0) { 256 $("#popup_oferta3").addClass("active"); 257 gaSendEvent({ 258 "category": "Funil assinatura", 259 "action": "Captação Lead View", 260 "label": "" 261 }); 262 $(document).off("mousemove"); 263 } 264 } 265 mY = e.pageY; 266 }); 267 268 $("#popup_oferta3 .close3").click(function (e) { 269 e.preventDefault(); 270 $("#popup_oferta3").removeClass("active"); 271 return; 272 }); 273} 274 275function mostraSKU(){ 276 if(tpl_tipo) return; 277 if($(".oferta-prod.active").data('sku_id') === '' || $(".oferta-prod.active").data('sku_id') === undefined){ 278 $(".botoes .or").css("display", "none"); 279 $(".botoes .btn-offer-google").css("display", "none"); 280 $(".oferta-content.active #purchase").attr("data-swg_price", ""); 281 $(".oferta-content.active .btn-offer-google").attr("data-swg-sku", ""); 282 }else{ 283 $(".botoes .or").css("display", "inline"); 284 $(".botoes .btn-offer-google").css("display", "inline"); 285 $(".oferta-content.active #purchase").attr("data-swg_price", $(".oferta-prod.active").data('sku_preco')); 286 let sufixo = ( $(".oferta-prod.active").data('sku_id').indexOf("SWGPD.") >= 0 ) ? "" : "_ofertas" ; 287 $(".oferta-content.active .btn-offer-google").attr("data-swg-sku", $(".oferta-prod.active").data('sku_id') + sufixo); 288 } 289} 290 291function fixedProd(){ 292 293 let tipo = $(".tabs .active").find("a").text(); 294 let prod = $(".oferta-prod.active").find("h3").text(); 295 let preco = $(".oferta-prod.active").find(".preco").text(); 296 297 let info_preco = `<strong>${prod} (${tipo})</strong><br><span>${preco}</span>`;
298 if($("#destacado .oferta-prod.active").length >= 1){ 299 info_preco = `<strong>${prod}</strong><br><span>${preco}</span>`; 300 } 301 if($(".tabs .tab2.active").length >= 1){ 302 $(".contents .info").css("display", "block"); 303 }else{ 304 $(".contents .info").css("display", "none"); 305 } 306 307 $(".info-preco").html(info_preco); 308} 309 310function validatePhone(phone) { 311 var regex = new RegExp('^((1[1-9])|([2-9][0-9]))((3[0-9]{3}[0-9]{4})|(9[0-9]{3}[0-9]{5}))$'); 312 return regex.test(phone); 313} 314 315indice_clique = 0; 316$('.login_oferta').click(function () { 317 318 if (indice_clique > 0) { 319 return; 320 } 321 indice_clique = indice_clique + 1; 322 323 AbrilLogin.sendMetricsGA('metric1', 'Paywall', 'Entrada na tela de Login', 'Login pela tela de ofertas'); 324 325 let queryString = window.location.search; 326 let urlParams = new URLSearchParams(queryString); 327 urlRetornoLogin = urlParams.get('url-retorno'); 328 329 if (!urlRetornoLogin) { 330 urlRetornoLogin = window.location.origin; 331 } 332 333 urlParams.get('tipo_paywall') ? urlTipoPaywall = "&tipo_paywall=" + urlParams.get('tipo_paywall') : urlTipoPaywall = ""; 334 urlParams.get('medium') ? urlUtmMedium = "&medium=" + urlParams.get('medium') : urlUtmMedium = ""; 335 urlParams.get('campaign') ? urlUtmCampaigm = "&campaign=" + urlParams.get('campaign') : urlUtmCampaigm = ""; 336 urlParams.get('source') ? urlUtmSource = "&source=" + urlParams.get('source') : urlUtmSource = ""; 337 eventLabel = "&eventLabel=Login pela tela de ofertas"; 338 339 let redirectUrl = "/login/?&url-retorno=" + urlRetornoLogin + eventLabel + urlTipoPaywall; 340 341 if($(".goread2").length > 0){ 342 redirectUrl = "https://goread.com.br/login/"; 343 } 344 345 return window.location.href = redirectUrl; 346}); 347 348function estaVisivel(el) { 349 if(el === null){ return false; } 350 const posicoes = el.getBoundingClientRect(); 351 const inicio = posicoes.top; 352 const fim = posicoes.bottom; 353 let estaVisivel = false 354 if((inicio >= 0) && (fim <= window.innerHeight)) { 355 estaVisivel = true; 356 } 357 358 return estaVisivel; 359} 360 361 362var video = "video_desktop"; 363if($('body').width() <= 767){ 364 video = "video_mobile"; 365} 366const videoElement = document.getElementById(video); 367if(videoElement !== null){ 368 if (videoElement.playing) { 369 console.log("video playing") 370 // video is already playing so do nothing 371 } 372 else { 373 // video is not playing 374 // so play video now 375 console.log("video play") 376 videoElement.play(); 377 } 378} 379 380$('#btn_captacaolead').click(function () { 381 382 console.log("btn_captacaolead clicked"); 383 384 let crm = ""; 385 if(userCRM.crm !== undefined){ 386 crm = userCRM.crm; 387 } 388 389 let email = $("#email").val(); 390 let nome = $("#nome").val(); 391 let tel = $("#telefone").val(); 392 let aceite = $("#aceite").is(":checked"); 393 394 if(nome === "" || email === "" || tel === ""){ 395 $(".lead_result").html("Preencha todos os campos!").show(); 396 return false; 397 } 398 399 if(nome.length < 3){ 400 $(".lead_result").html("Preencha o campo nome!").show(); 401 return false; 402 } 403 404 if(email && !email.match(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)){ 405 $(".lead_result").html("E-mail inválido!").show(); 406 return false; 407 } 408 409 if(tel && tel.length < 11){ 410 $(".lead_result").html("Celular precisa ter 11 numeros!").show(); 411 return false; 412 } 413 414 if(validatePhone(tel) === false){ 415 $(".lead_result").html("Celular inválido!").show(); 416 return false; 417 } 418 419 if(!aceite){ 420 $(".lead_result").html("Você precisa aceitar os termos de uso!").show(); 421 return false; 422 } 423 424 let numDdd = (tel ? tel.replace(/[^0-9]/g,'').substr(0, 2) : ''); 425 let numTelefone = (tel ? tel.replace(/[^0-9]/g,'').substr(2, 9) : ''); 426 427 gaSendEvent({ 428 "category": "Funil assinatura", 429 "action": "Captação Lead Click", 430 "label": "" 431 }); 432 433 const dataValue = { 434 "action": 'sendOfertaCaptacaoLead', 435 "captacaolead_send": $('#abril_captacaolead_form input#captacaolead_send').val(), 436 "email": email, 437 "nome": nome, 438 "numDdd": numDdd, 439 "numTelefone": numTelefone, 440 'indEmail': true, 441 "crm": crm, 442 "oferta": $(".oferta-prod.active").data("sku_oferta"), 443 "projeto": $(".oferta-prod.active").data("sku_cod_projeto"), 444 "url": encodeURI(location.href) 445 } 446 447 $.ajax({ 448 url: ajaxurl, 449 type: 'POST', 450 data: dataValue, 451 beforeSend: function(){} 452 }).done(function(data){ 453 454 txt_action = "Captação Lead Success"; 455 txt_label = ""; 456 if(data.status === "erro"){ 457 txt_action = "Captação Lead Error"; 458 txt_label = data.msg; 459 } 460 461 if(data.codStatus === "EP"){ 462 txt_action = "Captação Lead Error"; 463 txt_label = data.dscMensagem; 464 } 465 466 if(data.codStatus === "SU"){ 467 txt_action = "Captação Lead Success"; 468 txt_label = ""; 469 } 470 471 $("#email").val("").attr("disabled", "disabled"); 472 $("#nome").val("").attr("disabled", "disabled"); 473 $("#telefone").val("").attr("disabled", "disabled"); 474 $("#btn_captacaolead").attr("disabled", "disabled"); 475 476 gaSendEvent({ 477 "category": "Funil assinatura", 478 "action": txt_action, 479 "label": txt_label 480 }); 481 $(".lead_result").addClass("success").html("Cadastro efetuado com sucesso.").show(); 482 483 }).fail(function() { 484 gaSendEvent({ 485 "category": "Funil assinatura", 486 "action": "Captação Lead Error", 487 "label": "Captação Lead Error: Problema na captação de lead" 488 }); 489 $(".lead_result").addClass("success").html("Cadastro efetuado com sucesso.").show(); 490 }); 491 492 return false;
493}); 494 495function comprarOfertaBloqueio(productName, link){ 496 return window.location.href = link; 497} 498 499function equalizaBloco(container, sel) { 500 var els = $(container).find(sel); 501 els.css("min-height", ""); 502 var maxH = 0; 503 els.each(function() { maxH = Math.max(maxH, $(this).outerHeight()); }); 504 if (maxH > 0) els.css("min-height", maxH + "px"); 505} 506 507function equalizaOfertaTop() { 508 if (!tpl_tipo) return; 509 $(".oferta-content").each(function() { 510 var $el = $(this); 511 var wasHidden = $el.css("display") === "none"; 512 if (wasHidden) { 513 $el.css({ display: "flex", visibility: "hidden", position: "absolute", top: "-9999px" }); 514 } 515 equalizaBloco(this, ".oferta-top"); 516 if (wasHidden) { 517 $el.css({ display: "none", visibility: "", position: "", top: "" }); 518 } 519 }); 520} 521 522$(".template2-buttons .btn2").click(function(e){ 523 e.preventDefault(); 524 525 if ($("#popup_oferta").length === 1) { 526 let popup = $(this).data("popup"); 527 if (popup == "yes") { 528 $("#popup_oferta").addClass("active"); 529 $(this).addClass("active"); 530 gaSendEvent({ 531 "category": "Funil assinatura", 532 "action": "Pop Combo View", 533 "label": "" 534 }); 535 return; 536 } 537 } 538 539 let label = $(".oferta-prod.active").find("h3").text(); 540 let link = $(this).attr("href"); 541 comprarOfertaBloqueio(label, link); 542 return; 543});
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.