sunrize 2.2.0 → 2.3.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "description": "Sunrize — A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -91,7 +91,7 @@
91
91
  "@electron-forge/maker-zip": "^7.11.2",
92
92
  "@electron-forge/publisher-github": "^7.11.2",
93
93
  "@eslint/js": "^10.0.1",
94
- "eslint": "^10.9.0",
94
+ "eslint": "^10.9.1",
95
95
  "globals": "^17.11.0",
96
96
  "shell-tools": "^1.1.9"
97
97
  },
@@ -99,7 +99,7 @@
99
99
  "@vscode/codicons": "^0.0.45",
100
100
  "capitalize": "^2.0.4",
101
101
  "console": "^0.7.2",
102
- "electron": "^43.4.1",
102
+ "electron": "^44.0.0",
103
103
  "electron-prompt": "^1.7.0",
104
104
  "electron-squirrel-startup": "^1.0.1",
105
105
  "electron-tabs": "^1.0.4",
@@ -108,7 +108,7 @@
108
108
  "jquery-ui-dist": "^1.13.3",
109
109
  "jstree": "^3.3.17",
110
110
  "material-icons": "^1.13.14",
111
- "material-symbols": "^0.46.0",
111
+ "material-symbols": "^0.47.0",
112
112
  "md5": "^2.3.0",
113
113
  "mime-types": "^3.0.2",
114
114
  "monaco-editor": "^0.55.1",
@@ -118,7 +118,7 @@
118
118
  "string-similarity": "^4.0.4",
119
119
  "tweakpane": "^4.0.5",
120
120
  "update-electron-app": "^3.3.0",
121
- "x_ite": "^16.1.3",
121
+ "x_ite": "^16.2.0",
122
122
  "x_ite-off-parser": "^1.3.0",
123
123
  "x_ite-sog-parser": "^2.1.0",
124
124
  "x_ite-spz-parser": "^2.1.0",
@@ -87,11 +87,12 @@ module .exports = class Application
87
87
 
88
88
  async setup ()
