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
+41
View File
@@ -0,0 +1,41 @@
/*!
{
"name": "Animated PNG",
"async": true,
"property": "apng",
"tags": ["image"],
"builderAliases": ["img_apng"],
"notes": [{
"name": "Wikipedia Article",
"href": "https://en.wikipedia.org/wiki/APNG"
}]
}
!*/
/* DOC
Test for animated png support.
*/
define(['Modernizr', 'createElement', 'addTest', 'test/canvas'], function(Modernizr, createElement, addTest) {
Modernizr.addAsyncTest(function() {
if (!Modernizr.canvas) {
return false;
}
var image = new Image();
var canvas = createElement('canvas');
var ctx = canvas.getContext('2d');
image.onload = function() {
addTest('apng', function() {
if (typeof canvas.getContext === 'undefined') {
return false;
}
else {
ctx.drawImage(image, 0, 0);
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
}
});
};
image.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==';
});
});
+16
View File
@@ -0,0 +1,16 @@
/*!
{
"name": "Image crossOrigin",
"property": "imgcrossorigin",
"notes": [{
"name": "Cross Domain Images and the Tainted Canvas",
"href": "https://blog.codepen.io/2013/10/08/cross-domain-images-tainted-canvas/"
}]
}
!*/
/* DOC
Detects support for the crossOrigin attribute on images, which allow for cross domain images inside of a canvas without tainting it
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('imgcrossorigin', 'crossOrigin' in createElement('img'));
});
+29
View File
@@ -0,0 +1,29 @@
/*!
{
"name": "JPEG 2000",
"async": true,
"aliases": ["jpeg-2000", "jpg2"],
"property": "jpeg2000",
"tags": ["image"],
"authors": ["@eric_wvgg"],
"notes": [{
"name": "Wikipedia Article",
"href": "https://en.wikipedia.org/wiki/JPEG_2000"
}]
}
!*/
/* DOC
Test for JPEG 2000 support
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var image = new Image();
image.onload = image.onerror = function() {
addTest('jpeg2000', image.width === 1);
};
image.src = 'data:image/jp2;base64,/0//UQAyAAAAAAABAAAAAgAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAEBwEBBwEBBwEBBwEB/1IADAAAAAEAAAQEAAH/XAAEQED/ZAAlAAFDcmVhdGVkIGJ5IE9wZW5KUEVHIHZlcnNpb24gMi4wLjD/kAAKAAAAAABYAAH/UwAJAQAABAQAAf9dAAUBQED/UwAJAgAABAQAAf9dAAUCQED/UwAJAwAABAQAAf9dAAUDQED/k8+kEAGvz6QQAa/PpBABr994EAk//9k=';
});
});
+28
View File
@@ -0,0 +1,28 @@
/*!
{
"name": "JPEG XR (extended range)",
"async": true,
"aliases": ["jpeg-xr"],
"property": "jpegxr",
"tags": ["image"],
"notes": [{
"name": "Wikipedia Article",
"href": "https://en.wikipedia.org/wiki/JPEG_XR"
}]
}
!*/
/* DOC
Test for JPEG XR support
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var image = new Image();
image.onload = image.onerror = function() {
addTest('jpegxr', image.width === 1, {aliases: ['jpeg-xr']});
};
image.src = 'data:image/vnd.ms-photo;base64,SUm8AQgAAAAFAAG8AQAQAAAASgAAAIC8BAABAAAAAQAAAIG8BAABAAAAAQAAAMC8BAABAAAAWgAAAMG8BAABAAAAHwAAAAAAAAAkw91vA07+S7GFPXd2jckNV01QSE9UTwAZAYBxAAAAABP/gAAEb/8AAQAAAQAAAA==';
});
});
+46
View File
@@ -0,0 +1,46 @@
/*!
{
"name": "sizes attribute",
"async": true,
"property": "sizes",
"tags": ["image"],
"authors": ["Mat Marquis"],
"notes": [{
"name": "WHATWG Spec",
"href": "https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element"
},{
"name": "Srcset and sizes",
"href": "https://ericportis.com/posts/2014/srcset-sizes/"
}]
}
!*/
/* DOC
Test for the `sizes` attribute on images
*/
define(['Modernizr', 'createElement', 'addTest'], function(Modernizr, createElement, addTest) {
Modernizr.addAsyncTest(function() {
var width1, width2, test;
var image = createElement('img');
// in a perfect world this would be the test...
var isSizes = 'sizes' in image;
// ... but we need to deal with Safari 9...
if (!isSizes && ('srcset' in image)) {
width2 = 'data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==';
width1 = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
test = function() {
addTest('sizes', image.width === 2);
};
image.onload = test;
image.onerror = test;
image.setAttribute('sizes', '9px');
image.srcset = width1 + ' 1w,' + width2 + ' 8w';
image.src = width1;
} else {
addTest('sizes', isSizes);
}
});
});
+21
View File
@@ -0,0 +1,21 @@
/*!
{
"name": "srcset attribute",
"property": "srcset",
"caniuse": "srcset",
"tags": ["image"],
"notes": [{
"name": "Smashing Magazine Article",
"href": "https://www.smashingmagazine.com/2013/08/webkit-implements-srcset-and-why-its-a-good-thing/"
},{
"name": "Generate multi-resolution images for srcset with Grunt",
"href": "https://addyosmani.com/blog/generate-multi-resolution-images-for-srcset-with-grunt/"
}]
}
!*/
/* DOC
Test for the srcset attribute of images
*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
Modernizr.addTest('srcset', 'srcset' in createElement('img'));
});
+38
View File
@@ -0,0 +1,38 @@
/*!
{
"name": "Webp Alpha",
"async": true,
"property": "webpalpha",
"aliases": ["webp-alpha"],
"tags": ["image"],
"authors": ["Krister Kari", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "WebP Info",
"href": "https://developers.google.com/speed/webp/"
},{
"name": "Article about WebP support",
"href": "https://optimus.keycdn.com/support/webp-support/"
},{
"name": "Chromium WebP announcement",
"href": "https://blog.chromium.org/2011/11/lossless-and-transparency-encoding-in.html?m=1"
}]
}
!*/
/* DOC
Tests for transparent webp support.
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var image = new Image();
image.onerror = function() {
addTest('webpalpha', false, {aliases: ['webp-alpha']});
};
image.onload = function() {
addTest('webpalpha', image.width === 1, {aliases: ['webp-alpha']});
};
image.src = 'data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==';
});
});
+35
View File
@@ -0,0 +1,35 @@
/*!
{
"name": "Webp Animation",
"async": true,
"property": "webpanimation",
"aliases": ["webp-animation"],
"tags": ["image"],
"authors": ["Krister Kari", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "WebP Info",
"href": "https://developers.google.com/speed/webp/"
},{
"name": "Chromium blog - Chrome 32 Beta: Animated WebP images and faster Chrome for Android touch input",
"href": "https://blog.chromium.org/2013/11/chrome-32-beta-animated-webp-images-and.html"
}]
}
!*/
/* DOC
Tests for animated webp support.
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var image = new Image();
image.onerror = function() {
addTest('webpanimation', false, {aliases: ['webp-animation']});
};
image.onload = function() {
addTest('webpanimation', image.width === 1, {aliases: ['webp-animation']});
};
image.src = 'data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA';
});
});
+34
View File
@@ -0,0 +1,34 @@
/*!
{
"name": "Webp Lossless",
"async": true,
"property": ["webplossless", "webp-lossless"],
"tags": ["image"],
"authors": ["@amandeep", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "Webp Info",
"href": "https://developers.google.com/speed/webp/"
},{
"name": "Webp Lossless Spec",
"href": "https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification"
}]
}
!*/
/* DOC
Tests for non-alpha lossless webp support.
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var image = new Image();
image.onerror = function() {
addTest('webplossless', false, {aliases: ['webp-lossless']});
};
image.onload = function() {
addTest('webplossless', image.width === 1, {aliases: ['webp-lossless']});
};
image.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=';
});
});
+95
View File
@@ -0,0 +1,95 @@
/*!
{
"name": "Webp",
"async": true,
"property": "webp",
"tags": ["image"],
"builderAliases": ["img_webp"],
"authors": ["Krister Kari", "@amandeep", "Rich Bradshaw", "Ryan Seddon", "Paul Irish"],
"notes": [{
"name": "Webp Info",
"href": "https://developers.google.com/speed/webp/"
}, {
"name": "Chromium blog - Chrome 32 Beta: Animated WebP images and faster Chrome for Android touch input",
"href": "https://blog.chromium.org/2013/11/chrome-32-beta-animated-webp-images-and.html"
}, {
"name": "Webp Lossless Spec",
"href": "https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification"
}, {
"name": "Article about WebP support",
"href": "https://optimus.keycdn.com/support/webp-support/"
}, {
"name": "Chromium WebP announcement",
"href": "https://blog.chromium.org/2011/11/lossless-and-transparency-encoding-in.html?m=1"
}]
}
!*/
/* DOC
Tests for lossy, non-alpha webp support.
Tests for all forms of webp support (lossless, lossy, alpha, and animated)..
Modernizr.webp // Basic support (lossy)
Modernizr.webp.lossless // Lossless
Modernizr.webp.alpha // Alpha (both lossy and lossless)
Modernizr.webp.animation // Animated WebP
*/
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
Modernizr.addAsyncTest(function() {
var webpTests = [{
'uri': 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=',
'name': 'webp'
}, {
'uri': 'data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==',
'name': 'webp.alpha'
}, {
'uri': 'data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA',
'name': 'webp.animation'
}, {
'uri': 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=',
'name': 'webp.lossless'
}];
var webp = webpTests.shift();
function test(name, uri, cb) {
var image = new Image();
function addResult(event) {
// if the event is from 'onload', check the see if the image's width is
// 1 pixel (which indicates support). otherwise, it fails
var result = event && event.type === 'load' ? image.width === 1 : false;
var baseTest = name === 'webp';
// if it is the base test, and the result is false, just set a literal false
// rather than use the Boolean constructor
addTest(name, (baseTest && result) ? new Boolean(result) : result);
if (cb) {
cb(event);
}
}
image.onerror = addResult;
image.onload = addResult;
image.src = uri;
}
// test for webp support in general
test(webp.name, webp.uri, function(e) {
// if the webp test loaded, test everything else.
if (e && e.type === 'load') {
for (var i = 0; i < webpTests.length; i++) {
test(webpTests[i].name, webpTests[i].uri);
}
}
});
});
});