first commit

This commit is contained in:
armansansd
2023-07-12 16:31:19 +01:00
commit 3424b1927b
23306 changed files with 2217776 additions and 0 deletions
+83
View File
@@ -0,0 +1,83 @@
/*!
{
"name": "Audio Autoplay",
"property": "audioautoplay",
"authors": ["Jordy van Dortmont"],
"tags": ["audio"],
"async": true
}
!*/
/* DOC
Checks for support of the autoplay attribute of the audio element.
*/
define(['Modernizr', 'addTest', 'docElement', 'createElement', 'test/audio'], function(Modernizr, addTest, docElement, createElement) {
Modernizr.addAsyncTest(function() {
var timeout;
var waitTime = 200;
var retries = 5;
var currentTry = 0;
var elem = createElement('audio');
var elemStyle = elem.style;
function testAutoplay(arg) {
currentTry++;
clearTimeout(timeout);
var result = arg && arg.type === 'playing' || elem.currentTime !== 0;
if (!result && currentTry < retries) {
// Detection can be flaky if the browser is slow, so lets retry in a little bit
timeout = setTimeout(testAutoplay, waitTime);
return;
}
elem.removeEventListener('playing', testAutoplay, false);
addTest('audioautoplay', result);
// Cleanup, but don't assume elem is still in the page -
// an extension may already have removed it.
if (elem.parentNode) {
elem.parentNode.removeChild(elem);
}
}
// Skip the test if audio itself, or the autoplay element on it isn't supported
if (!Modernizr.audio || !('autoplay' in elem)) {
addTest('audioautoplay', false);
return;
}
elemStyle.position = 'absolute';
elemStyle.height = 0;
elemStyle.width = 0;
try {
if (Modernizr.audio.mp3) {
elem.src = 'data:audio/mpeg;base64,/+MYxAAAAANIAUAAAASEEB/jwOFM/0MM/90b/+RhST//w4NFwOjf///PZu////9lns5GFDv//l9GlUIEEIAAAgIg8Ir/JGq3/+MYxDsLIj5QMYcoAP0dv9HIjUcH//yYSg+CIbkGP//8w0bLVjUP///3Z0x5QCAv/yLjwtGKTEFNRTMuOTeqqqqqqqqqqqqq/+MYxEkNmdJkUYc4AKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq';
}
else if (Modernizr.audio.wav) {
elem.src = 'data:audio/wav;base64,UklGRjQAAABXQVZFZm10IBAAAAABAAEAEAAAABAAAAABAAgAZGF0YRAAAAB/f39/f39/f39/f39/f39/';
}
else {
addTest('audioautoplay', false);
return;
}
}
catch (e) {
addTest('audioautoplay', false);
return;
}
elem.setAttribute('autoplay', '');
elemStyle.cssText = 'display:none';
docElement.appendChild(elem);
// Wait for the next tick to add the listener, otherwise the element may
// not have time to play in high load situations (e.g. the test suite)
setTimeout(function() {
elem.addEventListener('playing', testAutoplay, false);
timeout = setTimeout(testAutoplay, waitTime);
}, 0);
});
});
+13
View File
@@ -0,0 +1,13 @@
/*!
{
"name": "Audio Loop Attribute",
"property": "audioloop",
"tags": ["audio", "media"]
}
!*/
/* DOC
Detects if an audio element can automatically restart, once it has finished
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('audioloop', 'loop' in createElement('audio'));
});
File diff suppressed because one or more lines are too long
+29
View File
@@ -0,0 +1,29 @@
/*!
{
"name": "Web Audio API",
"property": "webaudio",
"caniuse": "audio-api",
"polyfills": ["xaudiojs", "dynamicaudiojs", "audiolibjs"],
"tags": ["audio", "media"],
"builderAliases": ["audio_webaudio_api"],
"authors": ["Addy Osmani"],
"notes": [{
"name": "W3C Spec",
"href": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html"
}]
}
!*/
/* DOC
Detects the older non standard webaudio API, (as opposed to the standards based AudioContext API)
*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('webaudio', function() {
var prefixed = 'webkitAudioContext' in window;
var unprefixed = 'AudioContext' in window;
if (Modernizr._config.usePrefixes) {
return prefixed || unprefixed;
}
return unprefixed;
});
});