catlab-remote-client 1.3.9 → 2.0.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/dist/css/style.css +3 -2
- package/dist/scripts/WorkerPolyfills.js +219 -0
- package/dist/scripts/catlabremote.js +1 -1
- package/dist/scripts/main.js +8 -2
- package/dist/scripts/providermain.js +1 -1
- package/dist/scripts/webcontrol.js +1 -1
- package/dist/scripts/webremote.js +1 -1
- package/dist/scripts/webworker.js +134 -0
- package/dist/themes/portal/images/remote_atlas_.png +0 -0
- package/dist/themes/portal/remote.js +2386 -0
- package/package.json +17 -16
- package/dist/themes/createjs/createjsassets.html +0 -30
- package/dist/themes/createjs/createjsassets.js +0 -215
- package/dist/themes/quizwitz/images/BG_3.jpg +0 -0
- package/dist/themes/quizwitz/images/HD_background_02.jpg +0 -0
- package/dist/themes/quizwitz/images/Playersaccount_V_20.jpg +0 -0
- package/dist/themes/quizwitz/images/remote_atlas_.png +0 -0
- package/dist/themes/quizwitz/remote.html +0 -69
- package/dist/themes/quizwitz/remote.js +0 -1276
package/dist/css/style.css
CHANGED
|
@@ -55,6 +55,7 @@ body, #catlab-token-form
|
|
|
55
55
|
|
|
56
56
|
#catlab-token-form {
|
|
57
57
|
overflow: hidden;
|
|
58
|
+
min-width: 50vh;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
#catlab-token-form p {
|
|
@@ -75,7 +76,7 @@ body, #catlab-token-form
|
|
|
75
76
|
{
|
|
76
77
|
box-sizing: border-box;
|
|
77
78
|
font-size: 2em;
|
|
78
|
-
width:
|
|
79
|
+
width: 85%;
|
|
79
80
|
margin: 10vh auto;
|
|
80
81
|
padding: 5vmin 2vmin;
|
|
81
82
|
background:#DBD4D6;
|
|
@@ -92,7 +93,7 @@ body, #catlab-token-form
|
|
|
92
93
|
{
|
|
93
94
|
box-sizing: border-box;
|
|
94
95
|
font-size: 2em;
|
|
95
|
-
width:
|
|
96
|
+
width :85%;
|
|
96
97
|
margin: 10vh auto;
|
|
97
98
|
background: #492830;
|
|
98
99
|
padding: 5vmin 2vmin;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkerPolyfills — Minimal browser-API stubs for WebWorker context.
|
|
3
|
+
*
|
|
4
|
+
* Only stubs what the catlab-remote-client library actually needs at
|
|
5
|
+
* module-definition time:
|
|
6
|
+
* - window/self: socket.io-client, backbone, screenfull reference window
|
|
7
|
+
* - document: backbone needs createElement, KeyboardUser registers keydown/keyup
|
|
8
|
+
* - localStorage/sessionStorage: Storage.js wraps localStorage
|
|
9
|
+
* - alert/confirm: Portal default start handler uses alert()
|
|
10
|
+
* - navigator: socket.io-client reads navigator.userAgent
|
|
11
|
+
* - Canvas stubs: EaselJS checks instanceof at load time
|
|
12
|
+
* - Event/CustomEvent/Image: referenced by EaselJS and event code
|
|
13
|
+
* - requestAnimationFrame: CreateJS ticker
|
|
14
|
+
*
|
|
15
|
+
* This file is plain JS (not AMD) — loaded via importScripts() in webworker.js.
|
|
16
|
+
* Game-specific consumers can extend with additional polyfills before loading
|
|
17
|
+
* the worker module.
|
|
18
|
+
*/
|
|
19
|
+
(function (scope) {
|
|
20
|
+
"use strict";
|
|
21
|
+
|
|
22
|
+
if (typeof alert === 'undefined') {
|
|
23
|
+
scope.alert = function (msg) { console.warn('[worker] alert:', msg); };
|
|
24
|
+
}
|
|
25
|
+
if (typeof confirm === 'undefined') {
|
|
26
|
+
scope.confirm = function (msg) { console.warn('[worker] confirm:', msg); return false; };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (typeof window === 'undefined') {
|
|
30
|
+
scope.window = scope;
|
|
31
|
+
}
|
|
32
|
+
scope.window.addEventListener = scope.window.addEventListener || function () {};
|
|
33
|
+
scope.window.removeEventListener = scope.window.removeEventListener || function () {};
|
|
34
|
+
|
|
35
|
+
if (typeof navigator === 'undefined') {
|
|
36
|
+
scope.navigator = { userAgent: 'WebWorker', platform: 'WebWorker' };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ---------- Canvas stubs (EaselJS) ----------
|
|
40
|
+
|
|
41
|
+
function StubCanvasContext() {}
|
|
42
|
+
StubCanvasContext.prototype = {
|
|
43
|
+
save: function () {}, restore: function () {}, scale: function () {},
|
|
44
|
+
rotate: function () {}, translate: function () {}, transform: function () {},
|
|
45
|
+
setTransform: function () {}, resetTransform: function () {},
|
|
46
|
+
createLinearGradient: function () { return { addColorStop: function () {} }; },
|
|
47
|
+
createRadialGradient: function () { return { addColorStop: function () {} }; },
|
|
48
|
+
createPattern: function () { return {}; },
|
|
49
|
+
clearRect: function () {}, fillRect: function () {}, strokeRect: function () {},
|
|
50
|
+
beginPath: function () {}, closePath: function () {}, moveTo: function () {},
|
|
51
|
+
lineTo: function () {}, quadraticCurveTo: function () {}, bezierCurveTo: function () {},
|
|
52
|
+
arcTo: function () {}, arc: function () {}, rect: function () {},
|
|
53
|
+
fill: function () {}, stroke: function () {}, clip: function () {},
|
|
54
|
+
measureText: function () { return { width: 0 }; },
|
|
55
|
+
fillText: function () {}, strokeText: function () {},
|
|
56
|
+
drawImage: function () {},
|
|
57
|
+
getImageData: function (x, y, w, h) { return { data: new Uint8ClampedArray(w * h * 4) }; },
|
|
58
|
+
putImageData: function () {},
|
|
59
|
+
createImageData: function (w, h) { return { data: new Uint8ClampedArray(w * h * 4) }; },
|
|
60
|
+
canvas: null
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function StubCanvas() {
|
|
64
|
+
this.width = 0;
|
|
65
|
+
this.height = 0;
|
|
66
|
+
this.style = {};
|
|
67
|
+
}
|
|
68
|
+
StubCanvas.prototype.getContext = function () {
|
|
69
|
+
var ctx = new StubCanvasContext();
|
|
70
|
+
ctx.canvas = this;
|
|
71
|
+
return ctx;
|
|
72
|
+
};
|
|
73
|
+
StubCanvas.prototype.addEventListener = function () {};
|
|
74
|
+
StubCanvas.prototype.removeEventListener = function () {};
|
|
75
|
+
StubCanvas.prototype.setAttribute = function () {};
|
|
76
|
+
StubCanvas.prototype.appendChild = function () {};
|
|
77
|
+
StubCanvas.prototype.toDataURL = function () { return ''; };
|
|
78
|
+
|
|
79
|
+
// ---------- DOM element stubs ----------
|
|
80
|
+
|
|
81
|
+
function createStubElement(tag) {
|
|
82
|
+
if (tag === 'canvas') { return new StubCanvas(); }
|
|
83
|
+
return {
|
|
84
|
+
tagName: (tag || '').toUpperCase(),
|
|
85
|
+
style: {},
|
|
86
|
+
childNodes: [],
|
|
87
|
+
children: [],
|
|
88
|
+
setAttribute: function (key, value) { this[key] = value; },
|
|
89
|
+
getAttribute: function (key) { return this.hasOwnProperty(key) ? this[key] : null; },
|
|
90
|
+
appendChild: function (c) {
|
|
91
|
+
this.childNodes.push(c);
|
|
92
|
+
if (c) c.parentNode = this;
|
|
93
|
+
return c;
|
|
94
|
+
},
|
|
95
|
+
removeChild: function (c) {
|
|
96
|
+
var idx = this.childNodes.indexOf(c);
|
|
97
|
+
if (idx >= 0) this.childNodes.splice(idx, 1);
|
|
98
|
+
return c;
|
|
99
|
+
},
|
|
100
|
+
addEventListener: function () {},
|
|
101
|
+
removeEventListener: function () {},
|
|
102
|
+
getElementsByTagName: function () { return []; },
|
|
103
|
+
querySelector: function () { return null; },
|
|
104
|
+
querySelectorAll: function () { return []; },
|
|
105
|
+
classList: { add: function () {}, remove: function () {}, contains: function () { return false; } },
|
|
106
|
+
dataset: {},
|
|
107
|
+
parentNode: null,
|
|
108
|
+
textContent: '',
|
|
109
|
+
innerHTML: '',
|
|
110
|
+
id: '',
|
|
111
|
+
className: '',
|
|
112
|
+
getBoundingClientRect: function () { return { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 }; },
|
|
113
|
+
focus: function () {},
|
|
114
|
+
dispatchEvent: function () { return true; }
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ---------- document stub (with real event dispatch for KeyboardUser) ----------
|
|
119
|
+
|
|
120
|
+
if (typeof document === 'undefined') {
|
|
121
|
+
var _docListeners = {};
|
|
122
|
+
|
|
123
|
+
scope.document = {
|
|
124
|
+
nodeType: 9,
|
|
125
|
+
createElement: function (tag) { return createStubElement(tag); },
|
|
126
|
+
createElementNS: function (ns, tag) { return createStubElement(tag); },
|
|
127
|
+
createTextNode: function (text) { return { textContent: text || '', nodeType: 3 }; },
|
|
128
|
+
createDocumentFragment: function () {
|
|
129
|
+
var frag = createStubElement('fragment');
|
|
130
|
+
frag.nodeType = 11;
|
|
131
|
+
return frag;
|
|
132
|
+
},
|
|
133
|
+
createComment: function () { return { nodeType: 8 }; },
|
|
134
|
+
head: createStubElement('head'),
|
|
135
|
+
body: createStubElement('body'),
|
|
136
|
+
documentElement: createStubElement('html'),
|
|
137
|
+
getElementById: function () { return null; },
|
|
138
|
+
getElementsByTagName: function () { return []; },
|
|
139
|
+
getElementsByClassName: function () { return []; },
|
|
140
|
+
querySelector: function () { return null; },
|
|
141
|
+
querySelectorAll: function () { return []; },
|
|
142
|
+
addEventListener: function (type, listener) {
|
|
143
|
+
if (!_docListeners[type]) _docListeners[type] = [];
|
|
144
|
+
_docListeners[type].push(listener);
|
|
145
|
+
},
|
|
146
|
+
removeEventListener: function (type, listener) {
|
|
147
|
+
if (!_docListeners[type]) return;
|
|
148
|
+
var idx = _docListeners[type].indexOf(listener);
|
|
149
|
+
if (idx !== -1) _docListeners[type].splice(idx, 1);
|
|
150
|
+
},
|
|
151
|
+
dispatchEvent: function (event) {
|
|
152
|
+
var listeners = _docListeners[event.type];
|
|
153
|
+
if (listeners) {
|
|
154
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
155
|
+
listeners[i](event);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
},
|
|
160
|
+
createEvent: function () {
|
|
161
|
+
return { type: '', initEvent: function () {}, preventDefault: function () {}, stopPropagation: function () {} };
|
|
162
|
+
},
|
|
163
|
+
cookie: '',
|
|
164
|
+
readyState: 'complete',
|
|
165
|
+
title: '',
|
|
166
|
+
location: scope.location,
|
|
167
|
+
defaultView: scope
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ---------- Storage ----------
|
|
172
|
+
|
|
173
|
+
if (typeof localStorage === 'undefined') {
|
|
174
|
+
scope.localStorage = {
|
|
175
|
+
_data: {},
|
|
176
|
+
getItem: function (k) { return this._data.hasOwnProperty(k) ? this._data[k] : null; },
|
|
177
|
+
setItem: function (k, v) { this._data[k] = String(v); },
|
|
178
|
+
removeItem: function (k) { delete this._data[k]; },
|
|
179
|
+
clear: function () { this._data = {}; },
|
|
180
|
+
get length() { return Object.keys(this._data).length; },
|
|
181
|
+
key: function (i) { return Object.keys(this._data)[i] || null; }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (typeof sessionStorage === 'undefined') {
|
|
186
|
+
scope.sessionStorage = {
|
|
187
|
+
_data: {},
|
|
188
|
+
getItem: function (k) { return this._data.hasOwnProperty(k) ? this._data[k] : null; },
|
|
189
|
+
setItem: function (k, v) { this._data[k] = String(v); },
|
|
190
|
+
removeItem: function (k) { delete this._data[k]; },
|
|
191
|
+
clear: function () { this._data = {}; }
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ---------- Type stubs ----------
|
|
196
|
+
|
|
197
|
+
if (typeof HTMLCanvasElement === 'undefined') { scope.HTMLCanvasElement = StubCanvas; }
|
|
198
|
+
if (typeof HTMLElement === 'undefined') { scope.HTMLElement = function () {}; }
|
|
199
|
+
if (typeof HTMLDocument === 'undefined') { scope.HTMLDocument = function () {}; }
|
|
200
|
+
if (typeof Element === 'undefined') { scope.Element = function () {}; }
|
|
201
|
+
if (typeof Node === 'undefined') { scope.Node = function () {}; }
|
|
202
|
+
if (typeof Event === 'undefined') { scope.Event = function (type) { this.type = type; }; }
|
|
203
|
+
if (typeof CustomEvent === 'undefined') {
|
|
204
|
+
scope.CustomEvent = function (type, params) { this.type = type; this.detail = params && params.detail; };
|
|
205
|
+
}
|
|
206
|
+
if (typeof Image === 'undefined') {
|
|
207
|
+
scope.Image = function () {
|
|
208
|
+
this.src = '';
|
|
209
|
+
this.addEventListener = function () {};
|
|
210
|
+
this.removeEventListener = function () {};
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (typeof requestAnimationFrame === 'undefined') {
|
|
214
|
+
scope.requestAnimationFrame = function (cb) { return setTimeout(cb, 1000 / 60); };
|
|
215
|
+
scope.cancelAnimationFrame = function (id) { clearTimeout(id); };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
})(typeof self !== 'undefined' ? self : typeof global !== 'undefined' ? global : this);
|
|
219
|
+
|