diff options
Diffstat (limited to 'webclients/novnc/include/util.js')
-rw-r--r-- | webclients/novnc/include/util.js | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/webclients/novnc/include/util.js b/webclients/novnc/include/util.js index 0a9e0e0..ddc1914 100644 --- a/webclients/novnc/include/util.js +++ b/webclients/novnc/include/util.js @@ -33,6 +33,30 @@ Array.prototype.push32 = function (num) { (num ) & 0xFF ); }; +// IE does not support map (even in IE9) +//This prototype is provided by the Mozilla foundation and +//is distributed under the MIT license. +//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license +if (!Array.prototype.map) +{ + Array.prototype.map = function(fun /*, thisp*/) + { + var len = this.length; + if (typeof fun != "function") + throw new TypeError(); + + var res = new Array(len); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + { + if (i in this) + res[i] = fun.call(thisp, this[i], i, this); + } + + return res; + }; +} + /* * ------------------------------------------------------ * Namespaced in Util @@ -159,7 +183,7 @@ Util.conf_defaults = function(cfg, api, defaults, arr) { Util.conf_default(cfg, api, defaults, arr[i][0], arr[i][1], arr[i][2], arr[i][3], arr[i][4]); } -} +}; /* @@ -240,8 +264,11 @@ Util.stopEvent = function(e) { Util.Features = {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)}; Util.Engine = { - 'presto': (function() { - return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925)); }()), + // Version detection break in Opera 11.60 (errors on arguments.callee.caller reference) + //'presto': (function() { + // return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925)); }()), + 'presto': (function() { return (!window.opera) ? false : true; }()), + 'trident': (function() { return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? ((document.querySelectorAll) ? 6 : 5) : 4); }()), 'webkit': (function() { |