crossbrowdy
Version:
A Multimedia JavaScript framework to create real cross-platform and hybrid game engines, games, emulators, multimedia libraries and apps.
913 lines (770 loc) • 117 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>CrossBrowdy API documentation [printable] Source: CrossBase/CrossBase.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.yeti.css">
</head>
<body style="min-width:800px; overflow-wrap:break-word; word-wrap:break-word; word-break:break-word; line-break:strict; hyphens:none; -webkit-hyphens:none; -moz-hyphens:none;">
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">CrossBrowdy API documentation [printable]</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="CB_Arrays.html">CB_Arrays</a></li><li><a href="CB_AudioDetector.html">CB_AudioDetector</a></li><li><a href="CB_Client.html">CB_Client</a></li><li><a href="CB_Collisions.html">CB_Collisions</a></li><li><a href="CB_Configuration.html">CB_Configuration</a></li><li><a href="CB_Configuration.CrossBase.html">CB_Configuration.CrossBase</a></li><li><a href="CB_Configuration.CrossBrowdy.html">CB_Configuration.CrossBrowdy</a></li><li><a href="CB_Controllers.html">CB_Controllers</a></li><li><a href="CB_Controllers_Proprietary.html">CB_Controllers_Proprietary</a></li><li><a href="CB_Controllers_Proprietary.WII.html">CB_Controllers_Proprietary.WII</a></li><li><a href="CB_Controllers_Proprietary.WII_U.html">CB_Controllers_Proprietary.WII_U</a></li><li><a href="CB_Device.html">CB_Device</a></li><li><a href="CB_Device.AmbientLight.html">CB_Device.AmbientLight</a></li><li><a href="CB_Device.Battery.html">CB_Device.Battery</a></li><li><a href="CB_Device.Location.html">CB_Device.Location</a></li><li><a href="CB_Device.Motion.html">CB_Device.Motion</a></li><li><a href="CB_Device.Orientation.html">CB_Device.Orientation</a></li><li><a href="CB_Device.Proximity.html">CB_Device.Proximity</a></li><li><a href="CB_Device.Vibration.html">CB_Device.Vibration</a></li><li><a href="CB_Elements.html">CB_Elements</a></li><li><a href="CB_Events.html">CB_Events</a></li><li><a href="CB_Keyboard.html">CB_Keyboard</a></li><li><a href="CB_Keyboard.chars.html">CB_Keyboard.chars</a></li><li><a href="CB_Keyboard.extended.html">CB_Keyboard.extended</a></li><li><a href="CB_Keyboard.keys.html">CB_Keyboard.keys</a></li><li><a href="CB_Modules.html">CB_Modules</a></li><li><a href="CB_Mouse.html">CB_Mouse</a></li><li><a href="CB_Mouse.CursorImage.html">CB_Mouse.CursorImage</a></li><li><a href="CB_Net.html">CB_Net</a></li><li><a href="CB_Net.Fetch.html">CB_Net.Fetch</a></li><li><a href="CB_Net.REST.html">CB_Net.REST</a></li><li><a href="CB_Net.Sockets.html">CB_Net.Sockets</a></li><li><a href="CB_Net.Sockets.SockJS.html">CB_Net.Sockets.SockJS</a></li><li><a href="CB_Net.XHR.html">CB_Net.XHR</a></li><li><a href="CB_Pointer.html">CB_Pointer</a></li><li><a href="CB_Screen.html">CB_Screen</a></li><li><a href="CB_Speaker.html">CB_Speaker</a></li><li><a href="CB_Touch.html">CB_Touch</a></li><li><a href="CB_baseSymbols.html">CB_baseSymbols</a></li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="CB_AudioFile.html">CB_AudioFile</a></li><li><a href="CB_AudioFileCache.html">CB_AudioFileCache</a></li><li><a href="CB_AudioFileSprites.html">CB_AudioFileSprites</a></li><li><a href="CB_AudioFileSpritesPool.html">CB_AudioFileSpritesPool</a></li><li><a href="CB_AudioFile_API.AAPI.html">CB_AudioFile_API.AAPI</a></li><li><a href="CB_AudioFile_API.ACMP.html">CB_AudioFile_API.ACMP</a></li><li><a href="CB_AudioFile_API.SM2.html">CB_AudioFile_API.SM2</a></li><li><a href="CB_AudioFile_API.WAAPI.html">CB_AudioFile_API.WAAPI</a></li><li><a href="CB_Canvas.html">CB_Canvas</a></li><li><a href="CB_GraphicSprites.html">CB_GraphicSprites</a></li><li><a href="CB_GraphicSpritesScene.html">CB_GraphicSpritesScene</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu inline">
<li><a href="global.html#CB_BASE_NAME">CB_BASE_NAME</a></li><li><a href="global.html#CB_CREDITS_DEFAULT">CB_CREDITS_DEFAULT</a></li><li><a href="global.html#CB_NAME">CB_NAME</a></li><li><a href="global.html#CB_OPTIONS">CB_OPTIONS</a></li><li><a href="global.html#CB_VERSION">CB_VERSION</a></li><li><a href="global.html#CB_addCredits">CB_addCredits</a></li><li><a href="global.html#CB_baseToBase">CB_baseToBase</a></li><li><a href="global.html#CB_baseToInt">CB_baseToInt</a></li><li><a href="global.html#CB_br2nl">CB_br2nl</a></li><li><a href="global.html#CB_brToNl">CB_brToNl</a></li><li><a href="global.html#CB_combineArraysOrObjects">CB_combineArraysOrObjects</a></li><li><a href="global.html#CB_combineAutomatically">CB_combineAutomatically</a></li><li><a href="global.html#CB_combineJSON">CB_combineJSON</a></li><li><a href="global.html#CB_combineURIParameters">CB_combineURIParameters</a></li><li><a href="global.html#CB_combineURLParameters">CB_combineURLParameters</a></li><li><a href="global.html#CB_console">CB_console</a></li><li><a href="global.html#CB_copyObject">CB_copyObject</a></li><li><a href="global.html#CB_countDecimalDigits">CB_countDecimalDigits</a></li><li><a href="global.html#CB_countDecimalPart">CB_countDecimalPart</a></li><li><a href="global.html#CB_countDecimals">CB_countDecimals</a></li><li><a href="global.html#CB_countIntegerDigits">CB_countIntegerDigits</a></li><li><a href="global.html#CB_countIntegerPart">CB_countIntegerPart</a></li><li><a href="global.html#CB_credits">CB_credits</a></li><li><a href="global.html#CB_forEach">CB_forEach</a></li><li><a href="global.html#CB_forceString">CB_forceString</a></li><li><a href="global.html#CB_getBase64StringObject">CB_getBase64StringObject</a></li><li><a href="global.html#CB_getCookie">CB_getCookie</a></li><li><a href="global.html#CB_getDatum">CB_getDatum</a></li><li><a href="global.html#CB_getJSONPropertyValue">CB_getJSONPropertyValue</a></li><li><a href="global.html#CB_getLZStringObject">CB_getLZStringObject</a></li><li><a href="global.html#CB_getValueIndex">CB_getValueIndex</a></li><li><a href="global.html#CB_getValuePath">CB_getValuePath</a></li><li><a href="global.html#CB_includeJSFile">CB_includeJSFile</a></li><li><a href="global.html#CB_indexOf">CB_indexOf</a></li><li><a href="global.html#CB_init">CB_init</a></li><li><a href="global.html#CB_intToBase">CB_intToBase</a></li><li><a href="global.html#CB_isArray">CB_isArray</a></li><li><a href="global.html#CB_isEmail">CB_isEmail</a></li><li><a href="global.html#CB_isFileLocal">CB_isFileLocal</a></li><li><a href="global.html#CB_isString">CB_isString</a></li><li><a href="global.html#CB_lastIndexOf">CB_lastIndexOf</a></li><li><a href="global.html#CB_ltrim">CB_ltrim</a></li><li><a href="global.html#CB_nl2br">CB_nl2br</a></li><li><a href="global.html#CB_nlToBr">CB_nlToBr</a></li><li><a href="global.html#CB_numberFormat">CB_numberFormat</a></li><li><a href="global.html#CB_numberOfDecimalDigits">CB_numberOfDecimalDigits</a></li><li><a href="global.html#CB_numberOfDecimals">CB_numberOfDecimals</a></li><li><a href="global.html#CB_numberOfIntegerDigits">CB_numberOfIntegerDigits</a></li><li><a href="global.html#CB_parseJSON">CB_parseJSON</a></li><li><a href="global.html#CB_parseString">CB_parseString</a></li><li><a href="global.html#CB_regularExpressionString">CB_regularExpressionString</a></li><li><a href="global.html#CB_renderString">CB_renderString</a></li><li><a href="global.html#CB_replaceAll">CB_replaceAll</a></li><li><a href="global.html#CB_rtrim">CB_rtrim</a></li><li><a href="global.html#CB_scriptPath">CB_scriptPath</a></li><li><a href="global.html#CB_scriptPathCalculate">CB_scriptPathCalculate</a></li><li><a href="global.html#CB_setCookie">CB_setCookie</a></li><li><a href="global.html#CB_setDatum">CB_setDatum</a></li><li><a href="global.html#CB_sizeOf">CB_sizeOf</a></li><li><a href="global.html#CB_sizeof">CB_sizeof</a></li><li><a href="global.html#CB_stringifyJSON">CB_stringifyJSON</a></li><li><a href="global.html#CB_symmetricCall">CB_symmetricCall</a></li><li><a href="global.html#CB_symmetricCallClear">CB_symmetricCallClear</a></li><li><a href="global.html#CB_this">CB_this</a></li><li><a href="global.html#CB_trim">CB_trim</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content" style="width:100%;">
<div class="row" style="width:100%;">
<div class="col-md-12">
<div id="main">
<h1 class="page-title">Source: CrossBase/CrossBase.js</h1>
<section>
<article>
<pre
class="sunlight-highlight-javascript linenums">/**
* @file Main CrossBase module file.
* @author Joan Alba Maldonado <workindalian@gmail.com>
* @license Creative Commons Attribution 4.0 International. See more at {@link https://crossbrowdy.com/about#what_is_the_crossbrowdy_copyright_and_license}.
*/
//Credits of the module:
var CB_CrossBaseCredits =
"[CB] - CrossBase module by Joan Alba Maldonado<br />" +
"[CB] -- Array.* polyfills by Mozilla Foundation (MDN)<br />" +
"[CB] -- JSON 3 by Kit Cambridge<br />" +
"[CB] -- bluebird by Petka Antonov<br />" +
"[CB] -- BrowserDetect by Peter-Paul Koch<br />" +
"[CB] -- performance.now polyfill by Paul Irish, Aaron Levine and Joan Alba Maldonado<br />" +
"[CB] -- requestAnimationFrame polyfill by Erik Moller (fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavic, Darius Bacon, Tim Hall and Joan Alba Maldonado)<br />" +
"[CB] -- typedarray.js polyfill by Linden Research, Inc. and Joshua Bell<br />" +
"[CB] -- Base64Binary by Daniel Guerrero<br />" +
"[CB] -- localStorage polyfill by Morten Houmøller Nygaard<br />" +
"[CB] -- lz-string (including base64-string) by pieroxy<br />" +
"[CB] -- Canbox by Robert Inglin<br />" +
"[CB] -- ExplorerCanvas by Google Inc.<br />" +
"[CB] -- SLCanvas by David Anson and Jon Davis<br />" +
"[CB] -- FlashCanvas by Tim Cameron Ryan and Shinya Muramatsu<br />" +
"[CB] -- canvas-text by Fabien Ménager<br />" +
"[CB] -- Detect-zoom by yonran (maintained by tombigel)<br />" +
"[CB] -- AudioContext-MonkeyPatch by Chris Wilson<br />" +
"[CB] -- WAAPISim by g200kg<br />" +
"[CB] -- timbre.js and subcollider.js by mohayonao<br />" +
"[CB] -- Band.js by Cody Lundquist and various contributors<br />" +
"[CB] -- jsfx by Egon Elbre<br />" +
"[CB] -- SoundManager 2 by Scott Schiller<br />" +
"[CB] -- fetch-ie8 by Cam Song<br />" +
"[CB] -- SockJS-client by Marek, Bryce Kahle, Michael Bridgen, Luigi Pinca and others<br />" +
"[CB] -- Pressure.js by Stuart Yamartino<br />" +
"[CB] -- Hammer.js by Jorik Tangelder<br />" +
"[CB] -- Hammer Time by Alexander Schmitz and other contributors<br />" +
"[CB] -- wii-js by Ryan McGrath<br />" +
"[CB] -- gamepad-plus by Chris Van Wiemeersch (MozVR)<br />" +
"[CB] -- NoSleep.js by Rich Tibbett<br />";
//CrossBase constants and variables:
/**
* Keeps the name of the CrossBase module.
* @constant
* @type {string}
* @default
*/
var CB_BASE_NAME = "CrossBase";
/**
Property that contains an object with the options for the main script.
* @namespace CB_Configuration.CrossBase
*/
CB_Configuration[CB_BASE_NAME] =
{
/**
* Path to the CrossBase module, relative to the CrossBrowdy folder.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {string}
* @default {@link CB_BASE_NAME} + "/"
*/
SCRIPT_PATH: CB_BASE_NAME + "/",
/**
* Defines whether to have in mind possible [iframes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe} that could contain the script or not. Used by some functions of {@link CB_Client}, {@link CB_Events}, etc.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
MIND_IFRAMES: true,
/**
* Defines whether to allow to extend the DOM if needed or not. If set to true and some methods (as for example [Array.indexOf]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf}, [Array.lastIndexOf]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf}, [Array.isArray]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray}, [Array.forEach]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach}, [NodeList.forEach]{@link https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach}, [HTMLCollection.forEach]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach}, etc.) are not supported natively, they will be added.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
EXTEND_DOM: false,
/**
* Defines whether to use high precision in the CB_Device.getTime (returning '[window.performance.timing.navigationStart]{@link https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming/navigationStart} + [window.performance.now]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now}()', where '[window.performance.now]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now}' could be polyfilled) or not (returning '[Date.now]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now}()', where '[Date.now]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now}' could be polyfilled).
* @memberof CB_Configuration.CrossBase
* @constant
* @type {string}
* @default
*/
CB_Device_getTime_HIGH_PRECISION: true,
/**
* Defines whether to use cache for the function {@link CB_Elements.id} by default.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Elements_id_USE_CACHE: true,
/**
* Defines whether to use cache for the {@link CB_Elements.tag} function by default.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Elements_tag_USE_CACHE: true,
/**
* Defines whether to use cache for the function {@link CB_Elements.classes} by default.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Elements_classes_USE_CACHE: true,
/**
* Default language to use for {@link CB_Client} when no language can be detected (very strange case!).
* @memberof CB_Configuration.CrossBase
* @constant
* @type {string}
* @default
*/
CB_Client_language_DEFAULT: "en",
/**
* Default value for the "allowNavigatorLanguages" parameter for {@link CB_Client.getLanguage} and {@link CB_Client.getLanguages} functions.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Client_allowNavigatorLanguages_DEFAULT: false,
/**
* Tells whether the {@link CB_Client.getLanguage} and {@link CB_Client.getLanguages} functions will use the accepted languages detected by PHP (if any) as the first option by default or not.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Client_PHPAcceptedLanguagesFirst_DEFAULT: true,
/**
* Defines whether the URL for the proxy (defined in {@link CB_Configuration.CrossBase.CB_Net_XHR_PROXY_URL}) is relative to the main script folder or not. If it is relative, the "onCall" event of the CrossBase module will append the value of the "scriptPathGiven" parameter at the beginning.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Net_XHR_PROXY_URL_RELATIVE: true,
/**
* Defines whether we want to prevent the Firefox bug that affects [SockJS library]{@link https://github.com/sockjs/sockjs-client/} (see {@link https://github.com/sockjs/sockjs-client/issues/18}) or not. Used by {@link CB_Keyboard}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Net_Sockets_PREVENT_FIREFOX_ESC_BUG: true,
/**
* Defines whether to allow Nintendo Wii codes (from the Wiimote) set in the {@link CB_Keyboard.extended.WII} object to be defined in the key aliases even if they use codes which belong to other keys. Used by {@link CB_Keyboard}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Keyboard_extended_WII_allowDuplicateKeyAliases: true,
/**
* Defines whether to allow Sony Playstation 4 codes set in the {@link CB_Keyboard.extended.PS4CB_Keyboard.extended.PS4} object to be defined in the key aliases even if they use codes which belong to other keys. Used by {@link CB_Keyboard}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Keyboard_extended_PS4_allowDuplicateKeyAliases: false,
/**
* Defines whether to allow Smart TV codes (from the remote control) and virtual key codes set in the {@link CB_Keyboard.extended.VK} object to be defined in the key aliases even if they use codes which belong to other keys. Used by {@link CB_Keyboard}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Keyboard_extended_VK_allowDuplicateKeyAliases: true,
/**
* Defines whether to allow Samsung TV key codes (from the remote control) set in the {@link CB_Keyboard.extended.SAMSUNG_TV} object to be defined in the key aliases even if they use codes which belong to other keys. Used by {@link CB_Keyboard}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Keyboard_extended_SAMSUNG_TV_allowDuplicateKeyAliases: false,
/**
* Default value for the "avoidProprietary" proprietary when calling different functions of the {@link CB_Controllers} static class, as the {@link CB_Controllers.getButtonsDown}, the {@link CB_Controllers.isButtonDown} and the {@link CB_Controllers.getGamePads} functions, etc.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_Controllers_avoidProprietary_DEFAULT: false,
/**
* Allowed width margin of the total screen available to consider whether it is in full screen or not. Needed by old web clients without Fullscreen API support, mainly. Used by the {@link CB_Screen.isFullScreen} function.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {float}
* @default
*/
CB_Screen_isFullScreen_ALLOWED_WIDTH_MARGIN_PERCENTAGE: 3.9,
/**
* Allowed height margin of the total screen available to consider whether it is in full screen or not. Needed by old web clients without Fullscreen API support, mainly. Used by the {@link CB_Screen.isFullScreen} function.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {float}
* @default
*/
CB_Screen_isFullScreen_ALLOWED_HEIGHT_MARGIN_PERCENTAGE: 3.5,
/**
* Defines whether to allow using "WAAPI" ([HTML5 Web Audio API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API}) emulation (it will use [WAAPISim]{@link https://github.com/g200kg/WAAPISim} if needed) or not.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
WAAPI_EMULATION_ALLOWED: true,
/**
* Default volume for CB_Speaker (from 0 to 100).
* @memberof CB_Configuration.CrossBase
* @constant
* @type {integer}
* @default
*/
CB_Speaker_DEFAULT_VOLUME: 100,
/**
* Milliseconds that a file is played (with volume set to 0) automatically when an audio file is loaded. Needed for some web clients which cannot find out the duration otherwise. Used by {@link CB_AudioFile}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {integer}
* @default
*/
CB_AudioFile_AUTOPLAY_SILENTLY_ON_LOAD_MS: 500,
/**
* Milliseconds to wait before declaring a sound as failed if it cannot be loaded before. Used by {@link CB_AudioFile_API.SM2}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {integer}
* @default
*/
CB_AudioFile_ONLOAD_TIMEOUT_MS: 15000,
/**
* Tells whether CB_AudioFile["AAPI"] uses [setTimeout]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout} (instead of [timeupdate]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/timeupdate_event} event) to detect when the given "stopAt" is reached.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_AudioFile_AAPI_USE_TIMEOUT_TO_DETECT_STOPAT: true,
/**
* Default value for maximum delay (in milliseconds) to wait for a sound to start playing or start next loop (if the time expires, the sound will never be played).
Used by {@link CB_AudioFile_API.WAAPI}, {@link CB_AudioFile_API.AAPI}, {@link CB_AudioFile_API.SM2}, {@link CB_AudioFile_API.ACMP} and {@link CB_AudioFileCache}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {integer}
* @default
*/
CB_AudioFile_AudioFileCache_ALLOWED_RECURSIVE_DELAY_DEFAULT: 150,
/**
* Tells whether to mute or not the audio files when they load or are checking. Note: Audio cache does not work properly on BlackBerry PlayBook's default browser if the sounds are muted when load or are checking.
Used by {@link CB_AudioFile}, {@link CB_AudioFile_API.WAAPI}, {@link CB_AudioFile_API.AAPI}, {@link CB_AudioFile_API.SM2}, {@link CB_AudioFile_API.ACMP} and {@link CB_AudioFileCache}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default !(navigator.userAgent.indexOf("PlayBook") !== -1 && navigator.userAgent.indexOf("Tablet OS") !== -1)
*/
CB_AudioFile_AudioFileCache_MUTE_ON_LOAD_AND_CHECKING: !(navigator.userAgent.indexOf("PlayBook") !== -1 && navigator.userAgent.indexOf("Tablet OS") !== -1), //Audio cache does not work properly on BlackBerry PlayBook's default browser if the sounds are muted when load or are checking.
/**
* Defines whether to use {@link CB_Speaker._volume} as default volume. Used by {@link CB_AudioFile}, {@link CB_AudioFile_API.WAAPI}, {@link CB_AudioFile_API.AAPI}, {@link CB_AudioFile_API.SM2}, {@link CB_AudioFile_API.ACMP} and {@link CB_AudioFileCache}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_DEFAULT: true,
/**
* Defines whether to use {@link CB_Speaker._volume} as maximum volume. Used by {@link CB_AudioFile}, {@link CB_AudioFile_API.WAAPI}, {@link CB_AudioFile_API.AAPI}, {@link CB_AudioFile_API.SM2} and {@link CB_AudioFile_API.ACMP}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_AudioFile_AudioFileCache_USE_SPEAKER_VOLUME_AS_MAXIMUM: false,
/**
* Array with the default desired canvas emulation methods by order of preference. Used by {@link CB_Canvas}.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {array}
* @default
*/
CB_Canvas_PREFERRED_EMULATION_METHODS:
[
"FLASH", //FlashCanvas.
"VML", //ExplorerCanvas.
"DHTML", //Canbox.
"SILVERLIGHT" //SLCanvas.
],
/**
* Value by default when the "allowEmulation" parameter is not provided in the {@link CB_AudioDetector.getPreferredAPI}, the {@link CB_AudioDetector.getSupportedAPIs} or the {@link CB_AudioDetector.isAPISupported} function.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {boolean}
* @default
*/
CB_AudioDetector_allowEmulation_DEFAULT: false,
/**
* Array with the default preferred audio APIs by order of preference. Used by {@link CB_AudioFileCache} and {@link CB_AudioDetector}.
Possible audio APIs are "WAAPI" ([HTML5 Web Audio API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API}), "SM2" ([SoundManager 2]{@link http://schillmania.com/projects/soundmanager2/}), "ACMP" ([Apache Cordova Media Plugin]{@link https://github.com/apache/cordova-plugin-media}) or "AAPI" ([HTML5 Audio API]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio}).
Note: since Internet Explorer 9 works better with SM2 than with AAPI, if it is detected then the default value will be: [ "WAAPI", "SM2", "ACMP", "AAPI" ]
* @memberof CB_Configuration.CrossBase
* @constant
* @type {array}
* @default ["WAAPI", "AAPI", "ACMP", "SM2"]
*/
CB_AudioFileCache_PREFERRED_AUDIO_APIS:
navigator.appVersion.indexOf("MSIE 9") === -1 ?
[
"WAAPI", //HTML5 Web Audio API.
"AAPI", //HTML5 Audio API.
"ACMP", //Apache Cordova Media Plugin.
"SM2" //SoundManager 2.
]
:
[ "WAAPI", "SM2", "ACMP", "AAPI" ], //IE9 have works better with SM2 than with AAPI.
/**
* Array with the default preferred audio formats by order of preference. Used by {@link CB_AudioFileCache} and {@link CB_AudioDetector}.
NOTE: some web clients do not support to specify codecs so it is better to also provide strings without codecs.
* @memberof CB_Configuration.CrossBase
* @constant
* @type {array}
* @default
*/
CB_AudioFileCache_PREFERRED_AUDIO_FORMATS:
[
'audio/ogg; codecs="vorbis"', //audio/ogg with Vorbis codec.
'audio/ogg; codecs="speex"', //audio/ogg with Speex codec.
'audio/ogg; codecs="flac"', //audio/ogg with FLAC codec.
'audio/ogg', //audio/ogg is for .oga, .ogg.
'audio/mpeg; codecs="mp3"', //audio/mpeg with MP3 codec (?).
'audio/mpeg', //audio/mpeg is for .mp1, .mp2, .mp3, .mpg, .mpeg.
'audio/mp4; codecs="mp4a.40.5"', //audio/mp4 with mp4a.40.5 codec.
'audio/mp4; codecs="mp4a.40.2"', //audio/mp4 with mp4a.40.2 codec.
'audio/mp4; codecs="mp4a.40.05"', //audio/mp4 with mp4a.40.05 codec.
'audio/mp4; codecs="mp4a.40.02"', //audio/mp4 with mp4a.40.02 codec.
'audio/mp4; codecs="mp4a.69"', //audio/mp4 with mp4a.69 codec.
'audio/mp4; codecs="mp4a.6B"', //audio/mp4 with mp4a.6B codec.
'audio/mp4; codecs="mp4a.67"', //audio/mp4 with mp4a.67 codec.
'audio/mp4; codecs="mp4a.a6"', //audio/mp4 with mp4a.a6 codec.
'audio/mp4; codecs="mp4a.a5"', //audio/mp4 with mp4a.a5 codec.
'audio/mp4; codecs="aac51"', //audio/mp4 with aac51 codec.
'audio/mp4; codecs="ac-3"', //audio/mp4 with ac-3 codec.
'audio/mp4; codecs="ec-3"', //audio/mp4 with ec-3 codec.
'audio/mp4', //audio/mp4 is for .mp4, .m4a.
'audio/aac; codecs="aac"', //audio.aac with AAC codec (?).
'audio/aac; codecs="mp4a.40.5"', //audio/aac with mp4a.40.5 codec (?).
'audio/aac; codecs="vorbis"', //audio.aac with Vorbis codec (?).
'audio/aac', //audio/acc is for .aac.
'audio/x-aac; codecs="aac"',
'audio/x-aac',
'audio/x-m4b; codecs="aac"',
'audio/x-m4b',
'audio/x-m4p; codecs="aac"',
'audio/x-m4p',
'audio/webm; codecs="vorbis"', //audio/webm with Vorbis codec.
'audio/webm', //audio/webm is for .webm.
'audio/3gpp; codecs="samr"', //audio/3gpp with SAMR codec.
'audio/3gpp', //audio/3gpp is for .3gpp.
'audio/wav; codecs="1"', //audio/wav with 1 codec (?).
'audio/wav', //audio/wav is for .wav.
'audio/x-wav; codecs="1"', //audio/x-wav with 1 codec (?).
'audio/x-wav', //audio/x-wav is for .wav.
'audio/x-pn-wav; codecs="1"', //audio/x-pn-wav with 1 codec (?).
'audio/x-pn-wav', //audio/x-pn-wav is for .wav
'audio/wave; codecs="1"', //audio/wave with 1 codec (?).
'audio/wave', //audio/wave is for .wav.
'audio/x-wave; codecs="1"', //audio/x-wave with 1 codec (?).
'audio/x-wave' //audio/x-wave is for .wav.
]
};
/**
* URL for the proxy to prevent cross-domain issues through AJAX, used by {@link CB_Net.XHR.callProxy} function. Can be relative to the main script folder or not, depending on {@link CB_Configuration.CrossBase.CB_Net_XHR_PROXY_URL_RELATIVE}.
<br />
NOTE: Edit the "CB_proxy.config.php" file to configure the default proxy. Apart from configuring it, adding some security measures is highly recommended.
Have in mind that, for safety reasons, the default proxy only allows to request the URLs defined in the "$allowedURLs" array in the "CB_proxy.config.php" file. Just edit it to allow other URLs.
* @memberof CB_Configuration.CrossBase
* @name CB_Net_XHR_PROXY_URL
* @constant
* @type {string}
* @default {@link CB_Configuration.CrossBase.SCRIPT_PATH} + "net/proxy/CB_proxy.php"
*/
CB_Configuration[CB_BASE_NAME].CB_Net_XHR_PROXY_URL = CB_Configuration[CB_BASE_NAME].SCRIPT_PATH + "net/proxy/CB_proxy.php";
CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [WAAPISim]{@link https://github.com/g200kg/WAAPISim} or not.
* @memberof CB_Configuration.CrossBase
* @name needsWAAPISim
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsWAAPISim = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
var waapisimForceSim = window.waapisimForceSim || undefined;
CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn = //Note: copied from waapisim.js
//TODO: see what IE versions are compatible.
(navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1 && navigator.appVersion.indexOf("MSIE 9") === -1)
&&
(
typeof(waapisimForceSim) !== "undefined" && waapisimForceSim
||
(
typeof(window.AudioContext) !== "undefined"
&& typeof(window.AudioContext.prototype.createOscillator) === "undefined" //Be careful! Pale Moon browser does not have createOscillator method.
&& (typeof(waapisimForceSimWhenLackOsc) === "undefined" || (typeof(waapisimForceSimWhenLackOsc) !== "undefined" && waapisimForceSimWhenLackOsc))
)
||
(
typeof(window.webkitAudioContext) !== "undefined"
&& typeof(window.webkitAudioContext.prototype.createOscillator) === "undefined" //Be careful! Pale Moon browser does not have createOscillator method.
&& (typeof(waapisimForceSimWhenLackOsc) === "undefined" || (typeof(waapisimForceSimWhenLackOsc) !== "undefined" && waapisimForceSimWhenLackOsc))
)
|| typeof(window.AudioContext) === "undefined" && typeof(window.webkitAudioContext) === "undefined"
);
return CB_Configuration[CB_BASE_NAME].needsWAAPISimLastReturn;
}
}
CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn = null; //Cache to return always the same result.
CB_Configuration[CB_BASE_NAME]._supportsCanvasElement = null;
CB_Configuration[CB_BASE_NAME]._supportsCanvas = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn !== null) { return CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
CB_Configuration[CB_BASE_NAME]._supportsCanvasElement = CB_Configuration[CB_BASE_NAME]._supportsCanvasElement || document.createElement("canvas");
//If canvas is supported:
if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement !== null)
{
if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext !== null)
{
try //Uses try-catch to avoid some problems with some web clients (as BeZilla / Bon Echo 2.0.0.22Pre on Haiku OS):
{
//If fillText exists:
if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext("2d")) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext("2d") !== null)
{
CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn = true; //Canvas is supported.
return CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn;
}
} catch(E) { CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn = false; return CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn; }
}
}
CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn = false; //If we arrived here, canvas is not supported.
return CB_Configuration[CB_BASE_NAME]._supportsCanvasLastReturn;
}
}
CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [Canbox]{@link https://github.com/robertinglin/CanBox} or not.
* @memberof CB_Configuration.CrossBase
* @name needsCanbox
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsCanbox = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
//We need it only if canvas is not already supported by the web client (and it is not IE5/5.5 since it doesn't support Canbox):
//CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn = (typeof(document.createElement("canvas").getContext) === "undefined" && navigator.appVersion.indexOf("MSIE 5") === -1);
CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn = (!CB_Configuration[CB_BASE_NAME]._supportsCanvas() && navigator.appVersion.indexOf("MSIE 5") === -1);
return CB_Configuration[CB_BASE_NAME].needsCanboxLastReturn;
}
}
CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [ExplorerCanvas]{@link https://github.com/arv/explorercanvas} or not.
* @memberof CB_Configuration.CrossBase
* @name needsExplorerCanvas
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsExplorerCanvas = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
//We need it only if canvas is not already supported by the web client and the web client is IE 6, 7, 8 or 9 (IE9 doesn't support canvas in quirks mode and IE5/5.5 doesn't support ExplorerCanvas):
//CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn = (typeof(document.createElement("canvas").getContext) === "undefined" && navigator.userAgent.indexOf('MSIE') !== -1 && (navigator.appVersion.indexOf("MSIE 6") !== -1 || navigator.appVersion.indexOf("MSIE 7") !== -1 || navigator.appVersion.indexOf("MSIE 8") !== -1 || navigator.appVersion.indexOf("MSIE 9") !== -1));
CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn = (!CB_Configuration[CB_BASE_NAME]._supportsCanvas() && navigator.userAgent.indexOf('MSIE') !== -1 && (navigator.appVersion.indexOf("MSIE 6") !== -1 || navigator.appVersion.indexOf("MSIE 7") !== -1 || navigator.appVersion.indexOf("MSIE 8") !== -1 || navigator.appVersion.indexOf("MSIE 9") !== -1));
return CB_Configuration[CB_BASE_NAME].needsExplorerCanvasLastReturn;
}
}
//CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [SLCanvas]{@link https://slcanvas.codeplex.com/} or not.
* @memberof CB_Configuration.CrossBase
* @name needsSLCanvas
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsSLCanvas = function()
{
return !CB_Configuration[CB_BASE_NAME]._supportsCanvas();
/*
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
//We need it only if canvas is not already supported by the web client:
//CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn = (typeof(document.createElement("canvas").getContext) === "undefined");// && navigator.appVersion.indexOf("MSIE 5") === -1);
CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn = !CB_Configuration[CB_BASE_NAME]._supportsCanvas();// && navigator.appVersion.indexOf("MSIE 5") === -1);
return CB_Configuration[CB_BASE_NAME].needsSLCanvasLastReturn;
}
*/
}
CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [FlashCanvas]{@link https://github.com/everlaat/flashcanvas} or not.
* @memberof CB_Configuration.CrossBase
* @name needsFlashCanvas
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsFlashCanvas = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
//We need it only if ActiveXObject is available (it has to be IE) and it is not compatible with canvas:
CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn = (typeof(window.ActiveXObject) !== "undefined" && typeof(window.CanvasRenderingContext2D) === "undefined");
return CB_Configuration[CB_BASE_NAME].needsFlashCanvasLastReturn;
}
}
CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn = null; //Cache to return always the same result.
/**
* Detects whether the web client needs [canvas-text]{@link https://github.com/PhenX/canvas-text} or not.
* @memberof CB_Configuration.CrossBase
* @name needsCanvasText
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsCanvasText = function()
{
//If the last result is in the cache, we return again the same result:
if (typeof(CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn) !== "undefined" && CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn !== null) { return CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn; }
//...otherwise (it is the first time), we calculate if we need it or not:
else
{
//CB_Configuration[CB_BASE_NAME]._supportsCanvasElement = CB_Configuration[CB_BASE_NAME]._supportsCanvasElement || document.createElement("canvas");
//If canvas is supported:
//if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement !== null)
//{
//if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext !== null)
//{
if (CB_Configuration[CB_BASE_NAME]._supportsCanvas())
{
try //Uses try-catch to avoid some problems with some web clients (as BeZilla / Bon Echo 2.0.0.22Pre on Haiku OS).
{
//If fillText exists:
if (typeof(CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext("2d").fillText) !== "undefined" && CB_Configuration[CB_BASE_NAME]._supportsCanvasElement.getContext("2d").fillText !== null)
{
CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn = false; //We don't need canvas-text.
return CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn;
}
else { CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn = true; return CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn; }
} catch(E) { CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn = true; return CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn; }
}
//}
//}
CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn = false;
return CB_Configuration[CB_BASE_NAME].needsCanvasTextLastReturn;
}
}
/**
* Detects whether the web client needs [timbre.js]{@link https://mohayonao.github.io/timbre.js/} (including [subcollider.js]{@link https://github.com/mohayonao/subcollider}) or not.
* @function
* @memberof CB_Configuration.CrossBase
* @name needsTimbreJS
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsTimbreJS = function()
{
//TODO: see what IE versions are compatible.
return (navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1 && navigator.appVersion.indexOf("MSIE 9") === -1);
}
/**
* Detects whether the web client needs [jsfx]{@link https://github.com/loov/jsfx} or not.
* @memberof CB_Configuration.CrossBase
* @name needsJsfx
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsJsfx = function()
{
//TODO: see what IE versions are compatible.
return (navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1 && navigator.appVersion.indexOf("MSIE 9") === -1);
}
/**
* Detects whether the web client needs [Pressure.js]{@link https://pressurejs.com/} or not.
* @memberof CB_Configuration.CrossBase
* @name needsPressureJS
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsPressureJS= function()
{
//TODO: see what IE versions are compatible.
return (navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1 && navigator.appVersion.indexOf("MSIE 9") === -1);
}
/**
* Detects whether the web client needs [Hammer.js]{@link http://hammerjs.github.io/} or not.
* @memberof CB_Configuration.CrossBase
* @name needsHammerJS
* @function
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsHammerJS = function()
{
//TODO: see what IE versions are compatible.
return (navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1 && navigator.appVersion.indexOf("MSIE 9") === -1);
}
/**
* Detects whether the web client needs [gamepad-plus]{@link https://github.com/MozVR/gamepad-plus} or not.
* @memberof CB_Configuration.CrossBase
* @name needsGamepadPlus
* @function
* @returns {boolean}
* @todo Find a better way for this as old Firefox versions can only detect GamePad API support when the events are fired, so we cannot relay on navigator.getGamepads/navigator.webkitGetGamepads/navigator.webkitGamepads.
*/
CB_Configuration[CB_BASE_NAME].needsGamepadPlus = function()
{
//TODO: Find a better way for this as old Firefox versions can only detect GamePad API support when the events are fired, so we cannot relay on navigator.getGamepads/navigator.webkitGetGamepads/navigator.webkitGamepads.
return !!(typeof(navigator) === "object" && navigator !== null && (navigator.getGamepads || navigator.webkitGetGamepads || navigator.webkitGamepads));
}
/**
* Detects whether the web client needs [NoSleep.js]{@link https://github.com/richtr/NoSleep.js} or not.
* @function
* @memberof CB_Configuration.CrossBase
* @name needsSleepJS
* @returns {boolean}
*/
CB_Configuration[CB_BASE_NAME].needsSleepJS = function()
{
return (navigator.appVersion.indexOf("MSIE 5") === -1 && navigator.appVersion.indexOf("MSIE 6") === -1 && navigator.appVersion.indexOf("MSIE 7") === -1 && navigator.appVersion.indexOf("MSIE 8") === -1);
}
//SockJS parameters:
/**
* Directory that contains the [SockJS library]{@link https://github.com/sockjs/sockjs-client/} files.
* @memberof CB_Configuration.CrossBase
* @name SOCKJS_PATH
* @constant
* @type {string}
* @default {@link CB_Configuration.CrossBase.SCRIPT_PATH} + "net/sockets/SockJS/"
*/
CB_Configuration[CB_BASE_NAME].SOCKJS_PATH = CB_Configuration[CB_BASE_NAME].SCRIPT_PATH + "net/sockets/SockJS/";
/**
* The script file path for the [SockJS library]{@link https://github.com/sockjs/sockjs-client/}. As the newer [SockJS library]{@link https://github.com/sockjs/sockjs-client/} versions do not work in old Internet Explorer versions (6, 7 or 8), if they are detected it will use the [SockJS library]{@link https://github.com/sockjs/sockjs-client/} 0.3.4 version instead.
* @memberof CB_Configuration.CrossBase
* @name SOCKJS_PATH_SCRIPT_FILE
* @constant
* @type {string}
* @default {@link CB_Configuration[CB_BASE_NAME].SOCKJS_PATH} + SOCKJS_SCRIPT_FILE, where "SOCKJS_SCRIPT_FILE" is sockjs-0.3.4.min.js (SockJS 0.3.4), sockjs-1.1.1.min.js (SockJS 1.1.1) or sockjs.min.js (last version) depending on the client detected.
*/
CB_Configuration[CB_BASE_NAME].SOCKJS_PATH_SCRIPT_FILE = CB_Configuration[CB_BASE_NAME].SOCKJS_PATH;
if (navigator.appVersion.indexOf("MSIE 5") !== -1 || navigator.appVersion.indexOf("MSIE 6") !== -1 || navigator.appVersion.indexOf("MSIE 7") !== -1 || navigator.appVersion.indexOf("MSIE 8") !== -1) { CB_Configuration[CB_BASE_NAME].SOCKJS_PATH_SCRIPT_FILE += "sockjs-0.3.4.min.js"; }
else if (navigator.appVersion.indexOf("MSIE 9") !== -1) { CB_Configuration[CB_BASE_NAME].SOCKJS_PATH_SCRIPT_FILE += "sockjs-1.1.1.min.js"; }
else { CB_Configuration[CB_BASE_NAME].SOCKJS_PATH_SCRIPT_FILE += "sockjs.min.js"; }
//Intel XDK parameters:
/**
* Defines whether to load or not intelxdk.js (used by [Intel XDK]{@link https://en.wikipedia.org/wiki/Intel_XDK}).
* @memberof CB_Configuration.CrossBase
* @name INTELXDKJS_LOAD
* @constant
* @type {boolean}
* @default
*/
CB_Configuration[CB_BASE_NAME].INTELXDKJS_LOAD = false; //CB_Configuration[CB_BASE_NAME].needsIntelXDKJS();
/**
* Directory that contains the "intelxdk.js" file (used by [Intel XDK]{@link https://en.wikipedia.org/wiki/Intel_XDK}).
* @memberof CB_Configuration.CrossBase
* @name INTELXDKJS_PATH
* @constant
* @type {string}
* @default
*/
CB_Configuration[CB_BASE_NAME].INTELXDKJS_PATH = "../";
/**
* The script file path for intelxdk.js (used by [Intel XDK]{@link https://en.wikipedia.org/wiki/Intel_XDK}).
* @memberof CB_Configuration.CrossBase
* @name INTELXDKJS_PATH_SCRIPT_FILE
* @constant
* @type {string}
* @default {@link CB_Configuration.CrossBase.INTELXDKJS_PATH} + "intelxdk.js"
*/
CB_Configuration[CB_BASE_NAME].INTELXDKJS_PATH_SCRIPT_FILE = CB_Configuration[CB_BASE_NAME].INTELXDKJS_PATH + "intelxdk.js";
/**
* Defines whether the path defined in {@link CB_Configuration.CrossBase.INTELXDKJS_PATH_SCRIPT_FILE} is either absolute or relative to the CrossBr