From 94291c4968a65ce95a6646b675b8aedca0d481f8 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 1 May 2024 15:39:59 +0100 Subject: [PATCH] chore: Clarify usage of window fields in UITaskbar.js /puter/src/UI/UITaskbar.js 24:5 error 'global_element_id' is not defined no-undef 31:14 error 'api_origin' is not defined no-undef 36:40 error 'auth_token' is not defined no-undef 44:33 error 'global_element_id' is not defined no-undef 77:17 error 'launch_apps' is not defined no-undef 77:33 error 'launch_apps' is not defined no-undef 77:55 error 'launch_apps' is not defined no-undef 79:17 error 'launch_apps' is not defined no-undef 80:26 error 'api_origin' is not defined no-undef 85:52 error 'auth_token' is not defined no-undef 99:16 error 'launch_apps' is not defined no-undef 105:88 error 'launch_apps' is not defined no-undef 106:38 error 'launch_apps' is not defined no-undef 119:16 error 'launch_apps' is not defined no-undef 121:107 error 'launch_apps' is not defined no-undef 125:45 error 'launch_apps' is not defined no-undef 126:38 error 'launch_apps' is not defined no-undef 179:17 error 'launch_app' is not defined no-undef 201:25 error 'launch_app' is not defined no-undef 215:39 error 'trash_path' is not defined no-undef 228:68 error 'trash_path' is not defined no-undef 230:17 error 'launch_app' is not defined no-undef 236:13 error 'move_items' is not defined no-undef 236:31 error 'trash_path' is not defined no-undef 240:5 error 'make_taskbar_sortable' is not defined no-undef 262:22 error Empty block statement no-empty 284:29 error 'launch_app' is not defined no-undef 297:17 error 'update_taskbar' is not defined no-undef 301:17 error 'update_taskbar' is not defined no-undef --- src/UI/UITaskbar.js | 53 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/UI/UITaskbar.js b/src/UI/UITaskbar.js index 43b7a603..2184f4c4 100644 --- a/src/UI/UITaskbar.js +++ b/src/UI/UITaskbar.js @@ -21,19 +21,19 @@ import UITaskbarItem from './UITaskbarItem.js' import UIPopover from './UIPopover.js' async function UITaskbar(options){ - global_element_id++; + window.global_element_id++; options = options ?? {}; options.content = options.content ?? ''; // get launch apps $.ajax({ - url: api_origin + "/get-launch-apps", + url: window.api_origin + "/get-launch-apps", type: 'GET', async: true, contentType: "application/json", headers: { - "Authorization": "Bearer "+auth_token + "Authorization": "Bearer "+window.auth_token }, success: function (apps){ window.launch_apps = apps; @@ -41,7 +41,7 @@ async function UITaskbar(options){ }); let h = ''; - h += `
`; + h += `
`; $('.desktop').append(h); @@ -74,15 +74,15 @@ async function UITaskbar(options){ // In the rare case that launch_apps is not populated yet, get it from the server // then populate the popover - if(!launch_apps || !launch_apps.recent || launch_apps.recent.length === 0){ + if(!window.launch_apps || !window.launch_apps.recent || window.launch_apps.recent.length === 0){ // get launch apps - launch_apps = await $.ajax({ - url: api_origin + "/get-launch-apps", + window.launch_apps = await $.ajax({ + url: window.api_origin + "/get-launch-apps", type: 'GET', async: true, contentType: "application/json", headers: { - "Authorization": "Bearer "+auth_token + "Authorization": "Bearer "+window.auth_token }, }); } @@ -96,14 +96,14 @@ async function UITaskbar(options){ // ------------------------------------------- // Recent apps // ------------------------------------------- - if(launch_apps.recent.length > 0){ + if(window.launch_apps.recent.length > 0){ // heading apps_str += `

${i18n('recent')}

`; // apps apps_str += `
`; - for (let index = 0; index < window.launch_recent_apps_count && index < launch_apps.recent.length; index++) { - const app_info = launch_apps.recent[index]; + for (let index = 0; index < window.launch_recent_apps_count && index < window.launch_apps.recent.length; index++) { + const app_info = window.launch_apps.recent[index]; apps_str += `
`; apps_str += `
`; apps_str += ``; @@ -116,14 +116,14 @@ async function UITaskbar(options){ // ------------------------------------------- // Reccomended apps // ------------------------------------------- - if(launch_apps.recommended.length > 0){ + if(window.launch_apps.recommended.length > 0){ // heading - apps_str += `

Recommended

`; + apps_str += `

Recommended

`; // apps apps_str += `