| Server IP : 31.214.179.3 / Your IP : 216.73.216.84 Web Server : Apache System : Linux hostingsrv125.dondominio.com 6.12.96+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.96-1 (2026-07-20) x86_64 User : ( 1156851) PHP Version : 8.5.8 Disable Function : system,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,exec,ini_alter,show_source,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,mail,eval MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /hosting/www/thermatron.es/public/wp-content/plugins/code-snippets/js/services/settings/ |
Upload File : |
const selectTab = (tabsWrapper: Element, tab: Element, section: string) => {
// Swap the active tab class from the previously active tab to the current one.
tabsWrapper.querySelector('.nav-tab-active')?.classList.remove('nav-tab-active')
tab.classList.add('nav-tab-active')
// Update the current active tab attribute so that only the active tab is displayed.
tabsWrapper.closest('.wrap')?.setAttribute('data-active-tab', section)
}
// Refresh the editor preview if we're viewing the editor section.
const refreshEditorPreview = (section: string) => {
if ('editor' === section) {
window.code_snippets_editor_preview?.codemirror.refresh()
}
}
// Update the http referer value so that any redirections lead back to this tab.
const updateHttpReferer = (section: string) => {
const httpReferer = document.querySelector<HTMLInputElement>('input[name=_wp_http_referer]')
if (!httpReferer) {
console.error('could not find http referer')
return
}
const newReferer = httpReferer.value.replace(/(?<base>[&?]section=)[^&]+/, `$1${section}`)
httpReferer.value = newReferer + (newReferer === httpReferer.value ? `§ion=${section}` : '')
}
export const handleSettingsTabs = () => {
const tabsWrapper = document.getElementById('settings-sections-tabs')
if (!tabsWrapper) {
console.error('Could not find snippets tabs')
return
}
const tabs = tabsWrapper.querySelectorAll('.nav-tab')
for (const tab of tabs) {
tab.addEventListener('click', event => {
event.preventDefault()
const section = tab.getAttribute('data-section')
if (section) {
selectTab(tabsWrapper, tab, section)
refreshEditorPreview(section)
updateHttpReferer(section)
}
})
}
}