@vacantthinker/firefox-addon-framework-easy 2026.527.2111 → 2026.528.1449
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 +6 -6
- package/package.json +1 -1
- package/src/browserRuntime.js +3 -2
- package/src/opTab.js +56 -71
package/README.md
CHANGED
|
@@ -91,6 +91,12 @@ export async function stoOpSetNull(k) { }
|
|
|
91
91
|
|
|
92
92
|
### 📄 File: `src/opTab.js`
|
|
93
93
|
```javascript
|
|
94
|
+
export async function tabOpCreate(properties) { }
|
|
95
|
+
|
|
96
|
+
export async function tabOpCreateActiveFalse(properties) { }
|
|
97
|
+
|
|
98
|
+
export async function tabOpCreateByWindow(url) { }
|
|
99
|
+
|
|
94
100
|
export async function tabOpGet(tabId) { }
|
|
95
101
|
|
|
96
102
|
export async function tabOpQueryAll() { }
|
|
@@ -101,12 +107,6 @@ export async function tabOpQueryUrlThenRemove(urlQuery) { }
|
|
|
101
107
|
|
|
102
108
|
export async function tabOpReload(tabId) { }
|
|
103
109
|
|
|
104
|
-
export async function tabOpCreate(urlOrArgs) { }
|
|
105
|
-
|
|
106
|
-
export async function tabOpCreateNormal(urlOrArgs) { }
|
|
107
|
-
|
|
108
|
-
export async function tabOpCreateByWindow(url) { }
|
|
109
|
-
|
|
110
110
|
export async function tabOpRemove(tabId) { }
|
|
111
111
|
|
|
112
112
|
export async function tabOpHide(tabId) { }
|
package/package.json
CHANGED
package/src/browserRuntime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {tabOpCreateActiveFalse} from './opTab.js';
|
|
2
2
|
import {browserNotificationCreate} from './browserNotification.js';
|
|
3
3
|
|
|
4
4
|
export function browserRuntimeReload() {
|
|
@@ -31,7 +31,8 @@ export function browserRuntimeOnUpdateAvailable(doWhat = null) {
|
|
|
31
31
|
);
|
|
32
32
|
browser.notifications.onClicked.addListener(async (notificationId) => {
|
|
33
33
|
if (notificationId === id) {
|
|
34
|
-
|
|
34
|
+
let url = 'https://addons.mozilla.org/en-US/firefox/user/17783213/';
|
|
35
|
+
await tabOpCreateActiveFalse({url});
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
} catch (e) {
|
package/src/opTab.js
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a normal tab using either a URL string or a properties object.
|
|
3
|
+
*
|
|
4
|
+
* @param tab{browser.tabs.Tab}
|
|
5
|
+
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
6
|
+
*/
|
|
7
|
+
async function tabOpEnhance(tab) {
|
|
8
|
+
return Object.assign({}, tab, {tabId: tab.id});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a normal tab using either a URL string or a properties object.
|
|
13
|
+
*
|
|
14
|
+
* @param {browser.tabs._CreateCreateProperties} properties
|
|
15
|
+
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
16
|
+
*/
|
|
17
|
+
export async function tabOpCreate(properties) {
|
|
18
|
+
// Otherwise, assume it is already a properties object
|
|
19
|
+
let tab = await browser.tabs.create(properties);
|
|
20
|
+
return tabOpEnhance(tab);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* {active: false, muted: true}
|
|
26
|
+
* @param properties{browser.tabs._CreateCreateProperties}
|
|
27
|
+
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
28
|
+
*/
|
|
29
|
+
export async function tabOpCreateActiveFalse(properties) {
|
|
30
|
+
/**
|
|
31
|
+
* @type {browser.tabs._CreateCreateProperties}
|
|
32
|
+
*/
|
|
33
|
+
let source = {active: false, muted: true};
|
|
34
|
+
Object.assign(properties, source);
|
|
35
|
+
let tab = await browser.tabs.create(properties);
|
|
36
|
+
return tabOpEnhance(tab);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a normal tab using either a URL string or a properties object.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} url
|
|
43
|
+
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
44
|
+
*/
|
|
45
|
+
export async function tabOpCreateByWindow(url) {
|
|
46
|
+
// If it's a string, wrap it in an object
|
|
47
|
+
if (typeof url === 'string') {
|
|
48
|
+
let window = await browser.windows.create({
|
|
49
|
+
url,
|
|
50
|
+
});
|
|
51
|
+
let tab = window.tabs.shift();
|
|
52
|
+
return tabOpEnhance(tab);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
1
56
|
/**
|
|
2
57
|
*
|
|
3
58
|
* @param tabId{number}
|
|
@@ -44,66 +99,6 @@ export async function tabOpReload(tabId) {
|
|
|
44
99
|
await browser.tabs.reload(tabId);
|
|
45
100
|
}
|
|
46
101
|
|
|
47
|
-
/**
|
|
48
|
-
* {active: false, muted: true}
|
|
49
|
-
* Creates a normal tab using either a URL string or a properties object.
|
|
50
|
-
* @param urlOrArgs{string|browser.tabs._CreateCreateProperties}
|
|
51
|
-
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
52
|
-
*/
|
|
53
|
-
export async function tabOpCreate(urlOrArgs) {
|
|
54
|
-
/**
|
|
55
|
-
* @type {browser.tabs._CreateCreateProperties}
|
|
56
|
-
*/
|
|
57
|
-
let source = {active: false, muted: true};
|
|
58
|
-
// If it's a string, wrap it in an object
|
|
59
|
-
if (typeof urlOrArgs === 'string') {
|
|
60
|
-
let tab = await browser.tabs.create(Object.assign(
|
|
61
|
-
{url: urlOrArgs}, source,
|
|
62
|
-
));
|
|
63
|
-
return tabOpEnhance(tab);
|
|
64
|
-
}
|
|
65
|
-
Object.assign(urlOrArgs, source);
|
|
66
|
-
let tab = await browser.tabs.create(urlOrArgs);
|
|
67
|
-
return tabOpEnhance(tab)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Creates a normal tab using either a URL string or a properties object.
|
|
72
|
-
*
|
|
73
|
-
* @param {string|browser.tabs._CreateCreateProperties} urlOrArgs
|
|
74
|
-
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
75
|
-
*/
|
|
76
|
-
export async function tabOpCreateNormal(urlOrArgs) {
|
|
77
|
-
// If it's a string, wrap it in an object
|
|
78
|
-
if (typeof urlOrArgs === 'string') {
|
|
79
|
-
let tab = await browser.tabs.create({url: urlOrArgs});
|
|
80
|
-
return tabOpEnhance(tab)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Otherwise, assume it is already a properties object
|
|
84
|
-
let tab = await browser.tabs.create(urlOrArgs);
|
|
85
|
-
return tabOpEnhance(tab)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Creates a normal tab using either a URL string or a properties object.
|
|
90
|
-
*
|
|
91
|
-
* @param {string} url
|
|
92
|
-
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
93
|
-
*/
|
|
94
|
-
export async function tabOpCreateByWindow(url) {
|
|
95
|
-
// If it's a string, wrap it in an object
|
|
96
|
-
if (typeof url === 'string') {
|
|
97
|
-
let window = await browser.windows.create({
|
|
98
|
-
url
|
|
99
|
-
});
|
|
100
|
-
let tab = window.tabs.shift();
|
|
101
|
-
return tabOpEnhance(tab)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
102
|
/**
|
|
108
103
|
*
|
|
109
104
|
* @param tabId{number}
|
|
@@ -130,16 +125,6 @@ export async function tabOpHide(tabId) {
|
|
|
130
125
|
}
|
|
131
126
|
}
|
|
132
127
|
|
|
133
|
-
/**
|
|
134
|
-
* Creates a normal tab using either a URL string or a properties object.
|
|
135
|
-
*
|
|
136
|
-
* @param tab{browser.tabs.Tab}
|
|
137
|
-
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
138
|
-
*/
|
|
139
|
-
async function tabOpEnhance(tab) {
|
|
140
|
-
return Object.assign(tab, {tabId: tab.id});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
128
|
/**
|
|
144
129
|
*
|
|
145
130
|
* @param {number}tabId
|
|
@@ -170,7 +155,7 @@ export async function tabOpFocus(tabId) {
|
|
|
170
155
|
|
|
171
156
|
let updateProperties = {active: true, highlighted: true};
|
|
172
157
|
let tabUpdated = await tabOpUpdate(tabId, updateProperties);
|
|
173
|
-
return tabOpEnhance(tabUpdated)
|
|
158
|
+
return tabOpEnhance(tabUpdated);
|
|
174
159
|
}
|
|
175
160
|
|
|
176
161
|
/**
|