cornford-michael

js-001

May 2nd, 2021 (edited)
1,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function setCookie(t, e, n) {
  2.     var o = new Date;
  3.     "" != n && null != n || (n = 365), o.setTime(o.getTime() + 24 * n * 60 * 60 * 1e3);
  4.     var i = "expires=" + o.toUTCString();
  5.     document.cookie = t + "=" + e + ";" + i + ";path=/"
  6. }
  7.  
  8. function getCookie(t) {
  9.     for (var e = t + "=", n = decodeURIComponent(document.cookie)
  10.             .split(";"), o = 0; o < n.length; o++) {
  11.         for (var i = n[o];
  12.             " " == i.charAt(0);) i = i.substring(1);
  13.         if (0 == i.indexOf(e)) return i.substring(e.length, i.length)
  14.     }
  15.     return ""
  16. }
  17.  
  18. function checkCookie(t, e, n) {
  19.     return "" != n && null != n || (n = 365), "" != (e = getCookie(t)) && null != e || setCookie(t, e, n), e
  20. }
  21.  
  22. function stepfinal() {
  23.     jQuery("#p_body_content")
  24.         .fadeOut("slow"), jQuery("#p_loading")
  25.         .fadeIn("slow")
  26. }
  27.  
  28. function goToUrlFinish() {
  29.     stepfinal(), document.getElementById("p_form_post")
  30.         .submit()
  31. }
  32.  
  33. function scrollTo(t) {
  34.     if ($("#" + t)
  35.         .length) {
  36.         var e = $("#" + t)
  37.             .offset()
  38.             .top;
  39.         $("html,body")
  40.             .animate({
  41.                 scrollTop: e
  42.             }, {
  43.                 duration: "slow"
  44.             })
  45.     }
  46. }
  47.  
  48. function getBrowser() {
  49.     return -1 != (navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf("OPR")) ? "Opera" : -1 != navigator.userAgent.indexOf("Chrome") ? "Google Chrome" : -1 != navigator.userAgent.indexOf("Safari") ? "Safari" : -1 != navigator.userAgent.indexOf("Firefox") ? "Firefox" : -1 != navigator.userAgent.indexOf("MSIE") || 1 == !!document.documentMode ? "IE" : "Unknown"
  50. }
  51.  
  52. function getPlatform() {
  53.     return -1 != window.navigator.userAgent.indexOf("Windows NT 10.0") ? "Windows 10" : -1 != window.navigator.userAgent.indexOf("Windows NT 6.2") ? "Windows 8" : -1 != window.navigator.userAgent.indexOf("Windows NT 6.1") ? "Windows 7" : -1 != window.navigator.userAgent.indexOf("Windows NT 6.0") ? "Windows Vista" : -1 != window.navigator.userAgent.indexOf("Windows NT 5.1") ? "Windows XP" : -1 != window.navigator.userAgent.indexOf("Windows NT 5.0") ? "Windows 2000" : -1 != window.navigator.userAgent.indexOf("iPhone") ? "iPhone" : -1 != window.navigator.userAgent.indexOf("iPad") ? "iPad" : -1 != window.navigator.userAgent.indexOf("Android") ? "Android" : -1 != window.navigator.userAgent.indexOf("Mac") ? "Macintosh" : -1 != window.navigator.userAgent.indexOf("X11") ? "UNIX" : -1 != window.navigator.userAgent.indexOf("Linux") ? "Linux" : -1 != window.navigator.userAgent.indexOf("BlackBerry") ? "BlackBerry" : "Unknown"
  54. }
  55. var canvasConfetti, ctx, W_Confetti, H_Confetti, getUrlParameter = function (t) {
  56.     return decodeURIComponent((new RegExp("[?|&]" + t + "=([^&;]+?)(&|#|;|$)")
  57.         .exec(location.search) || [null, ""])[1].replace(/\+/g, "%20")) || null
  58. };
  59.  
  60. function setSecondary() {
  61.     "tar" == jQuery("body")
  62.         .data("type") && 0 < jQuery("[data-igeneric]")
  63.         .length && (jQuery(".img-primary")
  64.             .remove(), jQuery(".img-secondary")
  65.             .removeClass("p_hidden"), jQuery("[data-igeneric]")
  66.             .each(function () {
  67.                 jQuery(this)
  68.                     .attr("src", jQuery(this)
  69.                         .data("igeneric"))
  70.             }), jQuery("[data-cgeneric]")
  71.             .each(function () {
  72.                 jQuery(this)
  73.                     .addClass(jQuery(this)
  74.                         .data("cgeneric"))
  75.             }))
  76. }
  77. if (jQuery(document)
  78.     .ready(function () {
  79.         var t, e, n, o;
  80.        
  81.         function i(t) {
  82.             return t < 10 && (t = "0" + t), t
  83.         }
  84.         1 <= jQuery("#timerr")
  85.             .length && (n = 99, o = setInterval(function () {
  86.                 t = parseInt(n / 60, 10), e = (e = parseInt(n % 60, 10)) < 10 ? "0" + e : e, $("#timerr")
  87.                     .text(t + " " + minutos_y + " " + e + " " + segundos), --n < 0 && clearInterval(o)
  88.             }, 1e3));
  89.         var r = new Date
  90.             , a = i(r.getHours()) + ":" + i(r.getMinutes())
  91.             , u = i(r.getMonth() + 1);
  92.         if (jQuery(".p_var-dia")
  93.             .text(r.getDate()), jQuery(".p_var-mes")
  94.             .text(u), jQuery(".p_var-anyo")
  95.             .text(r.getFullYear()), jQuery(".p_var-dia_nombre")
  96.             .text(dayNames[r.getDay()]), jQuery(".p_var-mes_nombre")
  97.             .text(monthNames[r.getMonth()]), jQuery(".p_var-hora_fija")
  98.             .text(a), 1 <= jQuery(".p_var-browser")
  99.             .length) {
  100.             var c = getBrowser();
  101.             jQuery(".p_var-browser")
  102.                 .text(c)
  103.         }
  104.         if (1 <= jQuery(".p_var-browser")
  105.             .length) {
  106.             var s = getPlatform();
  107.             jQuery(".p_var-so")
  108.                 .text(s)
  109.         }
  110.         "1" == getCookie("prlwge_finish_" + jQuery("body")
  111.             .data("pid")) && setTimeout(function () {
  112.             setSecondary()
  113.         }, 100);
  114.         var l = getCookie("prlwge_count_" + jQuery("body")
  115.             .data("pid"));
  116.         "" == l || null == l ? setCookie("prlwge_count_" + jQuery("body")
  117.             .data("pid"), "1", "10") : 1 <= parseInt(l) ? setSecondary() : setCookie("prlwge_count_" + jQuery("body")
  118.             .data("pid"), "" + (parseInt(l) + 1), "10")
  119.     }), jQuery(document)
  120.     .ready(function () {
  121.         if (0 < jQuery("#questions_all")
  122.             .length) {
  123.             var t = 100
  124.                 , e = parseInt(jQuery("#questions_all")
  125.                     .data("total"));
  126.             jQuery(".questions_of")
  127.                 .html(e + "/" + e), jQuery(".bq:not(.qclicked)")
  128.                 .on("click", function () {
  129.                     var n = parseInt(jQuery(this)
  130.                         .data("question"));
  131.                     jQuery("#q" + n + " .bq")
  132.                         .addClass("qclicked"), null != jQuery(this)
  133.                         .data("ok") && (jQuery("#q" + n + " .bq")
  134.                             .each(function (t) {
  135.                                 "1" == jQuery(this)
  136.                                     .data("ok") ? jQuery(this)
  137.                                     .addClass("bg-success") : jQuery(this)
  138.                                     .addClass("bg-danger")
  139.                             }), t = 2e3), setTimeout(function () {
  140.                             e == n ? (scrollTo("id1"), "function" == typeof DeactivateConfetti && 0 < jQuery("#canvasConfetti")
  141.                                     .length && 1 == confettiActive && DeactivateConfetti(), $("#content1,.content1")
  142.                                     .fadeOut("slow", function () {
  143.                                         $("#content2")
  144.                                             .fadeIn(), setTimeout(function () {
  145.                                                 $("#result1")
  146.                                                     .fadeIn(1e3)
  147.                                             }, 3e3), setTimeout(function () {
  148.                                                 $("#result2")
  149.                                                     .fadeIn(1e3)
  150.                                             }, 4100), setTimeout(function () {
  151.                                                 $("#result3")
  152.                                                     .fadeIn(1e3)
  153.                                             }, 6e3), setTimeout(function () {
  154.                                                 $("#content2")
  155.                                                     .fadeOut("slow", function () {
  156.                                                         "undefined" != typeof roulette_ini ? rouletteRoot._init() : "undefined" != typeof box_ini && boxRoot._init(), $("#content3")
  157.                                                             .fadeIn(), $(".p_hidden_survey")
  158.                                                             .fadeIn()
  159.                                                     })
  160.                                             }, 7100)
  161.                                     })) : jQuery("#q" + n + ",#qphoto" + n)
  162.                                 .fadeOut("slow", function () {
  163.                                     jQuery("#q" + (n + 1) + ",#qphoto" + (n + 1))
  164.                                         .fadeIn("slow")
  165.                                 })
  166.                         }, t)
  167.                 })
  168.         } else $(".bq1")
  169.             .click(function () {
  170.                 $("#q1")
  171.                     .fadeOut("slow", function () {
  172.                         $("#q2")
  173.                             .fadeIn("slow")
  174.                     })
  175.             }), $(".bq2")
  176.             .click(function () {
  177.                 $("#q2")
  178.                     .fadeOut("slow", function () {
  179.                         $("#q3")
  180.                             .fadeIn("slow")
  181.                     })
  182.             }), $(".bq3")
  183.             .click(function () {
  184.                 $("#q3")
  185.                     .fadeOut("slow", function () {
  186.                         $("#q4")
  187.                             .fadeIn("slow")
  188.                     })
  189.             }), $(".bq4")
  190.             .click(function () {
  191.                 scrollTo("id1"), $("#content1")
  192.                     .fadeOut("slow", function () {
  193.                         $("#content2")
  194.                             .fadeIn(), setTimeout(function () {
  195.                                 $("#result1")
  196.                                     .fadeIn(1e3)
  197.                             }, 3e3), setTimeout(function () {
  198.                                 $("#result2")
  199.                                     .fadeIn(1e3)
  200.                             }, 4100), setTimeout(function () {
  201.                                 $("#result3")
  202.                                     .fadeIn(1e3)
  203.                             }, 6e3), setTimeout(function () {
  204.                                 $("#content2")
  205.                                     .fadeOut("slow", function () {
  206.                                         "undefined" != typeof roulette_ini ? rouletteRoot._init() : "undefined" != typeof box_ini && boxRoot._init(), $("#content3")
  207.                                             .fadeIn()
  208.                                     })
  209.                             }, 7100)
  210.                     })
  211.             })
  212.     }), 988 <= screen.width) var mp_Confetti = 150;
  213. else mp_Confetti = 75;
  214. var deactivationTimerHandler, reactivationTimerHandler, animationHandler, particles = []
  215.     , angleConfetti = 0
  216.     , tiltAngle = 0
  217.     , confettiActive = !1
  218.     , confettiIniciated = !1
  219.     , animationComplete = !0
  220.     , particleColors = {
  221.         colorOptions: ["DodgerBlue", "OliveDrab", "Gold", "pink", "SlateBlue", "lightblue", "Violet", "PaleGreen", "SteelBlue", "SandyBrown", "Chocolate", "Crimson"]
  222.         , colorIndex: 0
  223.         , colorIncrementer: 0
  224.         , colorThreshold: 10
  225.         , getColor: function () {
  226.             return 10 <= this.colorIncrementer && (this.colorIncrementer = 0, this.colorIndex++, this.colorIndex >= this.colorOptions.length && (this.colorIndex = 0)), this.colorIncrementer++, this.colorOptions[this.colorIndex]
  227.         }
  228.     };
  229.  
  230. function confettiParticle(t) {
  231.     this.x = Math.random() * W_Confetti, this.y = Math.random() * H_Confetti - H_Confetti, this.r = RandomFromTo(10, 30), this.d = Math.random() * mp_Confetti + 10, this.color = t, this.tilt = Math.floor(10 * Math.random()) - 10, this.tiltAngleIncremental = .07 * Math.random() + .05, this.tiltAngle = 0, this.draw = function () {
  232.         return ctx.beginPath(), ctx.lineWidth = this.r / 2, ctx.strokeStyle = this.color, ctx.moveTo(this.x + this.tilt + this.r / 4, this.y), ctx.lineTo(this.x + this.tilt, this.y + this.tilt + this.r / 4), ctx.stroke()
  233.     }
  234. }
  235.  
  236. function SetGlobalsConfetti() {
  237.     canvasConfetti = document.getElementById("canvasConfetti"), ctx = canvasConfetti.getContext("2d"), W_Confetti = window.innerWidth, H_Confetti = window.innerHeight, canvasConfetti.width = W_Confetti, canvasConfetti.height = H_Confetti
  238. }
  239.  
  240. function InitializeConfetti() {
  241.     animationComplete = !(particles = []);
  242.     for (var t = 0; t < mp_Confetti; t++) {
  243.         var e = particleColors.getColor();
  244.         particles.push(new confettiParticle(e))
  245.     }
  246.     StartConfetti()
  247. }
  248.  
  249. function Draw() {
  250.     ctx.clearRect(0, 0, W_Confetti, H_Confetti);
  251.     for (var t, e = [], n = 0; n < mp_Confetti; n++) t = n, e.push(particles[t].draw());
  252.     return UpdateConfetti(), e
  253. }
  254.  
  255. function RandomFromTo(t, e) {
  256.     return Math.floor(Math.random() * (e - t + 1) + t)
  257. }
  258.  
  259. function UpdateConfetti() {
  260.     var t, e = 0;
  261.     angleConfetti += .01, tiltAngle += .1;
  262.     for (var n = 0; n < mp_Confetti; n++) {
  263.         if (t = particles[n], animationComplete) return;
  264.         !confettiActive && t.y < -15 ? t.y = H_Confetti + 100 : (stepParticleConfetti(t, n), t.y <= H_Confetti && e++, CheckForRepositionConfetti(t, n))
  265.     }
  266.     0 === e && StopConfetti()
  267. }
  268.  
  269. function CheckForRepositionConfetti(t, e) {
  270.     (t.x > W_Confetti + 20 || t.x < -20 || t.y > H_Confetti) && confettiActive && (0 < e % 5 || e % 2 == 0 ? repositionParticleConfetti(t, Math.random() * W_Confetti, -10, Math.floor(10 * Math.random()) - 10) : 0 < Math.sin(angleConfetti) ? repositionParticleConfetti(t, -5, Math.random() * H_Confetti, Math.floor(10 * Math.random()) - 10) : repositionParticleConfetti(t, W_Confetti + 5, Math.random() * H_Confetti, Math.floor(10 * Math.random()) - 10))
  271. }
  272.  
  273. function stepParticleConfetti(t, e) {
  274.     t.tiltAngle += t.tiltAngleIncremental, t.y += (Math.cos(angleConfetti + t.d) + 3 + t.r / 2) / 2, t.x += Math.sin(angleConfetti), t.tilt = 15 * Math.sin(t.tiltAngle - e / 3)
  275. }
  276.  
  277. function repositionParticleConfetti(t, e, n, o) {
  278.     t.x = e, t.y = n, t.tilt = o
  279. }
  280.  
  281. function StartConfetti() {
  282.     confettiActive = !0, W_Confetti = window.innerWidth, H_Confetti = window.innerHeight, canvasConfetti.width = W_Confetti, canvasConfetti.height = H_Confetti
  283.         , function t() {
  284.             return animationComplete ? null : (animationHandler = requestAnimFrame(t), Draw())
  285.         }()
  286. }
  287.  
  288. function ClearTimers() {
  289.     clearTimeout(reactivationTimerHandler), clearTimeout(animationHandler)
  290. }
  291.  
  292. function DeactivateConfetti() {
  293.     confettiActive = !1, ClearTimers()
  294. }
  295.  
  296. function StopConfetti() {
  297.     animationComplete = !0, null != ctx && ctx.clearRect(0, 0, W_Confetti, H_Confetti)
  298. }
  299.  
  300. function RestartConfetti() {
  301.     ClearTimers(), StopConfetti(), reactivationTimerHandler = setTimeout(function () {
  302.         animationComplete = !(confettiActive = !0), InitializeConfetti()
  303.     }, 100)
  304. }
  305.  
  306. function SetupConfetti() {
  307.     SetGlobalsConfetti(), InitializeConfetti(), confettiIniciated = !0, jQuery(window)
  308.         .resize(function () {
  309.             W_Confetti = window.innerWidth, H_Confetti = window.innerHeight, canvasConfetti.width = W_Confetti, canvasConfetti.height = H_Confetti
  310.         })
  311. }
  312. window.requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (t) {
  313.         return window.setTimeout(t, 1e3 / 60)
  314.     }, jQuery(document)
  315.     .ready(function () {
  316.         "undefined" == typeof confetti_ini && 0 < jQuery("#canvasConfetti")
  317.             .length && SetupConfetti()
  318.     });
  319. var boxRoot, count = 0
  320.     , intentos = 3
  321.     , puedo = !1;
  322. ! function () {
  323.     "use strict";
  324.     boxRoot = {
  325.             _init: function () {
  326.                 setTimeout(function () {
  327.                         jQuery("#p_modal1")
  328.                             .modal(modalOptions)
  329.                     }, 1e3), jQuery(".try")
  330.                     .on("click", function () {
  331.                         if (puedo && 0 < intentos)
  332.                             if (jQuery(this)
  333.                                 .hasClass("abierta"));
  334.                             else switch (puedo = !1, jQuery(".circle-loader")
  335.                                 .removeClass("load-complete"), jQuery(".checkmark")
  336.                                 .css("display", "none"), jQuery(this)
  337.                                 .addClass("abierta"), intentos--, ++count) {
  338.                             case 3:
  339.                                 jQuery(this)
  340.                                     .addClass("premiazo"), setTimeout(function () {
  341.                                         "function" == typeof SetupConfetti && 0 < jQuery("#canvasConfetti")
  342.                                             .length && (confettiIniciated ? RestartConfetti() : SetupConfetti()), jQuery(".div_img_gift, .img_gift")
  343.                                             .fadeIn("slow", function () {
  344.                                                 setTimeout(function () {
  345.                                                     jQuery("#p_modal3")
  346.                                                         .modal(modalOptions), jQuery(".circle-loader")
  347.                                                         .addClass("load-complete"), jQuery(".checkmark")
  348.                                                         .css("display", "block")
  349.                                                 }, 1500)
  350.                                             })
  351.                                     }, 4e3);
  352.                                 break;
  353.                             default:
  354.                                 jQuery("#num_intentos, .num_intentos")
  355.                                     .html(intentos), setTimeout(function () {
  356.                                         jQuery("#p_modal2")
  357.                                             .modal(modalOptions), setTimeout(function () {
  358.                                                 jQuery(".circle-loader")
  359.                                                     .addClass("load-complete"), jQuery(".checkmark")
  360.                                                     .css("display", "block"), puedo = !0
  361.                                             }, 1e3)
  362.                                     }, 2e3)
  363.                             }
  364.                     }), jQuery("#p_modal_button1")
  365.                     .on("click", function (t) {
  366.                         t.stopPropagation(), jQuery("#p_modal1")
  367.                             .modal("hide"), puedo = !0
  368.                     }), jQuery("#p_modal_button2")
  369.                     .on("click", function (t) {
  370.                         t.stopPropagation(), jQuery("#p_modal2")
  371.                             .modal("hide")
  372.                     }), jQuery("#p_modal_button4")
  373.                     .on("click", function (t) {
  374.                         t.stopPropagation(), jQuery("#p_modal3")
  375.                             .modal("hide"), stepfinal(), goToUrlFinish()
  376.                     })
  377.             }
  378.         }, jQuery(document)
  379.         .ready(function () {
  380.             jQuery("#boxes")
  381.                 .length && boxRoot._init()
  382.         })
  383. }();
  384. var tid = (getUrlParameter = function (t) {
  385.         return decodeURIComponent((new RegExp("[?|&]" + t + "=([^&;]+?)(&|#|;|$)")
  386.             .exec(location.search) || [null, ""])[1].replace(/\+/g, "%20")) || null
  387.     })("transaction_id")
  388.     , tsource = getUrlParameter("source")
  389.     , tcode = getUrlParameter("code")
  390.     , url_f = getUrlParameter("url");
  391.  
  392. function goToUrlFinish() {
  393.     stepfinal(), setCookie("prlwge_finish_" + jQuery("body")
  394.         .data("pid"), "1", "10");
  395.     var t = jQuery("[name='url_f']")
  396.         .val();
  397.     window.location.href = "" != t && null != t ? t : url_f
Add Comment
Please, Sign In to add comment