1// CONFIG. BOOTSTRAP PARA RESPONSIVIDADE DA NAVBAR 2$('.collapse').collapse('hide'); 3 4$(document).on("DOMContentLoaded", function () { 5 $(`.dropdown [data-bs-toggle="dropdown"]`).on("mouseenter", function () { 6 $(this).parent().find(".dropdown-menu").fadeIn(200); 7 }); 8 9 $(`.dropdown [data-bs-toggle="dropdown"]`).on("click", function () { 10 $(this).parent().find(".dropdown-menu").fadeIn(200); 11 }); 12 13 $(`.dropdown`).on("mouseleave", function () { 14 $(this).parent().find(".dropdown-menu").fadeOut(200); 15 }); 16 17 COUNTDOWN_CONTROLLER.init(); 18 HELPER_CONTROLLER.init(); 19}) 20 21function configHeaderProps() { 22 const NAV_OUTER_HEIGHT = $("header nav").outerHeight(); 23 24 $(`body`).css("padding-top", `${NAV_OUTER_HEIGHT}px`); 25 $(`body`).css("scroll-padding-top", `${NAV_OUTER_HEIGHT}px`); 26 $(`#vehicle-type-selected`).css("top", `${NAV_OUTER_HEIGHT + 10}px`); 27} 28 29function escolherPF(btnElement) { 30 $(".btn-tipo-pessoa").removeClass("active"); 31 $(btnElement).addClass("active"); 32 33 $("#aIconePF").click(); 34} 35 36function escolherPJ(btnElement) { 37 $(".btn-tipo-pessoa").removeClass("active"); 38 $(btnElement).addClass("active"); 39 40 $("#aLinkCadPj").click(); 41} 42 43function showPassword() { 44 const inputElement = $(`input#senha`); 45 46 if (inputElement.attr("type") == "password") { 47 inputElement.attr("type", "text"); 48 49 $(`#passwd-input i.fa-eye`).css("display", "none"); 50 $(`#passwd-input i.fa-eye-slash`).css("display", "block"); 51 } else { 52 inputElement.attr("type", "password"); 53 54 $(`#passwd-input i.fa-eye`).css("display", "block"); 55 $(`#passwd-input i.fa-eye-slash`).css("display", "none"); 56 } 57} 58 59function changeView() { 60 $(".flip-box-inner").toggleClass("active"); 61 if ($(".flip-box-inner").hasClass("active")) 62 $(".flip-box-back").css("display", "block"); 63 64 setTimeout(() => { 65 if (!$(".flip-box-inner").hasClass("active")) 66 $(".flip-box-back").css("display", "none"); 67 }, 800); 68} 69 70function mudarView(tipo) { 71 if (tipo == 'cadastrar') { 72 // $(".flip-box-back").animate({width: 'toggle'}); 73 // $(".flip-box-front").animate({width: 'toggle'}); 74 75 $('.flip-box-back').slideToggle("slow"); 76 $('.flip-box-front').slideToggle("slow"); 77 78 // $('.flip-box-back').css("display", "block"); 79 // $('.flip-box-front').css("display", "none"); 80 } else { 81 82 // $(".flip-box-back").animate({width: 'toggle'}); 83 // $(".flip-box-front").animate({width: 'toggle'}); 84 85 $('.flip-box-back').slideToggle("slow"); 86 $('.flip-box-front').slideToggle("slow"); 87 88 // $('.flip-box-back').css("display", "none"); 89 // $('.flip-box-front').css("display", "block"); 90 } 91} 92 93function togglePasswdRecover() { 94 const loginContainer = $(`.col-lg-6.col-xs-12[data-container="login"]`); 95 const recoverPasswdContainer = $(`.col-lg-6.col-xs-12[data-container="recover-passwd"]`); 96 97 if (loginContainer.css("display") == "none") { 98 recoverPasswdContainer.fadeOut(400, function () { 99 loginContainer.fadeIn(400); 100 }); 101 } else { 102 loginContainer.fadeOut(400, function () { 103 $(`#recover-passwd-res`).css("margin-top", "0px").html(""); 104 $(`input#email-recover`).val(""); 105 recoverPasswdContainer.fadeIn(400); 106 }); 107 } 108} 109 110function recoverPasswd() { 111 $(`#recover-passwd-res`).css("margin-top", "16px").html(`<img src="imagens/carregando.gif">`); 112 113 $.post("arquivos/login/ajaxValidarEmailSolicitante", { 114 emailMotoboy: $(`input#email-recover`).val() 115 }, function (html) { 116 $(`#recover-passwd-res`).html(html); 117 }, "html"); 118} 119 120const HELPER_CONTROLLER = { 121 $POPUP: $(`div#login-helper-popup`), 122 LAST_ACCESS: localStorage.getItem("last-access"), 123 124 init: function () { 125 if (!this.LAST_ACCESS && this.getClientWidth() >= 992) { 126 localStorage.setItem("last-access", new Date()); 127 this.show(); 128 } else { 129 const DATE = new Date(this.LAST_ACCESS); 130 131 if (DATE) { 132 const { LAST_DAY, LAST_MONTH, LAST_YEAR } = this.getLastAccessDate(DATE); 133 const { CURR_DAY, CURR_MONTH, CURR_YEAR } = this.getCurrentAccessDate(); 134 135 if (LAST_DAY != CURR_DAY || LAST_MONTH != CURR_MONTH || LAST_YEAR != CURR_YEAR) { 136 if (this.getClientWidth() >= 992) { 137 localStorage.setItem("last-access", new Date()); 138 this.show(); 139 } 140 } 141 } 142 } 143 }, 144 145 show: function () { 146 if (this.$POPUP.length) $(this.$POPUP).fadeIn(); 147 }, 148 149 hide: function () { 150 if (this.$POPUP.length) { 151 $(this.$POPUP).fadeOut(250, function () { 152 $(this).remove(); 153 }); 154 } 155 }, 156 157 getLastAccessDate: function (date) { 158 const LAST_DAY = date.getDate(); 159 const LAST_MONTH = date.getMonth(); 160 const LAST_YEAR = date.getFullYear(); 161 162 return { LAST_DAY, LAST_MONTH, LAST_YEAR } 163 }, 164 165 getCurrentAccessDate: function () { 166 const DATE = new Date(); 167 168 const CURR_DAY = DATE.getDate(); 169 const CURR_MONTH = DATE.getMonth(); 170 const CURR_YEAR = DATE.getFullYear(); 171 172 return { CURR_DAY, CURR_MONTH, CURR_YEAR } 173 }, 174 175 getClientWidth: function () { 176 return window.innerWidth; 177 } 178} 179 180const COUNTDOWN_CONTROLLER = { 181 INTERVAL: null, 182 IS_ACTIVE: false, 183 $COUNTDOWN_ELEMENT: null, 184 185 init: function () { 186 if ($(`[data-feature="countdown"]`).length > 0 && !COUNTDOWN_CONTROLLER.IS_ACTIVE) { 187 COUNTDOWN_CONTROLLER.IS_ACTIVE = true; 188 COUNTDOWN_CONTROLLER.INTERVAL = setInterval(COUNTDOWN_CONTROLLER.update, 1000); 189 } 190 }, 191 192 update: function () { 193 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT = $(`[data-feature="countdown"]`); 194 195 const COUNTDOWN_DATE = COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.attr("data-date"); 196 const CURRENT_DATE = new Date(); 197 const COUNTDOWN_DIFF = new Date(COUNTDOWN_DATE) - CURRENT_DATE; 198 const CALC_RESULTS = COUNTDOWN_CONTROLLER.calculate(COUNTDOWN_DIFF); 199 200 if (COUNTDOWN_DIFF <= 0 || (!COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.is(":visible"))) 201 return COUNTDOWN_CONTROLLER.stop(); 202 203 COUNTDOWN_CONTROLLER.changeView(CALC_RESULTS); 204 }, 205 206 stop: function (hideOnStop = true) { 207 clearInterval(COUNTDOWN_CONTROLLER.INTERVAL); 208 COUNTDOWN_CONTROLLER.IS_ACTIVE = false;
209 210 if (hideOnStop) 211 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.closest(".promo-alert").fadeOut(400, function () { 212 $(COUNTDOWN_CONTROLLER).remove(); 213 }); 214 }, 215 216 restart: function () { 217 COUNTDOWN_CONTROLLER.stop(false); 218 COUNTDOWN_CONTROLLER.init(); 219 }, 220 221 calculate: function (COUNTDOWN_DIFF) { 222 return { 223 DAYS: Math.floor(COUNTDOWN_DIFF / (1000 * 60 * 60 * 24)), 224 HOURS: Math.floor((COUNTDOWN_DIFF % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)), 225 MINUTES: Math.floor((COUNTDOWN_DIFF % (1000 * 60 * 60)) / (1000 * 60)), 226 SECONDS: Math.floor((COUNTDOWN_DIFF % (1000 * 60)) / 1000) 227 }; 228 }, 229 230 changeView: function ({ DAYS, HOURS, MINUTES, SECONDS }) { 231 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.find(`span.countdown-number[data-label="days"]`) 232 .html(String(DAYS).padStart(2, "0")); 233 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.find(`span.countdown-number[data-label="hours"]`) 234 .html(String(HOURS).padStart(2, "0")); 235 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.find(`span.countdown-number[data-label="minutes"]`) 236 .html(String(MINUTES).padStart(2, "0")); 237 COUNTDOWN_CONTROLLER.$COUNTDOWN_ELEMENT.find(`span.countdown-number[data-label="seconds"]`) 238 .html(String(SECONDS).padStart(2, "0")); 239 } 240}
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.