browser-extension-settings 0.2.1 → 0.2.3

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/lib/common.ts CHANGED
@@ -1,3 +1,3 @@
1
- export const besVersion = 15
1
+ export const besVersion = 16
2
2
  export const openButton = `<svg viewBox="0 0 60.2601318359375 84.8134765625" version="1.1" xmlns="http://www.w3.org/2000/svg" class=" glyph-box" style="height: 9.62969px; width: 6.84191px;"><g transform="matrix(1 0 0 1 -6.194965820312518 77.63671875)"><path d="M66.4551-35.2539C66.4551-36.4746 65.9668-37.5977 65.0391-38.4766L26.3672-76.3672C25.4883-77.1973 24.4141-77.6367 23.1445-77.6367C20.6543-77.6367 18.7012-75.7324 18.7012-73.1934C18.7012-71.9727 19.1895-70.8496 19.9707-70.0195L55.5176-35.2539L19.9707-0.488281C19.1895 0.341797 18.7012 1.41602 18.7012 2.68555C18.7012 5.22461 20.6543 7.12891 23.1445 7.12891C24.4141 7.12891 25.4883 6.68945 26.3672 5.81055L65.0391-32.0312C65.9668-32.959 66.4551-34.0332 66.4551-35.2539Z"></path></g></svg>`
3
3
  export const openInNewTabButton = `<svg viewBox="0 0 72.127685546875 72.2177734375" version="1.1" xmlns="http://www.w3.org/2000/svg" class=" glyph-box" style="height: 8.19958px; width: 8.18935px;"><g transform="matrix(1 0 0 1 -12.451127929687573 71.3388671875)"><path d="M84.5703-17.334L84.5215-66.4551C84.5215-69.2383 82.7148-71.1914 79.7852-71.1914L30.6641-71.1914C27.9297-71.1914 26.0742-69.0918 26.0742-66.748C26.0742-64.4043 28.1738-62.4023 30.4688-62.4023L47.4609-62.4023L71.2891-63.1836L62.207-55.2246L13.8184-6.73828C12.9395-5.85938 12.4512-4.73633 12.4512-3.66211C12.4512-1.31836 14.5508 0.878906 16.9922 0.878906C18.1152 0.878906 19.1895 0.488281 20.0684-0.439453L68.5547-48.877L76.6113-58.0078L75.7324-35.2051L75.7324-17.1387C75.7324-14.8438 77.7344-12.6953 80.127-12.6953C82.4707-12.6953 84.5703-14.6973 84.5703-17.334Z"></path></g></svg>`
package/lib/settings.ts CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  activeExtensionList,
24
24
  deactiveExtensionList,
25
25
  } from "./extension-list"
26
- import { besVersion } from "./common"
26
+ import { besVersion, openInNewTabButton } from "./common"
27
27
 
28
28
  const prefix = "browser_extension_settings_"
29
29
 
@@ -61,6 +61,7 @@ type SettingsActionItem = {
61
61
  title: string
62
62
  type: string
63
63
  onclick?: () => void
64
+ url?: string
64
65
  group?: number
65
66
  defaultValue?: any
66
67
  }
@@ -366,6 +367,19 @@ function createSettingsElement() {
366
367
  break
367
368
  }
368
369
 
370
+ case "externalLink": {
371
+ const div4 = addElement(optionGroup, "div", {
372
+ class: "bes_external_link",
373
+ })
374
+
375
+ addElement(div4, "a", {
376
+ textContent: item.title,
377
+ href: (item as SettingsActionItem).url,
378
+ target: "_blank",
379
+ })
380
+ break
381
+ }
382
+
369
383
  case "tip": {
370
384
  const tip = addElement(optionGroup, "div", {
371
385
  class: "bes_tip",
@@ -455,6 +469,12 @@ function addCommonSettings(settingsTable: SettingsTable) {
455
469
  }
456
470
  }
457
471
 
472
+ function handleShowSettingsUrl() {
473
+ if (location.hash === "#bes-show-settings") {
474
+ setTimeout(showSettings, 100)
475
+ }
476
+ }
477
+
458
478
  export async function showSettings() {
459
479
  const settingsContainer = getSettingsContainer()
460
480
 
@@ -488,4 +508,6 @@ export const initSettings = async (options: SettingsOptions) => {
488
508
  initExtensionList()
489
509
  addSideMenu()
490
510
  })
511
+
512
+ handleShowSettingsUrl()
491
513
  }
package/lib/style.scss CHANGED
@@ -180,12 +180,24 @@
180
180
 
181
181
  .option_groups .action {
182
182
  font-size: 14px;
183
- border-top: 1px solid #cccccc;
184
183
  padding: 6px 0 6px 0;
185
184
  color: var(--browser-extension-settings-link-color);
186
185
  cursor: pointer;
187
186
  }
188
187
 
188
+ .bes_external_link {
189
+ font-size: 14px;
190
+ padding: 6px 0 6px 0;
191
+
192
+ a,
193
+ a:visited,
194
+ a:hover {
195
+ color: var(--browser-extension-settings-link-color);
196
+ text-decoration: none;
197
+ cursor: pointer;
198
+ }
199
+ }
200
+
189
201
  .option_groups textarea {
190
202
  font-size: 12px;
191
203
  margin: 10px 0 10px 0;
@@ -200,12 +212,15 @@
200
212
  display: flex;
201
213
  justify-content: space-between;
202
214
  align-items: center;
203
- border-top: 1px solid #cccccc;
204
215
  padding: 6px 0 6px 0;
205
216
  font-size: 14px;
206
217
  }
207
- .switch_option:first-of-type,
208
- .option_groups .action:first-of-type {
218
+
219
+ .option_groups > * {
220
+ border-top: 1px solid #cccccc;
221
+ }
222
+
223
+ .option_groups > *:first-child {
209
224
  border-top: none;
210
225
  }
211
226
 
@@ -330,7 +345,7 @@
330
345
  }
331
346
 
332
347
  #browser_extension_side_menu {
333
- min-height: 200px;
348
+ min-height: 100px;
334
349
  width: 40px;
335
350
  opacity: 0;
336
351
  position: fixed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-extension-settings",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Settings module for developing browser extensions and userscripts",
5
5
  "type": "module",
6
6
  "main": "./lib/index.ts",