Widget: Homepage: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Marterer (talk | contribs)
No edit summary
Marterer (talk | contribs)
No edit summary
Line 232: Line 232:


     </style>
     </style>
    <!-- CHAT BOT STYLES -->
     <link rel="stylesheet" href="https://www.safetyinnovation.center/widget/styles.css">
     <link rel="stylesheet" href="https://www.safetyinnovation.center/widget/styles.css">


Line 526: Line 528:
             </div>
             </div>
         </div>
         </div>
         <script>
         <script src="https://www.safetyinnovation.center/widget/script.js"></script>
            const chatWindow = document.getElementById('chat-window');
            const chatContent = document.getElementById('chat-window-content');
            const resizeBtn = document.getElementById('resize-chat');
            const closeBtn = document.getElementById('close-chat');
            const chatBtn = document.getElementById('chat-button');
 
            chatBtn.addEventListener('click', () => {
                chatWindow.classList.toggle('closed-chat');
            });
            resizeBtn.addEventListener('click', () => {
                chatWindow.classList.toggle('maximized-chat');
            });
            closeBtn.addEventListener('click', () => {
                chatWindow.classList.add('closed-chat');
            });
 
            const url = 'https://widget.safety-base.intern';
            fetch(url, { method: 'HEAD' })
                .then(response => {
                    if (response.ok) {
                        resizeBtn.style.visibility = 'visible';
                        chatContent.innerHTML = `
                        <iframe id="embedded-page" src="${url}" frameborder="0"
                        style="width:100%;aspect-ratio:9/16;"
                        ></iframe>
                        `;
                    }
                })
                .catch(error => console.error('Error during URL check', error));
        </script>
         <!-- END CHAT BOT -->
         <!-- END CHAT BOT -->
</includeonly>
</includeonly>

Revision as of 12:32, 5 May 2024

Second version of the LINKS Community Center homepage.
Do not modify!