script.js


SUBMITTED BY: Dudanet13

DATE: Dec. 9, 2023, 2:52 a.m.

UPDATED: Dec. 11, 2023, 1:05 p.m.

FORMAT: Text only

SIZE: 5.2 kB

HITS: 540

  1. function handleKeyPress(event) {
  2. if (event.key === 'Enter') {
  3. checkPassword();
  4. }
  5. }
  6. function showCategory(category) {
  7. console.log(`Abrindo 3 novos projetos da categoria ${category}`);
  8. // Adicione aqui a lógica específica para abrir os projetos da categoria
  9. }
  10. function showPortfolioScreen() {
  11. const loginScreen = document.querySelector('.login-screen');
  12. const portfolioScreen = document.querySelector('.portfolio-screen');
  13. loginScreen.style.display = 'none';
  14. portfolioScreen.style.display = 'flex';
  15. }
  16. function showCategory(categoryId) {
  17. const categoryContents = document.querySelectorAll('.category-content');
  18. categoryContents.forEach(content => {
  19. content.style.display = 'none';
  20. });
  21. const selectedCategory = document.getElementById(categoryId);
  22. if (selectedCategory) {
  23. selectedCategory.style.display = 'block';
  24. }
  25. }
  26. function checkPassword() {
  27. const passwordInput = document.getElementById('password');
  28. const enteredPassword = passwordInput.value;
  29. const currentDate = new Date();
  30. const day = currentDate.getDate();
  31. const month = currentDate.getMonth() + 1;
  32. const year = currentDate.getFullYear();
  33. const correctPassword = `${day.toString().padStart(2, '0')}/${month.toString().padStart(2, '0')}/${year}`;
  34. const errorElement = document.querySelector('.error-message');
  35. if (enteredPassword === correctPassword) {
  36. showPortfolioScreen();
  37. document.documentElement.requestFullscreen();
  38. } else {
  39. if (!errorElement) {
  40. const loginBox = document.querySelector('.login-box');
  41. const newErrorElement = document.createElement('p');
  42. newErrorElement.className = 'error-message';
  43. newErrorElement.style.color = '#d3d3d3';
  44. newErrorElement.style.marginTop = '10px';
  45. loginBox.appendChild(newErrorElement);
  46. }
  47. errorElement.textContent = 'Dica sobre a senha: Data atual';
  48. }
  49. }
  50. function togglePasswordVisibility() {
  51. const passwordInput = document.getElementById('password');
  52. const passwordToggle = document.querySelector('.password-toggle img');
  53. if (passwordInput.type === 'password') {
  54. passwordInput.type = 'text';
  55. passwordToggle.src = 'https://res.cloudinary.com/dudanet/image/upload/v1701904318/icon_ver_senha_zswgqv.png';
  56. } else {
  57. passwordInput.type = 'password';
  58. passwordToggle.src = 'https://res.cloudinary.com/dudanet/image/upload/v1700761690/icone_AGUA2-removebg-preview_ulzzxb.png';
  59. }
  60. }
  61. let darkMode = false;
  62. function toggleDarkMode() {
  63. darkMode = !darkMode;
  64. const body = document.body;
  65. const backgroundImageUrl = darkMode ? 'https://res-console.cloudinary.com/dudanet/thumbnails/v1/image/upload/v1701885797/bWlzdC1zdHJlZXQtbGlnaHQtYmxhY2stbWluaW1hbGlzbS13YWxscGFwZXItcHJldmlld19vc3J2dDA=/grid_landscape' : 'https://res-console.cloudinary.com/dudanet/thumbnails/v1/image/upload/v1701885797/Y29sb3JpZG9zLWF6dWlzLWFydGUtZGlnaXRhbC1pbWFnZW0tZGUtZnVuZG9fdWU5ZXBz/grid_landscape';
  66. body.style.backgroundImage = `url('${backgroundImageUrl}')`;
  67. const buttons = document.querySelectorAll('button');
  68. buttons.forEach(button => {
  69. button.style.backgroundColor = darkMode ? '#333' : '#0078d4';
  70. button.style.borderColor = darkMode ? '#666' : '#0078d4';
  71. });
  72. const darkModeIcon = document.querySelector('.dark-mode-icon');
  73. darkModeIcon.src = 'https://cdn-icons-png.flaticon.com/512/5262/5262027.png';
  74. const modeLabel = document.querySelector('.mode-label');
  75. modeLabel.textContent = darkMode ? 'Dark Mode' : 'Light Mode';
  76. const profilePicture = document.getElementById('profile-picture');
  77. profilePicture.style.backgroundImage = `url('${darkMode ? 'https://res.cloudinary.com/dudanet/image/upload/v1701974234/dark_img_profile_qoh7l9.png' : 'https://res-console.cloudinary.com/dudanet/thumbnails/v1/image/upload/v1701839344/V2hhdHNBcHBfSW1hZ2VfMjAyMy0xMi0wNl9hdF8wMi4wNy4yNV9kZHZqanI=/grid_landscape'}')`;
  78. }
  79. function closeTab() {
  80. window.close();
  81. }
  82. function createCategoryButtons() {
  83. const categoriesContainer = document.querySelector('.categories');
  84. const categoriesData = [
  85. { id: 'category1', label: 'Categoria 1', image: 'URL_DA_IMAGEM1', url: 'https://res.cloudinary.com/dudanet/image/upload/v1700411360/icone_casa_smart_s8glnx.png' },
  86. { id: 'category2', label: 'Categoria 2', image: 'URL_DA_IMAGEM2', url: 'URL_DA_CATEGORIA2' },
  87. { id: 'category3', label: 'Categoria 3', image: 'URL_DA_IMAGEM3', url: 'URL_DA_CATEGORIA3' },
  88. ];
  89. categoriesData.forEach(category => {
  90. const button = document.createElement('button');
  91. button.innerHTML = `
  92. <img src="${category.image}" alt="${category.label}">
  93. <span>${category.label}</span>
  94. `;
  95. button.addEventListener('click', () => {
  96. showCategory(category.id);
  97. window.location.href = category.url;
  98. });
  99. categoriesContainer.appendChild(button);
  100. });
  101. }
  102. createCategoryButtons();

comments powered by Disqus