-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfloating-panel.js
More file actions
93 lines (86 loc) · 3.16 KB
/
floating-panel.js
File metadata and controls
93 lines (86 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Version: 1.0
//
// Documentation:
// This file implements the entry point for the OneClickPrompts floating panel.
// It defines the window.MaxExtensionFloatingPanel namespace (with common properties)
// and loads additional functionality split into separate files: floating-panel-ui-creation.js,
// floating-panel-ui-interaction.js, and floating-panel-settings.js.
//
// Structure:
// 1. Namespace: window.MaxExtensionFloatingPanel - Global object containing all floating panel functionality
// 2. Properties:
// - panelElement: Reference to the panel DOM element
// - isPanelVisible: Boolean tracking current visibility state
// - currentProfileName: Currently active profile name
// - availableProfiles: Array of all available profile names
// - storageKeyPrefix: Prefix used for storing settings ('floating_panel_')
// - defaultPanelSettings: Default configuration for new panels
// - currentPanelSettings: Current active settings for the panel
// - savePositionTimer: Used for debounced settings saves
//
// Dependencies:
// - floating-panel-ui-creation.js: Contains UI creation methods
// - floating-panel-ui-interaction.js: Contains UI interaction methods
// - floating-panel-settings.js: Contains settings and profile management
// - config.js (Service Worker): Handles persistent storage of panel settings
//
// Communication:
// The floating panel uses chrome.runtime.sendMessage to communicate with the config.js
// service worker for storing and retrieving settings based on the website hostname.
//
// IMPORTANT: DO NOT REMOVE COMMENTS. All old names are preserved.
'use strict';
// Define the namespace for the floating panel and its properties.
window.MaxExtensionFloatingPanel = {
panelElement: null,
isPanelVisible: false,
currentProfileName: null,
availableProfiles: [],
storageKeyPrefix: 'floating_panel_',
defaultPanelSettings: {
width: 300,
height: 400,
posX: 100,
posY: 100,
opacity: 0.7,
isVisible: false,
isHeaderCollapsed: false,
isFooterCollapsed: false
},
currentPanelSettings: null,
savePositionTimer: null,
// Prompt Queue properties
promptQueue: [],
isQueueRunning: false,
queueTimerId: null,
timerStartTime: 0,
currentTimerDelay: 0,
remainingTimeOnPause: 0,
queueSectionElement: null,
queueDisplayArea: null,
queueProgressContainer: null,
queueProgressBar: null,
playQueueButton: null,
resetQueueButton: null,
delayInputElement: null,
queueModeToggle: null,
QUEUE_MAX_SIZE: 10,
nextQueueItemId: 1,
queueAutoScrollEnabled: false,
queueBeepEnabled: false,
queueSpeakEnabled: false,
queueFinishBeepEnabled: false,
queueKeepTabActiveEnabled: false,
queueAutomationButtons: null,
queuePreSendControlsWrapper: null,
queueAudioContext: null,
queueFinishedIndicatorButton: null,
queueFinishedState: false,
// Internal runtime flags
panelSettingsLoaded: false
};
// Define a separate namespace for global, non-profile settings.
window.MaxExtensionGlobalSettings = {
acceptedQueueTOS: false
};
// No need to load files: they are imported in manifest.json