Browse Source

chore: Clarify usage of window fields in UITaskbarItem.js

/puter/src/UI/UITaskbarItem.js
   31:24  error  'global_element_id' is not defined    no-undef
  124:21  error  'launch_app' is not defined           no-undef
  143:21  error  'empty_trash' is not defined          no-undef
  158:25  error  'remove_taskbar_item' is not defined  no-undef
  160:21  error  'update_taskbar' is not defined       no-undef
  174:21  error  'update_taskbar' is not defined       no-undef
  250:73  error  'mouseover_window' is not defined     no-undef
  254:33  error  'path' is not defined                 no-undef
  297:21  error  'launch_app' is not defined           no-undef
  328:89  error  'mouseover_window' is not defined     no-undef
Sam Atkins 1 year ago
parent
commit
126b00b35c
1 changed files with 10 additions and 9 deletions
  1. 10 9
      src/UI/UITaskbarItem.js

+ 10 - 9
src/UI/UITaskbarItem.js

@@ -18,6 +18,7 @@
  */
 
 import UIContextMenu from './UIContextMenu.js';
+import path from '../lib/path.js';
 
 let tray_item_id = 1;
 
@@ -28,7 +29,7 @@ function UITaskbarItem(options){
     options.open_windows_count = options.open_windows_count ?? 0;
     options.lock_keep_in_taskbar = options.lock_keep_in_taskbar ?? false;
     options.append_to_taskbar = options.append_to_taskbar ?? true;
-    const element_id = global_element_id++;
+    const element_id = window.global_element_id++;
 
     h += `<div  class = "taskbar-item ${options.sortable ? 'taskbar-item-sortable' : ''} disable-user-select"
                 id = "taskbar-item-${tray_item_id}"
@@ -121,7 +122,7 @@ function UITaskbarItem(options){
                 html: 'New Window',
                 val: $(this).attr('data-id'),
                 onClick: function(){
-                    launch_app({
+                    window.launch_app({
                         name: options.app,
                         maximized: (isMobile.phone || isMobile.tablet),
                     })
@@ -140,7 +141,7 @@ function UITaskbarItem(options){
                 html: i18n('empty_trash'),
                 val: $(this).attr('data-id'),
                 onClick: async function(){
-                    empty_trash();
+                    window.empty_trash();
                 }
             })
         }
@@ -155,9 +156,9 @@ function UITaskbarItem(options){
                 onClick: function(){
                     $(el_taskbar_item).attr('data-keep-in-taskbar', 'false');
                     if($(el_taskbar_item).attr('data-open-windows') === '0'){
-                        remove_taskbar_item(el_taskbar_item);
+                        window.remove_taskbar_item(el_taskbar_item);
                     }
-                    update_taskbar();
+                    window.update_taskbar();
                     options.keep_in_taskbar = false;
                 }
             })
@@ -171,7 +172,7 @@ function UITaskbarItem(options){
                 val: $(this).attr('data-id'),
                 onClick: function(){
                     $(el_taskbar_item).attr('data-keep-in-taskbar', 'true');
-                    update_taskbar();
+                    window.update_taskbar();
                     options.keep_in_taskbar = true;
                 }
             })  
@@ -247,7 +248,7 @@ function UITaskbarItem(options){
         tolerance: 'pointer',
         drop: async function( event, ui ) {
             // Check if hovering over an item that is VISIBILE
-            if($(event.target).closest('.window').attr('data-id') !== $(mouseover_window).attr('data-id'))
+            if($(event.target).closest('.window').attr('data-id') !== $(window.mouseover_window).attr('data-id'))
                 return;
 
             // If ctrl is pressed and source is Trashed, cancel whole operation
@@ -294,7 +295,7 @@ function UITaskbarItem(options){
                 // open each item
                 for (let i = 0; i < items_to_sign.length; i++) {
                     const item = items_to_sign[i];
-                    launch_app({ 
+                    window.launch_app({
                         name: options.app, 
                         file_path: item.path,
                         // app_obj: open_item_meta.suggested_apps[0],
@@ -325,7 +326,7 @@ function UITaskbarItem(options){
         over: function(event, ui){
             // Check hovering over an item that is VISIBILE
             const $event_parent_win = $(event.target).closest('.window')
-            if( $event_parent_win.length > 0 && $event_parent_win.attr('data-id') !== $(mouseover_window).attr('data-id'))
+            if( $event_parent_win.length > 0 && $event_parent_win.attr('data-id') !== $(window.mouseover_window).attr('data-id'))
                 return;
             // Don't do anything if the dragged item is NOT a UIItem
             if(!$(ui.draggable).hasClass('item'))