1const cabecalho = document.querySelector("#cabecalho"); 2const menu = document.querySelector("#menu-principal"); 3const botaoMenu = document.querySelector(".menu-botao"); 4const elementosAnimados = document.querySelectorAll(".animar"); 5const secaoHero = document.querySelector("#inicio"); 6const secaoSuite = document.querySelector("#suite"); 7const secaoCateyes = document.querySelector("#cateyes"); 8const secaoMinecraft = document.querySelector("#minecraft"); 9const rodape = document.querySelector("#contato"); 10const linksMenu = document.querySelectorAll(".menu a[href^='#']"); 11const secoesNavegacao = Array.from(linksMenu) 12 .map((link) => document.querySelector(link.getAttribute("href"))) 13 .filter(Boolean); 14const menuContexto = document.createElement("div"); 15let alvoContexto = null; 16const catEyesLojas = Object.freeze({ 17 chrome: "https://chromewebstore.google.com/detail/cat-eyes/abhlihknahkcmopioedcnimnfnifgcon?authuser=2&hl=pt-BR", 18 firefox: "https://addons.mozilla.org/pt-BR/firefox/addon/cateyes-netcattest/", 19}); 20 21document.body.classList.add("animacoes-ativas"); 22 23function dadosNavegadorCateyes() { 24 const agente = navigator.userAgent.toLowerCase(); 25 const firefox = agente.includes("firefox") || agente.includes("fxios"); 26 const edge = agente.includes("edg/") || agente.includes("edgios") || agente.includes("edga"); 27 const opera = agente.includes("opr/") || agente.includes("opera"); 28 const brave = agente.includes("brave") || Boolean(navigator.brave); 29 const vivaldi = agente.includes("vivaldi"); 30 const yandex = agente.includes("yabrowser"); 31 const chromium = agente.includes("chromium"); 32 33 if (firefox) { 34 return { 35 navegador: "firefox", 36 loja: "firefox", 37 rotulo: "Adicionar ao Firefox", 38 url: catEyesLojas.firefox, 39 }; 40 } 41 42 return { 43 navegador: edge ? "edge" : opera ? "opera" : brave ? "brave" : vivaldi ? "vivaldi" : yandex ? "yandex" : chromium ? "chromium" : "chrome", 44 loja: "chrome", 45 rotulo: edge ? "Adicionar ao Edge" : opera ? "Adicionar ao Opera" : brave ? "Adicionar ao Brave" : vivaldi ? "Adicionar ao Vivaldi" : yandex ? "Adicionar ao Yandex" : chromium ? "Adicionar ao Chromium" : "Adicionar ao Chrome", 46 url: catEyesLojas.chrome, 47 }; 48} 49 50const cateyesBrowser = dadosNavegadorCateyes(); 51const linksTemaTopo = Array.from(document.querySelectorAll('.menu a[href="#suite"], .menu a[href="#cateyes"], .menu a[href="#minecraft"]')); 52 53document.querySelectorAll("[data-cateyes-add-browser]").forEach((botao) => { 54 botao.textContent = cateyesBrowser.rotulo; 55 botao.setAttribute("aria-label", cateyesBrowser.rotulo); 56 botao.setAttribute("href", cateyesBrowser.url); 57 botao.setAttribute("target", "_blank"); 58 botao.setAttribute("rel", "noopener noreferrer"); 59}); 60 61console.log( 62 "%cNETCAT TEST%c Cat Suite gratuito", 63 "color:#38e8ff;background:#03050b;font-size:34px;font-weight:900;letter-spacing:3px;padding:10px 14px;border:1px solid #38e8ff;border-radius:6px 0 0 6px;text-shadow:0 0 12px rgba(56,232,255,.8);", 64 "color:#050505;background:#fff200;font-size:14px;font-weight:900;padding:17px 14px;border:1px solid #38e8ff;border-left:0;border-radius:0 6px 6px 0;", 65); 66console.log("Cat Suite: sem cobrança, feito para estudo e testes autorizados em ambientes próprios."); 67 68function atualizarCabecalho() { 69 if (!cabecalho) { 70 return; 71 } 72 73 cabecalho.classList.toggle("ativo", window.scrollY > 40); 74 75 const alturaJanela = window.innerHeight; 76 const heroAltura = secaoHero ? secaoHero.offsetHeight : 0; 77 const ocultarNoHero = window.scrollY < heroAltura * 0.55; 78 const ocultarNoRodape = rodape ? rodape.getBoundingClientRect().top < alturaJanela * 0.72 : false; 79 const suiteRect = secaoSuite ? secaoSuite.getBoundingClientRect() : null; 80 const cateyesRect = secaoCateyes ? secaoCateyes.getBoundingClientRect() : null; 81 const minecraftRect = secaoMinecraft ? secaoMinecraft.getBoundingClientRect() : null; 82 const suiteAtiva = suiteRect 83 ? suiteRect.top < alturaJanela * 0.58 && suiteRect.bottom > alturaJanela * 0.36 84 : false;
85 const cateyesAtiva = cateyesRect 86 ? cateyesRect.top < alturaJanela * 0.58 && cateyesRect.bottom > alturaJanela * 0.36 87 : false; 88 const minecraftAtiva = minecraftRect 89 ? minecraftRect.top < alturaJanela * 0.58 && minecraftRect.bottom > alturaJanela * 0.36 90 : false; 91 92 document.body.classList.toggle("nav-oculta", ocultarNoHero || ocultarNoRodape); 93 document.body.classList.toggle("suite-ativa", suiteAtiva); 94 document.body.classList.toggle("cateyes-ativa", cateyesAtiva); 95 document.body.classList.toggle("minecraft-ativa", minecraftAtiva); 96 document.documentElement.classList.toggle("suite-ativa", suiteAtiva); 97 document.documentElement.classList.toggle("cateyes-ativa", cateyesAtiva); 98 document.documentElement.classList.toggle("minecraft-ativa", minecraftAtiva); 99} 100 101function fecharMenu() { 102 document.body.classList.remove("menu-aberto"); 103 104 if (menu) { 105 menu.classList.remove("aberto"); 106 } 107 108 if (botaoMenu) { 109 botaoMenu.setAttribute("aria-expanded", "false"); 110 } 111} 112 113function centralizarItemDock(link) { 114 if (!menu || !link || !window.matchMedia("(max-width: 1020px)").matches) { 115 return; 116 } 117 118 link.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" }); 119} 120 121window.addEventListener("scroll", atualizarCabecalho); 122window.addEventListener("resize", atualizarCabecalho); 123atualizarCabecalho(); 124requestAnimationFrame(() => { 125 document.body.classList.remove("nav-sem-transicao"); 126}); 127 128linksTemaTopo.forEach((link) => { 129 const href = link.getAttribute("href"); 130 const tema = href === "#suite" ? "suite" : href === "#cateyes" ? "cateyes" : "minecraft"; 131 const classe = `nav-preview-${tema}`; 132 const ativarTema = () => { 133 document.body.classList.add(classe); 134 document.documentElement.classList.add(classe); 135 }; 136 const removerTema = () => { 137 document.body.classList.remove(classe); 138 document.documentElement.classList.remove(classe); 139 }; 140 141 link.addEventListener("mouseenter", ativarTema); 142 link.addEventListener("focus", ativarTema); 143 link.addEventListener("mouseleave", removerTema); 144 link.addEventListener("blur", removerTema); 145}); 146 147if (botaoMenu) { 148 botaoMenu.addEventListener("click", () => { 149 const aberto = menu.classList.toggle("aberto"); 150 document.body.classList.toggle("menu-aberto", aberto); 151 botaoMenu.setAttribute("aria-expanded", String(aberto)); 152 }); 153} 154 155document.querySelectorAll('a[href^="#"]').forEach((link) => { 156 link.addEventListener("click", (evento) => { 157 const destino = document.querySelector(link.getAttribute("href")); 158 159 if (!destino) { 160 return; 161 } 162 163 evento.preventDefault(); 164 fecharMenu(); 165 centralizarItemDock(link); 166 destino.scrollIntoView({ behavior: "smooth", block: "start" }); 167 }); 168}); 169 170function revelarElementosNoViewport(observador = null) { 171 const topoVisivel = window.innerHeight * 0.08; 172 const limiteEntrada = window.innerHeight * 0.86; 173 174 elementosAnimados.forEach((elemento) => { 175 if (elemento.classList.contains("visivel")) { 176 return; 177 } 178 179 const retangulo = elemento.getBoundingClientRect(); 180 const estaNaAreaDeRevelacao = retangulo.top < limiteEntrada && retangulo.bottom > topoVisivel; 181 182 if (!estaNaAreaDeRevelacao) { 183 return; 184 } 185 186 elemento.classList.add("visivel"); 187 188 if (observador) { 189 observador.unobserve(elemento); 190 } 191 }); 192} 193 194if ("IntersectionObserver" in window) { 195 const observador = new IntersectionObserver((entradas) => { 196 entradas.forEach((entrada) => { 197 if (entrada.isIntersecting) { 198 entrada.target.classList.add("visivel"); 199 observador.unobserve(entrada.target); 200 } 201 }); 202 }, { threshold: 0.18 }); 203 204 elementosAnimados.forEach((elemento) => observador.observe(elemento)); 205 206 window.addEventListener("scroll", () => revelarElementosNoViewport(observador), { passive: true }); 207 window.addEventListener("resize", () => revelarElementosNoViewport(observador)); 208 window.setTimeout(() => revelarElementosNoViewport(observador), 300); 209 210 if (secoesNavegacao.length) { 211 const observadorNavegacao = new IntersectionObserver((entradas) => { 212 entradas.forEach((entrada) => { 213 if (!entrada.isIntersecting) { 214 return; 215 } 216 217 linksMenu.forEach((link) => { 218 link.classList.toggle("link-ativo", link.getAttribute("href") === `#${entrada.target.id}`); 219 }); 220 centralizarItemDock(document.querySelector(`.menu a[href="#${entrada.target.id}"]`)); 221 }); 222 }, { rootMargin: "-40% 0px -48% 0px", threshold: 0 }); 223
224 secoesNavegacao.forEach((secao) => observadorNavegacao.observe(secao)); 225 } 226} else { 227 elementosAnimados.forEach((elemento) => elemento.classList.add("visivel")); 228} 229 230menuContexto.className = "menu-contexto"; 231menuContexto.setAttribute("role", "menu"); 232menuContexto.setAttribute("aria-hidden", "true"); 233document.body.appendChild(menuContexto); 234 235function ocultarMenuContexto() { 236 menuContexto.classList.remove("ativo"); 237 menuContexto.classList.remove("menu-contexto--suite"); 238 menuContexto.classList.remove("menu-contexto--cateyes"); 239 menuContexto.classList.remove("menu-contexto--minecraft"); 240 menuContexto.setAttribute("aria-hidden", "true"); 241 alvoContexto = null; 242} 243 244function criarItemContexto(rotulo, acao) { 245 const botao = document.createElement("button"); 246 botao.type = "button"; 247 botao.textContent = rotulo; 248 botao.dataset.contextoAcao = acao; 249 botao.setAttribute("role", "menuitem"); 250 251 return botao; 252} 253 254function criarSeparadorContexto() { 255 const separador = document.createElement("span"); 256 separador.className = "menu-contexto__separador"; 257 separador.setAttribute("aria-hidden", "true"); 258 259 return separador; 260} 261 262function posicionarMenuContexto(evento) { 263 const margem = 10; 264 const retangulo = menuContexto.getBoundingClientRect(); 265 const esquerda = Math.min(evento.clientX, window.innerWidth - retangulo.width - margem); 266 const topo = Math.min(evento.clientY, window.innerHeight - retangulo.height - margem); 267 268 menuContexto.style.left = `${Math.max(margem, esquerda)}px`; 269 menuContexto.style.top = `${Math.max(margem, topo)}px`; 270} 271 272function mostrarMenuContexto(evento) { 273 const link = evento.target.closest("a[href]"); 274 const imagem = evento.target.closest("img"); 275 const suite = evento.target.closest("#suite, .secao--suite"); 276 const cateyes = evento.target.closest("#cateyes, .secao--cateyes"); 277 const minecraft = evento.target.closest("#minecraft, .secao--minecraft"); 278 const secoes = [ 279 ["InÃcio", "#inicio"], 280 ["Manual", "#manual"], 281 ["Aulas", "#videoaulas"], 282 ["Cat Suite", "#suite"], 283 ["Minecraft", "#minecraft"], 284 ["Blog", "#blog"], 285 ["Cat Eyes", "#cateyes"], 286 ]; 287 288 evento.preventDefault(); 289 alvoContexto = { link, imagem, suite, cateyes, minecraft }; 290 menuContexto.replaceChildren(); 291 menuContexto.classList.toggle("menu-contexto--suite", Boolean(suite)); 292 menuContexto.classList.toggle("menu-contexto--cateyes", Boolean(cateyes)); 293 menuContexto.classList.toggle("menu-contexto--minecraft", Boolean(minecraft)); 294 295 if (link) { 296 menuContexto.append( 297 criarItemContexto("Abrir link", "abrir-link"), 298 criarItemContexto("Copiar link", "copiar-link"), 299 criarSeparadorContexto(), 300 ); 301 } 302 303 if (imagem) { 304 menuContexto.append( 305 criarItemContexto("Abrir imagem", "abrir-imagem"), 306 criarItemContexto("Copiar URL da imagem", "copiar-imagem"), 307 criarSeparadorContexto(), 308 ); 309 } 310 311 if (minecraft) { 312 const titulo = criarItemContexto("NCAT Minecraft", "minecraft-titulo"); 313 titulo.setAttribute("aria-disabled", "true"); 314 const curse = criarItemContexto("Baixar no CurseForge", "minecraft-curseforge"); 315 menuContexto.append( 316 titulo, 317 criarItemContexto("Ir para a seção", "minecraft-topo"), 318 criarItemContexto("Explorar o mod", "abrir-minecraft"), 319 criarItemContexto("Código no GitHub", "minecraft-github"), 320 criarItemContexto("Ver a página em inglês", "minecraft-en"), 321 criarItemContexto("Copiar seção", "copiar-minecraft"), 322 criarSeparadorContexto(), 323 curse, 324 ); 325 } else if (cateyes) { 326 menuContexto.append( 327 criarItemContexto("Cat Eyes", "cateyes-topo"), 328 criarItemContexto(cateyesBrowser.rotulo, "cateyes-download"), 329 criarItemContexto("Copiar seção Cat Eyes", "copiar-cateyes"), 330 criarSeparadorContexto(), 331 criarItemContexto("Privacidade Cat Eyes", "abrir-cateyes-privacidade"), 332 criarItemContexto("Suporte Cat Eyes", "abrir-cateyes-suporte"), 333 ); 334 } else if (suite) { 335 menuContexto.append( 336 criarItemContexto("Cat Suite", "suite-topo"), 337 criarItemContexto("Download Play Store", "suite-download"), 338 criarItemContexto("Copiar seção Cat Suite", "copiar-suite"), 339 criarSeparadorContexto(), 340 criarItemContexto("Ver manual gratuito", "abrir-manual"), 341 criarItemContexto("Ver videoaulas", "abrir-aulas"), 342 ); 343 } else {
344 secoes.forEach(([rotulo, destino]) => { 345 const item = criarItemContexto(rotulo, "ir-secao"); 346 item.dataset.destino = destino; 347 menuContexto.appendChild(item); 348 }); 349 } 350 351 menuContexto.append( 352 criarSeparadorContexto(), 353 criarItemContexto("Recarregar", "recarregar"), 354 criarItemContexto("Copiar endereço da página", "copiar-pagina"), 355 ); 356 357 menuContexto.classList.add("ativo"); 358 menuContexto.setAttribute("aria-hidden", "false"); 359 posicionarMenuContexto(evento); 360} 361 362async function copiarTexto(texto) { 363 if (!texto) { 364 return; 365 } 366 367 try { 368 await navigator.clipboard.writeText(texto); 369 } catch (erro) { 370 const campo = document.createElement("textarea"); 371 campo.value = texto; 372 campo.style.position = "fixed"; 373 campo.style.opacity = "0"; 374 document.body.appendChild(campo); 375 campo.select(); 376 document.execCommand("copy"); 377 campo.remove(); 378 } 379} 380 381menuContexto.addEventListener("click", (evento) => { 382 const item = evento.target.closest("[data-contexto-acao]"); 383 384 if (!item) { 385 return; 386 } 387 388 const acao = item.dataset.contextoAcao; 389 const linkHref = alvoContexto?.link?.href; 390 const imagemSrc = alvoContexto?.imagem?.currentSrc || alvoContexto?.imagem?.src; 391 392 if (acao === "abrir-link" && linkHref) { 393 window.location.href = linkHref; 394 } 395 396 if (acao === "copiar-link" && linkHref) { 397 copiarTexto(linkHref); 398 } 399 400 if (acao === "abrir-imagem" && imagemSrc) { 401 window.open(imagemSrc, "_blank", "noopener"); 402 } 403 404 if (acao === "copiar-imagem" && imagemSrc) { 405 copiarTexto(imagemSrc); 406 } 407 408 if (acao === "ir-secao") { 409 const destino = document.querySelector(item.dataset.destino); 410 411 if (destino) { 412 fecharMenu(); 413 destino.scrollIntoView({ behavior: "smooth", block: "start" }); 414 } 415 } 416 417 if (acao === "recarregar") { 418 window.location.reload(); 419 } 420 421 if (acao === "copiar-pagina") { 422 copiarTexto(window.location.href); 423 } 424 425 if (acao === "suite-topo") { 426 document.querySelector("#suite")?.scrollIntoView({ behavior: "smooth", block: "start" }); 427 } 428 429 if (acao === "suite-download") { 430 document.querySelector(".suite__download")?.click(); 431 } 432 433 if (acao === "copiar-suite") { 434 copiarTexto(`${window.location.origin}${window.location.pathname}#suite`); 435 } 436 437 if (acao === "abrir-manual") { 438 window.location.href = "/livro/manual-de-operacoes-anonimas"; 439 } 440 441 if (acao === "abrir-aulas") { 442 window.location.href = "/aulas"; 443 } 444 445 if (acao === "cateyes-topo") { 446 document.querySelector("#cateyes")?.scrollIntoView({ behavior: "smooth", block: "start" }); 447 } 448 449 if (acao === "cateyes-download") { 450 window.location.href = cateyesBrowser.url; 451 } 452 453 if (acao === "copiar-cateyes") { 454 copiarTexto(`${window.location.origin}${window.location.pathname}#cateyes`); 455 } 456 457 if (acao === "abrir-cateyes-privacidade") { 458 window.location.href = "/cateyes/privacidade"; 459 } 460 461 if (acao === "abrir-cateyes-suporte") { 462 window.location.href = "/cateyes/suporte"; 463 } 464 465 if (acao === "minecraft-topo") { 466 document.querySelector("#minecraft")?.scrollIntoView({ behavior: "smooth", block: "start" }); 467 } 468 469 if (acao === "abrir-minecraft") { 470 window.location.href = "/ncat_minecraft"; 471 } 472 473 if (acao === "minecraft-github") { 474 window.open("https://github.com/netcattest/ncat_minecraft", "_blank", "noopener"); 475 } 476 477 if (acao === "minecraft-curseforge") { 478 window.open("https://www.curseforge.com/minecraft/mc-mods/ncat", "_blank", "noopener"); 479 } 480 481 if (acao === "minecraft-en") { 482 window.location.href = "/ncat_minecraft?lang=en"; 483 } 484 485 if (acao === "copiar-minecraft") { 486 copiarTexto(`${window.location.origin}${window.location.pathname}#minecraft`); 487 } 488 489 ocultarMenuContexto(); 490}); 491 492document.addEventListener("contextmenu", mostrarMenuContexto); 493document.addEventListener("click", ocultarMenuContexto); 494window.addEventListener("blur", ocultarMenuContexto); 495window.addEventListener("resize", ocultarMenuContexto); 496window.addEventListener("scroll", ocultarMenuContexto, { passive: true }); 497window.addEventListener("keydown", (evento) => { 498 if (evento.key === "Escape") { 499 ocultarMenuContexto(); 500 } 501});
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.