colorgy_style 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +41 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +10 -0
  7. data/README.md +36 -0
  8. data/Rakefile +11 -0
  9. data/assets/fonts/colorgy/.keep +0 -0
  10. data/assets/images/colorgy/.keep +0 -0
  11. data/assets/javascripts/colorgy.js +1 -0
  12. data/assets/javascripts/colorgy/main.js +7 -0
  13. data/assets/javascripts/colorgy/modernizr.js +7 -0
  14. data/assets/javascripts/colorgy/modernizr/classifier.coffee +14 -0
  15. data/assets/javascripts/vendor/es5-shim.js +1432 -0
  16. data/assets/javascripts/vendor/modernizr.js +1406 -0
  17. data/assets/javascripts/vendor/modernizr/feature-detects/a-download.js +8 -0
  18. data/assets/javascripts/vendor/modernizr/feature-detects/audio-audiodata-api.js +4 -0
  19. data/assets/javascripts/vendor/modernizr/feature-detects/audio-webaudio-api.js +4 -0
  20. data/assets/javascripts/vendor/modernizr/feature-detects/battery-api.js +8 -0
  21. data/assets/javascripts/vendor/modernizr/feature-detects/battery-level.js +11 -0
  22. data/assets/javascripts/vendor/modernizr/feature-detects/blob-constructor.js +10 -0
  23. data/assets/javascripts/vendor/modernizr/feature-detects/canvas-todataurl-type.js +28 -0
  24. data/assets/javascripts/vendor/modernizr/feature-detects/contenteditable.js +9 -0
  25. data/assets/javascripts/vendor/modernizr/feature-detects/contentsecuritypolicy.js +10 -0
  26. data/assets/javascripts/vendor/modernizr/feature-detects/contextmenu.js +11 -0
  27. data/assets/javascripts/vendor/modernizr/feature-detects/cookies.js +15 -0
  28. data/assets/javascripts/vendor/modernizr/feature-detects/cors.js +3 -0
  29. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-shorthand.js +19 -0
  30. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-xy.js +15 -0
  31. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundrepeat.js +31 -0
  32. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundsizecover.js +10 -0
  33. data/assets/javascripts/vendor/modernizr/feature-detects/css-boxsizing.js +9 -0
  34. data/assets/javascripts/vendor/modernizr/feature-detects/css-calc.js +12 -0
  35. data/assets/javascripts/vendor/modernizr/feature-detects/css-cubicbezierrange.js +8 -0
  36. data/assets/javascripts/vendor/modernizr/feature-detects/css-displayrunin.js +18 -0
  37. data/assets/javascripts/vendor/modernizr/feature-detects/css-displaytable.js +27 -0
  38. data/assets/javascripts/vendor/modernizr/feature-detects/css-filters.js +7 -0
  39. data/assets/javascripts/vendor/modernizr/feature-detects/css-hyphens.js +205 -0
  40. data/assets/javascripts/vendor/modernizr/feature-detects/css-lastchild.js +11 -0
  41. data/assets/javascripts/vendor/modernizr/feature-detects/css-mask.js +12 -0
  42. data/assets/javascripts/vendor/modernizr/feature-detects/css-mediaqueries.js +3 -0
  43. data/assets/javascripts/vendor/modernizr/feature-detects/css-objectfit.js +6 -0
  44. data/assets/javascripts/vendor/modernizr/feature-detects/css-overflow-scrolling.js +9 -0
  45. data/assets/javascripts/vendor/modernizr/feature-detects/css-pointerevents.js +25 -0
  46. data/assets/javascripts/vendor/modernizr/feature-detects/css-positionsticky.js +13 -0
  47. data/assets/javascripts/vendor/modernizr/feature-detects/css-regions.js +55 -0
  48. data/assets/javascripts/vendor/modernizr/feature-detects/css-remunit.js +19 -0
  49. data/assets/javascripts/vendor/modernizr/feature-detects/css-resize.js +8 -0
  50. data/assets/javascripts/vendor/modernizr/feature-detects/css-scrollbars.js +19 -0
  51. data/assets/javascripts/vendor/modernizr/feature-detects/css-shapes.js +4 -0
  52. data/assets/javascripts/vendor/modernizr/feature-detects/css-subpixelfont.js +23 -0
  53. data/assets/javascripts/vendor/modernizr/feature-detects/css-supports.js +6 -0
  54. data/assets/javascripts/vendor/modernizr/feature-detects/css-userselect.js +10 -0
  55. data/assets/javascripts/vendor/modernizr/feature-detects/css-vhunit.js +14 -0
  56. data/assets/javascripts/vendor/modernizr/feature-detects/css-vmaxunit.js +14 -0
  57. data/assets/javascripts/vendor/modernizr/feature-detects/css-vminunit.js +14 -0
  58. data/assets/javascripts/vendor/modernizr/feature-detects/css-vwunit.js +14 -0
  59. data/assets/javascripts/vendor/modernizr/feature-detects/custom-protocol-handler.js +10 -0
  60. data/assets/javascripts/vendor/modernizr/feature-detects/dart.js +6 -0
  61. data/assets/javascripts/vendor/modernizr/feature-detects/dataview-api.js +4 -0
  62. data/assets/javascripts/vendor/modernizr/feature-detects/dom-classlist.js +4 -0
  63. data/assets/javascripts/vendor/modernizr/feature-detects/dom-createElement-attrs.js +11 -0
  64. data/assets/javascripts/vendor/modernizr/feature-detects/dom-dataset.js +9 -0
  65. data/assets/javascripts/vendor/modernizr/feature-detects/dom-microdata.js +4 -0
  66. data/assets/javascripts/vendor/modernizr/feature-detects/elem-datalist.js +12 -0
  67. data/assets/javascripts/vendor/modernizr/feature-detects/elem-details.js +25 -0
  68. data/assets/javascripts/vendor/modernizr/feature-detects/elem-output.js +4 -0
  69. data/assets/javascripts/vendor/modernizr/feature-detects/elem-progress-meter.js +11 -0
  70. data/assets/javascripts/vendor/modernizr/feature-detects/elem-ruby.js +53 -0
  71. data/assets/javascripts/vendor/modernizr/feature-detects/elem-time.js +4 -0
  72. data/assets/javascripts/vendor/modernizr/feature-detects/elem-track.js +11 -0
  73. data/assets/javascripts/vendor/modernizr/feature-detects/emoji.js +11 -0
  74. data/assets/javascripts/vendor/modernizr/feature-detects/es5-strictmode.js +7 -0
  75. data/assets/javascripts/vendor/modernizr/feature-detects/event-deviceorientation-motion.js +11 -0
  76. data/assets/javascripts/vendor/modernizr/feature-detects/exif-orientation.js +32 -0
  77. data/assets/javascripts/vendor/modernizr/feature-detects/file-api.js +12 -0
  78. data/assets/javascripts/vendor/modernizr/feature-detects/file-filesystem.js +9 -0
  79. data/assets/javascripts/vendor/modernizr/feature-detects/forms-fileinput.js +13 -0
  80. data/assets/javascripts/vendor/modernizr/feature-detects/forms-formattribute.js +29 -0
  81. data/assets/javascripts/vendor/modernizr/feature-detects/forms-inputnumber-l10n.js +32 -0
  82. data/assets/javascripts/vendor/modernizr/feature-detects/forms-placeholder.js +10 -0
  83. data/assets/javascripts/vendor/modernizr/feature-detects/forms-speechinput.js +19 -0
  84. data/assets/javascripts/vendor/modernizr/feature-detects/forms-validation.js +62 -0
  85. data/assets/javascripts/vendor/modernizr/feature-detects/fullscreen-api.js +10 -0
  86. data/assets/javascripts/vendor/modernizr/feature-detects/gamepad.js +12 -0
  87. data/assets/javascripts/vendor/modernizr/feature-detects/getusermedia.js +5 -0
  88. data/assets/javascripts/vendor/modernizr/feature-detects/ie8compat.js +12 -0
  89. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-sandbox.js +5 -0
  90. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-seamless.js +5 -0
  91. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-srcdoc.js +5 -0
  92. data/assets/javascripts/vendor/modernizr/feature-detects/img-apng.js +26 -0
  93. data/assets/javascripts/vendor/modernizr/feature-detects/img-webp.js +20 -0
  94. data/assets/javascripts/vendor/modernizr/feature-detects/json.js +7 -0
  95. data/assets/javascripts/vendor/modernizr/feature-detects/lists-reversed.js +6 -0
  96. data/assets/javascripts/vendor/modernizr/feature-detects/mathml.js +23 -0
  97. data/assets/javascripts/vendor/modernizr/feature-detects/network-connection.js +22 -0
  98. data/assets/javascripts/vendor/modernizr/feature-detects/network-eventsource.js +5 -0
  99. data/assets/javascripts/vendor/modernizr/feature-detects/network-xhr2.js +13 -0
  100. data/assets/javascripts/vendor/modernizr/feature-detects/notification.js +10 -0
  101. data/assets/javascripts/vendor/modernizr/feature-detects/performance.js +5 -0
  102. data/assets/javascripts/vendor/modernizr/feature-detects/pointerlock-api.js +4 -0
  103. data/assets/javascripts/vendor/modernizr/feature-detects/quota-management-api.js +11 -0
  104. data/assets/javascripts/vendor/modernizr/feature-detects/requestanimationframe.js +7 -0
  105. data/assets/javascripts/vendor/modernizr/feature-detects/script-async.js +3 -0
  106. data/assets/javascripts/vendor/modernizr/feature-detects/script-defer.js +3 -0
  107. data/assets/javascripts/vendor/modernizr/feature-detects/style-scoped.js +6 -0
  108. data/assets/javascripts/vendor/modernizr/feature-detects/svg-filters.js +13 -0
  109. data/assets/javascripts/vendor/modernizr/feature-detects/unicode.js +32 -0
  110. data/assets/javascripts/vendor/modernizr/feature-detects/url-data-uri.js +26 -0
  111. data/assets/javascripts/vendor/modernizr/feature-detects/userdata.js +7 -0
  112. data/assets/javascripts/vendor/modernizr/feature-detects/vibration.js +4 -0
  113. data/assets/javascripts/vendor/modernizr/feature-detects/web-intents.js +6 -0
  114. data/assets/javascripts/vendor/modernizr/feature-detects/webgl-extensions.js +42 -0
  115. data/assets/javascripts/vendor/modernizr/feature-detects/websockets-binary.js +20 -0
  116. data/assets/javascripts/vendor/modernizr/feature-detects/window-framed.js +8 -0
  117. data/assets/javascripts/vendor/modernizr/feature-detects/workers-blobworkers.js +66 -0
  118. data/assets/javascripts/vendor/modernizr/feature-detects/workers-dataworkers.js +34 -0
  119. data/assets/javascripts/vendor/modernizr/feature-detects/workers-sharedworkers.js +3 -0
  120. data/assets/stylesheets/colorgy.scss +1 -0
  121. data/assets/stylesheets/colorgy/components/.keep +0 -0
  122. data/assets/stylesheets/colorgy/components/_button.scss +18 -0
  123. data/assets/stylesheets/colorgy/core/_base.scss +12 -0
  124. data/assets/stylesheets/colorgy/core/_config.scss +8 -0
  125. data/assets/stylesheets/colorgy/core/_fonts.scss +8 -0
  126. data/assets/stylesheets/colorgy/core/_grid.scss +8 -0
  127. data/assets/stylesheets/colorgy/core/_helpers.scss +44 -0
  128. data/assets/stylesheets/colorgy/layouts/.keep +0 -0
  129. data/assets/stylesheets/colorgy/main.scss +63 -0
  130. data/assets/stylesheets/colorgy/structures/.keep +0 -0
  131. data/bin/console +14 -0
  132. data/bin/server +3 -0
  133. data/bin/setup +7 -0
  134. data/colorgy_style.gemspec +52 -0
  135. data/config.rb +63 -0
  136. data/lib/colorgy_style.rb +74 -0
  137. data/lib/colorgy_style/rails.rb +13 -0
  138. data/lib/colorgy_style/version.rb +3 -0
  139. data/styleguide/index.html.haml +7 -0
  140. data/styleguide/javascripts/body.js +5 -0
  141. data/styleguide/javascripts/head.js +2 -0
  142. data/styleguide/javascripts/styleguide/kss.js +40 -0
  143. data/styleguide/javascripts/styleguide/prism.js +6 -0
  144. data/styleguide/layouts/default.erb +5 -0
  145. data/styleguide/layouts/layout.erb +20 -0
  146. data/styleguide/styleblocks/.keep +0 -0
  147. data/styleguide/styleblocks/_button.html.erb +23 -0
  148. data/styleguide/stylesheets/all.css +4 -0
  149. data/styleguide/stylesheets/styleguide/_prism.css +107 -0
  150. data/styleguide/stylesheets/styleguide/styles.scss +97 -0
  151. metadata +402 -0
