mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Added is.js library
This commit is contained in:
parent
2616b911e1
commit
2038acc14a
10 changed files with 3220 additions and 68 deletions
|
|
@ -7,6 +7,7 @@
|
|||
Globals = {},
|
||||
|
||||
window = require('window'),
|
||||
is = require('is'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -68,24 +69,14 @@
|
|||
Globals.bUnload = false;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
|
||||
Globals.bTabletDevice = is.tablet();
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
|
||||
Globals.bMobileDevice = is.mobile() || is.tablet();
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
|
|
|
|||
|
|
@ -325,61 +325,6 @@
|
|||
};
|
||||
}());
|
||||
|
||||
Utils.audio = (function () {
|
||||
|
||||
var
|
||||
oAudio = false
|
||||
;
|
||||
|
||||
return function (sMp3File, sOggFile) {
|
||||
|
||||
if (false === oAudio)
|
||||
{
|
||||
if (Globals.bIsiOSDevice)
|
||||
{
|
||||
oAudio = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var
|
||||
bCanPlayMp3 = false,
|
||||
bCanPlayOgg = false,
|
||||
oAudioLocal = window.Audio ? new window.Audio() : null
|
||||
;
|
||||
|
||||
if (oAudioLocal && oAudioLocal.canPlayType && oAudioLocal.play)
|
||||
{
|
||||
bCanPlayMp3 = '' !== oAudioLocal.canPlayType('audio/mpeg; codecs="mp3"');
|
||||
if (!bCanPlayMp3)
|
||||
{
|
||||
bCanPlayOgg = '' !== oAudioLocal.canPlayType('audio/ogg; codecs="vorbis"');
|
||||
}
|
||||
|
||||
if (bCanPlayMp3 || bCanPlayOgg)
|
||||
{
|
||||
oAudio = oAudioLocal;
|
||||
oAudio.preload = 'none';
|
||||
oAudio.loop = false;
|
||||
oAudio.autoplay = false;
|
||||
oAudio.muted = false;
|
||||
oAudio.src = bCanPlayMp3 ? sMp3File : sOggFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
oAudio = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oAudio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oAudio;
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* @param {(Object|null|undefined)} oObject
|
||||
* @param {string} sProp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue