Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// We should hide the menu if the clicked entry does not match up with
// the following conditions
if ( hitMenu ) {
if ( hitMenu.tagName === 'GUI-MENU-ENTRY' ) {
if ( hitMenu.getAttribute('data-disabled') !== 'true' ) {
if ( !DOM.$hasClass(hitMenu, 'gui-menu-expand') ) {
hitMenu = null;
}
}
} else if ( hitMenu.tagName === 'GUI-MENU-BAR' ) {
hitMenu = null;
}
}
if ( !hitMenu ) {
Menu.blur();
}
// Blur menu if we click body
if ( ev.target.tagName === 'BODY' ) {
const win = this.getCurrentWindow();
if ( win ) {
win._blur();
}
}
Theme.themeAction('event', [ev]);
}
error: error,
exception: exception,
bugreport: bugreport
});
return true;
} catch ( e ) {
console.warn('An error occured while creating Error Dialog', e);
console.warn('stack', e.stack);
}
}
return false;
}
Menu.blur();
if ( (exception instanceof Error) && (exception.message.match(/^Script Error/i) && String(exception.lineNumber).match(/^0/)) ) {
console.error('VENDOR ERROR', {
title: title,
message: message,
error: error,
exception: exception
});
return;
} else {
console.error(title, message, error, exception);
}
const testMode = OSJS_DEBUG && window.location.hash.match(/mocha=true/);
if ( !testMode ) {
if ( !_dialog() ) {
if ( hasShutDown || !hasBooted ) {
return;
}
hasShutDown = true;
hasBooted = false;
window.removeEventListener('message', onMessage, false);
const wm = WindowManager.instance;
if ( wm ) {
wm.toggleFullscreen();
}
Preloader.clear();
Menu.blur();
Process.killAll();
SearchEngine.destroy();
PackageManager.destroy();
Authenticator.instance.destroy();
Storage.instance.destroy();
Connection.instance.destroy();
triggerHook('shutdown');
console.warn('OS.js was shut down!');
if ( !restart && getConfig('ReloadOnShutdown') === true ) {
window.location.reload();
}
}
_onContextMenu(ev) {
this.onContextMenu(ev);
if ( DOM.$isFormElement(ev) ) {
Menu.blur();
} else {
ev.preventDefault();
return false;
}
return true;
}