@@ -0,0 +1,4 @@
1
+ // <time> element
2
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#the-time-element-0
3
+ // by Addy Osmani
4
+ Modernizr.addTest('time', 'valueAsDate' in document.createElement('time'));
@@ -0,0 +1,11 @@
1
+ // Track element + Timed Text Track API
2
+ // http://www.w3.org/TR/html5/video.html#the-track-element
3
+ // http://www.w3.org/TR/html5/media-elements.html#text-track-api
4
+ //
5
+ // While IE10 has implemented the track element, IE10 does not expose the underlying APIs to create timed text tracks by JS (really sad)
6
+ // By Addy Osmani
7
+ Modernizr.addTest({
8
+ texttrackapi: (typeof (document.createElement('video').addTextTrack) === 'function'),
9
+ // a more strict test for track including UI support: document.createElement('track').kind === 'subtitles'
10
+ track: ('kind' in document.createElement('track'))
11
+ });
@@ -0,0 +1,11 @@
1
+ // Requires a Modernizr build with `canvastext` included
2
+ // http://www.modernizr.com/download/#-canvas-canvastext
3
+ Modernizr.addTest('emoji', function() {
4
+ if (!Modernizr.canvastext) return false;
5
+ var node = document.createElement('canvas'),
6
+ ctx = node.getContext('2d');
7
+ ctx.textBaseline = 'top';
8
+ ctx.font = '32px Arial';
9
+ ctx.fillText('\ud83d\ude03', 0, 0); // "smiling face with open mouth" emoji
10
+ return ctx.getImageData(16, 16, 1, 1).data[0] !== 0;
11
+ });
@@ -0,0 +1,7 @@
1
+ // strict mode
2
+
3
+ // test by @kangax
4
+
5
+ Modernizr.addTest('strictmode', function(){
6
+ return (function(){ "use strict"; return !this; })();
7
+ });
@@ -0,0 +1,11 @@
1
+ //By Shi Chuan
2
+ //Part of Device Access aspect of HTML5, same category as geolocation
3
+ //W3C Editor's Draft at http://dev.w3.org/geo/api/spec-source-orientation.html
4
+ //Implementation by iOS Safari at http://goo.gl/fhce3 and http://goo.gl/rLKz8
5
+
6
+
7
+ //test for Device Motion Event support, returns boolean value true/false
8
+ Modernizr.addTest('devicemotion', ('DeviceMotionEvent' in window) );
9
+
10
+ //test for Device Orientation Event support, returns boolean value true/false
11
+ Modernizr.addTest('deviceorientation', ('DeviceOrientationEvent' in window) );
@@ -0,0 +1,32 @@
1
+ // EXIF Orientation test
2
+
3
+ // iOS looks at the EXIF Orientation flag in jpgs and rotates the image
4
+ // accordingly. Looks like most desktop browsers just ignore this data.
5
+
6
+ // description: www.impulseadventure.com/photo/exif-orientation.html
7
+
8
+ // Bug trackers:
9
+ // bugzil.la/298619 (unimplemented)
10
+ // crbug.com/56845 (looks incomplete)
11
+ // webk.it/19688 (available upstream but its up all ports to turn on individually)
12
+ //
13
+
14
+ // detect by Paul Sayre
15
+
16
+
17
+ (function(){
18
+
19
+ var img = new Image();
20
+
21
+ img.onerror = function() {
22
+ Modernizr.addTest('exif-orientation', function () { return false; });
23
+ };
24
+
25
+ img.onload = function() {
26
+ Modernizr.addTest('exif-orientation', function () { return img.width !== 2; });
27
+ };
28
+
29
+ // There may be a way to shrink this more, it's a 1x2 white jpg with the orientation flag set to 6
30
+ img.src = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAASUkqAAgAAAABABIBAwABAAAABgASAAAAAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAABAAIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/iiiigD/2Q==";
31
+
32
+ })();
@@ -0,0 +1,12 @@
1
+ /**
2
+ * file tests for the File API specification
3
+ * Tests for objects specific to the File API W3C specification without
4
+ * being redundant (don't bother testing for Blob since it is assumed
5
+ * to be the File object's prototype.
6
+ *
7
+ * Will fail in Safari 5 due to its lack of support for the standards
8
+ * defined FileReader object
9
+ */
10
+ Modernizr.addTest('filereader', function () {
11
+ return !!(window.File && window.FileList && window.FileReader);
12
+ });
@@ -0,0 +1,9 @@
1
+ // Filesystem API
2
+ // dev.w3.org/2009/dap/file-system/file-dir-sys.html
3
+
4
+ // The API will be present in Chrome incognito, but will throw an exception.
5
+ // See crbug.com/93417
6
+ //
7
+ // By Eric Bidelman (@ebidel)
8
+
9
+ Modernizr.addTest('filesystem', !!Modernizr.prefixed('requestFileSystem', window));
@@ -0,0 +1,13 @@
1
+
2
+
3
+ // Detects whether input type="file" is available on the platform
4
+ // E.g. iOS < 6 and some android version don't support this
5
+
6
+ // It's useful if you want to hide the upload feature of your app on devices that
7
+ // don't support it (iphone, ipad, etc).
8
+
9
+ Modernizr.addTest('fileinput', function() {
10
+ var elem = document.createElement('input');
11
+ elem.type = 'file';
12
+ return !elem.disabled;
13
+ });
@@ -0,0 +1,29 @@
1
+ // Detects whether input form="form_id" is available on the platform
2
+ // E.g. IE 10 (and below), don't support this
3
+ Modernizr.addTest("formattribute", function() {
4
+ var form = document.createElement("form"),
5
+ input = document.createElement("input"),
6
+ div = document.createElement("div"),
7
+ id = "formtest"+(new Date().getTime()),
8
+ attr,
9
+ bool = false;
10
+
11
+ form.id = id;
12
+
13
+ //IE6/7 confuses the form idl attribute and the form content attribute
14
+ if(document.createAttribute){
15
+ attr = document.createAttribute("form");
16
+ attr.nodeValue = id;
17
+ input.setAttributeNode(attr);
18
+ div.appendChild(form);
19
+ div.appendChild(input);
20
+
21
+ document.documentElement.appendChild(div);
22
+
23
+ bool = form.elements.length === 1 && input.form == form;
24
+
25
+ div.parentNode.removeChild(div);
26
+ }
27
+
28
+ return bool;
29
+ });
@@ -0,0 +1,32 @@
1
+ // input[type="number"] localized input/output
2
+ // // Detects whether input type="number" is capable of receiving and
3
+ // // displaying localized numbers, e.g. with comma separator
4
+ // // https://bugs.webkit.org/show_bug.cgi?id=42484
5
+ // // Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/forms/script-tests/input-number-keyoperation.js?rev=80096#L9
6
+ // // By Peter Janes
7
+
8
+ Modernizr.addTest('localizedNumber', function() {
9
+ var doc = document,
10
+ el = document.createElement('div'),
11
+ fake,
12
+ root,
13
+ input,
14
+ diff;
15
+ root = doc.body || (function() {
16
+ var de = doc.documentElement;
17
+ fake = true;
18
+ return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
19
+ }());
20
+ el.innerHTML = '<input type="number" value="1.0" step="0.1"/>';
21
+ input = el.childNodes[0];
22
+ root.appendChild(el);
23
+ input.focus();
24
+ try {
25
+ doc.execCommand('InsertText', false, '1,1');
26
+ } catch(e) { // prevent warnings in IE
27
+ }
28
+ diff = input.type === 'number' && input.valueAsNumber === 1.1 && input.checkValidity();
29
+ root.removeChild(el);
30
+ fake && root.parentNode.removeChild(root);
31
+ return diff;
32
+ });
@@ -0,0 +1,10 @@
1
+ // testing for placeholder attribute in inputs and textareas
2
+ // re-using Modernizr.input if available
3
+
4
+ Modernizr.addTest('placeholder', function(){
5
+
6
+ return !!( 'placeholder' in ( Modernizr.input || document.createElement('input') ) &&
7
+ 'placeholder' in ( Modernizr.textarea || document.createElement('textarea') )
8
+ );
9
+
10
+ });
@@ -0,0 +1,19 @@
1
+ // speech input for inputs
2
+ // by @alrra
3
+
4
+
5
+ // `webkitSpeech` in elem
6
+ // doesn`t work correctly in all versions of Chromium based browsers.
7
+ // It can return false even if they have support for speech i.imgur.com/2Y40n.png
8
+ // Testing with 'onwebkitspeechchange' seems to fix this problem
9
+
10
+ // this detect only checks the webkit version because
11
+ // the speech attribute is likely to be deprecated in favor of a JavaScript API.
12
+ // http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/att-1696/speechapi.html
13
+
14
+ // FIXME: add support for detecting the new spec'd behavior
15
+
16
+ Modernizr.addTest('speechinput', function(){
17
+ var elem = document.createElement('input');
18
+ return 'speech' in elem || 'onwebkitspeechchange' in elem;
19
+ });
@@ -0,0 +1,62 @@
1
+ // This implementation only tests support for interactive form validation.
2
+ // To check validation for a specific type or a specific other constraint,
3
+ // the test can be combined:
4
+ // - Modernizr.inputtypes.numer && Modernizr.formvalidation (browser supports rangeOverflow, typeMismatch etc. for type=number)
5
+ // - Modernizr.input.required && Modernizr.formvalidation (browser supports valueMissing)
6
+ //
7
+ (function(document, Modernizr){
8
+
9
+
10
+ Modernizr.formvalidationapi = false;
11
+ Modernizr.formvalidationmessage = false;
12
+
13
+ Modernizr.addTest('formvalidation', function() {
14
+ var form = document.createElement('form');
15
+ if ( !('checkValidity' in form) || !('addEventListener' in form) ) {
16
+ return false;
17
+ }
18
+ if ('reportValidity' in form) {
19
+ return true;
20
+ }
21
+ var invalidFired = false;
22
+ var input;
23
+
24
+ Modernizr.formvalidationapi = true;
25
+
26
+ // Prevent form from being submitted
27
+ form.addEventListener('submit', function(e) {
28
+ //Opera does not validate form, if submit is prevented
29
+ if ( !window.opera ) {
30
+ e.preventDefault();
31
+ }
32
+ e.stopPropagation();
33
+ }, false);
34
+
35
+ // Calling form.submit() doesn't trigger interactive validation,
36
+ // use a submit button instead
37
+ //older opera browsers need a name attribute
38
+ form.innerHTML = '<input name="modTest" required><button></button>';
39
+
40
+ Modernizr.testStyles('#modernizr form{position:absolute;top:-99999em}', function( node ) {
41
+ node.appendChild(form);
42
+
43
+ input = form.getElementsByTagName('input')[0];
44
+
45
+ // Record whether "invalid" event is fired
46
+ input.addEventListener('invalid', function(e) {
47
+ invalidFired = true;
48
+ e.preventDefault();
49
+ e.stopPropagation();
50
+ }, false);
51
+
52
+ //Opera does not fully support the validationMessage property
53
+ Modernizr.formvalidationmessage = !!input.validationMessage;
54
+
55
+ // Submit form by clicking submit button
56
+ form.getElementsByTagName('button')[0].click();
57
+ });
58
+
59
+ return invalidFired;
60
+ });
61
+
62
+ })(document, window.Modernizr);
@@ -0,0 +1,10 @@
1
+ Modernizr.addTest('fullscreen',function(){
2
+ for(var i = 0; i < Modernizr._domPrefixes.length; i++) {
3
+ if( document[Modernizr._domPrefixes[i].toLowerCase() + 'CancelFullScreen'])
4
+ return true;
5
+ }
6
+ return !!document['cancelFullScreen'] || false;
7
+ });
8
+
9
+ // http://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html#//apple_ref/doc/uid/TP40009523-CH3-SW20
10
+ // https://developer.mozilla.org/en/API/Fullscreen
@@ -0,0 +1,12 @@
1
+ // GamePad API
2
+ // https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
3
+ // By Eric Bidelman
4
+
5
+ // FF has Gamepad API support only in special builds, but not in any release (even behind a flag)
6
+ // Their current implementation has no way to feature detect, only events to bind to.
7
+ // http://www.html5rocks.com/en/tutorials/doodles/gamepad/#toc-featuredetect
8
+
9
+ // but a patch will bring them up to date with the spec when it lands (and they'll pass this test)
10
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=690935
11
+
12
+ Modernizr.addTest('gamepads', !!Modernizr.prefixed('getGamepads', navigator));
@@ -0,0 +1,5 @@
1
+ // getUserMedia
2
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video-conferencing-and-peer-to-peer-communication.html
3
+ // By Eric Bidelman
4
+
5
+ Modernizr.addTest('getusermedia', !!Modernizr.prefixed('getUserMedia', navigator));
@@ -0,0 +1,12 @@
1
+
2
+ // IE8 compat mode aka Fake IE7
3
+ // by Erich Ocean
4
+
5
+ // In this case, IE8 will be acting as IE7. You may choose to remove features in this case.
6
+
7
+ // related:
8
+ // james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
9
+
10
+ Modernizr.addTest('ie8compat',function(){
11
+ return (!window.addEventListener && document.documentMode && document.documentMode === 7);
12
+ });
@@ -0,0 +1,5 @@
1
+ // Test for `sandbox` attribute in iframes.
2
+ //
3
+ // Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-sandbox
4
+
5
+ Modernizr.addTest('sandbox', 'sandbox' in document.createElement('iframe'));
@@ -0,0 +1,5 @@
1
+ // Test for `seamless` attribute in iframes.
2
+ //
3
+ // Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-seamless
4
+
5
+ Modernizr.addTest('seamless', 'seamless' in document.createElement('iframe'));
@@ -0,0 +1,5 @@
1
+ // Test for `srcdoc` attribute in iframes.
2
+ //
3
+ // Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-srcdoc
4
+
5
+ Modernizr.addTest('srcdoc', 'srcdoc' in document.createElement('iframe'));
@@ -0,0 +1,26 @@
1
+ // Animated PNG
2
+ // http://en.wikipedia.org/wiki/APNG
3
+ // By Addy Osmani
4
+ (function () {
5
+
6
+ if (!Modernizr.canvas) return false;
7
+
8
+ var image = new Image(),
9
+ canvas = document.createElement('canvas'),
10
+ ctx = canvas.getContext('2d');
11
+
12
+
13
+ image.onload = function () {
14
+ Modernizr.addTest('apng', function () {
15
+ if (typeof canvas.getContext == 'undefined') {
16
+ return false;
17
+ } else {
18
+ ctx.drawImage(image, 0, 0);
19
+ return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
20
+ }
21
+ });
22
+ };
23
+
24
+ image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==";
25
+
26
+ }());
@@ -0,0 +1,20 @@
1
+ // code.google.com/speed/webp/
2
+ // by rich bradshaw, ryan seddon, and paul irish
3
+
4
+
5
+ // This test is asynchronous. Watch out.
6
+
7
+ (function(){
8
+
9
+ var image = new Image();
10
+
11
+ image.onerror = function() {
12
+ Modernizr.addTest('webp', false);
13
+ };
14
+ image.onload = function() {
15
+ Modernizr.addTest('webp', function() { return image.width == 1; });
16
+ };
17
+
18
+ image.src = 'data:image/webp;base64,UklGRiwAAABXRUJQVlA4ICAAAAAUAgCdASoBAAEAL/3+/3+CAB/AAAFzrNsAAP5QAAAAAA==';
19
+
20
+ }());
@@ -0,0 +1,7 @@
1
+ // native JSON support.
2
+ // developer.mozilla.org/en/JSON
3
+
4
+ // this will also succeed if you've loaded the JSON2.js polyfill ahead of time
5
+ // ... but that should be obvious. :)
6
+
7
+ Modernizr.addTest('json', !!window.JSON && !!JSON.parse);
@@ -0,0 +1,6 @@
1
+
2
+ // impressivewebs.com/reverse-ordered-lists-html5
3
+ // polyfill: github.com/impressivewebs/HTML5-Reverse-Ordered-Lists
4
+
5
+
6
+ Modernizr.addTest('olreversed', 'reversed' in document.createElement('ol'));
@@ -0,0 +1,23 @@
1
+ // MathML
2
+ // http://www.w3.org/Math/
3
+ // By Addy Osmani
4
+ // Based on work by Davide (@dpvc) and David (@davidcarlisle)
5
+ // in https://github.com/mathjax/MathJax/issues/182
6
+
7
+ Modernizr.addTest('mathml', function(){
8
+ var hasMathML = false;
9
+ if ( document.createElementNS ) {
10
+ var ns = "http://www.w3.org/1998/Math/MathML",
11
+ div = document.createElement("div");
12
+ div.style.position = "absolute";
13
+ var mfrac = div.appendChild(document.createElementNS(ns,"math"))
14
+ .appendChild(document.createElementNS(ns,"mfrac"));
15
+ mfrac.appendChild(document.createElementNS(ns,"mi"))
16
+ .appendChild(document.createTextNode("xx"));
17
+ mfrac.appendChild(document.createElementNS(ns,"mi"))
18
+ .appendChild(document.createTextNode("yy"));
19
+ document.body.appendChild(div);
20
+ hasMathML = div.offsetHeight > div.offsetWidth;
21
+ }
22
+ return hasMathML;
23
+ });
@@ -0,0 +1,22 @@
1
+ // determining low-bandwidth via navigator.connection
2
+
3
+ // There are two iterations of the navigator.connection interface:
4
+
5
+ // The first is present in Android 2.2+ and only in the Browser (not WebView)
6
+ // : docs.phonegap.com/en/1.2.0/phonegap_connection_connection.md.html#connection.type
7
+ // : davidbcalhoun.com/2010/using-navigator-connection-android
8
+
9
+ // The second is specced at dev.w3.org/2009/dap/netinfo/ and perhaps landing in WebKit
10
+ // : bugs.webkit.org/show_bug.cgi?id=73528
11
+
12
+ // unknown devices are assumed as fast
13
+ // for more rigorous network testing, consider boomerang.js: github.com/bluesmoon/boomerang/
14
+
15
+ Modernizr.addTest('lowbandwidth', function() {
16
+
17
+ var connection = navigator.connection || { type: 0 }; // polyfill
18
+
19
+ return connection.type == 3 || // connection.CELL_2G
20
+ connection.type == 4 || // connection.CELL_3G
21
+ /^[23]g$/.test(connection.type); // string value in new spec
22
+ });