From 82ceb4c1c01b94704dc2cffd0950f2f9da588743 Mon Sep 17 00:00:00 2001 From: Jeremy Fields Date: Thu, 22 Sep 2016 09:42:38 -0600 Subject: [PATCH] Update to README --- README.md | 1 + dist/what-input.min.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b603b2..ab55ebc 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ What Input adds data attributes to the `` tag based on the type of input b * Key logging and the corresponding `whatInput.keys()` API option have been removed. * Event binding and attributes are now added to the `` tag to eliminate the need to test for `DOMContentLoaded`. * The `whatInput.set()` API option has been removed. +* A new set of `whatinput-types-[type]` classes are now added as inputs are detected. New classes are added but existing ones remain, creating the same output as what the `whatInput.types()` returns. ## How it works diff --git a/dist/what-input.min.js b/dist/what-input.min.js index 7be6436..104c040 100644 --- a/dist/what-input.min.js +++ b/dist/what-input.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("whatInput",[],t):"object"==typeof exports?exports.whatInput=t():e.whatInput=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){e.exports=function(){var e=document.documentElement,t="initial",n=null,o=["input","textarea"],i=[16,17,18,91,93],r={keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"},u=[],d=!1,a={2:"touch",3:"touch",4:"mouse"},p=null,s=function(){r[h()]="mouse",c(),m()},c=function(){window.PointerEvent?(e.addEventListener("pointerdown",f),e.addEventListener("pointermove",w)):window.MSPointerEvent?(e.addEventListener("MSPointerDown",f),e.addEventListener("MSPointerMove",w)):(e.addEventListener("mousedown",f),e.addEventListener("mousemove",w),"ontouchstart"in window&&e.addEventListener("touchstart",v)),e.addEventListener(h(),w),e.addEventListener("keydown",f),e.addEventListener("keyup",f)},f=function(e){if(!d){var u=e.which,a=r[e.type];if("pointer"===a&&(a=l(e)),t!==a){var p=!(!document.activeElement||o.indexOf(document.activeElement.nodeName.toLowerCase())!==-1);("touch"===a||"mouse"===a&&i.indexOf(u)===-1||"keyboard"===a&&p)&&(t=n=a,m())}}},m=function(){e.setAttribute("data-whatinput",t),e.setAttribute("data-whatintent",t),u.indexOf(t)===-1&&u.push(t)},w=function(t){var o=r[t.type];"pointer"===o&&(o=l(t)),n!==o&&(n=o,e.setAttribute("data-whatintent",n))},v=function(e){window.clearTimeout(p),f(e),d=!0,p=window.setTimeout(function(){d=!1},200)},l=function(e){return"number"==typeof e.pointerType?a[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},h=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"};return"addEventListener"in window&&Array.prototype.indexOf&&s(),{ask:function(e){return"loose"===e?n:t},types:function(){return u}}}()}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("whatInput",[],t):"object"==typeof exports?exports.whatInput=t():e.whatInput=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){e.exports=function(){var e=document.documentElement,t="initial",n=null,o=["input","textarea"],i=[16,17,18,91,93],r={keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"},u=[],d=!1,a={2:"touch",3:"touch",4:"mouse"},p=null,s=function(){r[h()]="mouse",c(),m()},c=function(){window.PointerEvent?(e.addEventListener("pointerdown",f),e.addEventListener("pointermove",w)):window.MSPointerEvent?(e.addEventListener("MSPointerDown",f),e.addEventListener("MSPointerMove",w)):(e.addEventListener("mousedown",f),e.addEventListener("mousemove",w),"ontouchstart"in window&&e.addEventListener("touchstart",v)),e.addEventListener(h(),w),e.addEventListener("keydown",f),e.addEventListener("keyup",f)},f=function(e){if(!d){var u=e.which,a=r[e.type];if("pointer"===a&&(a=l(e)),t!==a){var p=!(!document.activeElement||o.indexOf(document.activeElement.nodeName.toLowerCase())!==-1);("touch"===a||"mouse"===a&&i.indexOf(u)===-1||"keyboard"===a&&p)&&(t=n=a,m())}}},m=function(){e.setAttribute("data-whatinput",t),e.setAttribute("data-whatintent",t),u.indexOf(t)===-1&&(u.push(t),e.classList.add("whatinput-types-"+t))},w=function(t){var o=r[t.type];"pointer"===o&&(o=l(t)),n!==o&&(n=o,e.setAttribute("data-whatintent",n))},v=function(e){window.clearTimeout(p),f(e),d=!0,p=window.setTimeout(function(){d=!1},200)},l=function(e){return"number"==typeof e.pointerType?a[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},h=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"};return"addEventListener"in window&&Array.prototype.indexOf&&s(),{ask:function(e){return"loose"===e?n:t},types:function(){return u}}}()}])}); \ No newline at end of file