diff --git a/README.md b/README.md index 42b322e..b0f9f11 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,10 @@ What Input works in all modern browsers. ## Changelog +### v5.1.3 + +- **Added:** Sourcemap for the minified version. + ### v5.1.2 - **Added:** `specificKeys` functionality to allow overriding of keyboard keys list. Fix via [bk3](https://github.com/bk3). diff --git a/dist/maps/what-input.min.js.map b/dist/maps/what-input.min.js.map index 5cd4142..6d69872 100644 --- a/dist/maps/what-input.min.js.map +++ b/dist/maps/what-input.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["what-input.min.js","what-input.js"],"names":["root","factory","exports","module","define","amd","this","modules","installedModules","__webpack_require__","moduleId","id","loaded","call","m","c","p","document","window","ask","element","ignoreKeys","specificKeys","registerOnChange","unRegisterOnChange","docElem","documentElement","currentElement","currentInput","currentIntent","sessionStorage","getItem","e","eventTimer","formInputs","functionList","ignoreMap","specificMap","inputMap","keydown","keyup","mousedown","mousemove","MSPointerDown","MSPointerMove","pointerdown","pointermove","touchstart","isBuffering","isScrolling","mousePos","x","y","pointerMap","2","3","4","supportsPassive","opts","Object","defineProperty","get","addEventListener","addListeners","options","passive","PointerEvent","setInput","setIntent","MSPointerEvent","eventBuffer","detectWheel","setElement","clearElement","event","eventKey","which","value","type","pointerType","ignoreMatch","length","indexOf","specificMatch","shouldUpdate","setItem","doUpdate","activeElem","activeElement","nodeName","toLowerCase","setAttribute","fireFunctions","detectScrolling","target","classList","toString","replace","removeAttribute","clearTimeout","setTimeout","createElement","undefined","onmousewheel","i","len","fn","screenX","screenY","Array","prototype","opt","arr","eventType","push","position","match","objPos","splice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,CCNA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,YAAA,GAAAH,GACA,iBAAAC,QALAA,QAAA,UAAAD,IAEAD,EAAA,UAAAC,IAFA,CAGAK,KAAA,WACA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AiC,SAAAzD,EAAA,IAAAwB,EAAAkC,SACA3D,GAAA,EAEAC,EAAA,EAAAwB,EAAAiC,QACAzD,EAAA,EAAAwB,EAAAkC,SAEA3D,GAAA,GAkBA,MARA,qBAAA/B,QAAA2F,MAAAC,UAAA5B,UAvOA5C,EAAAiC,KAAA,QAEAR,IACAuB,EAAA,SACAA,EAAA,WA2OA,CAKAnE,IAAA,SAAA4F,GACA,MAAA,WAAAA,EAAAlF,EAAAD,GAIAR,QAAA,WACA,OAAAO,GAIAN,WAAA,SAAA2F,GACA5E,EAAA4E,GAIA1F,aAAA,SAAA0F,GACA3E,EAAA2E,GAMAzF,iBAAA,SAAAmF,EAAAO,GACA9E,EAAA+E,KAAA,CACAR,GAAAA,EACA5B,KAAAmC,GAAA,WAIAzF,mBAAA,SAAAkF,GACA,IAAAS,EApEA,SAAAC,GACA,IAAA,IAAAZ,EAAA,EAAAC,EAAAtE,EAAA8C,OAAAuB,EAAAC,EAAAD,IACA,GAAArE,EAAAqE,GAAAE,KAAAU,EACA,OAAAZ,EAiEAa,CAAAX,IAEAS,GAAA,IAAAA,IACAhF,EAAAmF,OAAAH,EAAA,KAtZA","file":"../what-input.min.js","sourcesContent":[null,"/**\n * what-input - A global utility for tracking the current input method (mouse, keyboard or touch).\n * @version v5.1.2\n * @link https://github.com/ten1seven/what-input\n * @license MIT\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"whatInput\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"whatInput\"] = factory();\n\telse\n\t\troot[\"whatInput\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\tmodule.exports = function () {\n\t /*\n\t * bail out if there is no document or window\n\t * (i.e. in a node/non-DOM environment)\n\t *\n\t * Return a stubbed API instead\n\t */\n\t if (typeof document === 'undefined' || typeof window === 'undefined') {\n\t return {\n\t // always return \"initial\" because no interaction will ever be detected\n\t ask: function ask() {\n\t return 'initial';\n\t },\n\n\t // always return null\n\t element: function element() {\n\t return null;\n\t },\n\n\t // no-op\n\t ignoreKeys: function ignoreKeys() {},\n\n\t // no-op\n\t specificKeys: function specificKeys() {},\n\n\t // no-op\n\t registerOnChange: function registerOnChange() {},\n\n\t // no-op\n\t unRegisterOnChange: function unRegisterOnChange() {}\n\t };\n\t }\n\n\t /*\n\t * variables\n\t */\n\n\t // cache document.documentElement\n\t var docElem = document.documentElement;\n\n\t // currently focused dom element\n\t var currentElement = null;\n\n\t // last used input type\n\t var currentInput = 'initial';\n\n\t // last used input intent\n\t var currentIntent = currentInput;\n\n\t // check for sessionStorage support\n\t // then check for session variables and use if available\n\t try {\n\t if (window.sessionStorage.getItem('what-input')) {\n\t currentInput = window.sessionStorage.getItem('what-input');\n\t }\n\n\t if (window.sessionStorage.getItem('what-intent')) {\n\t currentIntent = window.sessionStorage.getItem('what-intent');\n\t }\n\t } catch (e) {}\n\n\t // event buffer timer\n\t var eventTimer = null;\n\n\t // form input types\n\t var formInputs = ['input', 'select', 'textarea'];\n\n\t // empty array for holding callback functions\n\t var functionList = [];\n\n\t // list of modifier keys commonly used with the mouse and\n\t // can be safely ignored to prevent false keyboard detection\n\t var ignoreMap = [16, // shift\n\t 17, // control\n\t 18, // alt\n\t 91, // Windows key / left Apple cmd\n\t 93 // Windows menu / right Apple cmd\n\t ];\n\n\t var specificMap = [];\n\n\t // mapping of events to input types\n\t var inputMap = {\n\t keydown: 'keyboard',\n\t keyup: 'keyboard',\n\t mousedown: 'mouse',\n\t mousemove: 'mouse',\n\t MSPointerDown: 'pointer',\n\t MSPointerMove: 'pointer',\n\t pointerdown: 'pointer',\n\t pointermove: 'pointer',\n\t touchstart: 'touch'\n\n\t // boolean: true if touch buffer is active\n\t };var isBuffering = false;\n\n\t // boolean: true if the page is being scrolled\n\t var isScrolling = false;\n\n\t // store current mouse position\n\t var mousePos = {\n\t x: null,\n\t y: null\n\n\t // map of IE 10 pointer events\n\t };var pointerMap = {\n\t 2: 'touch',\n\t 3: 'touch', // treat pen like touch\n\t 4: 'mouse'\n\n\t // check support for passive event listeners\n\t };var supportsPassive = false;\n\n\t try {\n\t var opts = Object.defineProperty({}, 'passive', {\n\t get: function get() {\n\t supportsPassive = true;\n\t }\n\t });\n\n\t window.addEventListener('test', null, opts);\n\t } catch (e) {}\n\n\t /*\n\t * set up\n\t */\n\n\t var setUp = function setUp() {\n\t // add correct mouse wheel event mapping to `inputMap`\n\t inputMap[detectWheel()] = 'mouse';\n\n\t addListeners();\n\t doUpdate('input');\n\t doUpdate('intent');\n\t };\n\n\t /*\n\t * events\n\t */\n\n\t var addListeners = function addListeners() {\n\t // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding\n\t // can only demonstrate potential, but not actual, interaction\n\t // and are treated separately\n\t var options = supportsPassive ? { passive: true } : false;\n\n\t // pointer events (mouse, pen, touch)\n\t if (window.PointerEvent) {\n\t window.addEventListener('pointerdown', setInput);\n\t window.addEventListener('pointermove', setIntent);\n\t } else if (window.MSPointerEvent) {\n\t window.addEventListener('MSPointerDown', setInput);\n\t window.addEventListener('MSPointerMove', setIntent);\n\t } else {\n\t // mouse events\n\t window.addEventListener('mousedown', setInput);\n\t window.addEventListener('mousemove', setIntent);\n\n\t // touch events\n\t if ('ontouchstart' in window) {\n\t window.addEventListener('touchstart', eventBuffer, options);\n\t window.addEventListener('touchend', setInput);\n\t }\n\t }\n\n\t // mouse wheel\n\t window.addEventListener(detectWheel(), setIntent, options);\n\n\t // keyboard events\n\t window.addEventListener('keydown', eventBuffer);\n\t window.addEventListener('keyup', eventBuffer);\n\n\t // focus events\n\t window.addEventListener('focusin', setElement);\n\t window.addEventListener('focusout', clearElement);\n\t };\n\n\t // checks conditions before updating new input\n\t var setInput = function setInput(event) {\n\t // only execute if the event buffer timer isn't running\n\t if (!isBuffering) {\n\t var eventKey = event.which;\n\t var value = inputMap[event.type];\n\n\t if (value === 'pointer') {\n\t value = pointerType(event);\n\t }\n\n\t var ignoreMatch = !specificMap.length && ignoreMap.indexOf(eventKey) === -1;\n\n\t var specificMatch = specificMap.length && specificMap.indexOf(eventKey) !== -1;\n\n\t var shouldUpdate = value === 'keyboard' && eventKey && (ignoreMatch || specificMatch) || value === 'mouse' || value === 'touch';\n\n\t if (currentInput !== value && shouldUpdate) {\n\t currentInput = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-input', currentInput);\n\t } catch (e) {}\n\n\t doUpdate('input');\n\t }\n\n\t if (currentIntent !== value && shouldUpdate) {\n\t // preserve intent for keyboard typing in form fields\n\t var activeElem = document.activeElement;\n\t var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1;\n\n\t if (notFormInput) {\n\t currentIntent = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-intent', currentIntent);\n\t } catch (e) {}\n\n\t doUpdate('intent');\n\t }\n\t }\n\t }\n\t };\n\n\t // updates the doc and `inputTypes` array with new input\n\t var doUpdate = function doUpdate(which) {\n\t docElem.setAttribute('data-what' + which, which === 'input' ? currentInput : currentIntent);\n\n\t fireFunctions(which);\n\t };\n\n\t // updates input intent for `mousemove` and `pointermove`\n\t var setIntent = function setIntent(event) {\n\t // test to see if `mousemove` happened relative to the screen to detect scrolling versus mousemove\n\t detectScrolling(event);\n\n\t // only execute if the event buffer timer isn't running\n\t // or scrolling isn't happening\n\t if (!isBuffering && !isScrolling) {\n\t var value = inputMap[event.type];\n\t if (value === 'pointer') {\n\t value = pointerType(event);\n\t }\n\n\t if (currentIntent !== value) {\n\t currentIntent = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-intent', currentIntent);\n\t } catch (e) {}\n\n\t doUpdate('intent');\n\t }\n\t }\n\t };\n\n\t var setElement = function setElement(event) {\n\t if (!event.target.nodeName) {\n\t // If nodeName is undefined, clear the element\n\t // This can happen if click inside an element.\n\t clearElement();\n\t return;\n\t }\n\n\t currentElement = event.target.nodeName.toLowerCase();\n\t docElem.setAttribute('data-whatelement', currentElement);\n\n\t if (event.target.classList && event.target.classList.length) {\n\t docElem.setAttribute('data-whatclasses', event.target.classList.toString().replace(' ', ','));\n\t }\n\t };\n\n\t var clearElement = function clearElement() {\n\t currentElement = null;\n\n\t docElem.removeAttribute('data-whatelement');\n\t docElem.removeAttribute('data-whatclasses');\n\t };\n\n\t // buffers events that frequently also fire mouse events\n\t var eventBuffer = function eventBuffer(event) {\n\t // set the current input\n\t setInput(event);\n\n\t // clear the timer if it happens to be running\n\t window.clearTimeout(eventTimer);\n\n\t // set the isBuffering to `true`\n\t isBuffering = true;\n\n\t // run the timer\n\t eventTimer = window.setTimeout(function () {\n\t // if the timer runs out, set isBuffering back to `false`\n\t isBuffering = false;\n\t }, 100);\n\t };\n\n\t /*\n\t * utilities\n\t */\n\n\t var pointerType = function pointerType(event) {\n\t if (typeof event.pointerType === 'number') {\n\t return pointerMap[event.pointerType];\n\t } else {\n\t // treat pen like touch\n\t return event.pointerType === 'pen' ? 'touch' : event.pointerType;\n\t }\n\t };\n\n\t // detect version of mouse wheel event to use\n\t // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel\n\t var detectWheel = function detectWheel() {\n\t var wheelType = void 0;\n\n\t // Modern browsers support \"wheel\"\n\t if ('onwheel' in document.createElement('div')) {\n\t wheelType = 'wheel';\n\t } else {\n\t // Webkit and IE support at least \"mousewheel\"\n\t // or assume that remaining browsers are older Firefox\n\t wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';\n\t }\n\n\t return wheelType;\n\t };\n\n\t // runs callback functions\n\t var fireFunctions = function fireFunctions(type) {\n\t for (var i = 0, len = functionList.length; i < len; i++) {\n\t if (functionList[i].type === type) {\n\t functionList[i].fn.call(undefined, type === 'input' ? currentInput : currentIntent);\n\t }\n\t }\n\t };\n\n\t // finds matching element in an object\n\t var objPos = function objPos(match) {\n\t for (var i = 0, len = functionList.length; i < len; i++) {\n\t if (functionList[i].fn === match) {\n\t return i;\n\t }\n\t }\n\t };\n\n\t var detectScrolling = function detectScrolling(event) {\n\t if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) {\n\t isScrolling = false;\n\n\t mousePos['x'] = event.screenX;\n\t mousePos['y'] = event.screenY;\n\t } else {\n\t isScrolling = true;\n\t }\n\t };\n\n\t /*\n\t * init\n\t */\n\n\t // don't start script unless browser cuts the mustard\n\t // (also passes if polyfills are used)\n\t if ('addEventListener' in window && Array.prototype.indexOf) {\n\t setUp();\n\t }\n\n\t /*\n\t * api\n\t */\n\n\t return {\n\t // returns string: the current input type\n\t // opt: 'intent'|'input'\n\t // 'input' (default): returns the same value as the `data-whatinput` attribute\n\t // 'intent': includes `data-whatintent` value if it's different than `data-whatinput`\n\t ask: function ask(opt) {\n\t return opt === 'intent' ? currentIntent : currentInput;\n\t },\n\n\t // returns string: the currently focused element or null\n\t element: function element() {\n\t return currentElement;\n\t },\n\n\t // overwrites ignored keys with provided array\n\t ignoreKeys: function ignoreKeys(arr) {\n\t ignoreMap = arr;\n\t },\n\n\t // overwrites specific char keys to update on\n\t specificKeys: function specificKeys(arr) {\n\t specificMap = arr;\n\t },\n\n\t // attach functions to input and intent \"events\"\n\t // funct: function to fire on change\n\t // eventType: 'input'|'intent'\n\t registerOnChange: function registerOnChange(fn, eventType) {\n\t functionList.push({\n\t fn: fn,\n\t type: eventType || 'input'\n\t });\n\t },\n\n\t unRegisterOnChange: function unRegisterOnChange(fn) {\n\t var position = objPos(fn);\n\n\t if (position || position === 0) {\n\t functionList.splice(position, 1);\n\t }\n\t }\n\t };\n\t}();\n\n/***/ })\n/******/ ])\n});\n;"]} \ No newline at end of file +{"version":3,"sources":["what-input.min.js","what-input.js"],"names":["root","factory","exports","module","define","amd","this","modules","installedModules","__webpack_require__","moduleId","id","loaded","call","m","c","p","document","window","ask","element","ignoreKeys","specificKeys","registerOnChange","unRegisterOnChange","docElem","documentElement","currentElement","currentInput","currentIntent","sessionStorage","getItem","e","eventTimer","formInputs","functionList","ignoreMap","specificMap","inputMap","keydown","keyup","mousedown","mousemove","MSPointerDown","MSPointerMove","pointerdown","pointermove","touchstart","isBuffering","isScrolling","mousePos","x","y","pointerMap","2","3","4","supportsPassive","opts","Object","defineProperty","get","addEventListener","addListeners","options","passive","PointerEvent","setInput","setIntent","MSPointerEvent","eventBuffer","detectWheel","setElement","clearElement","event","eventKey","which","value","type","pointerType","ignoreMatch","length","indexOf","specificMatch","shouldUpdate","setItem","doUpdate","activeElem","activeElement","nodeName","toLowerCase","setAttribute","fireFunctions","detectScrolling","target","classList","toString","replace","removeAttribute","clearTimeout","setTimeout","createElement","undefined","onmousewheel","i","len","fn","screenX","screenY","Array","prototype","opt","arr","eventType","push","position","match","objPos","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A,kBAOAX,EAAA,SAAAd,GACA,IAAA,IAAA0B,EAAA,EAAAC,EAAAtE,EAAA8C,OAAAuB,EAAAC,EAAAD,IACArE,EAAAqE,GAAA1B,OAAAA,GACA3C,EAAAqE,GAAAE,GAAA7F,UAAAyF,EAAA,UAAAxB,EAAAlD,EAAAC,IAcAgE,EAAA,SAAAnB,GACAxB,EAAA,IAAAwB,EAAAiC,SAAAzD,EAAA,IAAAwB,EAAAkC,SACA3D,GAAA,EAEAC,EAAA,EAAAwB,EAAAiC,QACAzD,EAAA,EAAAwB,EAAAkC,SAEA3D,GAAA,GAkBA,MARA,qBAAA/B,QAAA2F,MAAAC,UAAA5B,UAvOA5C,EAAAiC,KAAA,QAEAR,IACAuB,EAAA,SACAA,EAAA,WA2OA,CAKAnE,IAAA,SAAA4F,GACA,MAAA,WAAAA,EAAAlF,EAAAD,GAIAR,QAAA,WACA,OAAAO,GAIAN,WAAA,SAAA2F,GACA5E,EAAA4E,GAIA1F,aAAA,SAAA0F,GACA3E,EAAA2E,GAMAzF,iBAAA,SAAAmF,EAAAO,GACA9E,EAAA+E,KAAA,CACAR,GAAAA,EACA5B,KAAAmC,GAAA,WAIAzF,mBAAA,SAAAkF,GACA,IAAAS,EApEA,SAAAC,GACA,IAAA,IAAAZ,EAAA,EAAAC,EAAAtE,EAAA8C,OAAAuB,EAAAC,EAAAD,IACA,GAAArE,EAAAqE,GAAAE,KAAAU,EACA,OAAAZ,EAiEAa,CAAAX,IAEAS,GAAA,IAAAA,IACAhF,EAAAmF,OAAAH,EAAA,KAtZA","file":"../what-input.min.js","sourcesContent":[null,"/**\n * what-input - A global utility for tracking the current input method (mouse, keyboard or touch).\n * @version v5.1.3\n * @link https://github.com/ten1seven/what-input\n * @license MIT\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"whatInput\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"whatInput\"] = factory();\n\telse\n\t\troot[\"whatInput\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\n\tmodule.exports = function () {\n\t /*\n\t * bail out if there is no document or window\n\t * (i.e. in a node/non-DOM environment)\n\t *\n\t * Return a stubbed API instead\n\t */\n\t if (typeof document === 'undefined' || typeof window === 'undefined') {\n\t return {\n\t // always return \"initial\" because no interaction will ever be detected\n\t ask: function ask() {\n\t return 'initial';\n\t },\n\n\t // always return null\n\t element: function element() {\n\t return null;\n\t },\n\n\t // no-op\n\t ignoreKeys: function ignoreKeys() {},\n\n\t // no-op\n\t specificKeys: function specificKeys() {},\n\n\t // no-op\n\t registerOnChange: function registerOnChange() {},\n\n\t // no-op\n\t unRegisterOnChange: function unRegisterOnChange() {}\n\t };\n\t }\n\n\t /*\n\t * variables\n\t */\n\n\t // cache document.documentElement\n\t var docElem = document.documentElement;\n\n\t // currently focused dom element\n\t var currentElement = null;\n\n\t // last used input type\n\t var currentInput = 'initial';\n\n\t // last used input intent\n\t var currentIntent = currentInput;\n\n\t // check for sessionStorage support\n\t // then check for session variables and use if available\n\t try {\n\t if (window.sessionStorage.getItem('what-input')) {\n\t currentInput = window.sessionStorage.getItem('what-input');\n\t }\n\n\t if (window.sessionStorage.getItem('what-intent')) {\n\t currentIntent = window.sessionStorage.getItem('what-intent');\n\t }\n\t } catch (e) {}\n\n\t // event buffer timer\n\t var eventTimer = null;\n\n\t // form input types\n\t var formInputs = ['input', 'select', 'textarea'];\n\n\t // empty array for holding callback functions\n\t var functionList = [];\n\n\t // list of modifier keys commonly used with the mouse and\n\t // can be safely ignored to prevent false keyboard detection\n\t var ignoreMap = [16, // shift\n\t 17, // control\n\t 18, // alt\n\t 91, // Windows key / left Apple cmd\n\t 93 // Windows menu / right Apple cmd\n\t ];\n\n\t var specificMap = [];\n\n\t // mapping of events to input types\n\t var inputMap = {\n\t keydown: 'keyboard',\n\t keyup: 'keyboard',\n\t mousedown: 'mouse',\n\t mousemove: 'mouse',\n\t MSPointerDown: 'pointer',\n\t MSPointerMove: 'pointer',\n\t pointerdown: 'pointer',\n\t pointermove: 'pointer',\n\t touchstart: 'touch'\n\n\t // boolean: true if touch buffer is active\n\t };var isBuffering = false;\n\n\t // boolean: true if the page is being scrolled\n\t var isScrolling = false;\n\n\t // store current mouse position\n\t var mousePos = {\n\t x: null,\n\t y: null\n\n\t // map of IE 10 pointer events\n\t };var pointerMap = {\n\t 2: 'touch',\n\t 3: 'touch', // treat pen like touch\n\t 4: 'mouse'\n\n\t // check support for passive event listeners\n\t };var supportsPassive = false;\n\n\t try {\n\t var opts = Object.defineProperty({}, 'passive', {\n\t get: function get() {\n\t supportsPassive = true;\n\t }\n\t });\n\n\t window.addEventListener('test', null, opts);\n\t } catch (e) {}\n\n\t /*\n\t * set up\n\t */\n\n\t var setUp = function setUp() {\n\t // add correct mouse wheel event mapping to `inputMap`\n\t inputMap[detectWheel()] = 'mouse';\n\n\t addListeners();\n\t doUpdate('input');\n\t doUpdate('intent');\n\t };\n\n\t /*\n\t * events\n\t */\n\n\t var addListeners = function addListeners() {\n\t // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding\n\t // can only demonstrate potential, but not actual, interaction\n\t // and are treated separately\n\t var options = supportsPassive ? { passive: true } : false;\n\n\t // pointer events (mouse, pen, touch)\n\t if (window.PointerEvent) {\n\t window.addEventListener('pointerdown', setInput);\n\t window.addEventListener('pointermove', setIntent);\n\t } else if (window.MSPointerEvent) {\n\t window.addEventListener('MSPointerDown', setInput);\n\t window.addEventListener('MSPointerMove', setIntent);\n\t } else {\n\t // mouse events\n\t window.addEventListener('mousedown', setInput);\n\t window.addEventListener('mousemove', setIntent);\n\n\t // touch events\n\t if ('ontouchstart' in window) {\n\t window.addEventListener('touchstart', eventBuffer, options);\n\t window.addEventListener('touchend', setInput);\n\t }\n\t }\n\n\t // mouse wheel\n\t window.addEventListener(detectWheel(), setIntent, options);\n\n\t // keyboard events\n\t window.addEventListener('keydown', eventBuffer);\n\t window.addEventListener('keyup', eventBuffer);\n\n\t // focus events\n\t window.addEventListener('focusin', setElement);\n\t window.addEventListener('focusout', clearElement);\n\t };\n\n\t // checks conditions before updating new input\n\t var setInput = function setInput(event) {\n\t // only execute if the event buffer timer isn't running\n\t if (!isBuffering) {\n\t var eventKey = event.which;\n\t var value = inputMap[event.type];\n\n\t if (value === 'pointer') {\n\t value = pointerType(event);\n\t }\n\n\t var ignoreMatch = !specificMap.length && ignoreMap.indexOf(eventKey) === -1;\n\n\t var specificMatch = specificMap.length && specificMap.indexOf(eventKey) !== -1;\n\n\t var shouldUpdate = value === 'keyboard' && eventKey && (ignoreMatch || specificMatch) || value === 'mouse' || value === 'touch';\n\n\t if (currentInput !== value && shouldUpdate) {\n\t currentInput = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-input', currentInput);\n\t } catch (e) {}\n\n\t doUpdate('input');\n\t }\n\n\t if (currentIntent !== value && shouldUpdate) {\n\t // preserve intent for keyboard typing in form fields\n\t var activeElem = document.activeElement;\n\t var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1;\n\n\t if (notFormInput) {\n\t currentIntent = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-intent', currentIntent);\n\t } catch (e) {}\n\n\t doUpdate('intent');\n\t }\n\t }\n\t }\n\t };\n\n\t // updates the doc and `inputTypes` array with new input\n\t var doUpdate = function doUpdate(which) {\n\t docElem.setAttribute('data-what' + which, which === 'input' ? currentInput : currentIntent);\n\n\t fireFunctions(which);\n\t };\n\n\t // updates input intent for `mousemove` and `pointermove`\n\t var setIntent = function setIntent(event) {\n\t // test to see if `mousemove` happened relative to the screen to detect scrolling versus mousemove\n\t detectScrolling(event);\n\n\t // only execute if the event buffer timer isn't running\n\t // or scrolling isn't happening\n\t if (!isBuffering && !isScrolling) {\n\t var value = inputMap[event.type];\n\t if (value === 'pointer') {\n\t value = pointerType(event);\n\t }\n\n\t if (currentIntent !== value) {\n\t currentIntent = value;\n\n\t try {\n\t window.sessionStorage.setItem('what-intent', currentIntent);\n\t } catch (e) {}\n\n\t doUpdate('intent');\n\t }\n\t }\n\t };\n\n\t var setElement = function setElement(event) {\n\t if (!event.target.nodeName) {\n\t // If nodeName is undefined, clear the element\n\t // This can happen if click inside an element.\n\t clearElement();\n\t return;\n\t }\n\n\t currentElement = event.target.nodeName.toLowerCase();\n\t docElem.setAttribute('data-whatelement', currentElement);\n\n\t if (event.target.classList && event.target.classList.length) {\n\t docElem.setAttribute('data-whatclasses', event.target.classList.toString().replace(' ', ','));\n\t }\n\t };\n\n\t var clearElement = function clearElement() {\n\t currentElement = null;\n\n\t docElem.removeAttribute('data-whatelement');\n\t docElem.removeAttribute('data-whatclasses');\n\t };\n\n\t // buffers events that frequently also fire mouse events\n\t var eventBuffer = function eventBuffer(event) {\n\t // set the current input\n\t setInput(event);\n\n\t // clear the timer if it happens to be running\n\t window.clearTimeout(eventTimer);\n\n\t // set the isBuffering to `true`\n\t isBuffering = true;\n\n\t // run the timer\n\t eventTimer = window.setTimeout(function () {\n\t // if the timer runs out, set isBuffering back to `false`\n\t isBuffering = false;\n\t }, 100);\n\t };\n\n\t /*\n\t * utilities\n\t */\n\n\t var pointerType = function pointerType(event) {\n\t if (typeof event.pointerType === 'number') {\n\t return pointerMap[event.pointerType];\n\t } else {\n\t // treat pen like touch\n\t return event.pointerType === 'pen' ? 'touch' : event.pointerType;\n\t }\n\t };\n\n\t // detect version of mouse wheel event to use\n\t // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel\n\t var detectWheel = function detectWheel() {\n\t var wheelType = void 0;\n\n\t // Modern browsers support \"wheel\"\n\t if ('onwheel' in document.createElement('div')) {\n\t wheelType = 'wheel';\n\t } else {\n\t // Webkit and IE support at least \"mousewheel\"\n\t // or assume that remaining browsers are older Firefox\n\t wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';\n\t }\n\n\t return wheelType;\n\t };\n\n\t // runs callback functions\n\t var fireFunctions = function fireFunctions(type) {\n\t for (var i = 0, len = functionList.length; i < len; i++) {\n\t if (functionList[i].type === type) {\n\t functionList[i].fn.call(undefined, type === 'input' ? currentInput : currentIntent);\n\t }\n\t }\n\t };\n\n\t // finds matching element in an object\n\t var objPos = function objPos(match) {\n\t for (var i = 0, len = functionList.length; i < len; i++) {\n\t if (functionList[i].fn === match) {\n\t return i;\n\t }\n\t }\n\t };\n\n\t var detectScrolling = function detectScrolling(event) {\n\t if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) {\n\t isScrolling = false;\n\n\t mousePos['x'] = event.screenX;\n\t mousePos['y'] = event.screenY;\n\t } else {\n\t isScrolling = true;\n\t }\n\t };\n\n\t /*\n\t * init\n\t */\n\n\t // don't start script unless browser cuts the mustard\n\t // (also passes if polyfills are used)\n\t if ('addEventListener' in window && Array.prototype.indexOf) {\n\t setUp();\n\t }\n\n\t /*\n\t * api\n\t */\n\n\t return {\n\t // returns string: the current input type\n\t // opt: 'intent'|'input'\n\t // 'input' (default): returns the same value as the `data-whatinput` attribute\n\t // 'intent': includes `data-whatintent` value if it's different than `data-whatinput`\n\t ask: function ask(opt) {\n\t return opt === 'intent' ? currentIntent : currentInput;\n\t },\n\n\t // returns string: the currently focused element or null\n\t element: function element() {\n\t return currentElement;\n\t },\n\n\t // overwrites ignored keys with provided array\n\t ignoreKeys: function ignoreKeys(arr) {\n\t ignoreMap = arr;\n\t },\n\n\t // overwrites specific char keys to update on\n\t specificKeys: function specificKeys(arr) {\n\t specificMap = arr;\n\t },\n\n\t // attach functions to input and intent \"events\"\n\t // funct: function to fire on change\n\t // eventType: 'input'|'intent'\n\t registerOnChange: function registerOnChange(fn, eventType) {\n\t functionList.push({\n\t fn: fn,\n\t type: eventType || 'input'\n\t });\n\t },\n\n\t unRegisterOnChange: function unRegisterOnChange(fn) {\n\t var position = objPos(fn);\n\n\t if (position || position === 0) {\n\t functionList.splice(position, 1);\n\t }\n\t }\n\t };\n\t}();\n\n/***/ })\n/******/ ])\n});\n;"]} \ No newline at end of file diff --git a/dist/what-input.js b/dist/what-input.js index e4ea0f2..d4cf764 100644 --- a/dist/what-input.js +++ b/dist/what-input.js @@ -1,6 +1,6 @@ /** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). - * @version v5.1.2 + * @version v5.1.3 * @link https://github.com/ten1seven/what-input * @license MIT */ diff --git a/dist/what-input.min.js b/dist/what-input.min.js index 1211cc9..87615aa 100644 --- a/dist/what-input.min.js +++ b/dist/what-input.min.js @@ -1,6 +1,6 @@ /** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). - * @version v5.1.2 + * @version v5.1.3 * @link https://github.com/ten1seven/what-input * @license MIT */ diff --git a/package.json b/package.json index 8e8c172..c45518b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "what-input", - "version": "5.1.2", + "version": "5.1.3", "description": "A global utility for tracking the current input method (mouse, keyboard or touch).", "main": "dist/what-input.js", "repository": {