@vacantthinker/firefox-addon-framework-easy 2026.613.2158 → 2026.614.840

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.
@@ -1,8 +1,14 @@
1
+ export interface NotificationTwoOptions {
2
+ message: string;
3
+ title?: string;
4
+ }
5
+ export declare function browserNotificationCreateBasicMessageOnly(message: string): Promise<string>;
1
6
  /**
2
- * Creates a browser notification with basic type.
3
- * @param content The notification message string.
4
- * @param title The notification title (defaults to manifest name).
7
+ * Creates a browser notification with basic type,
8
+ * if title null use addon manifest name.
5
9
  * @returns The notification identifier.
10
+ * @param notificationTwoOptions
6
11
  */
7
- export declare function browserNotificationCreate(content: string, title?: string): Promise<string>;
12
+ export declare function browserNotificationCreateBasicMessage(notificationTwoOptions: NotificationTwoOptions): Promise<string>;
13
+ export declare function browserNotificationCreate(notificationOptions: browser.notifications.CreateNotificationOptions): Promise<string>;
8
14
  //# sourceMappingURL=browserNotification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserNotification.d.ts","sourceRoot":"","sources":["../src/browserNotification.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAqC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAejB"}
1
+ {"version":3,"file":"browserNotification.d.ts","sourceRoot":"","sources":["../src/browserNotification.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;;;;GAKG;AACH,wBAAsB,qCAAqC,CACzD,sBAAsB,EAAE,sBAAsB,GAC7C,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAsB,yBAAyB,CAC7C,mBAAmB,EAAE,OAAO,CAAC,aAAa,CAAC,yBAAyB,GACnE,OAAO,CAAC,MAAM,CAAC,CAGjB"}
@@ -1,17 +1,24 @@
1
- import { browserRuntimeGeckoId, browserRuntimeManifestName } from './browserRuntime';
1
+ import { browserRuntimeManifestName } from './browserRuntime';
2
+ export async function browserNotificationCreateBasicMessageOnly(message) {
3
+ return await browserNotificationCreateBasicMessage({ message });
4
+ }
2
5
  /**
3
- * Creates a browser notification with basic type.
4
- * @param content The notification message string.
5
- * @param title The notification title (defaults to manifest name).
6
+ * Creates a browser notification with basic type,
7
+ * if title null use addon manifest name.
6
8
  * @returns The notification identifier.
9
+ * @param notificationTwoOptions
7
10
  */
8
- export async function browserNotificationCreate(content, title = browserRuntimeManifestName()) {
9
- const notificationId = `${browserRuntimeGeckoId()}cake-noti`;
10
- const options = {
11
+ export async function browserNotificationCreateBasicMessage(notificationTwoOptions) {
12
+ const notificationOptions = {
13
+ message: "",
11
14
  type: 'basic',
12
- title: title,
13
- message: content,
15
+ title: browserRuntimeManifestName()
14
16
  };
15
- await browser.notifications.create(notificationId, options);
16
- return notificationId;
17
+ const options = {
18
+ ...notificationOptions, ...notificationTwoOptions
19
+ };
20
+ return await browserNotificationCreate(options);
21
+ }
22
+ export async function browserNotificationCreate(notificationOptions) {
23
+ return await browser.notifications.create(notificationOptions);
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serviceCommon.d.ts","sourceRoot":"","sources":["../src/serviceCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACf,MAAM,mBAAmB,CAAC;AAK3B;;GAEG;AACH,wBAAsB,iBAAiB,kBAGtC;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrF"}
1
+ {"version":3,"file":"serviceCommon.d.ts","sourceRoot":"","sources":["../src/serviceCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACf,MAAM,mBAAmB,CAAC;AAS3B;;GAEG;AACH,wBAAsB,iBAAiB,kBAGtC;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBrF"}
@@ -1,5 +1,5 @@
1
1
  import { browserDownloadByDownlink } from './browserDownload';
2
- import { browserNotificationCreate } from './browserNotification';
2
+ import { browserNotificationCreateBasicMessageOnly } from './browserNotification';
3
3
  import { stoOpClear } from "./opStorage";
4
4
  import { browserRuntimeReload } from "./browserRuntime";
5
5
  /**
@@ -19,11 +19,12 @@ export async function serviceDownloadByDownlink(params) {
19
19
  try {
20
20
  // Attempt 1: Full download with provided parameters
21
21
  await browserDownloadByDownlink(params);
22
- await browserNotificationCreate(`downloading! ${filename ?? 'file'}`);
22
+ await browserNotificationCreateBasicMessageOnly(`downloading! ${filename ??
23
+ 'file'}`);
23
24
  }
24
25
  catch (error) {
25
26
  // Notify about the failure
26
- await browserNotificationCreate(`reason=${error}`);
27
+ await browserNotificationCreateBasicMessageOnly(`reason=${error}`);
27
28
  // Attempt 2: Fallback retry using only the downlink
28
29
  await browserDownloadByDownlink({ downlink });
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serviceOpJavascript.d.ts","sourceRoot":"","sources":["../src/serviceOpJavascript.ts"],"names":[],"mappings":"AAUA,UAAU,UAAU;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,iBACR,SAAQ,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,iBAAiB,CAAC;CACxD;AAID;;GAEG;AAC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E,UAAU,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA+HhF;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCxF;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCzF"}
@@ -1,6 +1,6 @@
1
1
  import { serviceGetCurrentDateYYYYMMDDHHMMSS } from './serviceGet';
2
2
  import { serviceCopyContentToClipboard, serviceRemoveIllegalWord, serviceSaveContentToLocal, } from './serviceOpContent';
3
- import { browserNotificationCreate } from './browserNotification';
3
+ import { browserNotificationCreateBasicMessageOnly } from './browserNotification';
4
4
  // --- Services ---
5
5
  /**
6
6
  * Captures a tab's screenshot and triggers a local download in the target tab.
@@ -9,7 +9,12 @@ export async function serviceTakeScreenshot({ tabId, filename, rect }) {
9
9
  const dataURI = await browser.tabs.captureTab(tabId, { rect });
10
10
  await browser.scripting.executeScript({
11
11
  target: { tabId },
12
- args: [{ dataURI, filename }],
12
+ args: [
13
+ {
14
+ dataURI,
15
+ filename
16
+ }
17
+ ],
13
18
  func: (message) => {
14
19
  const { dataURI, filename } = message;
15
20
  const a = document.createElement('a');
@@ -45,7 +50,9 @@ export async function serviceElementPicker(message) {
45
50
  function getUniqueSelector(el) {
46
51
  const path = [];
47
52
  let current = el;
48
- while (current && current.nodeType === Node.ELEMENT_NODE) {
53
+ while (current &&
54
+ current.nodeType ===
55
+ Node.ELEMENT_NODE) {
49
56
  let selector = current.nodeName.toLowerCase();
50
57
  if (current.id) {
51
58
  selector += `#${current.id}`;
@@ -54,10 +61,14 @@ export async function serviceElementPicker(message) {
54
61
  }
55
62
  else {
56
63
  let sib = current, nth = 1;
57
- while ((sib = sib.previousElementSibling) && sib.nodeName.toLowerCase() === selector)
64
+ while ((sib = sib.previousElementSibling) &&
65
+ sib.nodeName.toLowerCase() ===
66
+ selector)
58
67
  nth++;
59
- if (nth !== 1)
68
+ if (nth !==
69
+ 1) {
60
70
  selector += `:nth-of-type(${nth})`;
71
+ }
61
72
  }
62
73
  path.unshift(selector);
63
74
  current = current.parentElement;
@@ -66,13 +77,18 @@ export async function serviceElementPicker(message) {
66
77
  }
67
78
  function handleMouseOver(e) {
68
79
  const target = e.target;
69
- if (target.id === overlayId || !overlay)
80
+ if (target.id ===
81
+ overlayId ||
82
+ !overlay) {
70
83
  return;
84
+ }
71
85
  const rect = target.getBoundingClientRect();
72
86
  Object.assign(overlay.style, {
73
87
  display: 'block',
74
- top: `${rect.top}px`, left: `${rect.left}px`,
75
- width: `${rect.width}px`, height: `${rect.height}px`,
88
+ top: `${rect.top}px`,
89
+ left: `${rect.left}px`,
90
+ width: `${rect.width}px`,
91
+ height: `${rect.height}px`,
76
92
  });
77
93
  document.body.style.setProperty('cursor', 'crosshair', 'important');
78
94
  }
@@ -85,8 +101,10 @@ export async function serviceElementPicker(message) {
85
101
  const rect = {
86
102
  height: clientRect.height,
87
103
  width: clientRect.width,
88
- x: clientRect.left + window.scrollX,
89
- y: clientRect.top + window.scrollY,
104
+ x: clientRect.left +
105
+ window.scrollX,
106
+ y: clientRect.top +
107
+ window.scrollY,
90
108
  };
91
109
  await browser.runtime.sendMessage({
92
110
  ...message,
@@ -114,11 +132,15 @@ export async function serviceGetFullPageRectData(message) {
114
132
  args: [message],
115
133
  func: (message) => {
116
134
  const rect = {
117
- x: 0, y: 0,
135
+ x: 0,
136
+ y: 0,
118
137
  width: document.documentElement.scrollWidth,
119
138
  height: document.documentElement.scrollHeight,
120
139
  };
121
- browser.runtime.sendMessage({ ...message, rect });
140
+ browser.runtime.sendMessage({
141
+ ...message,
142
+ rect
143
+ });
122
144
  },
123
145
  });
124
146
  }
@@ -136,18 +158,22 @@ export async function serviceFindAllMagnetLink(message) {
136
158
  attrElements.forEach(el => {
137
159
  Array.from(el.attributes)
138
160
  .forEach(attr => {
139
- if (attr.value.includes('magnet:?xt='))
161
+ if (attr.value.includes('magnet:?xt=')) {
140
162
  magnets.add(attr.value.trim());
163
+ }
141
164
  });
142
165
  });
143
166
  // Type 2: Text content
144
167
  document.querySelectorAll('div, span, td, p, a, button')
145
168
  .forEach(el => {
146
- if (el.children.length === 0) {
147
- const text = el.textContent?.trim() || '';
169
+ if (el.children.length ===
170
+ 0) {
171
+ const text = el.textContent?.trim() ||
172
+ '';
148
173
  const match = text.match(/magnet:\?xt=[^\s"'<>]+/);
149
- if (match)
174
+ if (match) {
150
175
  magnets.add(match[0]);
176
+ }
151
177
  }
152
178
  });
153
179
  await browser.runtime.sendMessage({
@@ -163,12 +189,18 @@ export async function serviceFindAllMagnetLink(message) {
163
189
  export async function serviceDealWithMagnetLink(message) {
164
190
  const { title, data, handleOption } = message;
165
191
  const titleCleaned = serviceRemoveIllegalWord(title);
166
- if (!Array.isArray(data) || data.length === 0) {
167
- await browserNotificationCreate('magnet link not found!');
192
+ if (!Array.isArray(data) ||
193
+ data.length ===
194
+ 0) {
195
+ await browserNotificationCreateBasicMessageOnly('magnet link not found!');
168
196
  return;
169
197
  }
170
198
  const content = `${data.join('\n')}\n`;
171
- const filename = ['magnet-link', titleCleaned, serviceGetCurrentDateYYYYMMDDHHMMSS()].join(' ');
199
+ const filename = [
200
+ 'magnet-link',
201
+ titleCleaned,
202
+ serviceGetCurrentDateYYYYMMDDHHMMSS()
203
+ ].join(' ');
172
204
  switch (handleOption) {
173
205
  case 'clipboard':
174
206
  await serviceCopyContentToClipboard(content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0613.2158",
3
+ "version": "2026.0614.0840",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",