@vacantthinker/firefox-addon-framework-easy 2026.528.1449 β†’ 2026.528.1648

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 CHANGED
@@ -91,8 +91,12 @@ export async function stoOpSetNull(k) { }
91
91
 
92
92
  ### πŸ“„ File: `src/opTab.js`
93
93
  ```javascript
94
+ export async function tabOpEnhance(tab) { }
95
+
94
96
  export async function tabOpCreate(properties) { }
95
97
 
98
+ export async function tabOpCreateNear(properties) { }
99
+
96
100
  export async function tabOpCreateActiveFalse(properties) { }
97
101
 
98
102
  export async function tabOpCreateByWindow(url) { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0528.1449",
3
+ "version": "2026.0528.1648",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
package/src/opTab.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * @param tab{browser.tabs.Tab}
5
5
  * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
6
6
  */
7
- async function tabOpEnhance(tab) {
7
+ export async function tabOpEnhance(tab) {
8
8
  return Object.assign({}, tab, {tabId: tab.id});
9
9
  }
10
10
 
@@ -20,6 +20,22 @@ export async function tabOpCreate(properties) {
20
20
  return tabOpEnhance(tab);
21
21
  }
22
22
 
23
+ /**
24
+ *
25
+ * @param {browser.tabs._CreateCreateProperties & {tabId: number} } properties
26
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
27
+ */
28
+ export async function tabOpCreateNear(properties) {
29
+ let tabPrev = await tabOpGet(properties.tabId);
30
+ delete properties.tabId;
31
+ Object.assign(properties, {
32
+ index: tabPrev.index + 1, openerTabId: tabPrev.id,
33
+ })
34
+
35
+ let tab = await tabOpCreate(properties);
36
+ return tabOpEnhance(tab);
37
+ }
38
+
23
39
 
24
40
  /**
25
41
  * {active: false, muted: true}
@@ -65,14 +65,28 @@ export async function serviceGenerateMkvToolNixScript({vid, title}) {
65
65
  }
66
66
 
67
67
  /**
68
- *
69
- * @param {string} value
70
- * @returns {string}
68
+ * Ultimate sanitization function: Filters all Chinese/English punctuation, full-width symbols, and illegal characters.
69
+ * (100% prevents download errors and copy-paste character corruption)
70
+ * @param {string} value - The original video title
71
+ * @returns {string} - A clean, safe plaintext/alphanumeric filename
71
72
  */
72
73
  export function serviceRemoveIllegalWord(value) {
73
- let searchValue = /[\/\\\[\]\-"γ€Žγ€<>β€Ί:οΌšοΌ›β—β€β€œ'|δΈ¨ο½œβ¦‡β¦ˆ??!οΌγ€Œγ€γ€γ€‘β”€\(\)οΌˆοΌ‰γ€Šγ€‹*#$@&%、,οΌŒγ€‚+Β·β€’]/g;
74
- let name0 = value.trim().split(/\r?\n/).shift();
75
- let name1 = name0.replace(searchValue, ' ');
76
- let name2 = name1.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, ' ');
77
- return name2;
74
+ if (!value) return '';
75
+
76
+ // 1. Get the first line and trim whitespace from both ends
77
+ let name = value.trim().split(/\r?\n/).shift();
78
+
79
+ // 2. Use Unicode properties to remove all punctuation (\p{P}) and all symbols/geometry (\p{S})
80
+ // This natively crushes Chinese full-width punctuation, em dashes (β€”), Emojis, math symbols, and special brackets.
81
+ // Note: The 'u' flag is mandatory to enable Unicode mode in the regex.
82
+ name = name.replace(/[\p{P}\p{S}]/gu, ' ');
83
+
84
+ // 3. Additional defense: Filter out hidden control characters that Firefox/OS are extremely sensitive to (0-31 and 127-159)
85
+ name = name.replace(/[\x00-\x1F\x7F-\x9F]/g, ' ');
86
+
87
+ // 4. Clean up Emojis and any remaining surrogate pairs
88
+ name = name.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, ' ');
89
+
90
+ // 5. Merge consecutive spaces (including Chinese full-width spaces) into a single standard space
91
+ return name.replace(/[\s\u3000]+/g, ' ').trim();
78
92
  }