diff --git a/src/_h5ai/public/js/inc/core/location.js b/src/_h5ai/public/js/inc/core/location.js
index 2e8680e2..88ef1fc3 100644
--- a/src/_h5ai/public/js/inc/core/location.js
+++ b/src/_h5ai/public/js/inc/core/location.js
@@ -1,4 +1,4 @@
-modulejs.define('core/location', ['_', 'modernizr', 'core/event', 'core/settings', 'view/notification'], function (_, modernizr, event, allsettings, notification) {
+modulejs.define('core/location', ['_', 'core/event', 'core/modernizr', 'core/settings', 'view/notification'], function (_, event, modernizr, allsettings, notification) {
var settings = _.extend({
fastBrowsing: true,
diff --git a/src/_h5ai/public/js/inc/core/modernizr.js b/src/_h5ai/public/js/inc/core/modernizr.js
new file mode 100644
index 00000000..9ac6f5a0
--- /dev/null
+++ b/src/_h5ai/public/js/inc/core/modernizr.js
@@ -0,0 +1,28 @@
+modulejs.define('core/modernizr', function () {
+
+ var hasCanvas = (function () {
+
+ var elem = document.createElement('canvas');
+ return Boolean(elem.getContext && elem.getContext('2d'));
+ }());
+
+ var hasHistory = Boolean(window.history && history.pushState);
+
+ var hasLocalStorage = (function () {
+
+ var key = '#test#';
+ try {
+ localStorage.setItem(key, key);
+ localStorage.removeItem(key);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }());
+
+ return {
+ canvas: hasCanvas,
+ history: hasHistory,
+ localstorage: hasLocalStorage
+ };
+});
diff --git a/src/_h5ai/public/js/inc/core/store.js b/src/_h5ai/public/js/inc/core/store.js
index 74eacd7f..90f1f835 100644
--- a/src/_h5ai/public/js/inc/core/store.js
+++ b/src/_h5ai/public/js/inc/core/store.js
@@ -1,4 +1,4 @@
-modulejs.define('core/store', ['modernizr'], function (modernizr) {
+modulejs.define('core/store', ['core/modernizr'], function (modernizr) {
var store = modernizr.localstorage ? window.localStorage : {};
var storekey = '_h5ai';
diff --git a/src/_h5ai/public/js/inc/ext/info.js b/src/_h5ai/public/js/inc/ext/info.js
index bdca7d35..c904993f 100644
--- a/src/_h5ai/public/js/inc/ext/info.js
+++ b/src/_h5ai/public/js/inc/ext/info.js
@@ -1,4 +1,4 @@
-modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/event', 'core/format', 'core/resource', 'core/settings', 'core/store'], function (_, $, modernizr, event, format, resource, allsettings, store) {
+modulejs.define('ext/info', ['_', '$', 'core/event', 'core/format', 'core/modernizr', 'core/resource', 'core/settings', 'core/store'], function (_, $, event, format, modernizr, resource, allsettings, store) {
var settings = _.extend({
enabled: false,
diff --git a/src/_h5ai/public/js/lib/modernizr-2.8.3.min.js b/src/_h5ai/public/js/lib/modernizr-2.8.3.min.js
deleted file mode 100644
index ffdb64e9..00000000
--- a/src/_h5ai/public/js/lib/modernizr-2.8.3.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
- * Build: http://modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-localstorage-shiv-cssclasses-prefixes
- */
-;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(m.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.history=function(){return!!a.history&&!!history.pushState},n.rgba=function(){return v("background-color:rgba(150,255,150,.5)"),y(j.backgroundColor,"rgba")},n.opacity=function(){return w("opacity:.55"),/^0.55$/.test(j.opacity)},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},n.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},n.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},v(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document);
\ No newline at end of file
diff --git a/src/_h5ai/public/js/scripts.js b/src/_h5ai/public/js/scripts.js
index 0bc664d8..77e4d595 100644
--- a/src/_h5ai/public/js/scripts.js
+++ b/src/_h5ai/public/js/scripts.js
@@ -1,17 +1,17 @@
(function () {
'use strict';
+ document.documentElement.className = '';
var el = document.createElement('i');
el.innerHTML = '';
var browser = el.getElementsByTagName('br').length === 0;
if (!browser) {
- document.documentElement.className = 'js no-browser';
+ document.documentElement.className = 'no-browser';
throw 'no-browser';
}
}());
-// @include 'lib/modernizr-*.js'
// @include 'lib/jquery-*.js'
// @include 'lib/jquery.*.js'
// @include 'lib/lodash-*.js'
@@ -26,7 +26,6 @@
modulejs.define('_', function () { return win._; });
modulejs.define('$', function () { return win.jQuery; });
modulejs.define('marked', function () { return win.marked; });
- modulejs.define('modernizr', function () { return win.Modernizr; });
modulejs.define('prism', function () { return win.Prism; });
// @include 'inc/**/*.js'
diff --git a/test/tests/unit/core/location.js b/test/tests/unit/core/location.js
index d0e1e922..5d1809e1 100644
--- a/test/tests/unit/core/location.js
+++ b/test/tests/unit/core/location.js
@@ -2,7 +2,7 @@
'use strict';
var ID = 'core/location';
-var DEPS = ['_', 'modernizr', 'core/event', 'core/settings', 'view/notification'];
+var DEPS = ['_', 'core/event', 'core/modernizr', 'core/settings', 'view/notification'];
describe('module \'' + ID + '\'', function () {
@@ -30,7 +30,7 @@ describe('module \'' + ID + '\'', function () {
this.xEvent.sub.reset();
this.xNotification.set.reset();
- return this.definition.fn(_, this.xModernizr, this.xEvent, this.xSettings, this.xNotification);
+ return this.definition.fn(_, this.xEvent, this.xModernizr, this.xSettings, this.xNotification);
};
});
diff --git a/test/tests/unit/core/modernizr.js b/test/tests/unit/core/modernizr.js
new file mode 100644
index 00000000..b9f3f38b
--- /dev/null
+++ b/test/tests/unit/core/modernizr.js
@@ -0,0 +1,90 @@
+(function () {
+'use strict';
+
+var ID = 'core/modernizr';
+var DEPS = [];
+
+describe('module \'' + ID + '\'', function () {
+
+ before(function () {
+
+ this.definition = modulejs._private.definitions[ID];
+
+ this.applyFn = function () {
+
+ return this.definition.fn();
+ };
+ });
+
+ describe('definition', function () {
+
+ it('is defined', function () {
+
+ assert.isPlainObject(this.definition);
+ });
+
+ it('has correct id', function () {
+
+ assert.strictEqual(this.definition.id, ID);
+ });
+
+ it('requires correct', function () {
+
+ assert.deepEqual(this.definition.deps, DEPS);
+ });
+
+ it('args for each request', function () {
+
+ assert.strictEqual(this.definition.deps.length, this.definition.fn.length);
+ });
+
+ it('has no instance', function () {
+
+ assert.notProperty(modulejs._private.instances, ID);
+ });
+
+ it('inits without errors', function () {
+
+ this.applyFn();
+ });
+ });
+
+ describe('application', function () {
+
+ it('returns plain object with 3 properties', function () {
+
+ var instance = this.applyFn();
+ assert.isPlainObject(instance);
+ assert.lengthOf(_.keys(instance), 3);
+ });
+ });
+
+ describe('.canvas', function () {
+
+ it('is boolean', function () {
+
+ var instance = this.applyFn();
+ assert.isBoolean(instance.canvas);
+ });
+ });
+
+ describe('.history', function () {
+
+ it('is boolean', function () {
+
+ var instance = this.applyFn();
+ assert.isBoolean(instance.history);
+ });
+ });
+
+ describe('.localstorage', function () {
+
+ it('is boolean', function () {
+
+ var instance = this.applyFn();
+ assert.isBoolean(instance.localstorage);
+ });
+ });
+});
+
+}());
diff --git a/test/tests/unit/core/store.js b/test/tests/unit/core/store.js
index ab63f7cc..6de17ebf 100644
--- a/test/tests/unit/core/store.js
+++ b/test/tests/unit/core/store.js
@@ -2,7 +2,7 @@
'use strict';
var ID = 'core/store';
-var DEPS = ['modernizr'];
+var DEPS = ['core/modernizr'];
describe('module \'' + ID + '\'', function () {
diff --git a/test/tests/unit/libs.js b/test/tests/unit/libs.js
index f645ed63..36a44d5d 100644
--- a/test/tests/unit/libs.js
+++ b/test/tests/unit/libs.js
@@ -7,7 +7,6 @@ describe('libs', function () {
_: window._,
$: window.jQuery,
marked: window.marked,
- modernizr: window.Modernizr,
prism: window.Prism
};