· 7 years ago · Apr 20, 2018, 04:46 PM
1/**
2 * @license
3 jQLite JavaScript Library v1.1.1 (http://code.google.com/p/jqlite/)
4 Copyright (c) 2010 Brett Fattori (bfattori@gmail.com)
5 Licensed under the MIT license
6 http://www.opensource.org/licenses/mit-license.php
7
8 Many thanks to the jQuery team's efforts. Some code is
9 Copyright (c) 2010, John Resig. See
10 http://jquery.org/license
11
12 @author Brett Fattori (bfattori@gmail.com)
13 @author $Author: bfattori $
14 @version $Revision: 145 $
15
16 Created: 03/29/2010
17 Modified: $Date: 2010-06-21 11:08:14 -0400 (Mon, 21 Jun 2010) $
18*/
19'use strict';
20(function() {
21 /**
22 * @return {?}
23 */
24 function now() {
25 return +new Date;
26 }
27 /**
28 * @param {string} options
29 * @param {!Array} value
30 * @return {?}
31 */
32 var cb = function(options, value) {
33 if (options === "" && value) {
34 return value;
35 }
36 var headersAndBody = options.split(" ");
37 var j = headersAndBody.shift();
38 var token;
39 if (j.charAt(0) == "#") {
40 var callback = document.getElementById(j.substring(1));
41 /** @type {!Array} */
42 token = callback ? [callback] : [];
43 } else {
44 token = j.charAt(0) !== "." ? j.split(".")[0] : "*";
45 var data = j.split(".");
46 /** @type {null} */
47 var s = null;
48 if (token.indexOf("[") != -1) {
49 s = token;
50 token = token.substr(0, token.indexOf("["));
51 }
52 /**
53 * @param {!Element} r
54 * @return {?}
55 */
56 callback = function(r) {
57 /** @type {(!Function|null)} */
58 var c = arguments.callee;
59 var value;
60 if (!(value = !c.needClass)) {
61 value = c.classes;
62 if (r.className.length == 0) {
63 /** @type {boolean} */
64 value = false;
65 } else {
66 var i = r.className.split(" ");
67 var result = value.length;
68 /** @type {number} */
69 var j = 0;
70 for (; j < value.length; j++) {
71 if ($.inArray(value[j], i) != -1) {
72 result--;
73 }
74 }
75 /** @type {boolean} */
76 value = result == 0;
77 }
78 }
79 if (value = value) {
80 if (!(value = !c.needAttribute)) {
81 c = c.attributes;
82 /** @type {boolean} */
83 value = true;
84 /** @type {number} */
85 i = 0;
86 for (; i < c.length; i++) {
87 result = c[i].split("=");
88 j = result[0].indexOf("!") != -1 || result[0].indexOf("*") != -1 ? result[0].charAt(result[0].length - 1) + "=" : "=";
89 if (j != "=") {
90 result[0] = result[0].substring(0, result[0].length - 1);
91 }
92 switch(j) {
93 case "=":
94 /** @type {number} */
95 value = value & r.getAttribute(result[0]) === result[1];
96 break;
97 case "!=":
98 /** @type {number} */
99 value = value & r.getAttribute(result[0]) !== result[1];
100 break;
101 case "*=":
102 /** @type {number} */
103 value = value & r.getAttribute(result[0]).indexOf(result[1]) != -1;
104 break;
105 default:
106 /** @type {boolean} */
107 value = false;
108 }
109 }
110 /** @type {boolean} */
111 value = value;
112 }
113 /** @type {boolean} */
114 value = value;
115 }
116 if (value) {
117 return r;
118 }
119 };
120 /** @type {!Array} */
121 var m = [];
122 /** @type {number} */
123 var i = 0;
124 for (; i < value.length; i++) {
125 var files = value[i].getElementsByTagName(token);
126 /** @type {number} */
127 var j = 0;
128 for (; j < files.length; j++) {
129 m.push(files[j]);
130 }
131 }
132 if (data) {
133 data.shift();
134 }
135 /** @type {!Array} */
136 token = [];
137 callback.classes = data;
138 if (s != null) {
139 var eIndex = s.indexOf("[");
140 i = s.lastIndexOf("]");
141 eIndex = s.substring(eIndex + 1, i).split("][");
142 }
143 callback.attributes = s != null ? eIndex : null;
144 /** @type {boolean} */
145 callback.needClass = j.indexOf(".") != -1 && data.length > 0;
146 /** @type {boolean} */
147 callback.needAttribute = s != null;
148 /** @type {number} */
149 j = 0;
150 for (; j < m.length; j++) {
151 if (callback(m[j])) {
152 token.push(m[j]);
153 }
154 }
155 }
156 return cb(headersAndBody.join(" "), token);
157 };
158 /**
159 * @param {!Object} node
160 * @param {!Object} m
161 * @return {?}
162 */
163 var select = function(node, m) {
164 m = m || document;
165 if (node.nodeType && node.nodeType === style) {
166 node = document.body;
167 if (node === null) {
168 return [document];
169 }
170 }
171 if (node.nodeType && node.nodeType === undefined) {
172 return [node];
173 }
174 if (node.jquery && typeof node.jquery === "string") {
175 return node.toArray();
176 }
177 if (m) {
178 m = init(m);
179 }
180 if ($.isArray(node)) {
181 return node;
182 } else {
183 if (typeof node === "string") {
184 /** @type {!Array} */
185 var result = [];
186 /** @type {number} */
187 var i = 0;
188 for (; i < m.length; i++) {
189 /** @type {!Array} */
190 var component = [m[i]];
191 if (!$.forceSimpleSelectorEngine && component[0].querySelectorAll) {
192 component = component[0].querySelectorAll(node);
193 /** @type {number} */
194 var i = 0;
195 for (; i < component.length; i++) {
196 result.push(component.item(i));
197 }
198 } else {
199 /** @type {!Array<?>} */
200 result = result.concat(cb(node, component));
201 }
202 }
203 return result;
204 } else {
205 return null;
206 }
207 }
208 };
209 /** @type {boolean} */
210 var G = false;
211 setTimeout(function() {
212 var head = document.body;
213 if (head) {
214 var script = document.createElement("script");
215 /** @type {string} */
216 var fn = "i" + (new Date).getTime();
217 /** @type {string} */
218 script.type = "text/javascript";
219 try {
220 script.appendChild(document.createTextNode("window." + fn + "=1;"));
221 } catch (c) {
222 }
223 head.insertBefore(script, head.firstChild);
224 /** @type {boolean} */
225 var C = true;
226 if (window[fn]) {
227 delete window[fn];
228 } else {
229 /** @type {boolean} */
230 C = false;
231 }
232 head.removeChild(script);
233 /** @type {boolean} */
234 G = C;
235 } else {
236 setTimeout(arguments.callee, 33);
237 }
238 }, 33);
239 /**
240 * @param {string} state
241 * @return {?}
242 */
243 var callback = function(state) {
244 var b = document.createElement("div");
245 /** @type {string} */
246 b.innerHTML = state;
247 return {
248 scripts : b.getElementsByTagName("script"),
249 data : state
250 };
251 };
252 /**
253 * @param {string} value
254 * @return {?}
255 */
256 var camelize = function(value) {
257 value = value.replace(/-/g, " ");
258 /** @type {string} */
259 value = value;
260 /** @type {boolean} */
261 var index = true;
262 /** @type {boolean} */
263 index = index || false;
264 value = !value ? "" : value.toString().replace(/^\s*|\s*$/g, "");
265 /** @type {string} */
266 var result = "";
267 if (value.length <= 0) {
268 /** @type {string} */
269 value = "";
270 } else {
271 /** @type {boolean} */
272 var leadingZero = false;
273 /** @type {string} */
274 result = result + (index ? value.charAt(0) : value.charAt(0).toUpperCase());
275 /** @type {number} */
276 index = 1;
277 for (; index < value.length; index++) {
278 /** @type {string} */
279 result = result + (leadingZero ? value.charAt(index).toUpperCase() : value.charAt(index).toLowerCase());
280 var e = value.charCodeAt(index);
281 /** @type {boolean} */
282 leadingZero = e == 32 || e == 45 || e == 46;
283 if (e == 99 || e == 67) {
284 if (value.charCodeAt(index - 1) == 77 || value.charCodeAt(index - 1) == 109) {
285 /** @type {boolean} */
286 leadingZero = true;
287 }
288 }
289 }
290 /** @type {string} */
291 value = result;
292 }
293 return value.replace(/ /g, "");
294 };
295 var events = {
296 click : "MouseEvents",
297 dblclick : "MouseEvents",
298 mousedown : "MouseEvents",
299 mouseup : "MouseEvents",
300 mouseover : "MouseEvents",
301 mousemove : "MouseEvents",
302 mouseout : "MouseEvents",
303 contextmenu : "MouseEvents",
304 keypress : "KeyEvents",
305 keydown : "KeyEvents",
306 keyup : "KeyEvents",
307 load : "HTMLEvents",
308 unload : "HTMLEvents",
309 abort : "HTMLEvents",
310 error : "HTMLEvents",
311 resize : "HTMLEvents",
312 scroll : "HTMLEvents",
313 select : "HTMLEvents",
314 change : "HTMLEvents",
315 submit : "HTMLEvents",
316 reset : "HTMLEvents",
317 focus : "HTMLEvents",
318 blur : "HTMLEvents",
319 touchstart : "MouseEvents",
320 touchend : "MouseEvents",
321 touchmove : "MouseEvents"
322 };
323 /**
324 * @param {!Object} obj
325 * @param {string} type
326 * @param {!Object} value
327 * @return {undefined}
328 */
329 var bind = function(obj, type, value) {
330 if ($.isFunction(value)) {
331 if (typeof type === "string") {
332 /** @type {string} */
333 type = type.toLowerCase();
334 }
335 var fn = events[type];
336 if (type.indexOf("on") == 0) {
337 type = type.substring(2);
338 }
339 if (fn) {
340 /**
341 * @param {!Event} e
342 * @return {?}
343 */
344 fn = function(e) {
345 /** @type {(!Function|null)} */
346 var args = arguments.callee;
347 var nodes = e.data || [];
348 nodes.unshift(e);
349 args = args.fn.apply(obj, nodes);
350 if (typeof args != "undefined" && args === false) {
351 if (e.preventDefault && e.stopPropagation) {
352 e.preventDefault();
353 e.stopPropagation();
354 } else {
355 /** @type {boolean} */
356 e.returnValue = false;
357 /** @type {boolean} */
358 e.cancelBubble = true;
359 }
360 return false;
361 }
362 return true;
363 };
364 /** @type {!Object} */
365 fn.fn = value;
366 if (obj.addEventListener) {
367 obj.addEventListener(type, fn, false);
368 } else {
369 obj.attachEvent("on" + type, fn);
370 }
371 } else {
372 if (!obj._handlers) {
373 obj._handlers = {};
374 }
375 fn = obj._handlers[type] || [];
376 fn.push(value);
377 obj._handlers[type] = fn;
378 }
379 }
380 };
381 /**
382 * @param {!Object} name
383 * @param {!Object} context
384 * @return {?}
385 */
386 var $ = function(name, context) {
387 return (new module).init(name, context);
388 };
389 var document = window.document;
390 /** @type {function(this:Object, *): boolean} */
391 var hasOwnProperty = Object.prototype.hasOwnProperty;
392 /** @type {function(this:*): string} */
393 var objectToString$2 = Object.prototype.toString;
394 /** @type {function(this:IArrayLike<T>, ...T): number} */
395 var push = Array.prototype.push;
396 /** @type {function(this:(IArrayLike<T>|string), *=, *=): !Array<T>} */
397 var _slice = Array.prototype.slice;
398 /** @type {number} */
399 var undefined = 1;
400 /** @type {number} */
401 var style = 9;
402 /** @type {!Array} */
403 var functionBuffer = [];
404 /** @type {boolean} */
405 var M = false;
406 /** @type {boolean} */
407 var N = false;
408 var onReady;
409 /** @type {boolean} */
410 $.forceSimpleSelectorEngine = false;
411 /**
412 * @param {string} o
413 * @param {!Function} f
414 * @return {?}
415 */
416 $.each = function(o, f) {
417 var i;
418 /** @type {number} */
419 var x = 0;
420 var t = o.length;
421 if (t === undefined || $.isFunction(o)) {
422 for (i in o) {
423 if (f.call(o[i], i, o[i]) === false) {
424 break;
425 }
426 }
427 } else {
428 i = o[0];
429 for (; x < t && f.call(i, x, i) !== false; i = o[++x]) {
430 }
431 }
432 return o;
433 };
434 /**
435 * @return {undefined}
436 */
437 $.noop = function() {
438 };
439 /**
440 * @param {!Object} value
441 * @return {?}
442 */
443 $.isFunction = function(value) {
444 return objectToString$2.call(value) === "[object Function]";
445 };
446 /**
447 * @param {!Object} value
448 * @return {?}
449 */
450 $.isArray = function(value) {
451 return objectToString$2.call(value) === "[object Array]";
452 };
453 /**
454 * @param {!Object} value
455 * @return {?}
456 */
457 $.isPlainObject = function(value) {
458 if (!value || objectToString$2.call(value) !== "[object Object]" || value.nodeType || value.setInterval) {
459 return false;
460 }
461 if (value.constructor && !hasOwnProperty.call(value, "constructor") && !hasOwnProperty.call(value.constructor.prototype, "isPrototypeOf")) {
462 return false;
463 }
464 var key;
465 for (key in value) {
466 }
467 return key === undefined || hasOwnProperty.call(value, key);
468 };
469 /**
470 * @param {!Object} a
471 * @param {!Object} b
472 * @return {?}
473 */
474 $.merge = function(a, b) {
475 var i = a.length;
476 /** @type {number} */
477 var j = 0;
478 if (typeof b.length === "number") {
479 /** @type {number} */
480 var bLength = b.length;
481 for (; j < bLength; j++) {
482 a[i++] = b[j];
483 }
484 } else {
485 for (; b[j] !== undefined;) {
486 a[i++] = b[j++];
487 }
488 }
489 a.length = i;
490 return a;
491 };
492 /**
493 * @param {!Function} value
494 * @return {?}
495 */
496 $.param = function(value) {
497 /** @type {string} */
498 var result = "";
499 if (value) {
500 $.each(value, function(qov, targetFormIdAndName) {
501 result = result + ((result.length != 0 ? "&" : "") + targetFormIdAndName + "=" + encodeURIComponent(qov));
502 });
503 }
504 return result;
505 };
506 /**
507 * @param {!NodeList} scripts
508 * @return {undefined}
509 */
510 $.evalScripts = function(scripts) {
511 var head = document.getElementsByTagName("head")[0] || document.documentElement;
512 /** @type {number} */
513 var i = 0;
514 for (; i < scripts.length; i++) {
515 var script = document.createElement("script");
516 /** @type {string} */
517 script.type = "text/javascript";
518 if (G) {
519 script.appendChild(document.createTextNode(scripts[i].text));
520 } else {
521 script.text = scripts[i].text;
522 }
523 head.insertBefore(script, head.firstChild);
524 head.removeChild(script);
525 }
526 };
527 /**
528 * @return {undefined}
529 */
530 $.ready = function() {
531 /** @type {boolean} */
532 M = true;
533 for (; functionBuffer.length > 0;) {
534 functionBuffer.shift()();
535 }
536 };
537 /** @type {string} */
538 var expando = "jQuery" + now();
539 /** @type {number} */
540 var uuid = 0;
541 var windowData = {};
542 $.noData = {
543 embed : true,
544 object : true,
545 applet : true
546 };
547 $.cache = {};
548 /**
549 * @param {!Object} elem
550 * @param {string} name
551 * @param {string} value
552 * @return {?}
553 */
554 $.data = function(elem, name, value) {
555 if (!(elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()])) {
556 elem = elem == window ? windowData : elem;
557 var id = elem[expando];
558 if (!id) {
559 /** @type {number} */
560 id = elem[expando] = ++uuid;
561 }
562 if (name && !jQuery.cache[id]) {
563 jQuery.cache[id] = {};
564 }
565 if (value !== undefined) {
566 /** @type {string} */
567 jQuery.cache[id][name] = value;
568 }
569 return name ? jQuery.cache[id][name] : id;
570 }
571 };
572 /**
573 * @param {!Object} elem
574 * @param {string} name
575 * @return {undefined}
576 */
577 $.removeData = function(elem, name) {
578 elem = elem == window ? windowData : elem;
579 var id = elem[expando];
580 if (name) {
581 if (jQuery.cache[id]) {
582 delete jQuery.cache[id][name];
583 /** @type {string} */
584 name = "";
585 for (name in jQuery.cache[id]) {
586 break;
587 }
588 if (!name) {
589 jQuery.removeData(elem);
590 }
591 }
592 } else {
593 try {
594 delete elem[expando];
595 } catch (c) {
596 if (elem.removeAttribute) {
597 elem.removeAttribute(expando);
598 }
599 }
600 delete jQuery.cache[id];
601 }
602 };
603 $.ajax = {
604 status : -1,
605 statusText : "",
606 responseText : null,
607 responseXML : null,
608 send : function(options, request, callback) {
609 if ($.isFunction(request)) {
610 /** @type {!Object} */
611 callback = request;
612 request = {};
613 }
614 if (options) {
615 /** @type {boolean} */
616 var async = true;
617 /** @type {null} */
618 var username = null;
619 /** @type {null} */
620 var password = null;
621 if (typeof request.async !== "undefined") {
622 async = request.async;
623 delete request.async;
624 }
625 if (typeof request.username !== "undefined") {
626 username = request.username;
627 delete request.username;
628 }
629 if (typeof request.password !== "undefined") {
630 password = request.password;
631 delete request.password;
632 }
633 request = $.param(request);
634 if (request.length != 0) {
635 /** @type {string} */
636 options = options + ((options.indexOf("?") == -1 ? "?" : "&") + request);
637 }
638 /** @type {!XMLHttpRequest} */
639 request = new XMLHttpRequest;
640 request.open("GET", options, async, username, password);
641 request.send();
642 if (async) {
643 /**
644 * @param {!Object} res
645 * @return {undefined}
646 */
647 options = function(res) {
648 /** @type {(!Function|null)} */
649 var self = arguments.callee;
650 if (res.status == 200) {
651 $.ajax.complete(res, self.cb);
652 } else {
653 $.ajax.error(res, self.cb);
654 }
655 };
656 /** @type {!Object} */
657 options.cb = callback;
658 /**
659 * @return {undefined}
660 */
661 callback = function() {
662 /** @type {(!Function|null)} */
663 var self = arguments.callee;
664 if (self.req.readyState != 4) {
665 setTimeout(self, 250);
666 } else {
667 self.xcb(self.req);
668 }
669 };
670 /** @type {!Object} */
671 callback.req = request;
672 /** @type {!Object} */
673 callback.xcb = options;
674 setTimeout(callback, 250);
675 }
676 }
677 },
678 complete : function(response, callback) {
679 $.ajax.status = response.status;
680 $.ajax.responseText = response.responseText;
681 $.ajax.responseXML = response.responseXML;
682 if ($.isFunction(callback)) {
683 callback(response.responseText, response.status);
684 }
685 },
686 error : function(res, callback) {
687 $.ajax.status = res.status;
688 $.ajax.statusText = res.statusText;
689 if ($.isFunction(callback)) {
690 callback(res.status, res.statusText);
691 }
692 }
693 };
694 /**
695 * @param {!Object} value
696 * @param {number} results
697 * @return {?}
698 */
699 $.makeArray = function(value, results) {
700 var ret = results || [];
701 if (value != null) {
702 if (value.length == null || typeof value === "string" || jQuery.isFunction(value) || typeof value !== "function" && value.setInterval) {
703 push.call(ret, value);
704 } else {
705 $.merge(ret, value);
706 }
707 }
708 return ret;
709 };
710 /**
711 * @param {string} a
712 * @param {!NodeList} b
713 * @return {?}
714 */
715 $.inArray = function(a, b) {
716 /** @type {number} */
717 var i = 0;
718 for (; i < b.length; i++) {
719 if (b[i] === a) {
720 return i;
721 }
722 }
723 return -1;
724 };
725 /**
726 * @param {!Object} text
727 * @return {?}
728 */
729 $.trim = function(text) {
730 return text != null ? text.toString().replace(/^\s*|\s*$/g, "") : "";
731 };
732 /**
733 * @return {undefined}
734 */
735 var module = function() {
736 };
737 module.prototype = {
738 selector : "",
739 context : null,
740 length : 0,
741 jquery : "jqlite-1.1.1",
742 init : function(selector, data) {
743 if (!selector) {
744 return this;
745 }
746 if (selector.nodeType) {
747 this.context = this[0] = selector;
748 /** @type {number} */
749 this.length = 1;
750 } else {
751 if (typeof selector === "function") {
752 this.ready(selector);
753 } else {
754 /** @type {!Array} */
755 var result = [];
756 if (selector.jquery && typeof selector.jquery === "string") {
757 result = selector.toArray();
758 } else {
759 if ($.isArray(selector)) {
760 /** @type {!Object} */
761 result = selector;
762 } else {
763 if (typeof selector === "string" && $.trim(selector).indexOf("<") == 0 && $.trim(selector).indexOf(">") != -1) {
764 result = $.trim(selector).toLowerCase();
765 /** @type {string} */
766 result = result.indexOf("<option") == 0 ? "SELECT" : result.indexOf("<li") == 0 ? "UL" : result.indexOf("<tr") == 0 ? "TBODY" : result.indexOf("<td") == 0 ? "TR" : "DIV";
767 result = document.createElement(result);
768 /** @type {!Object} */
769 result.innerHTML = selector;
770 /** @type {!Array} */
771 result = [result.removeChild(result.firstChild)];
772 } else {
773 if (selector.indexOf(",") != -1) {
774 result = selector.split(",");
775 /** @type {number} */
776 var c = 0;
777 for (; c < result.length; c++) {
778 result[c] = $.trim(result[c]);
779 }
780 } else {
781 /** @type {!Array} */
782 result = [selector];
783 }
784 /** @type {!Array} */
785 c = [];
786 /** @type {number} */
787 var i = 0;
788 for (; i < result.length; i++) {
789 /** @type {!Array<?>} */
790 c = c.concat(select(result[i], data));
791 }
792 /** @type {!Array} */
793 result = c;
794 }
795 }
796 }
797 push.apply(this, result);
798 }
799 }
800 return this;
801 },
802 each : function(type) {
803 return $.each(this, type);
804 },
805 size : function() {
806 return this.length;
807 },
808 toArray : function() {
809 return _slice.call(this, 0);
810 },
811 ready : function(fn) {
812 if (M) {
813 fn();
814 } else {
815 functionBuffer.push(fn);
816 return this;
817 }
818 },
819 data : function(key, value) {
820 if (typeof key === "undefined" && this.length) {
821 return jQuery.data(this[0]);
822 } else {
823 if (typeof key === "object") {
824 return this.each(function() {
825 jQuery.data(this, key);
826 });
827 }
828 }
829 var parts = key.split(".");
830 parts[1] = parts[1] ? "." + parts[1] : "";
831 if (value === undefined) {
832 if (data === undefined && this.length) {
833 data = jQuery.data(this[0], key);
834 }
835 return data === undefined && parts[1] ? this.data(parts[0]) : data;
836 } else {
837 return this.each(function() {
838 jQuery.data(this, key, value);
839 });
840 }
841 },
842 removeData : function(key) {
843 return this.each(function() {
844 jQuery.removeData(this, key);
845 });
846 },
847 addClass : function(className) {
848 return this.each(function() {
849 if (this.className.length != 0) {
850 var methods = this.className.split(" ");
851 if ($.inArray(className, methods) == -1) {
852 methods.push(className);
853 this.className = methods.join(" ");
854 }
855 } else {
856 /** @type {string} */
857 this.className = className;
858 }
859 });
860 },
861 removeClass : function(className) {
862 return this.each(function() {
863 if (this.className.length != 0) {
864 var temp = this.className.split(" ");
865 var i = $.inArray(className, temp);
866 if (i != -1) {
867 temp.splice(i, 1);
868 this.className = temp.join(" ");
869 }
870 }
871 });
872 },
873 hasClass : function(val) {
874 if (this[0].className.length == 0) {
875 return false;
876 }
877 return $.inArray(val, this[0].className.split(" ")) != -1;
878 },
879 isElementName : function(p_Interval) {
880 return this[0].nodeName.toLowerCase() === p_Interval.toLowerCase();
881 },
882 toggleClass : function(name) {
883 return this.each(function() {
884 if (this.className.length == 0) {
885 /** @type {string} */
886 this.className = name;
887 } else {
888 var b = this.className.split(" ");
889 var order = $.inArray(name, b);
890 if (order != -1) {
891 b.splice(order, 1);
892 } else {
893 b.push(name);
894 }
895 this.className = b.join(" ");
896 }
897 });
898 },
899 hide : function(callback) {
900 return this.each(function() {
901 if (this.style && this.style.display != null) {
902 if (this.style.display.toString() != "none") {
903 this._oldDisplay = this.style.display.toString() || (this.nodeName != "span" ? "block" : "inline");
904 /** @type {string} */
905 this.style.display = "none";
906 }
907 }
908 if ($.isFunction(callback)) {
909 callback(this);
910 }
911 });
912 },
913 show : function(a) {
914 return this.each(function() {
915 this.style.display = (this._oldDisplay && this._oldDisplay != "" ? this._oldDisplay : null) || (this.nodeName != "span" ? "block" : "inline");
916 if ($.isFunction(a)) {
917 a(this);
918 }
919 });
920 },
921 css : function(name, value) {
922 if (typeof name === "string" && value == null) {
923 return this[0].style[camelize(name)];
924 } else {
925 name = typeof name === "string" ? get(name, value) : name;
926 return this.each(function() {
927 var Omi = this;
928 if (typeof Omi.style != "undefined") {
929 $.each(name, function(type, value) {
930 value = typeof value === "number" ? value + "px" : value;
931 var name = camelize(type);
932 if (!Omi.style[name]) {
933 /** @type {string} */
934 name = type;
935 }
936 /** @type {string} */
937 Omi.style[name] = value;
938 });
939 }
940 });
941 }
942 },
943 load : function(fn, url, s) {
944 if ($.isFunction(url)) {
945 /** @type {!Object} */
946 s = url;
947 url = {};
948 }
949 return this.each(function() {
950 /**
951 * @param {string} doc
952 * @param {?} context
953 * @return {undefined}
954 */
955 var cb = function(doc, context) {
956 /** @type {(!Function|null)} */
957 var self = arguments.callee;
958 if (doc) {
959 var response = callback(doc);
960 self.elem.innerHTML = response.data;
961 $.evalScripts(response.scripts);
962 }
963 if ($.isFunction(self.cback)) {
964 self.cback(doc, context);
965 }
966 };
967 cb.cback = s;
968 cb.elem = this;
969 $.ajax.send(fn, url, cb);
970 });
971 },
972 html : function(data) {
973 return data ? this.each(function() {
974 var ret = callback(data);
975 this.innerHTML = ret.data;
976 $.evalScripts(ret.scripts);
977 }) : this[0].innerHTML;
978 },
979 attr : function(key, value) {
980 return typeof key === "string" && value == null ? this[0] ? this[0].getAttribute(key) : "" : this.each(function() {
981 key = typeof key === "string" ? get(key, value) : key;
982 var name;
983 for (name in key) {
984 this.setAttribute(name, key[name]);
985 }
986 });
987 },
988 eq : function(i) {
989 var arr = this.toArray();
990 this.context = this[0] = i < 0 ? arr[arr.length + i] : arr[i];
991 /** @type {number} */
992 this.length = 1;
993 return this;
994 },
995 first : function() {
996 this.context = this[0] = this.toArray()[0];
997 /** @type {number} */
998 this.length = 1;
999 return this;
1000 },
1001 last : function() {
1002 var array = this.toArray();
1003 this.context = this[0] = array[array.length - 1];
1004 /** @type {number} */
1005 this.length = 1;
1006 return this;
1007 },
1008 index : function(tag) {
1009 /** @type {number} */
1010 var model = -1;
1011 if (this.length != 0) {
1012 var d = this[0];
1013 if (tag) {
1014 var c = $(tag)[0];
1015 this.each(function(_TestMode_) {
1016 if (this === c) {
1017 /** @type {number} */
1018 model = _TestMode_;
1019 return false;
1020 }
1021 });
1022 } else {
1023 tag = this.parent()[0].firstChild;
1024 /** @type {!Array} */
1025 var stackNoCollapseWhitespace = [];
1026 for (; tag != null;) {
1027 if (tag.nodeType === undefined) {
1028 stackNoCollapseWhitespace.push(tag);
1029 }
1030 tag = tag.nextSibling;
1031 }
1032 $.each(tag, function(_TestMode_) {
1033 if (this === d) {
1034 /** @type {number} */
1035 model = _TestMode_;
1036 return false;
1037 }
1038 });
1039 }
1040 }
1041 return model;
1042 },
1043 next : function(wrap) {
1044 /** @type {!Array} */
1045 var b = [];
1046 if (wrap) {
1047 var output = $(wrap);
1048 this.each(function() {
1049 var element = this.nextSibling;
1050 for (; element != null && element.nodeType !== undefined;) {
1051 element = element.nextSibling;
1052 }
1053 if (element != null) {
1054 /** @type {boolean} */
1055 var e = false;
1056 output.each(function() {
1057 if (this == element) {
1058 /** @type {boolean} */
1059 e = true;
1060 return false;
1061 }
1062 });
1063 if (e) {
1064 b.push(element);
1065 }
1066 }
1067 });
1068 } else {
1069 this.each(function() {
1070 var element = this.nextSibling;
1071 for (; element != null && element.nodeType !== undefined;) {
1072 element = element.nextSibling;
1073 }
1074 if (element != null) {
1075 b.push(element);
1076 }
1077 });
1078 }
1079 return $(b);
1080 },
1081 prev : function(start) {
1082 /** @type {!Array} */
1083 var b = [];
1084 if (start) {
1085 var d = $(start);
1086 this.each(function() {
1087 var node = this.previousSibling;
1088 for (; node != null && node.nodeType !== undefined;) {
1089 node = node.previousSibling;
1090 }
1091 if (node != null) {
1092 /** @type {boolean} */
1093 var e = false;
1094 d.each(function() {
1095 if (this == node) {
1096 /** @type {boolean} */
1097 e = true;
1098 return false;
1099 }
1100 });
1101 if (e) {
1102 b.push(node);
1103 }
1104 }
1105 });
1106 } else {
1107 this.each(function() {
1108 var node = this.previousSibling;
1109 for (; node != null && node.nodeType !== undefined;) {
1110 node = node.previousSibling;
1111 }
1112 if (node != null) {
1113 b.push(node);
1114 }
1115 });
1116 }
1117 return $(b);
1118 },
1119 parent : function(a) {
1120 /** @type {!Array} */
1121 var container = [];
1122 if (a) {
1123 var d = $(a);
1124 this.each(function() {
1125 var tick = this.parentNode;
1126 /** @type {boolean} */
1127 var e = false;
1128 d.each(function() {
1129 if (this == tick) {
1130 /** @type {boolean} */
1131 e = true;
1132 return false;
1133 }
1134 });
1135 if (e) {
1136 container.push(tick);
1137 }
1138 });
1139 } else {
1140 this.each(function() {
1141 container.push(this.parentNode);
1142 });
1143 }
1144 return $(container);
1145 },
1146 parents : function(cl) {
1147 /** @type {!Array} */
1148 var b = [];
1149 if (cl) {
1150 var entries = $(cl);
1151 this.each(function() {
1152 var parent = this;
1153 for (; parent != document.body;) {
1154 entries.each(function() {
1155 if (this == parent) {
1156 b.push(parent);
1157 }
1158 });
1159 parent = parent.parentNode;
1160 }
1161 });
1162 } else {
1163 this.each(function() {
1164 var parent = this;
1165 for (; parent != document.body;) {
1166 parent = parent.parentNode;
1167 b.push(parent);
1168 }
1169 });
1170 }
1171 return $(b);
1172 },
1173 children : function(value) {
1174 /** @type {!Array} */
1175 var b = [];
1176 if (value) {
1177 var d = $(value);
1178 this.each(function() {
1179 var node = this.firstChild;
1180 for (; node != null;) {
1181 if (node.nodeType == undefined) {
1182 d.each(function() {
1183 if (this === node) {
1184 b.push(node);
1185 }
1186 });
1187 }
1188 node = node.nextSibling;
1189 }
1190 });
1191 } else {
1192 this.each(function() {
1193 var node = this.firstChild;
1194 for (; node != null;) {
1195 if (node.nodeType == undefined) {
1196 b.push(node);
1197 }
1198 node = node.nextSibling;
1199 }
1200 });
1201 }
1202 return $(b);
1203 },
1204 append : function(m) {
1205 m = init(m);
1206 return this.each(function() {
1207 /** @type {number} */
1208 var i = 0;
1209 for (; i < m.length; i++) {
1210 this.appendChild(m[i]);
1211 }
1212 });
1213 },
1214 remove : function(a) {
1215 return this.each(function() {
1216 if (a) {
1217 $(a, this).remove();
1218 } else {
1219 this.parentNode.removeChild(this);
1220 }
1221 });
1222 },
1223 empty : function() {
1224 return this.each(function() {
1225 /** @type {string} */
1226 this.innerHTML = "";
1227 });
1228 },
1229 val : function(value) {
1230 if (value == null) {
1231 /** @type {null} */
1232 var returnVal = null;
1233 if (this && this.length != 0 && typeof this[0].value != "undefined") {
1234 returnVal = this[0].value;
1235 }
1236 return returnVal;
1237 } else {
1238 return this.each(function() {
1239 if (typeof this.value != "undefined") {
1240 /** @type {string} */
1241 this.value = value;
1242 }
1243 });
1244 }
1245 },
1246 bind : function(type, data) {
1247 return this.each(function() {
1248 bind(this, type, data);
1249 });
1250 },
1251 trigger : function(a, obj) {
1252 return this.each(function() {
1253 var match;
1254 var type;
1255 /** @type {string} */
1256 type = a;
1257 if (typeof type === "string") {
1258 /** @type {string} */
1259 type = type.toLowerCase();
1260 }
1261 /** @type {null} */
1262 var c = null;
1263 var t = events[type] || "Event";
1264 if (document.createEvent) {
1265 c = document.createEvent(t);
1266 c._eventClass = t;
1267 if (type) {
1268 c.initEvent(type, true, true);
1269 }
1270 }
1271 if (document.createEventObject) {
1272 c = document.createEventObject();
1273 if (type) {
1274 c.type = type;
1275 c._eventClass = t;
1276 }
1277 }
1278 type = c;
1279 if (type._eventClass !== "Event") {
1280 /** @type {string} */
1281 type.data = obj;
1282 match = this.dispatchEvent(type);
1283 } else {
1284 if (c = (this._handlers || {})[a]) {
1285 /** @type {number} */
1286 t = 0;
1287 for (; t < c.length; t++) {
1288 var data = $.isArray(obj) ? obj : [];
1289 data.unshift(type);
1290 data = c[t].apply(this, data);
1291 if (!(typeof data == "undefined" ? true : data)) {
1292 break;
1293 }
1294 }
1295 }
1296 }
1297 return match;
1298 });
1299 },
1300 submit : function(value) {
1301 return this.each(function() {
1302 if ($.isFunction(value)) {
1303 bind(this, "onsubmit", value);
1304 } else {
1305 if (this.submit) {
1306 this.submit();
1307 }
1308 }
1309 });
1310 }
1311 };
1312 if (document.addEventListener) {
1313 /**
1314 * @return {undefined}
1315 */
1316 onReady = function() {
1317 document.removeEventListener("DOMContentLoaded", onReady, false);
1318 $.ready();
1319 };
1320 } else {
1321 if (document.attachEvent) {
1322 /**
1323 * @return {undefined}
1324 */
1325 onReady = function() {
1326 if (document.readyState === "complete") {
1327 document.detachEvent("onreadystatechange", onReady);
1328 $.ready();
1329 }
1330 };
1331 }
1332 }
1333 if (!N) {
1334 /** @type {boolean} */
1335 N = true;
1336 if (document.readyState === "complete") {
1337 return $.ready();
1338 }
1339 if (document.addEventListener) {
1340 document.addEventListener("DOMContentLoaded", onReady, false);
1341 window.addEventListener("load", $.ready, false);
1342 } else {
1343 if (document.attachEvent) {
1344 document.attachEvent("onreadystatechange", onReady);
1345 window.attachEvent("onload", $.ready);
1346 }
1347 }
1348 }
1349 /**
1350 * @param {string} variable
1351 * @param {!Object} value
1352 * @return {?}
1353 */
1354 var get = function(variable, value) {
1355 var parameters = {};
1356 /** @type {!Object} */
1357 parameters[variable] = value;
1358 return parameters;
1359 };
1360 /**
1361 * @param {!Object} item
1362 * @return {?}
1363 */
1364 var init = function(item) {
1365 if (item.nodeType && (item.nodeType === undefined || item.nodeType === style)) {
1366 /** @type {!Array} */
1367 item = [item];
1368 } else {
1369 if (typeof item === "string") {
1370 item = $(item).toArray();
1371 } else {
1372 if (item.jquery && typeof item.jquery === "string") {
1373 item = item.toArray();
1374 }
1375 }
1376 }
1377 return item;
1378 };
1379 if (typeof window.jQuery == "undefined") {
1380 /** @type {function(!Object, !Object): ?} */
1381 window.jQuery = $;
1382 window.jQuery.fn = module.prototype;
1383 /** @type {function(!Object, !Object): ?} */
1384 window.$ = window.jQuery;
1385 /** @type {function(): ?} */
1386 window.now = now;
1387 }
1388 /** @type {function(): ?} */
1389 jQuery.extend = jQuery.fn.extend = function() {
1390 var result = arguments[0] || {};
1391 /** @type {number} */
1392 var i = 1;
1393 /** @type {number} */
1394 var length = arguments.length;
1395 /** @type {boolean} */
1396 var model = false;
1397 var _ref;
1398 var key;
1399 var value;
1400 var config;
1401 if (typeof result === "boolean") {
1402 /** @type {boolean} */
1403 model = result;
1404 result = arguments[1] || {};
1405 /** @type {number} */
1406 i = 2;
1407 }
1408 if (typeof result !== "object" && !jQuery.isFunction(result)) {
1409 result = {};
1410 }
1411 if (length === i) {
1412 result = this;
1413 --i;
1414 }
1415 for (; i < length; i++) {
1416 if ((_ref = arguments[i]) != null) {
1417 for (key in _ref) {
1418 value = result[key];
1419 config = _ref[key];
1420 if (result !== config) {
1421 if (model && config && (jQuery.isPlainObject(config) || jQuery.isArray(config))) {
1422 value = value && (jQuery.isPlainObject(value) || jQuery.isArray(value)) ? value : jQuery.isArray(config) ? [] : {};
1423 result[key] = jQuery.extend(model, value, config);
1424 } else {
1425 if (config !== undefined) {
1426 result[key] = config;
1427 }
1428 }
1429 }
1430 }
1431 }
1432 }
1433 return result;
1434 };
1435 jQuery.each("click,dblclick,mouseover,mouseout,mousedown,mouseup,keydown,keypress,keyup,focus,blur,change,select,error,load,unload,scroll,resize,touchstart,touchend,touchmove".split(","), function(a, o) {
1436 /**
1437 * @param {!Object} f
1438 * @return {?}
1439 */
1440 jQuery.fn[o] = function(f) {
1441 return f ? this.bind(o, f) : this.trigger(o);
1442 };
1443 });
1444})();
1445(function() {
1446 this.Dosbox = function() {
1447 /**
1448 * @param {!Window} options
1449 * @return {undefined}
1450 */
1451 function Dosbox$jscomp$0(options) {
1452 this.onload = options.onload;
1453 this.onrun = options.onrun;
1454 this.ui = new Dosbox$jscomp$0.UI(options);
1455 this.module = new Dosbox$jscomp$0.Module({
1456 canvas : this.ui.canvas
1457 });
1458 this.ui.onStart(function(self) {
1459 return function() {
1460 self.ui.showLoader();
1461 return self.downloadScript();
1462 };
1463 }(this));
1464 }
1465 /**
1466 * @param {number} diff
1467 * @param {string} done
1468 * @return {?}
1469 */
1470 Dosbox$jscomp$0.prototype.run = function(diff, done) {
1471 return new Dosbox$jscomp$0.Mount(this.module, diff, {
1472 success : function(self) {
1473 return function() {
1474 var scrollHeightObserver;
1475 var hide;
1476 self.ui.updateMessage("Launching " + done);
1477 /**
1478 * @return {?}
1479 */
1480 hide = function() {
1481 return self.ui.hideLoader();
1482 };
1483 /**
1484 * @return {?}
1485 */
1486 scrollHeightObserver = function() {
1487 return self._dosbox_main(self, done);
1488 };
1489 setTimeout(scrollHeightObserver, 1000);
1490 return setTimeout(hide, 3000);
1491 };
1492 }(this),
1493 progress : function(thread) {
1494 return function(max_progress, cur_progress) {
1495 return thread.ui.updateMessage("Mount " + done + " (" + (cur_progress * 100 / max_progress | 0) + "%)");
1496 };
1497 }(this)
1498 });
1499 };
1500 /**
1501 * @return {?}
1502 */
1503 Dosbox$jscomp$0.prototype.requestFullScreen = function() {
1504 if (this.module.requestFullScreen) {
1505 return this.module.requestFullScreen(true, false);
1506 }
1507 };
1508 /**
1509 * @return {?}
1510 */
1511 Dosbox$jscomp$0.prototype.downloadScript = function() {
1512 this.module.setStatus("Downloading js-dos");
1513 this.ui.updateMessage("Downloading js-dos");
1514 return new Dosbox$jscomp$0.Xhr("https://js-dos.com/cdn/js-dos-v3.js", {
1515 success : function(that) {
1516 return function(query) {
1517 var scrollHeightObserver;
1518 that.ui.updateMessage("Initializing dosbox");
1519 /**
1520 * @return {?}
1521 */
1522 scrollHeightObserver = function() {
1523 return that._jsdos_init(that.module, query, that.onload);
1524 };
1525 return setTimeout(scrollHeightObserver, 1000);
1526 };
1527 }(this),
1528 progress : function(thread) {
1529 return function(max_progress, cur_progress) {
1530 return thread.ui.updateMessage("Downloading js-dos (" + (cur_progress * 100 / max_progress | 0) + "%)");
1531 };
1532 }(this)
1533 });
1534 };
1535 /**
1536 * @param {number} module$jscomp$0
1537 * @param {?} script$jscomp$1
1538 * @param {?} onload$jscomp$0
1539 * @return {?}
1540 */
1541 Dosbox$jscomp$0.prototype._jsdos_init = function(module$jscomp$0, script$jscomp$1, onload$jscomp$0) {
1542 var Module$jscomp$0;
1543 /** @type {number} */
1544 Module$jscomp$0 = module$jscomp$0;
1545 eval(script$jscomp$1);
1546 if (onload$jscomp$0) {
1547 return onload$jscomp$0(this);
1548 }
1549 };
1550 /**
1551 * @param {!Object} obj
1552 * @param {string} ctx
1553 * @return {?}
1554 */
1555 Dosbox$jscomp$0.prototype._dosbox_main = function(obj, ctx) {
1556 var name;
1557 var scrollHeightObserver;
1558 try {
1559 if (obj.onrun) {
1560 /**
1561 * @return {?}
1562 */
1563 scrollHeightObserver = function() {
1564 return obj.onrun(obj, ctx);
1565 };
1566 setTimeout(scrollHeightObserver, 1000);
1567 }
1568 return obj.module.ccall("dosbox_main", "int", ["string"], [ctx]);
1569 } catch (MOUSE_LEFT_BUTTON_PRESSED) {
1570 name = MOUSE_LEFT_BUTTON_PRESSED;
1571 if (name === "SimulateInfiniteLoop") {
1572 } else {
1573 return typeof console !== "undefined" && console !== null ? typeof console.error === "function" ? console.error(name) : void 0 : void 0;
1574 }
1575 }
1576 };
1577 return Dosbox$jscomp$0;
1578 }();
1579}).call(this);
1580(function() {
1581 Dosbox.Module = function() {
1582 /**
1583 * @param {!Object} reader
1584 * @return {undefined}
1585 */
1586 function Module(reader) {
1587 this.elCanvas = reader.canvas;
1588 this.canvas = this.elCanvas[0];
1589 }
1590 /** @type {!Array} */
1591 Module.prototype.preRun = [];
1592 /** @type {!Array} */
1593 Module.prototype.postRun = [];
1594 /** @type {number} */
1595 Module.prototype.totalDependencies = 0;
1596 /**
1597 * @param {string} data
1598 * @return {?}
1599 */
1600 Module.prototype.print = function(data) {
1601 /** @type {string} */
1602 data = Array.prototype.slice.call(arguments).join(" ");
1603 return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(data) : void 0 : void 0;
1604 };
1605 /**
1606 * @param {string} e
1607 * @return {?}
1608 */
1609 Module.prototype.printErr = function(e) {
1610 /** @type {string} */
1611 e = Array.prototype.slice.call(arguments).join(" ");
1612 return typeof console !== "undefined" && console !== null ? typeof console.error === "function" ? console.error(e) : void 0 : void 0;
1613 };
1614 /**
1615 * @param {string} value
1616 * @return {?}
1617 */
1618 Module.prototype.setStatus = function(value) {
1619 return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(value) : void 0 : void 0;
1620 };
1621 /**
1622 * @param {number} left
1623 * @return {?}
1624 */
1625 Module.prototype.monitorRunDependencies = function(left) {
1626 var status;
1627 /** @type {number} */
1628 this.totalDependencies = Math.max(this.totalDependencies, left);
1629 /** @type {string} */
1630 status = left ? "Preparing... (" + (this.totalDependencies - left) + "/" + this.totalDependencies + ")" : "All downloads complete.";
1631 return this.setStatus(status);
1632 };
1633 return Module;
1634 }();
1635}).call(this);
1636(function() {
1637 Dosbox.Mount = function() {
1638 /**
1639 * @param {!Object} module
1640 * @param {!Object} url
1641 * @param {!Object} data
1642 * @return {undefined}
1643 */
1644 function send(module, url, data) {
1645 /** @type {!Object} */
1646 this.module = module;
1647 new Dosbox.Xhr(url, {
1648 success : function(self) {
1649 return function(a) {
1650 var help;
1651 help = self._toArray(a);
1652 if (self._mountZip(help)) {
1653 return data.success();
1654 } else {
1655 return typeof console !== "undefined" && console !== null ? typeof console.error === "function" ? console.error("Unable to mount", url) : void 0 : void 0;
1656 }
1657 };
1658 }(this),
1659 progress : data.progress
1660 });
1661 }
1662 /**
1663 * @param {number} data
1664 * @return {?}
1665 */
1666 send.prototype._mountZip = function(data) {
1667 var image_m;
1668 var code;
1669 image_m = this.module._malloc(data.length);
1670 this.module.HEAPU8.set(data, image_m);
1671 code = this.module.ccall("extract_zip", "int", ["number", "number"], [image_m, data.length]);
1672 this.module._free(image_m);
1673 return code === 0;
1674 };
1675 /**
1676 * @param {string} obj
1677 * @return {?}
1678 */
1679 send.prototype._toArray = function(obj) {
1680 var arr;
1681 var i;
1682 var len;
1683 if (typeof obj === "string") {
1684 /** @type {!Array} */
1685 arr = new Array(obj.length);
1686 /** @type {number} */
1687 i = 0;
1688 /** @type {number} */
1689 len = obj.length;
1690 for (; i < len;) {
1691 /** @type {number} */
1692 arr[i] = obj.charCodeAt(i);
1693 ++i;
1694 }
1695 return arr;
1696 }
1697 return obj;
1698 };
1699 return send;
1700 }();
1701}).call(this);
1702(function() {
1703 Dosbox.UI = function() {
1704 /**
1705 * @param {string} eVideoJSON
1706 * @return {undefined}
1707 */
1708 function draw(eVideoJSON) {
1709 this.appendCss();
1710 this.div = $("#" + (eVideoJSON.id || "dosbox"));
1711 this.wrapper = $('<div class="dosbox-container">');
1712 this.canvas = $('<canvas class="dosbox-canvas" oncontextmenu="event.preventDefault()">');
1713 this.overlay = $('<div class="dosbox-overlay">');
1714 this.loaderMessage = $('<div class="dosbox-loader-message">');
1715 this.loader = $('<div class="dosbox-loader">').append($('<div class="st-loader">').append($('<span class="equal">'))).append(this.loaderMessage);
1716 this.start = $('<div class="dosbox-start">Click to start');
1717 this.div.append(this.wrapper);
1718 this.wrapper.append(this.canvas);
1719 this.wrapper.append(this.loader);
1720 this.wrapper.append(this.overlay);
1721 this.overlay.append($('<div class="dosbox-powered">Powered by ').append($('<a href="http://js-dos.com">js-dos.com')));
1722 this.overlay.append(this.start);
1723 }
1724 /**
1725 * @param {?} onChildRunning
1726 * @return {?}
1727 */
1728 draw.prototype.onStart = function(onChildRunning) {
1729 return this.start.click(function(settings) {
1730 return function() {
1731 onChildRunning();
1732 return settings.overlay.hide();
1733 };
1734 }(this));
1735 };
1736 /**
1737 * @return {?}
1738 */
1739 draw.prototype.appendCss = function() {
1740 var detectBlock;
1741 var style;
1742 /** @type {!Element} */
1743 detectBlock = document.head || document.getElementsByTagName("head")[0];
1744 /** @type {!Element} */
1745 style = document.createElement("style");
1746 /** @type {string} */
1747 style.type = "text/css";
1748 if (style.styleSheet) {
1749 style.styleSheet.cssText = this.css;
1750 } else {
1751 style.appendChild(document.createTextNode(this.css));
1752 }
1753 return detectBlock.appendChild(style);
1754 };
1755 /**
1756 * @return {?}
1757 */
1758 draw.prototype.showLoader = function() {
1759 this.loader.show();
1760 return this.loaderMessage.html("");
1761 };
1762 /**
1763 * @param {string} text
1764 * @return {?}
1765 */
1766 draw.prototype.updateMessage = function(text) {
1767 return this.loaderMessage.html(text);
1768 };
1769 /**
1770 * @return {?}
1771 */
1772 draw.prototype.hideLoader = function() {
1773 return this.loader.hide();
1774 };
1775 /** @type {string} */
1776 draw.prototype.css = '.dosbox-container { position: relative; min-width: 320px; min-height: 200px; } .dosbox-canvas { } .dosbox-overlay, .dosbox-loader { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background-color: #333; } .dosbox-start { text-align: center; position: absolute; left: 0; right: 0; bottom: 50%; color: #f80; font-size: 1.5em; text-decoration: underline; cursor: pointer; } .dosbox-overlay a { color: #f80; } .dosbox-loader { display: none; } .dosbox-powered { position: absolute; right: 1em; bottom: 1em; font-size: 0.8em; color: #9C9C9C; } .dosbox-loader-message { text-align: center; position: absolute; left: 0; right: 0; bottom: 50%; margin: 0 0 -3em 0; box-sizing: border-box; color: #f80; font-size: 1.5em; } @-moz-keyframes loading { 0% { left: 0; } 50% { left: 8.33333em; } 100% { left: 0; } } @-webkit-keyframes loading { 0% { left: 0; } 50% { left: 8.33333em; } 100% { left: 0; } } @keyframes loading { 0% { left: 0; } 50% { left: 8.33333em; } 100% { left: 0; } } .st-loader { width: 10em; height: 2.5em; position: absolute; top: 50%; left: 50%; margin: -1.25em 0 0 -5em; box-sizing: border-box; } .st-loader:before, .st-loader:after { content: ""; display: block; position: absolute; top: 0; bottom: 0; width: 1.25em; box-sizing: border-box; border: 0.25em solid #f80; } .st-loader:before { left: -0.76923em; border-right: 0; } .st-loader:after { right: -0.76923em; border-left: 0; } .st-loader .equal { display: block; position: absolute; top: 50%; margin-top: -0.5em; left: 4.16667em; height: 1em; width: 1.66667em; border: 0.25em solid #f80; box-sizing: border-box; border-width: 0.25em 0; -moz-animation: loading 1.5s infinite ease-in-out; -webkit-animation: loading 1.5s infinite ease-in-out; animation: loading 1.5s infinite ease-in-out; }';
1777 return draw;
1778 }();
1779}).call(this);
1780(function() {
1781 Dosbox.Xhr = function() {
1782 /**
1783 * @param {?} url
1784 * @param {!Object} options
1785 * @return {undefined}
1786 */
1787 function request(url, options) {
1788 var e;
1789 this.success = options.success;
1790 this.progress = options.progress;
1791 if (window.ActiveXObject) {
1792 try {
1793 this.xhr = new ActiveXObject("Microsoft.XMLHTTP");
1794 } catch (_error) {
1795 e = _error;
1796 /** @type {null} */
1797 this.xhr = null;
1798 }
1799 } else {
1800 /** @type {!XMLHttpRequest} */
1801 this.xhr = new XMLHttpRequest;
1802 }
1803 this.xhr.open("GET", url, true);
1804 this.xhr.overrideMimeType("text/plain; charset=x-user-defined");
1805 this.xhr.addEventListener("progress", function(self) {
1806 return function(event) {
1807 if (self.progress) {
1808 return self.progress(event.total, event.loaded);
1809 }
1810 };
1811 }(this));
1812 this.xhr.onreadystatechange = function(EMSarray) {
1813 return function() {
1814 return EMSarray._onReadyStateChange();
1815 };
1816 }(this);
1817 this.xhr.send();
1818 }
1819 /**
1820 * @return {?}
1821 */
1822 request.prototype._onReadyStateChange = function() {
1823 if (this.xhr.readyState === 4 && this.success) {
1824 return this.success(this.xhr.responseText);
1825 }
1826 };
1827 return request;
1828 }();
1829}).call(this);