89
89
  {
90
- electron .app .on ("activate", (event) => this .onactivate ());
91
- electron .app .on ("new-window-for-tab", (event) => this .createWindow ());
90
+ electron .app .on ("activate", () => this .onactivate ());
91
+ electron .app .on ("new-window-for-tab", () => this .createWindow ());
92
92
  electron .app .on ("open-file", (event, filePath) => this .openFiles ([url .pathToFileURL (filePath) .href]));
93
- electron .app .on ("window-all-closed", (event) => this .quit ());
93
+ electron .app .on ("window-all-closed", () => this .quit ());
94
94
 
95
+ electron .ipcMain .on ("locale", (event, locale) => _.setLocale (locale));
95
96
  electron .ipcMain .on ("title", (event, title) => this .title = title);
96
97
  electron .ipcMain .on ("current-file", (event, currentFile) => this .currentFile = currentFile);
97
98
  electron .ipcMain .on ("add-recent-location", (event, fileURL) => this .addRecentLocation (fileURL));
@@ -112,7 +113,7 @@ module .exports = class Application
112
113
 
113
114
  this .openFiles (this .receivedFiles);
114
115
 
115
- electron .app .on ("second-instance", (event, argv, cwd) =>
116
+ electron .app .on ("second-instance", (event, argv) =>
116
117
  {
117
118
  this .openFiles (argv .slice (1)
118
119
  .filter (filePath => fs .existsSync (filePath) && fs .lstatSync (filePath) .isFile ())
@@ -139,24 +140,35 @@ module .exports = class Application
139
140
 
140
141
  set currentFile (currentFile)
141
142
  {
143
+ currentFile = String (currentFile);
144
+
142
145
  const protocol = currentFile .match (/^(.+?:)/);
143
146
 
144
147
  switch (protocol ?.[1])
145
148
  {
146
- default:
147
- this .#currentFile = new URL (currentFile) .pathname .split ("/") .at (-1);
149
+ case undefined:
150
+ case "id:":
151
+ case "data:":
152
+ {
153
+ this .#currentFile = `${_("New Scene")}.x3d`;
148
154
  break;
155
+ }
149
156
  case "file:":
157
+ {
150
158
  this .#currentFile = url .fileURLToPath (currentFile);
151
159
  break;
152
- case "data:":
153
- case "id:":
154
- case undefined:
155
- this .#currentFile = "";
160
+ }
161
+ default:
162
+ {
163
+ this .#currentFile = new URL (currentFile) .pathname .split ("/") .at (-1);
156
164
  break;
165
+ }
157
166
  }
158
167
 
159
- this .mainWindow .setRepresentedFilename (this .#currentFile);
168
+ if (fs .existsSync (this .#currentFile))
169
+ this .mainWindow .setRepresentedFilename (this .#currentFile);
170
+ else
171
+ this .mainWindow .setRepresentedFilename ("");
160
172
  }
161
173
 
162
174
  pushMenu (menu)
@@ -220,7 +232,7 @@ module .exports = class Application
220
232
  accelerator: "Shift+CmdOrCtrl+O",
221
233
  click: async () =>
222
234
  {
223
- const clipboard = electron .clipboard .readText ();
235
+ const clipboard = await electron .clipboard .readText ();
224
236
 
225
237
  this .pushMenu (this .createDialogMenu ());
226
238
 
@@ -314,6 +326,8 @@ module .exports = class Application
314
326
  if (response .canceled)
315
327
  return;
316
328
 
329
+ this .currentFile = url .pathToFileURL (response .filePath);
330
+
317
331
  this .addRecentDocument (response .filePath);
318
332
 
319
333
  this .mainWindow .webContents .send ("save-file-as", response .filePath);
@@ -377,6 +391,8 @@ module .exports = class Application
377
391
 
378
392
  this .mainWindow .webContents .send ("export-as", response .filePath);
379
393
 
394
+ this .currentFile = url .pathToFileURL (response .filePath);
395
+
380
396
  this .updateMenu ();
381
397
  },
382
398
  },
@@ -43,6 +43,17 @@ module .exports = class Dashboard extends Interface
43
43
  .appendTo (this .toolbar)
44
44
  .on ("click", () => this .play (!this .config .file .play));
45
45
 
46
+ this .volumeButton = $("<span></span>")
47
+ .addClass (["material-icons"])
48
+ .attr ("title", _("Adjust global sound intensity."))
49
+ .css ({ position: "relative", left: "1px", transform: "scale(0.9)" })
50
+ .text ("volume_down")
51
+ .appendTo (this .toolbar)
52
+ .on ("click", () => this .showVolumeSlider ());
53
+
54
+ this .browser .getBrowserOptions () ._SoundIntensity
55
+ .addFieldCallback (this, value => this .updateSoundIntensity (value));
56
+
46
57
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
47
58
 
48
59
  const hierarchy = require ("./Hierarchy");
@@ -105,9 +116,12 @@ module .exports = class Dashboard extends Interface
105
116
  this .config .file .setDefaultValues ({
106
117
  pointer: "arrow",
107
118
  play: this .config .global .play,
119
+ soundIntensity: 1,
108
120
  panel: false,
109
121
  });
110
122
 
123
+ this .browser .setBrowserOption ("SoundIntensity", this .config .file .soundIntensity);
124
+
111
125
  this [this .config .file .pointer] ();
112
126
  this .play ((this .config .file .play) && !this .isInitialScene);
113
127
  this .straighten (this .browser .getBrowserOption ("StraightenHorizon"));
@@ -160,6 +174,25 @@ module .exports = class Dashboard extends Interface
160
174
  this .playButton .removeClass ("active");
161
175
  }
162
176
 
177
+ showVolumeSlider ()
178
+ {
179
+ require ("../Controls/VolumeSliderPopover");
180
+
181
+ this .volumeButton .volumeSliderPopover (this .browser);
182
+ }
183
+
184
+ updateSoundIntensity (value)
185
+ {
186
+ this .config .file .soundIntensity = value;
187
+
188
+ if (value === 0)
189
+ this .volumeButton .text ("volume_off");
190
+ else if (value < 0.75)
191
+ this .volumeButton .text ("volume_down");
192
+ else
193
+ this .volumeButton .text ("volume_up");
194
+ }
195
+
163
196
  selectParent ()
164
197
  {
165
198
  this .selectHierarchy ("up");
@@ -8,6 +8,7 @@ const
8
8
  X3D = require ("../X3D"),
9
9
  Interface = require ("./Interface"),
10
10
  Splitter = require ("../Controls/Splitter"),
11
+ TopBar = require ("./TopBar"),
11
12
  Dashboard = require ("./Dashboard"),
12
13
  Footer = require ("./Footer"),
13
14
  Sidebar = require ("./Sidebar"),
@@ -43,6 +44,7 @@ module .exports = class Document extends Interface
43
44
 
44
45
  this .verticalSplitter = new Splitter ($("#vertical-splitter"), "vertical");
45
46
  this .horizontalSplitter = new Splitter ($("#horizontal-splitter"), "horizontal");
47
+ this .topBar = new TopBar ($("#browser-top-bar"), this);
46
48
  this .secondaryToolbar = new Dashboard ($("#secondary-toolbar"), this);
47
49
  this .footer = new Footer ($("#footer"));
48
50
  this .sidebar = new Sidebar ($("#sidebar"));
@@ -164,7 +166,7 @@ module .exports = class Document extends Interface
164
166
 
165
167
  // Connect browser events.
166
168
 
167
- this .browser ._audio .addInterest ("toggleAudio", this);
169
+ this .browser .getRenderingProperties () ._SoundDestinations .addInterest ("toggleMuteButton", this);
168
170
  this .browser ._activeLayer .addInterest ("toggleGrids", this);
169
171
 
170
172
  // Connect for Snap Target and Snap Source.
@@ -237,8 +239,6 @@ module .exports = class Document extends Interface
237
239
  this .setDisplayTimings (this .config .file .timings);
238
240
  this .setMute (this .config .file .mute);
239
241
 
240
- this .toggleAudio ();
241
-
242
242
  // Configure grids.
243
243
 
244
244
  this .#grids .forEach (grid => grid .dispose ());
@@ -429,13 +429,15 @@ module .exports = class Document extends Interface
429
429
  }
430
430
  else
431
431
  {
432
- await this .loadURL (encodeURI (`data:model/x3d+vrml,
433
- Viewpoint {
434
- description "Initial View"
435
- position 2.869677 3.854335 8.769781
436
- orientation -0.7765887 0.6177187 0.1238285 0.5052317
437
- }
438
- `));
432
+ await this .loadURL (encodeURI (/* xml */ `data:model/x3d+xml,
433
+ <X3D profile='Interchange'>
434
+ <Scene>
435
+ <Viewpoint
436
+ description='Initial View'
437
+ position='2.869677 3.854335 8.769781'
438
+ orientation='-0.7765887 0.6177187 0.1238285 0.5052317'/>
439
+ </Scene>
440
+ </X3D>`));
439
441
 
440
442
  this .activateGridTool ("GridTool", true, false);
441
443
  }
@@ -1327,9 +1329,9 @@ Viewpoint {
1327
1329
  viewpointNode ._set_bind = true;
1328
1330
  }
1329
1331
 
1330
- toggleAudio ()
1332
+ toggleMuteButton ()
1331
1333
  {
1332
- electron .ipcRenderer .sendToHost ("audio", this .browser ._audio .getValue ());
1334
+ electron .ipcRenderer .sendToHost ("mute-button", this .browser .getRenderingProperty ("SoundDestinations"));
1333
1335
  }
1334
1336
 
1335
1337
  /**
@@ -16,9 +16,14 @@ module .exports = class Footer extends Tabs
16
16
 
17
17
  addTabs ()
18
18
  {
19
- this .addTextTab ("console", _("Console"));
20
- this .addTextTab ("script-editor", _("Script Editor"));
21
- this .addTextTab ("animation-editor", _("Animation Editor"));
19
+ this .addIconTextTab ("console", "menu", _("Console"))
20
+ .find (".material-icons") .css ("color", "var(--system-green)");
21
+
22
+ this .addIconTextTab ("script-editor", "data_array", _("Script Editor"))
23
+ .find (".material-icons") .css ("color", "var(--system-blue)");
24
+
25
+ this .addIconTextTab ("animation-editor","animation", _("Animation Editor"))
26
+ .find (".material-icons") .css ("color", "var(--system-indigo)");
22
27
 
23
28
  this .console = new Console (this .getPanel ("console"));
24
29
  }
@@ -1,10 +1,28 @@
1
1
  "use strict";
2
2
 
3
+ const strings = require ("../assets/locale/dictionary.json");
4
+
5
+ let locale, language;
6
+
3
7
  function gettext (string)
4
8
  {
5
- return string;
9
+ const translations = strings [string];
10
+
11
+ return translations ?.[locale]
12
+ ?? translations ?.[language]
13
+ ?? translations ?.["en"]
14
+ ?? string;
6
15
  }
7
16
 
8
- gettext .locale = "en";
17
+ gettext .setLocale = function (value)
18
+ {
19
+ gettext .locale = value;
20
+ gettext .language = value .split ("-") [0];
21
+
22
+ locale = gettext .locale;
23
+ language = gettext .language;
24
+ };
25
+
26
+ gettext .setLocale (Intl .DateTimeFormat () .resolvedOptions() .locale);
9
27
 
10
28
  module .exports = gettext;
@@ -43,9 +43,12 @@ module .exports = new class Tabs
43
43
  {
44
44
  this .config .setDefaultValues ({
45
45
  openTabs: [ ],
46
+ closedTabs: [ ],
46
47
  scrollLeft: 0,
47
48
  });
48
49
 
50
+ electron .ipcRenderer .send ("locale", _.locale);
51
+
49
52
  // Connect to TabGroup Events
50
53
 
51
54
  this .tabs = $("tab-group") .get (0);
@@ -228,14 +231,14 @@ module .exports = new class Tabs
228
231
  .addClass ("material-symbols-outlined")
229
232
  .text ("close");
230
233
 
231
- // Audio Button
234
+ // Sound Button
232
235
 
233
- tab .audioButton = $("<span></span>")
234
- .addClass (["tab-audio", "material-symbols-outlined"])
236
+ tab .muteButton = $("<span></span>")
237
+ .addClass (["tab-mute", "material-symbols-outlined"])
235
238
  .text ("volume_up")
236
239
  .on ("click", () => tab .webview .send ("mute", !tab .mute));
237
240
 
238
- tab .closeButton .before (tab .audioButton);
241
+ tab .closeButton .before (tab .muteButton);
239
242
 
240
243
  // Pin Button
241
244
 
@@ -279,14 +282,14 @@ module .exports = new class Tabs
279
282
  this .setTabURL (tab, tab .url, ... event .args);
280
283
  break;
281
284
  }
282
- case "audio":
285
+ case "mute-button":
283
286
  {
284
- this .toggleAudio (tab, ... event .args);
287
+ this .showMuteButton (tab, ... event .args);
285
288
  break;
286
289
  }
287
290
  case "mute":
288
291
  {
289
- this .toggleMute (tab, ... event .args);
292
+ this .setMute (tab, ... event .args);
290
293
  break;
291
294
  }
292
295
  }
@@ -580,22 +583,19 @@ module .exports = new class Tabs
580
583
  this .config .activeTab = tabs .length ? this .tabs .getActiveTab () .url : undefined;
581
584
  }
582
585
 
583
- toggleAudio (tab, audio)
586
+ showMuteButton (tab, value)
584
587
  {
585
- if (audio)
586
- tab .audioButton .show ();
588
+ if (value)
589
+ tab .muteButton .show ();
587
590
  else
588
- tab .audioButton .hide ();
591
+ tab .muteButton .hide ();
589
592
  }
590
593
 
591
- toggleMute (tab, mute)
594
+ setMute (tab, value)
592
595
  {
593
- tab .mute = mute;
596
+ tab .mute = value;
594
597
 
595
- if (mute)
596
- tab .audioButton .text ("volume_mute");
597
- else
598
- tab .audioButton .text ("volume_up");
598
+ tab .muteButton .text (value ? "volume_mute" : "volume_up");
599
599
  }
600
600
 
601
601
  tabClosing (tab)
@@ -621,19 +621,28 @@ module .exports = new class Tabs
621
621
 
622
622
  tabClose (tab)
623
623
  {
624
- // If all tabs are closed, open empty tab.
624
+ // Save closed tab.
625
625
 
626
626
  const closedTabs = this .config .closedTabs;
627
627
 
628
- closedTabs .push (tab .url);
628
+ if (closedTabs .at (-1) !== tab .url)
629
+ {
630
+ closedTabs .push (tab .url);
629
631
 
630
- this .config .closedTabs = closedTabs;
632
+ this .config .closedTabs = closedTabs .slice (-100);
633
+ }
634
+
635
+ // Add closed url to recent locations.
631
636
 
632
637
  electron .ipcRenderer .send ("add-recent-location", tab .url);
633
638
 
639
+ // If all tabs are closed, open empty tab.
640
+
634
641
  if (!this .tabs .getTabs () .length)
635
642
  this .openTabs ();
636
643
 
644
+ // Save tabs.
645
+
637
646
  this .saveTabs ();
638
647
  }
639
648
 
@@ -703,9 +712,6 @@ module .exports = new class Tabs
703
712
 
704
713
  maintenance ()
705
714
  {
706
- // Limit closed tabs.
707
- this .config .closedTabs = this .config .closedTabs .slice (-1000);
708
-
709
715
  // Remove items older than one year, time in milliseconds.
710
716
  // new DataStorage (localStorage, "Sunrize.") .removeItems (Date .now () - (1000 * 60 * 60 * 24 * 365));
711
717
  }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ const
4
+ $ = require ("jquery"),
5
+ electron = require ("electron"),
6
+ Interface = require ("./Interface"),
7
+ Editor = require("../Undo/Editor"),
8
+ _ = require ("./GetText");
9
+
10
+ module .exports = class TopBar extends Interface
11
+ {
12
+ constructor (element, document)
13
+ {
14
+ super ("Sunrize.TopBar.");
15
+
16
+ this .document = document;
17
+ this .topBar = element;
18
+
19
+ this .setup ();
20
+ }
21
+
22
+ async initialize ()
23
+ {
24
+ }
25
+
26
+ configure ()
27
+ {
28
+ this .config .file .setDefaultValues ({
29
+ });
30
+ }
31
+ };
32
+
@@ -1,12 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const
4
- $ = require ("jquery"),
5
- path = require ("path"),
6
- X3D = require ("../X3D"),
7
- Editor = require ("../Undo/Editor"),
8
- UndoManager = require("../Undo/UndoManager"),
9
- _ = require ("../Application/GetText");
3
+ const $ = require ("jquery");
10
4
 
11
5
  require ("./Popover");
12
6
 
@@ -44,7 +38,7 @@ $.fn.audioPreviewPopover = async function (node)
44
38
 
45
39
  // Create tooltip.
46
40
 
47
- const tooltip = this .popover ({
41
+ this .popover ({
48
42
  preview: true,
49
43
  content: preview,
50
44
  show: {
@@ -55,18 +55,22 @@ module .exports = class Tabs extends Interface
55
55
  {
56
56
  const tab = $("<li></li>")
57
57
  .append ($("<a></a>")
58
+ .addClass ("text")
58
59
  .attr ("href", `#${id}-tab`)
59
60
  .attr ("title", title)
60
61
  .text (title))
61
62
  .appendTo (this .tabs);
62
63
 
63
64
  this .addPanel (id);
65
+
66
+ return tab;
64
67
  }
65
68
 
66
69
  addIconTab (id, icon, title)
67
70
  {
68
- $("<li></li>")
71
+ const tab = $("<li></li>")
69
72
  .append ($("<a></a>")
73
+ .addClass ("icon")
70
74
  .attr ("href", `#${id}-tab`)
71
75
  .attr ("title", title)
72
76
  .append ($("<span></span>")
@@ -75,6 +79,27 @@ module .exports = class Tabs extends Interface
75
79
  .appendTo (this .tabs);
76
80
 
77
81
  this .addPanel (id);
82
+
83
+ return tab;
84
+ }
85
+
86
+ addIconTextTab (id, icon, title)
87
+ {
88
+ const tab = $("<li></li>")
89
+ .append ($("<a></a>")
90
+ .addClass ("icon-text")
91
+ .attr ("href", `#${id}-tab`)
92
+ .attr ("title", title)
93
+ .attr ("ondragstart", "return false;")
94
+ .text (title)
95
+ .prepend ($("<span></span>")
96
+ .addClass ("material-icons")
97
+ .text (icon)))
98
+ .appendTo (this .tabs);
99
+
100
+ this .addPanel (id);
101
+
102
+ return tab;
78
103
  }
79
104
 
80
105
  addPanel (id)
@@ -92,5 +117,6 @@ module .exports = class Tabs extends Interface
92
117
  return this .element .find (`.tabs-panel.${id}`);
93
118
  }
94
119
 
95
- initTab (panel) { }
120
+ initTab ()
121
+ { }
96
122
  };
@@ -114,22 +114,22 @@ $.fn.texturePreviewPopover = async function (node)
114
114
  {
115
115
  case X3D .X3DConstants .MovieTexture:
116
116
  {
117
- sizes .text (`${node .getWidth ()} × ${node .getHeight ()}, ${formatTime (node ._duration_changed .getValue ())}, ${format}`);
117
+ sizes .text (`${node .getWidth ()} × ${node .getHeight ()} px, ${formatTime (node ._duration_changed .getValue ())}, ${format}`);
118
118
  break;
119
119
  }
120
120
  case X3D .X3DConstants .X3DEnvironmentTextureNode:
121
121
  {
122
- sizes .text (`${node .getSize ()} × ${node .getSize ()}, ${format}`);
122
+ sizes .text (`${node .getSize ()} × ${node .getSize ()} px, ${format}`);
123
123
  break;
124
124
  }
125
125
  case X3D .X3DConstants .X3DTexture2DNode:
126
126
  {
127
- sizes .text (`${node .getWidth ()} × ${node .getHeight ()}, ${format}`);
127
+ sizes .text (`${node .getWidth ()} × ${node .getHeight ()} px, ${format}`);
128
128
  break;
129
129
  }
130
130
  case X3D .X3DConstants .X3DTexture3DNode:
131
131
  {
132
- sizes .text (`${node .getWidth ()} × ${node .getHeight ()} × ${node .getDepth ()}, ${format}`);
132
+ sizes .text (`${node .getWidth ()} × ${node .getHeight ()} × ${node .getDepth ()} px, ${format}`);
133
133
  break;
134
134
  }
135
135
  default:
@@ -152,7 +152,7 @@ $.fn.texturePreviewPopover = async function (node)
152
152
 
153
153
  // Create tooltip.
154
154
 
155
- const tooltip = this .popover ({
155
+ this .popover ({
156
156
  preview: true,
157
157
  content: preview,
158
158
  show: {
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  const
4
- $ = require ("jquery"),
5
- path = require ("path"),
6
- X3D = require ("../X3D"),
7
- Editor = require ("../Undo/Editor"),
8
- UndoManager = require("../Undo/UndoManager"),
9
- _ = require ("../Application/GetText");
4
+ $ = require ("jquery"),
5
+ X3D = require ("../X3D"),
6
+ _ = require ("../Application/GetText");
10
7
 
11
8
  require ("./Popover");
12
9
 
@@ -64,7 +61,7 @@ $.fn.videoPreviewPopover = async function (node)
64
61
  }
65
62
  case X3D .X3DConstants .COMPLETE_STATE:
66
63
  {
67
- sizes .text (`${node .getWidth ()} × ${node .getHeight ()}`);
64
+ sizes .text (`${node .getWidth ()} × ${node .getHeight ()} px`);
68
65
  break;
69
66
  }
70
67
  }
@@ -86,7 +83,7 @@ $.fn.videoPreviewPopover = async function (node)
86
83
 
87
84
  // Create tooltip.
88
85
 
89
- const tooltip = this .popover ({
86
+ this .popover ({
90
87
  preview: true,
91
88
  content: preview,
92
89
  show: {
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ const $ = require ("jquery");
4
+
5
+ require ("./Popover");
6
+
7
+ $.fn.volumeSliderPopover = function (browser)
8
+ {
9
+ // Create content.
10
+
11
+ const input = $("<input>")
12
+ .attr ("type", "range")
13
+ .attr ("min", 0)
14
+ .attr ("max", 1)
15
+ .attr ("step", "any")
16
+ .val (browser .getBrowserOption ("SoundIntensity"))
17
+ .css ({ "height": 120, "writing-mode": "vertical-lr", "direction": "rtl" })
18
+ .on ("input", () => browser .setBrowserOption ("SoundIntensity", input .val ()));
19
+
20
+ // Create tooltip.
21
+
22
+ this .popover ({
23
+ content: input,
24
+ position: {
25
+ my: "right top",
26
+ at: "bottom left",
27
+ },
28
+ style: {
29
+ classes: "qtip-tipsy qtip-preview qtip-sound-intensity",
30
+ },
31
+ events: {
32
+ hide: (event, api) =>
33
+ {
34
+ api .destroy (true);
35
+ },
36
+ },
37
+ });
38
+
39
+ return this;
40
+ };
41
+