From: Laury GvR Date: Wed, 23 Sep 2015 18:15:58 +0000 (-0400) Subject: Modernizr updated files. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5e3cf7501f5ffc97ad088e8096e01f673244e58a;p=WP-Themes%2Fglmthemes%2Fmountpleasant-theme.git Modernizr updated files. --- diff --git a/js/modernizr/Gruntfile.js b/js/modernizr/Gruntfile.js new file mode 100644 index 0000000..b426544 --- /dev/null +++ b/js/modernizr/Gruntfile.js @@ -0,0 +1,247 @@ +/*global module */ + +var browsers = require('./test/browser/sauce-browsers.json'); + +module.exports = function(grunt) { + 'use strict'; + + // Load grunt dependencies + require('load-grunt-tasks')(grunt); + + var browserTests = grunt.file.expand([ + 'test/universal/**/*.js', + 'test/browser/**/*.js', + '!test/browser/setup.js', + '!test/browser/integration/*.js' + ]); + + grunt.initConfig({ + env: { + nodeTests: [ + 'test/universal/**/*.js', + 'test/node/**/*.js' + ], + browserTests: browserTests, + coverage: { + APP_DIR_FOR_CODE_COVERAGE: 'test/coverage/instrument', + urls: [ + 'http://localhost:9999/test/unit.html', + 'http://localhost:9999/test/index.html' + ] + } + }, + generate: { + dest: './dist/modernizr-build.js' + }, + copy: { + 'gh-pages': { + files: [ + { + expand: true, + src: [ + './**/*', + '!./test/coverage/**', + '!./node_modules/*grunt-*/**', + '!./node_modules/**/node_modules/**' + ], + dest: 'gh-pages' + } + ] + } + }, + jscs: { + src: [ + 'Gruntfile.js', + 'src/*.js', + 'lib/*.js', + 'test/**/*.js', + 'feature-detects/**/*.js', + '!src/html5printshiv.js', + '!test/coverage/**/*.js', + '!test/js/lib/**/*.js', + '!src/html5shiv.js' + ] + }, + jshint: { + options: { + jshintrc: true, + ignores: [ + 'src/html5printshiv.js', + 'src/html5shiv.js' + ] + }, + files: [ + 'Gruntfile.js', + 'src/*.js', + 'lib/*.js', + 'feature-detects/**/*.js' + ], + tests: { + options: { + jshintrc: true + }, + files: { + src: [ + '<%= env.nodeTests%>', + '<%= env.browserTests %>', + 'test/browser/setup.js', + 'test/browser/integration/*.js' + ] + } + } + }, + clean: { + dist: [ + 'dist', + 'test/coverage', + 'test/*.html', + 'gh-pages' + ] + }, + jade: { + compile: { + options: { + data: { + unitTests: browserTests, + integrationTests: grunt.file.expand(['test/browser/integration/*.js']) + } + }, + files: { + 'test/unit.html': 'test/browser/unit.jade', + 'test/iframe.html': 'test/browser/iframe.jade', + 'test/index.html': 'test/browser/integration.jade' + } + } + }, + connect: { + server: { + options: { + middleware: function(connect, options) { + return [ + function(req, res, next) { + // catchall middleware used in testing + var ua = req.headers['user-agent']; + + // record code coverage results from browsers + if (req.url == '/coverage/client' && req.method == 'POST') { + var name = encodeURI(ua.replace(/\//g, '-')); + var body = ''; + + req.on('data', function(data) { + body = body + data; + }); + + req.on('end', function() { + grunt.file.write('test/coverage/reports/' + name + '.json', body); + res.end(); + }); + + return; + } + + // redirect requests form the `require`d components to their instrumented versions + if (req.url.match(/^\/(src|lib)\//)) { + req.url = '/test/coverage/instrument' + req.url; + } + + next(); + }, + connect.static(options.base) + ]; + }, + base: '', + port: 9999 + } + } + }, + 'saucelabs-custom': { + all: { + options: { + urls: '<%= env.coverage.urls %>', + testname: process.env.CI_BUILD_NUMBER || 'Modernizr Test', + browsers: browsers, + maxRetries: 3 + } + } + }, + mocha: { + test: { + options: { + urls: '<%= env.coverage.urls %>', + log: true + }, + }, + }, + // `mocha` runs browser tests, `mochaTest` runs node tests + mochaTest: { + test: { + options: { + reporter: 'dot' + }, + src: ['<%= env.nodeTests%>'] + } + }, + instrument: { + files: [ + 'src/**/*.js', + 'lib/**/*.js' + ], + options: { + basePath: 'test/coverage/instrument/' + } + }, + storeCoverage: { + options: { + dir: 'test/coverage/reports' + } + }, + makeReport: { + src: 'test/coverage/reports/**/*.json', + options: { + type: 'lcov', + dir: 'test/coverage/reports', + print: 'detail' + } + }, + coveralls: { + all: { + src: 'test/coverage/reports/lcov.info', + options: { + force: true + } + } + } + }); + + grunt.registerMultiTask('generate', 'Create a version of Modernizr from Grunt', function() { + var done = this.async(); + var config = require('./lib/config-all'); + var modernizr = require('./lib/cli'); + var dest = this.data; + + modernizr.build(config, function(output) { + grunt.file.write(dest, output); + done(); + }); + }); + + grunt.registerTask('nodeTests', ['mochaTest']); + + grunt.registerTask('browserTests', ['connect', 'mocha']); + + grunt.registerTask('build', ['clean', 'generate']); + + grunt.registerTask('lint', ['jshint', 'jscs']); + + grunt.registerTask('default', ['lint', 'build']); + + var tests = ['clean', 'lint', 'jade', 'instrument', 'env:coverage', 'nodeTests']; + + if (process.env.APPVEYOR) { + grunt.registerTask('test', tests); + } else if (process.env.BROWSER_COVERAGE !== 'true') { + grunt.registerTask('test', tests.concat(['generate', 'browserTests'])); + } else { + grunt.registerTask('test', tests.concat(['generate', 'storeCoverage', 'browserTests', 'saucelabs-custom', 'makeReport', 'coveralls'])); + } +}; diff --git a/js/modernizr/feature-detects/a/download.js b/js/modernizr/feature-detects/a/download.js new file mode 100644 index 0000000..ef728e5 --- /dev/null +++ b/js/modernizr/feature-detects/a/download.js @@ -0,0 +1,19 @@ +/*! +{ + "name": "a[download] Attribute", + "property": "adownload", + "caniuse" : "download", + "tags": ["media", "attribute"], + "builderAliases": ["a_download"], + "notes": [{ + "name": "WhatWG Reference", + "href": "http://developers.whatwg.org/links.html#downloading-resources" + }] +} +!*/ +/* DOC +When used on an ``, this attribute signifies that the resource it points to should be downloaded by the browser rather than navigating to it. +*/ +define(['Modernizr', 'createElement'], function(Modernizr, createElement) { + Modernizr.addTest('adownload', !window.externalHost && 'download' in createElement('a')); +}); diff --git a/js/modernizr/feature-detects/ambientlight.js b/js/modernizr/feature-detects/ambientlight.js new file mode 100644 index 0000000..0f9e579 --- /dev/null +++ b/js/modernizr/feature-detects/ambientlight.js @@ -0,0 +1,16 @@ +/*! +{ + "name": "Ambient Light Events", + "property": "ambientlight", + "notes": [{ + "name": "W3C Ambient Light Events", + "href": "http://www.w3.org/TR/ambient-light/" + }] +} +!*/ +/* DOC +Detects support for the API that provides information about the ambient light levels, as detected by the device's light detector, in terms of lux units. +*/ +define(['Modernizr', 'hasEvent'], function(Modernizr, hasEvent) { + Modernizr.addTest('ambientlight', hasEvent('devicelight', window)); +}); diff --git a/js/modernizr/feature-detects/applicationcache.js b/js/modernizr/feature-detects/applicationcache.js new file mode 100644 index 0000000..bec050a --- /dev/null +++ b/js/modernizr/feature-detects/applicationcache.js @@ -0,0 +1,21 @@ +/*! +{ + "name": "Application Cache", + "property": "applicationcache", + "caniuse": "offline-apps", + "tags": ["storage", "offline"], + "notes": [{ + "name": "MDN documentation", + "href": "https://developer.mozilla.org/en/docs/HTML/Using_the_application_cache" + }], + "polyfills": ["html5gears"] +} +!*/ +/* DOC +Detects support for the Application Cache, for storing data to enable web-based applications run offline. + +The API has been [heavily criticized](http://alistapart.com/article/application-cache-is-a-douchebag) and discussions are underway to address this. +*/ +define(['Modernizr'], function(Modernizr) { + Modernizr.addTest('applicationcache', 'applicationCache' in window); +}); diff --git a/js/modernizr/feature-detects/audio.js b/js/modernizr/feature-detects/audio.js new file mode 100644 index 0000000..d3e8776 --- /dev/null +++ b/js/modernizr/feature-detects/audio.js @@ -0,0 +1,48 @@ +/*! +{ + "name" : "HTML5 Audio Element", + "property": "audio", + "tags" : ["html5", "audio", "media"] +} +!*/ +/* DOC +Detects the audio element +*/ +define(['Modernizr', 'createElement'], function(Modernizr, createElement) { + // This tests evaluates support of the audio element, as well as + // testing what types of content it supports. + // + // We're using the Boolean constructor here, so that we can extend the value + // e.g. Modernizr.audio // true + // Modernizr.audio.ogg // 'probably' + // + // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 + // thx to NielsLeenheer and zcorpan + + // Note: in some older browsers, "no" was a return value instead of empty string. + // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 + // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 + Modernizr.addTest('audio', function() { + /* jshint -W053 */ + var elem = createElement('audio'); + var bool = false; + + try { + if (bool = !!elem.canPlayType) { + bool = new Boolean(bool); + bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''); + bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/, ''); + bool.opus = elem.canPlayType('audio/ogg; codecs="opus"') .replace(/^no$/, ''); + + // Mimetypes accepted: + // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements + // bit.ly/iphoneoscodecs + bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/, ''); + bool.m4a = (elem.canPlayType('audio/x-m4a;') || + elem.canPlayType('audio/aac;')) .replace(/^no$/, ''); + } + } catch (e) { } + + return bool; + }); +}); diff --git a/js/modernizr/feature-detects/audio/loop.js b/js/modernizr/feature-detects/audio/loop.js new file mode 100644 index 0000000..96a2d77 --- /dev/null +++ b/js/modernizr/feature-detects/audio/loop.js @@ -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')); +}); diff --git a/js/modernizr/feature-detects/audio/preload.js b/js/modernizr/feature-detects/audio/preload.js new file mode 100644 index 0000000..7bd1caa --- /dev/null +++ b/js/modernizr/feature-detects/audio/preload.js @@ -0,0 +1,13 @@ +/*! +{ + "name": "Audio Preload Attribute", + "property": "audiopreload", + "tags": ["audio", "media"] +} +!*/ +/* DOC +Detects if audio can be downloaded in the background before it starts playing in the `