janusweb 1.5.29 → 1.5.33
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/LICENSE +1 -1
- package/media/assets/janus-avatar-animations.glb +0 -0
- package/media/assets/janus-avatar-base.glb +0 -0
- package/media/assets/webui/apps/avatar/avatar.css +6 -2
- package/media/assets/webui/apps/avatar/avatar.js +97 -10
- package/media/assets/webui/apps/buttons/buttons.html +2 -2
- package/media/assets/webui/apps/buttons/buttons.js +3 -3
- package/media/assets/webui/apps/comms/comms.js +7 -4
- package/media/assets/webui/apps/comms/voip.js +138 -55
- package/media/assets/webui/apps/editor/editor.js +2 -0
- package/media/assets/webui/apps/inventory/inventory.html +7 -4
- package/media/assets/webui/apps/inventory/inventory.js +1 -1
- package/media/assets/webui/apps/locomotion/teleporter.js +9 -8
- package/media/assets/webui/apps/settings/settings.html +1 -1
- package/media/assets/webui/apps/virtualgamepad/virtualgamepad.js +9 -7
- package/media/assets/webui/apps/xrmenu/xrmenu.js +13 -4
- package/media/assets/webui/none.json +1 -0
- package/media/assets.json +2 -1
- package/media/index.html +1 -1
- package/media/lib/draco/README.md +32 -0
- package/media/lib/draco/draco_decoder.js +52 -0
- package/media/lib/draco/draco_decoder.wasm +0 -0
- package/media/lib/draco/draco_encoder.js +33 -0
- package/media/lib/draco/draco_wasm_wrapper.js +104 -0
- package/media/lib/draco/gltf/draco_decoder.js +48 -0
- package/media/lib/draco/gltf/draco_decoder.wasm +0 -0
- package/media/lib/draco/gltf/draco_encoder.js +33 -0
- package/media/lib/draco/gltf/draco_wasm_wrapper.js +104 -0
- package/media/lib/physx/physx.release.js +21 -0
- package/media/lib/physx/physx.release.wasm +0 -0
- package/media/manifest.json +5 -5
- package/media/service-worker.js +7 -0
- package/package.json +1 -1
- package/scripts/client.js +4 -3
- package/scripts/config.js +2 -0
- package/scripts/elements/linesegments.js +5 -1
- package/scripts/external/JanusFireboxParser.js +1 -0
- package/scripts/image.js +7 -1
- package/scripts/janusbase.js +83 -34
- package/scripts/janusghost.js +314 -15
- package/scripts/januslight.js +11 -2
- package/scripts/janusparagraph.js +3 -3
- package/scripts/janusparticle.js +16 -5
- package/scripts/janusplayer.js +124 -35
- package/scripts/janusweb.js +5 -0
- package/scripts/janusxrplayer.js +2 -3
- package/scripts/multiplayermanager.js +3 -1
- package/scripts/object.js +106 -10
- package/scripts/portal.js +28 -12
- package/scripts/remoteplayer.js +1 -25
- package/scripts/room.js +116 -36
- package/scripts/sound.js +8 -5
- package/scripts/text.js +3 -3
- package/scripts/websurface.js +6 -1
- package/utils/build.sh +3 -0
- package/utils/init.sh +2 -2
- package/scripts/chat.js +0 -80
- package/scripts/ui.js +0 -265
- package/scripts/urlbar.js +0 -93
- package/templates/janusweb.tpl +0 -3
package/scripts/chat.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
elation.requireCSS('janusweb.chat');
|
|
2
|
-
elation.require(['ui.window', 'ui.list', 'ui.input', 'elation.collection'], function() {
|
|
3
|
-
elation.template.add('janusweb.chat.message', '[{userId}] {message}');
|
|
4
|
-
|
|
5
|
-
elation.component.add('janusweb.chat', function() {
|
|
6
|
-
this.init = function() {
|
|
7
|
-
this.args.title = 'Chat Log';
|
|
8
|
-
this.args.bottom = true;
|
|
9
|
-
this.args.resizable = false;
|
|
10
|
-
this.args.controls = true;
|
|
11
|
-
this.client = this.args.client;
|
|
12
|
-
this.player = this.args.player || this.client.player;
|
|
13
|
-
this.network = this.args.network;
|
|
14
|
-
|
|
15
|
-
elation.janusweb.chat.extendclass.init.call(this);
|
|
16
|
-
|
|
17
|
-
this.chatbutton = elation.ui.button({classname: 'janusweb_chat', label: 'Chat'});
|
|
18
|
-
elation.events.add(this.chatbutton, 'ui_button_click', elation.bind(this, this.toggleChat));
|
|
19
|
-
this.client.buttons.add('chat', this.chatbutton);
|
|
20
|
-
|
|
21
|
-
this.messagecollection = elation.collection.indexed({index: 'timestamp'});
|
|
22
|
-
var panel = elation.ui.panel_vertical({classname: 'janusweb_chat_panel'});
|
|
23
|
-
this.messagelist = elation.ui.list({append: panel, classname: 'janusweb_chat_messages', itemcollection: this.messagecollection, attrs: {itemtemplate: 'janusweb.chat.message'}});
|
|
24
|
-
this.input = elation.ui.input({
|
|
25
|
-
append: panel,
|
|
26
|
-
classname: 'janusweb_chat_input',
|
|
27
|
-
placeholder: 'Press T to talk',
|
|
28
|
-
events: {
|
|
29
|
-
ui_input_accept: elation.bind(this, this.sendmessage),
|
|
30
|
-
focus: elation.bind(this, this.focus),
|
|
31
|
-
blur: elation.bind(this, this.blur),
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
this.setcontent(panel);
|
|
36
|
-
this.hide();
|
|
37
|
-
}
|
|
38
|
-
this.addmessage = function(msg) {
|
|
39
|
-
if (!msg.timestamp) msg.timestamp = window.performance.now();
|
|
40
|
-
var bottom = this.messagelist.isScrollAtBottom();
|
|
41
|
-
if (elation.utils.isObject(msg.message)) {
|
|
42
|
-
msg.message = msg.message.data;
|
|
43
|
-
}
|
|
44
|
-
this.messagecollection.add(msg);
|
|
45
|
-
if (bottom) {
|
|
46
|
-
this.messagelist.scrollToBottom();
|
|
47
|
-
}
|
|
48
|
-
this.refresh();
|
|
49
|
-
}
|
|
50
|
-
this.sendmessage = function() {
|
|
51
|
-
this.network.send({'method': 'chat', data: this.input.value});
|
|
52
|
-
var msg = {userId: 'me', message: this.input.value, self: true};
|
|
53
|
-
this.addmessage(msg);
|
|
54
|
-
elation.events.fire({element: this, type: 'janusweb_chat_send', data: msg});
|
|
55
|
-
this.input.value = '';
|
|
56
|
-
}
|
|
57
|
-
this.focus = function() {
|
|
58
|
-
if (this.input) {
|
|
59
|
-
this.input.focus();
|
|
60
|
-
}
|
|
61
|
-
if (this.player) {
|
|
62
|
-
this.player.disable();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
this.blur = function() {
|
|
66
|
-
if (this.player) {
|
|
67
|
-
this.player.enable();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
this.toggleChat = function() {
|
|
71
|
-
if (this.hidden) {
|
|
72
|
-
this.show();
|
|
73
|
-
this.refresh();
|
|
74
|
-
} else {
|
|
75
|
-
this.hide();
|
|
76
|
-
this.refresh();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, elation.ui.window);
|
|
80
|
-
});
|
package/scripts/ui.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
elation.require(['ui.all', 'janusweb.urlbar'], function() {
|
|
2
|
-
elation.component.add('janusweb.ui.old', function() {
|
|
3
|
-
this.init = function() {
|
|
4
|
-
elation.janusweb.ui.navigation.extendclass.init.call(this);
|
|
5
|
-
|
|
6
|
-
this.client = this.args.client;
|
|
7
|
-
this.player = this.client.player;
|
|
8
|
-
this.janusweb = this.client.janusweb;
|
|
9
|
-
|
|
10
|
-
this.createUI();
|
|
11
|
-
//this.createUI3D();
|
|
12
|
-
}
|
|
13
|
-
this.createUI = function() {
|
|
14
|
-
this.navigation = elation.ui.panel({append: this, classname: 'janusweb_ui_navigation'})
|
|
15
|
-
this.backbutton = elation.ui.button({append: this.navigation, label: '◀', events: { click: elation.bind(this.janusweb, this.janusweb.navigateBack) } });
|
|
16
|
-
this.homebutton = elation.ui.button({append: this.navigation, label: '🏠', events: { click: elation.bind(this.janusweb, this.janusweb.navigateHome) } });
|
|
17
|
-
this.urlbar = elation.janusweb.urlbar({
|
|
18
|
-
append: this.navigation,
|
|
19
|
-
label: '',
|
|
20
|
-
value: this.janusweb.properties.url,
|
|
21
|
-
janusweb: this.janusweb,
|
|
22
|
-
client: this.client,
|
|
23
|
-
events: {
|
|
24
|
-
ui_input_accept: elation.bind(this, function(ev) { this.janusweb.setActiveRoom(ev.data); this.client.hideMenu(); this.player.enable(); }),
|
|
25
|
-
focus: elation.bind(this, function(ev) { this.player.disable(); }),
|
|
26
|
-
blur: elation.bind(this, function(ev) { this.player.enable(); }),
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.createUI3D = function() {
|
|
32
|
-
var nav3d = this.janusweb.spawn('generic', 'janusweb_navigation_3d', { position: [0,1,5] });
|
|
33
|
-
this.navigation3d = elation.ui.panel3d({append3d: nav3d, panelorientation: 'horizontal', classname: 'janusweb_ui_navigation'})
|
|
34
|
-
|
|
35
|
-
this.backbutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '◀', events: { click: elation.bind(this.janusweb, this.janusweb.navigateBack) } });
|
|
36
|
-
this.forwardbutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '▶', events: { click: elation.bind(this.janusweb, this.janusweb.navigateForward) } });
|
|
37
|
-
this.homebutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '🏠', events: { click: elation.bind(this.janusweb, this.janusweb.navigateHome) } });
|
|
38
|
-
}
|
|
39
|
-
this.enable = function() {
|
|
40
|
-
elation.janusweb.ui.navigation.extendclass.enable.call(this);
|
|
41
|
-
this.navigation.enable();
|
|
42
|
-
}
|
|
43
|
-
this.disable = function() {
|
|
44
|
-
elation.janusweb.ui.navigation.extendclass.disable.call(this);
|
|
45
|
-
this.navigation.disable();
|
|
46
|
-
}
|
|
47
|
-
}, elation.ui.base);
|
|
48
|
-
|
|
49
|
-
/* base3d */
|
|
50
|
-
elation.component.add('ui.base3d', function() {
|
|
51
|
-
this.init = function() {
|
|
52
|
-
var append3d = this.args.append3d;
|
|
53
|
-
if (append3d.sceneobj) append3d = append3d.sceneobj;
|
|
54
|
-
this.style = new elation.ui.style3d();
|
|
55
|
-
|
|
56
|
-
if (append3d) {
|
|
57
|
-
this.engine = append3d.engine;
|
|
58
|
-
this.client = this.engine.client;
|
|
59
|
-
this.sceneobj = this.create();
|
|
60
|
-
if (this.sceneobj) {
|
|
61
|
-
append3d.add(this.sceneobj);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
this.create = function() {
|
|
66
|
-
}
|
|
67
|
-
this.dimensions = function() {
|
|
68
|
-
if (this.sceneobj) {
|
|
69
|
-
var bounds = this.sceneobj.getBoundingBox();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, elation.ui.base);
|
|
73
|
-
|
|
74
|
-
/* panel */
|
|
75
|
-
elation.component.add('ui.panel3d', function() {
|
|
76
|
-
this.init = function() {
|
|
77
|
-
elation.ui.panel3d.extendclass.init.call(this);
|
|
78
|
-
}
|
|
79
|
-
this.create = function() {
|
|
80
|
-
return elation.engine.things.ui_panel({engine: this.client.engine, client: this.client, properties: this.args, id: Math.floor(Math.random() * 1e10), events: this.events});
|
|
81
|
-
}
|
|
82
|
-
}, elation.ui.base3d);
|
|
83
|
-
elation.component.add('engine.things.ui_panel', function() {
|
|
84
|
-
this.postinit = function() {
|
|
85
|
-
elation.engine.things.ui_panel.extendclass.postinit.call(this);
|
|
86
|
-
this.defineProperties({
|
|
87
|
-
panelorientation: { type: 'string', default: 'vertical' }
|
|
88
|
-
});
|
|
89
|
-
elation.events.add(this, 'thing_add', elation.bind(this, this.update));
|
|
90
|
-
}
|
|
91
|
-
this.createObject3D = function() {
|
|
92
|
-
var box = new THREE.BoxGeometry(1,1,1);
|
|
93
|
-
var mat = new THREE.MeshBasicMaterial({color: 0xff0000, wireframe: true});
|
|
94
|
-
var bbox = new THREE.Mesh(box, mat);
|
|
95
|
-
|
|
96
|
-
this.geometry = box;
|
|
97
|
-
|
|
98
|
-
var obj = new THREE.Object3D();
|
|
99
|
-
obj.add(bbox);
|
|
100
|
-
bbox.visible = false;
|
|
101
|
-
return obj;
|
|
102
|
-
}
|
|
103
|
-
this.update = function() {
|
|
104
|
-
var offset = [0,0,0];
|
|
105
|
-
var size = new THREE.Vector3();
|
|
106
|
-
var bounds = new THREE.Box3();
|
|
107
|
-
|
|
108
|
-
// Use the 3d object's children since it's a regular array, in order of insertion
|
|
109
|
-
for (var i = 0; i < this.objects['3d'].children.length; i++) {
|
|
110
|
-
if (!this.objects['3d'].children[i].userData || !this.objects['3d'].children[i].userData.thing) continue;
|
|
111
|
-
var child = this.objects['3d'].children[i].userData.thing;
|
|
112
|
-
var dims = child.getBoundingBox();
|
|
113
|
-
dims.size(size);
|
|
114
|
-
child.position.x = offset[0];
|
|
115
|
-
child.position.y = offset[1];
|
|
116
|
-
child.position.z = offset[2];
|
|
117
|
-
|
|
118
|
-
if (this.panelorientation == 'horizontal') {
|
|
119
|
-
offset[0] += size.x;
|
|
120
|
-
} else if (this.panelorientation == 'vertical') {
|
|
121
|
-
offset[1] -= size.y;
|
|
122
|
-
} else if (this.panelorientation == 'depth') {
|
|
123
|
-
offset[2] += size.z;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var dims = child.getBoundingBox();
|
|
127
|
-
bounds.expandByPoint(dims.min);
|
|
128
|
-
bounds.expandByPoint(dims.max);
|
|
129
|
-
}
|
|
130
|
-
var worldpos = this.localToWorld(new THREE.Vector3(0,0,0));
|
|
131
|
-
bounds.min.sub(worldpos);
|
|
132
|
-
bounds.max.sub(worldpos);
|
|
133
|
-
bounds.size(size);
|
|
134
|
-
//this.objects['3d'].scale.set(size.x, size.y, size.z);
|
|
135
|
-
|
|
136
|
-
this.geometry.vertices[0].set(bounds.max.x, bounds.max.y, bounds.max.z);
|
|
137
|
-
this.geometry.vertices[1].set(bounds.max.x, bounds.max.y, bounds.min.z);
|
|
138
|
-
this.geometry.vertices[2].set(bounds.max.x, bounds.min.y, bounds.max.z);
|
|
139
|
-
this.geometry.vertices[3].set(bounds.max.x, bounds.min.y, bounds.min.z);
|
|
140
|
-
this.geometry.vertices[4].set(bounds.min.x, bounds.max.y, bounds.min.z);
|
|
141
|
-
this.geometry.vertices[5].set(bounds.min.x, bounds.max.y, bounds.max.z);
|
|
142
|
-
this.geometry.vertices[6].set(bounds.min.x, bounds.min.y, bounds.min.z);
|
|
143
|
-
this.geometry.vertices[7].set(bounds.min.x, bounds.min.y, bounds.max.z);
|
|
144
|
-
|
|
145
|
-
if (this.geometry.boundingBox) {
|
|
146
|
-
this.geometry.boundingBox.copy(bounds);
|
|
147
|
-
} else {
|
|
148
|
-
this.geometry.boundingBox = bounds;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, elation.engine.things.generic);
|
|
152
|
-
|
|
153
|
-
/* button */
|
|
154
|
-
elation.component.add('ui.button3d', function() {
|
|
155
|
-
this.create = function() {
|
|
156
|
-
return elation.engine.things.ui_button({engine: this.client.engine, client: this.client, properties: this.args, id: Math.floor(Math.random() * 1e10), events: this.events});
|
|
157
|
-
}
|
|
158
|
-
}, elation.ui.base3d);
|
|
159
|
-
elation.component.add('engine.things.ui_button', function() {
|
|
160
|
-
this.postinit = function() {
|
|
161
|
-
elation.engine.things.ui_panel.extendclass.postinit.call(this);
|
|
162
|
-
this.defineProperties({
|
|
163
|
-
label: { type: 'string', default: '' },
|
|
164
|
-
fontSize: { type: 'integer', default: 512 },
|
|
165
|
-
font: { type: 'string', default: 'Open Sans Regular' },
|
|
166
|
-
});
|
|
167
|
-
elation.events.add(this, 'mouseover,mouseout,mousedown,mouseup,click', this);
|
|
168
|
-
}
|
|
169
|
-
this.createObject3D = function() {
|
|
170
|
-
var box = new THREE.BoxGeometry(1,0.5,0.1);
|
|
171
|
-
box.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,.05));
|
|
172
|
-
var mat = new THREE.MeshBasicMaterial({color: 0x0000ff, wireframe: true});
|
|
173
|
-
var bbox = new THREE.Mesh(box, mat);
|
|
174
|
-
|
|
175
|
-
var labelgen = this.getAssetWrapper();
|
|
176
|
-
var label = labelgen.getLabel(this.label);
|
|
177
|
-
|
|
178
|
-
var buttongeo = new THREE.BoxGeometry(0.8,.4,.1);
|
|
179
|
-
var buttonmat = new THREE.MeshPhongMaterial({color: 0x999999, map: label});
|
|
180
|
-
var sidemat = new THREE.MeshPhongMaterial({color: 0x999999});
|
|
181
|
-
var button = new THREE.Mesh(buttongeo, new THREE.MeshFaceMaterial([sidemat, sidemat, sidemat, sidemat, buttonmat, sidemat]));
|
|
182
|
-
|
|
183
|
-
this.geometry = buttongeo;
|
|
184
|
-
this.material = buttonmat;
|
|
185
|
-
|
|
186
|
-
var obj = new THREE.Object3D();
|
|
187
|
-
bbox.visible = false;
|
|
188
|
-
obj.add(bbox);
|
|
189
|
-
obj.add(button);
|
|
190
|
-
|
|
191
|
-
return obj;
|
|
192
|
-
}
|
|
193
|
-
this.createChildren = function() {
|
|
194
|
-
}
|
|
195
|
-
this.createForces = function() {
|
|
196
|
-
this.geometry.computeBoundingBox();
|
|
197
|
-
this.setCollider('box', this.geometry.boundingBox);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
this.mouseover = function() {
|
|
201
|
-
this.material.color.setHex(0xccffcc);
|
|
202
|
-
}
|
|
203
|
-
this.mouseout = function() {
|
|
204
|
-
this.material.color.setHex(0x999999)
|
|
205
|
-
}
|
|
206
|
-
this.mousedown = function() {
|
|
207
|
-
alert('e');
|
|
208
|
-
this.scale.z = 0.5;
|
|
209
|
-
}
|
|
210
|
-
this.mouseup = function() {
|
|
211
|
-
this.scale.z = 1.0;
|
|
212
|
-
}
|
|
213
|
-
this.getAssetWrapper = function() {
|
|
214
|
-
var color = (this.properties.color instanceof THREE.Color ? this.properties.color : new THREE.Color(this.properties.color));
|
|
215
|
-
if (!this.labelgen) {
|
|
216
|
-
var genname = ['label2d', this.font, this.fontSize, color.getHexString()].join('_');
|
|
217
|
-
var asset = elation.engine.assets.find('labelgen', genname);
|
|
218
|
-
if (!asset) {
|
|
219
|
-
asset = elation.engine.assets.get({
|
|
220
|
-
assettype: 'labelgen',
|
|
221
|
-
assetname: genname,
|
|
222
|
-
color: '#' + color.getHexString(),
|
|
223
|
-
font: this.font,
|
|
224
|
-
fontSize: this.fontSize,
|
|
225
|
-
outlineSize: 0
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
this.labelgen = asset;
|
|
229
|
-
}
|
|
230
|
-
return this.labelgen;
|
|
231
|
-
}
|
|
232
|
-
}, elation.engine.things.generic);
|
|
233
|
-
|
|
234
|
-
elation.define('ui.style3d', {
|
|
235
|
-
margin: function() { },
|
|
236
|
-
marginLeft: 0,
|
|
237
|
-
marginRight: 0,
|
|
238
|
-
marginTop: 0,
|
|
239
|
-
marginBottom: 0,
|
|
240
|
-
marginFront: 0,
|
|
241
|
-
marginBack: 0,
|
|
242
|
-
|
|
243
|
-
padding: function() { },
|
|
244
|
-
paddingLeft: 0,
|
|
245
|
-
paddingRight: 0,
|
|
246
|
-
paddingTop: 0,
|
|
247
|
-
paddingBottom: 0,
|
|
248
|
-
paddingFront: 0,
|
|
249
|
-
paddingBack: 0,
|
|
250
|
-
|
|
251
|
-
width: 'auto',
|
|
252
|
-
height: 'auto',
|
|
253
|
-
depth: 'auto',
|
|
254
|
-
|
|
255
|
-
border: function() { },
|
|
256
|
-
borderWidth: 0,
|
|
257
|
-
borderColor: 0xffffff,
|
|
258
|
-
borderStyle: 'solid',
|
|
259
|
-
borderRadius: 0,
|
|
260
|
-
|
|
261
|
-
background: function() { },
|
|
262
|
-
backgroundColor: 'trans',
|
|
263
|
-
backgroundImage: null,
|
|
264
|
-
});
|
|
265
|
-
});
|
package/scripts/urlbar.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
elation.require(['ui.input'], function() {
|
|
2
|
-
elation.requireCSS('janusweb.urlbar');
|
|
3
|
-
|
|
4
|
-
elation.component.add('janusweb.urlbar', function() {
|
|
5
|
-
this.create = function() {
|
|
6
|
-
this.janusweb = this.args.janusweb;
|
|
7
|
-
this.client = this.args.client;
|
|
8
|
-
|
|
9
|
-
this.indicator = elation.ui.indicator({ append: this, state: 'ready' });
|
|
10
|
-
this.addclass('janusweb_urlbar');
|
|
11
|
-
|
|
12
|
-
if (this.container instanceof HTMLInputElement) {
|
|
13
|
-
this.inputelement = this.container;
|
|
14
|
-
} else {
|
|
15
|
-
var inputs = elation.find('input', this.container);
|
|
16
|
-
if (inputs.length > 0) {
|
|
17
|
-
this.inputelement = inputs[0];
|
|
18
|
-
} else {
|
|
19
|
-
this.inputelement = elation.html.create({tag: 'input', append: this.container});
|
|
20
|
-
if (this.args.type) {
|
|
21
|
-
this.inputelement.type = this.args.type;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
this.progress = elation.ui.progressbar({ append: this, value: 0, classname: 'janusweb_urlbar_progress' });
|
|
27
|
-
this.progress.hide();
|
|
28
|
-
|
|
29
|
-
if (this.args.id) {
|
|
30
|
-
this.inputelement.id = this.args.id;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
elation.events.add(this.janusweb, 'room_change', elation.bind(this, this.updateCurrentURL));
|
|
34
|
-
}
|
|
35
|
-
this.updateCurrentURL = function() {
|
|
36
|
-
this.value = this.janusweb.url;
|
|
37
|
-
var room = this.janusweb.currentroom;
|
|
38
|
-
elation.events.add(room, 'room_load_queued', elation.bind(this, this.updateStatus, 'queued'));
|
|
39
|
-
elation.events.add(room, 'room_load_start', elation.bind(this, this.updateStatus, 'downloading'));
|
|
40
|
-
elation.events.add(room, 'room_load_processing', elation.bind(this, this.updateStatus, 'processing'));
|
|
41
|
-
elation.events.add(room, 'room_load_processed', elation.bind(this, this.updateRoomAssets));
|
|
42
|
-
elation.events.add(room, 'room_load_complete', elation.bind(this, this.updateStatus, 'complete'));
|
|
43
|
-
|
|
44
|
-
elation.events.add(room, 'room_load_progress', elation.bind(this, this.updateProgress));
|
|
45
|
-
|
|
46
|
-
elation.events.add(room, 'room_add_asset', elation.bind(this, this.roomAddAsset));
|
|
47
|
-
this.loading = {};
|
|
48
|
-
this.progress.set(0);
|
|
49
|
-
this.progress.show();
|
|
50
|
-
}
|
|
51
|
-
this.updateStatus = function(status, ev) {
|
|
52
|
-
}
|
|
53
|
-
this.updateRoomAssets = function(ev) {
|
|
54
|
-
this.updateStatus('processed');
|
|
55
|
-
var room = this.janusweb.currentroom;
|
|
56
|
-
var assets = room.getActiveAssets();
|
|
57
|
-
for (var type in assets) {
|
|
58
|
-
for (var id in assets[type]) {
|
|
59
|
-
var asset = assets[type][id];
|
|
60
|
-
elation.events.add(asset, 'asset_load_progress', elation.bind(this, this.updateProgress));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
this.roomAddAsset = function(ev) {
|
|
65
|
-
var room = this.janusweb.currentroom;
|
|
66
|
-
var asset = ev.data;
|
|
67
|
-
|
|
68
|
-
if (!this.loading[asset.src]) {
|
|
69
|
-
elation.events.add(asset, 'asset_load_progress', elation.bind(this, this.updateProgress));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
this.updateProgress = function(ev) {
|
|
73
|
-
//console.log('room had some progress', this.loading);
|
|
74
|
-
var progress = ev.data;
|
|
75
|
-
|
|
76
|
-
var url = progress.src;
|
|
77
|
-
if (!this.loading[url]) {
|
|
78
|
-
this.loading[url] = progress;
|
|
79
|
-
}
|
|
80
|
-
this.loading[url].loaded = progress.loaded;
|
|
81
|
-
|
|
82
|
-
var loaded = 0, total = 0, count = 0;
|
|
83
|
-
for (var k in this.loading) {
|
|
84
|
-
count++;
|
|
85
|
-
loaded += this.loading[k].loaded;
|
|
86
|
-
total += this.loading[k].total;
|
|
87
|
-
}
|
|
88
|
-
var percent = loaded / total;
|
|
89
|
-
//console.log('room had some progress', count + ' files, ' + loaded + ' / ' + total + ' bytes, ' + percent.toFixed(2) + '%', url);
|
|
90
|
-
this.progress.set(percent);
|
|
91
|
-
}
|
|
92
|
-
}, elation.ui.input);
|
|
93
|
-
});
|
package/templates/janusweb.tpl
DELETED