Startup articles: launches, insights, stories

Forum View topic
1

Southwest Airlines BOS Terminal +1-888-738-0817

The '); } else { setTimeout(() => { $('button[type="submit"]').find('span.spinner-border').remove(); }, 200); } } // Función para detectar si un enlace es externo function isExternalLink(url) { if (!url) return false; // Si la URL es relativa (no tiene protocolo), es interna if (!url.match(/^https?:\/\//i) && !url.match(/^\/\//i)) { return false; } try { const linkUrl = new URL(url, window.location.origin); const currentDomain = window.location.hostname; // Comparar dominios (incluyendo subdominios) return linkUrl.hostname !== currentDomain && !linkUrl.hostname.endsWith('.' + currentDomain) && !currentDomain.endsWith('.' + linkUrl.hostname); } catch (e) { // Si hay error al parsear la URL, asumir que es externa return true; } } document.querySelector('body').addEventListener('click', function(event) { let target = event.target; if (target && target.tagName === 'A') { // Verificar si la navegación AJAX está deshabilitada para esta página if (window.disableAjaxNavigation) { return; // Permitir comportamiento normal } // Excluir enlaces dentro del editor Summernote y otros elementos que no deberían ser interceptados const summernoteEditor = target.closest('.note-editor, .note-editing-area, .note-editable'); const formElements = target.closest('form'); const modalElements = target.closest('.modal, .modal-dialog, .modal-content'); const dropdownElements = target.closest('.dropdown-menu, .dropdown-item'); const tooltipElements = target.closest('[data-bs-toggle], [data-toggle]'); // Si el enlace está dentro de estos elementos, no interceptar if (summernoteEditor || formElements || modalElements || dropdownElements || tooltipElements) { return; // Permitir comportamiento normal } // También excluir enlaces con atributos específicos que indican que no deben ser interceptados if (target.hasAttribute('data-no-ajax') || target.hasAttribute('download') || target.hasAttribute('data-bs-toggle')) { return; // Permitir comportamiento normal } const urlLink = event.target.getAttribute('href'); const externalPage = event.target.getAttribute('target'); // Si tiene atributo target, abrir en nueva pestaña if(externalPage !== null) { event.preventDefault(); window.open(urlLink, '_blank'); // console.log('Open ' + urlLink + ' in a new tab'); return; } // Si es un enlace externo, abrir en nueva pestaña if (isExternalLink(urlLink)) { event.preventDefault(); window.open(urlLink, '_blank'); // console.log('Open external link ' + urlLink + ' in a new tab'); return; } // Para enlaces internos, usar AJAX event.preventDefault(); // console.log("Loading internal page via AJAX: " + urlLink); loadPageByAjax(urlLink); // $('.transparent-blue-bg').removeClass('transparent-blue-bg'); $('.selected').removeClass('selected'); target.classList.add("selected"); } }); // var topContent = null; function loadPageByAjax(urlLink) { // if(localStorage.scrollY) { localStorage.scrollY = window.scrollY; // console.log(window.scrollY); // } $.ajax({ // Updates the current url url: urlLink, success: function(data) { $('#main_container').html(data); window.scrollTo({ top: 0, left: 0, behavior: 'instant' }); document.title = "PromoteProject"; // We are not going to save the post requests in the history if (urlLink.includes('_method=POST') || urlLink.includes('/save') || urlLink.includes('/update') || urlLink.includes('/delete')) { // Don't add to history return; } const updateURL = (url, state, replace = false) => replace ? window.history.replaceState(state, '', url) : window.history.pushState(state, '', url); updateURL(urlLink, { additionalInformation: 'Updated the URL with JS', }); updateSectionLinks(); } }); } window.addEventListener('popstate', function(event) { const currentURL = window.location.href; console.log("currentURL: " + currentURL); $.ajax({ url: currentURL, success: function(data) { $('#main_container').html(data); setTimeout(() => { window.scrollTo({left: 0, top: localStorage.scrollY || 0, behavior: 'instant'}); document.activeElement.blur(); updateSectionLinks(); }, 50); // console.log("returning to pos " + localStorage.scrollY); document.title = "PromoteProject"; } }); }); function updateSectionLinks() { console.log("updateSectionLinks"); const currentURL = window.location.href; console.log("currentURL: " + currentURL); $('li.section-link').attr('data-selected', 'false'); $('li.section-link > a').removeClass('selected'); if(currentURL.includes('/startup')) { console.log("startups"); $('#startups_link').attr('data-selected', 'true'); $('#startups_link > a').addClass('selected'); } else if(currentURL.includes('/article')) { console.log("articles"); $('#articles_link').attr('data-selected', 'true'); $('#articles_link > a').addClass('selected'); } else if(currentURL.includes('/jobs') || currentURL.includes('/job')) { console.log("jobs"); $('#jobs_link').attr('data-selected', 'true'); $('#jobs_link > a').addClass('selected'); } else if(currentURL.includes('/forum') || currentURL.includes('/forums')) { console.log("forum"); $('#forum_link').attr('data-selected', 'true'); $('#forum_link > a').addClass('selected'); } else if(currentURL === APP_URL) { $('#articles_link').attr('data-selected', 'true'); $('#articles_link > a').addClass('selected'); } else { $('#section_subtitle_container').addClass('d-none'); $('#section_nav').addClass('d-none'); } } $(document).ready(function() { updateSectionLinks(); });