@vacantthinker/firefox-addon-framework-easy 2026.604.1932 → 2026.605.843
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/package.json +1 -1
- package/src/browserRuntimeOnMessageCommon.js +35 -3
- package/src/generate.js +22 -0
package/README.md
CHANGED
|
@@ -61,7 +61,15 @@ export function browserRuntimeManifestName() { }
|
|
|
61
61
|
|
|
62
62
|
### 📄 File: `src/browserRuntimeOnMessageCommon.js`
|
|
63
63
|
```javascript
|
|
64
|
-
export function browserRuntimeOnMessageCommon(
|
|
64
|
+
export function browserRuntimeOnMessageCommon(
|
|
65
|
+
act,
|
|
66
|
+
message,
|
|
67
|
+
sendResponse
|
|
68
|
+
) { }
|
|
69
|
+
|
|
70
|
+
export function browserRuntimeOnMessageMerge(
|
|
71
|
+
message, sender
|
|
72
|
+
) { }
|
|
65
73
|
|
|
66
74
|
```
|
|
67
75
|
|
package/package.json
CHANGED
|
@@ -5,23 +5,30 @@ import {browserNotificationCreate} from './browserNotification.js';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* offer common act <=> function, eg: actRemoveTab, actLog
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
8
|
*
|
|
11
9
|
* @param act{
|
|
12
10
|
* 'actLog'
|
|
11
|
+
* |'actRequestTabIdTabUrl'
|
|
13
12
|
* |'actNotification'
|
|
14
13
|
* |'actRemoveTab'
|
|
15
14
|
* |'actDownloadFile'
|
|
16
15
|
* |'actSendMessageToTab'
|
|
17
16
|
* }
|
|
18
17
|
* @param message
|
|
18
|
+
* @param sendResponse
|
|
19
19
|
*/
|
|
20
|
-
export function browserRuntimeOnMessageCommon(
|
|
20
|
+
export function browserRuntimeOnMessageCommon(
|
|
21
|
+
act,
|
|
22
|
+
message,
|
|
23
|
+
sendResponse
|
|
24
|
+
) {
|
|
21
25
|
switch (act) {
|
|
22
26
|
case 'actLog':
|
|
23
27
|
console.log('act', act, 'message', message);
|
|
24
28
|
break;
|
|
29
|
+
case 'actRequestTabIdTabUrl':
|
|
30
|
+
sendResponse(message);
|
|
31
|
+
break
|
|
25
32
|
case 'actNotification':
|
|
26
33
|
browserNotificationCreate(message.content)
|
|
27
34
|
break
|
|
@@ -37,3 +44,28 @@ export function browserRuntimeOnMessageCommon(act, message) {
|
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param message
|
|
51
|
+
* @param sender
|
|
52
|
+
* @returns {
|
|
53
|
+
* 'actLog'
|
|
54
|
+
* |'actRequestTabIdTabUrl'
|
|
55
|
+
* |'actNotification'
|
|
56
|
+
* |'actRemoveTab'
|
|
57
|
+
* |'actDownloadFile'
|
|
58
|
+
* |'actSendMessageToTab'
|
|
59
|
+
* }
|
|
60
|
+
*/
|
|
61
|
+
export function browserRuntimeOnMessageMerge(
|
|
62
|
+
message, sender
|
|
63
|
+
) {
|
|
64
|
+
let keyAct = 'act';
|
|
65
|
+
let act = message[keyAct];
|
|
66
|
+
delete message[keyAct];
|
|
67
|
+
message['tabId'] = sender.tab?.id;
|
|
68
|
+
message['tabUrl'] = sender.tab?.url;
|
|
69
|
+
|
|
70
|
+
return act;
|
|
71
|
+
}
|
package/src/generate.js
CHANGED
|
@@ -161,6 +161,28 @@ export function generateHtmlByUserSettings(
|
|
|
161
161
|
eleWrap.append(eleInput);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// --- CONDITION 4: SPAN / READ-ONLY TEXT ---
|
|
165
|
+
else if (type === 'span' ) {
|
|
166
|
+
const eleSpan = document.createElement('span');
|
|
167
|
+
// Optional: Add a class for styling read-only text differently
|
|
168
|
+
// eleSpan.className = 'read-only-text';
|
|
169
|
+
|
|
170
|
+
stoOpGet(storageKey).then((v) => {
|
|
171
|
+
// Fallback to default schema configuration if no value is stored yet
|
|
172
|
+
const currentVal = (v !== undefined && v !== null) ?
|
|
173
|
+
v :
|
|
174
|
+
storageValue.selected;
|
|
175
|
+
|
|
176
|
+
// Render as plain text
|
|
177
|
+
eleSpan.textContent = String(currentVal);
|
|
178
|
+
|
|
179
|
+
// Initial visibility evaluation
|
|
180
|
+
triggerVisibility(storageKey, currentVal);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
eleWrap.append(eleSpan);
|
|
184
|
+
}
|
|
185
|
+
|
|
164
186
|
return eleWrap;
|
|
165
187
|
});
|
|
166
188
|
|