MCPcopy Create free account
hub / github.com/Cu-chi/cuchi_computer / FocusApp

Function FocusApp

nui/scripts/script.js:811–837  ·  view source on GitHub ↗
(e, appName)

Source from the content-addressed store, hash-verified

809 * @param {string} appName the application to focus
810 */
811const FocusApp = (e, appName) => {
812 if (e)
813 e.stopPropagation(); // stop the event from also being handled by the body
814
815 UnfocusAllApp();
816
817 let taskbarIcon = document.getElementById("taskbar-"+appName);
818 taskbarIcon.classList.add("app-active");
819
820 apps.forEach(app => {
821 if (app == appName) {
822 document.getElementById("app-"+appName).style.zIndex = 9999999;
823 AppsZIndex[app] = 9999999;
824 }
825 else {
826 if (AppsZIndex[app]) {
827 AppsZIndex[app] -= 1;
828 }
829 document.getElementById("app-"+app).style.zIndex = AppsZIndex[app];
830 }
831 });
832
833 if (appName == "console") {
834 let consoleInput = document.getElementById("console-input");
835 if (consoleInput) consoleInput.focus();
836 }
837};
838
839/**
840 * Minimizes application

Callers 1

OpenAppFunction · 0.85

Calls 1

UnfocusAllAppFunction · 0.85

Tested by

no test coverage detected