Spaces:
Running
Running
Download script.js from mohsenghq/scamshield: direct link, hf CLI and curl.
- Browser
- Download file 2.53 kB
-
https://huggingface.co/spaces/mohsenghq/scamshield/resolve/main/script.js
- Command line
-
hf download hf://spaces/mohsenghq/scamshield/script.js
-
curl -L -o script.js https://huggingface.co/spaces/mohsenghq/scamshield/resolve/main/script.js
2.53 kB
| // Persian (RTL) script for ScamShield | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips for icons | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Mobile menu toggle functionality | |
| const mobileMenuButton = document.querySelector('.mobile-menu-button'); | |
| const mobileMenu = document.querySelector('.mobile-menu'); | |
| if (mobileMenuButton && mobileMenu) { | |
| mobileMenuButton.addEventListener('click', function() { | |
| mobileMenu.classList.toggle('hidden'); | |
| }); | |
| } | |
| // Search functionality | |
| const searchForm = document.querySelector('#search-form'); | |
| if (searchForm) { | |
| searchForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| const searchQuery = document.querySelector('#search-input').value.trim(); | |
| if (searchQuery) { | |
| window.location.href = `/search.html?q=${encodeURIComponent(searchQuery)}`; | |
| } | |
| }); | |
| } | |
| // Report modal functionality | |
| const reportModal = document.getElementById('report-modal'); | |
| if (reportModal) { | |
| const openModalButtons = document.querySelectorAll('.open-report-modal'); | |
| const closeModalButton = document.querySelector('.close-report-modal'); | |
| openModalButtons.forEach(button => { | |
| button.addEventListener('click', function() { | |
| reportModal.classList.remove('hidden'); | |
| }); | |
| }); | |
| if (closeModalButton) { | |
| closeModalButton.addEventListener('click', function() { | |
| reportModal.classList.add('hidden'); | |
| }); | |
| } | |
| } | |
| // Initialize Persian date picker if needed | |
| if (typeof persianDate !== 'undefined') { | |
| const datePickers = document.querySelectorAll('.persian-date-picker'); | |
| datePickers.forEach(picker => { | |
| new persianDate(picker, { | |
| observer: true, | |
| format: 'YYYY/MM/DD' | |
| }); | |
| }); | |
| } | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Initialize Persian number input formatters | |
| document.querySelectorAll('.persian-number').forEach(element => { | |
| element.addEventListener('input', function() { | |
| this.value = this.value.replace(/[^۰-۹]/g, ''); | |
| }); | |
| }); | |
| }); |