| @ -0,0 +1,38 @@ | |||||
| /* Foundation v2.1.4 http://foundation.zurb.com */ | |||||
| /* Artfully masterminded by ZURB */ | |||||
| /* -------------------------------------------------- | |||||
| Table of Contents | |||||
| ----------------------------------------------------- | |||||
| :: Shared Styles | |||||
| :: Page Name 1 | |||||
| :: Page Name 2 | |||||
| */ | |||||
| /* ----------------------------------------- | |||||
| Shared Styles | |||||
| ----------------------------------------- */ | |||||
| table th { font-weight: bold; } | |||||
| table td, table th { padding: 9px 10px; text-align: left; } | |||||
| /* Mobile */ | |||||
| @media only screen and (max-width: 767px) { | |||||
| table.responsive { margin-bottom: 0; } | |||||
| .pinned { position: absolute; left: 0; top: 0; background: #fff; width: 35%; overflow: hidden; overflow-x: scroll; border-right: 1px solid #ccc; border-left: 1px solid #ccc; } | |||||
| .pinned table { border-right: none; border-left: none; width: 100%; } | |||||
| .pinned table th, .pinned table td { white-space: nowrap; } | |||||
| .pinned td:last-child { border-bottom: 0; } | |||||
| div.table-wrapper { position: relative; margin-bottom: 20px; overflow: hidden; border-right: 1px solid #ccc; } | |||||
| div.table-wrapper div.scrollable { margin-left: 35%; } | |||||
| div.table-wrapper div.scrollable { overflow: scroll; overflow-y: hidden; } | |||||
| table.responsive td, table.responsive th { position: relative; white-space: nowrap; overflow: hidden; } | |||||
| table.responsive th:first-child, table.responsive td:first-child, table.responsive td:first-child, table.responsive.pinned td { display: none; } | |||||
| } | |||||
| @ -0,0 +1,83 @@ | |||||
| <!doctype html> | |||||
| <html lang="en" dir="ltr"> | |||||
| <head> | |||||
| <meta charset="utf-8"> | |||||
| <meta http-equiv="x-ua-compatible" content="ie=edge"> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |||||
| <title>$GatewayName</title> | |||||
| <link rel="stylesheet" href="css/foundation.css"> | |||||
| <link rel="stylesheet" href="css/app.css"> | |||||
| </head> | |||||
| <body> | |||||
| <div class="row"> | |||||
| <div class="large-12 columns"> | |||||
| <h2><img src="http://www.dailydeurne.nl/files/22294/skins/current/images/logo.png?version=20160414090629" width="90px"> Daily Deurne publieke WIFI</h2> | |||||
| </div> | |||||
| </div> | |||||
| <div class="row"> | |||||
| <div class="large-4 medium-6 columns"> | |||||
| <p>Daily Deurne verwerkt persoonsgegevens voor geen enkel ander doel dan het tot standbrengen van de verbinding. Deze gegevens worden weer verwijderd zodra de sessie geëndigd is. </p> | |||||
| <br> | |||||
| <form method="POST" action="$action"> | |||||
| <input type="hidden" name="mode_login"> | |||||
| <input type="hidden" name="redirect" value="$redirect"> | |||||
| <input type="hidden" name="accept_terms" value="yes"> | |||||
| <button class="button rounded" type="submit" value="Submit">Maak verbinding met internet en accepteer voorwaarden</button> | |||||
| </form></div> | |||||
| <div class="large-4 medium-6 columns"> | |||||
| <table> | |||||
| <caption>Vertrektijden eerstvolgende treinen</caption> | |||||
| <thead> | |||||
| <th width="75px">Spoor</th> | |||||
| <th width="250px">Eindbestemming</th> | |||||
| <th>vertrektijd</th> | |||||
| </thead> | |||||
| <tbody id="vertrek_trein"> | |||||
| </tbody> | |||||
| </table> | |||||
| </div> | |||||
| <div class="large-4 medium-6 columns"> | |||||
| <table> | |||||
| <caption>Vertrektijden eerstvolgende bussen</caption> | |||||
| <thead> | |||||
| <th width="75px">Lijn</th> | |||||
| <th width="250px">Richting</th> | |||||
| <th>vertrektijd</th> | |||||
| </thead> | |||||
| <tbody id="vertrek_bus"> | |||||
| </tbody> | |||||
| </table> | |||||
| </div> | |||||
| </div> | |||||
| <hr> | |||||
| <div class="row"> | |||||
| <div class="large-6 medium-6 columns"> | |||||
| <h5>Gebruiksvoorwaarden Publieke WIFI</h5> | |||||
| <ol> | |||||
| <li>De bandbreedte die per sessie ter beschikking wordt gesteld is beperkt. Dit betekent dat u aanvaardt dat er vertraging bij het gebruik van bepaalde internettoepassingen kan optreden.</li> | |||||
| <li>U zult: | |||||
| <ul> | |||||
| <li>niets doen dat leidt tot overlast of hinder voor Daily Deurne, voor andere gebruikers van het netwerk en/of het internet;</li> | |||||
| <li>niet handelen in strijd met wettelijke bepalingen en in ieder geval het netwerk niet gebruiken voor het versturen van ongevraagde berichten;</li> | |||||
| <li>geen inbreuk maken op de beveiliging van het netwerk;</li> | |||||
| <li>geen toegang (proberen te) verkrijgen tot de randapparatuur van anderen.</li> | |||||
| </ul> | |||||
| </li> | |||||
| <li>Het dataverkeer tussen de door u gebruikte apparatuur en het toegangspunt geschiedt onversleuteld. Zodoende bestaat de mogelijkheid dat onbevoegden kennis kunnen nemen van uw dataverkeer. U bent zelf verantwoordelijk voor beveiliging tegen onbevoegde kennisname.</li> | |||||
| <li>U bent zelf verantwoordelijk voor persoonsgegevens die u middels het netwerk verwerkt.</li> | |||||
| </ol> | |||||
| </div> | |||||
| <hr class="show-for-small-only"> | |||||
| <div class="large-6 medium-6 columns"> | |||||
| <h5>Privacy Statement</h5> | |||||
| <p>Uw laptop of mobiele apparaat maakt zich kenbaar op ons WiFi netwerk middels een uniek nummer, het MAC-adres. Wij verwerken dit persoonsgegeven alleen om de toegang tot het internet mogelijk te maken. Hiertoe verstrekken wij uw laptop of mobiele apparaat een dynamisch IP-adres. Wij verwerken deze informatie niet voor andere doeleinden. Deze gegevens worden weer verwijderd zodra de sessie geëindigd is of als u het pand verlaat</p> | |||||
| </div> | |||||
| </div> | |||||
| <script src="js/vendor/jquery.js"></script> | |||||
| <script src="js/vendor/foundation.js"></script> | |||||
| <script src="js/app.js"></script> | |||||
| </body> | |||||
| </html> | |||||
| @ -0,0 +1,51 @@ | |||||
| // Trein Tijden opvragen en weergeven | |||||
| $.ajax({ | |||||
| url: 'https://api.vertrektijd.info/ns/_departures?station=dn', | |||||
| type: 'get', | |||||
| headers: { | |||||
| "Accept-Version": '1.3.0', | |||||
| "X-Vertrektijd-Client-Api-Key": 'cymk3fzZHYTiAl974wPMgqrGvDuU0p' | |||||
| }, | |||||
| dataType: 'json', | |||||
| success: function(data) { | |||||
| $('#vertrek_trein').empty(); | |||||
| $.each(data, function(i,tijd){ | |||||
| content = '<tr>'; | |||||
| content += '<td>' + Object.values(tijd.VertrekSpoor)[0] + '</td>'; | |||||
| content += '<td>' + tijd.EindBestemming + '</td>'; | |||||
| var str = tijd.VertrekTijd; | |||||
| var res = str.slice(11, 16); | |||||
| content += '<td>' + res + '</td>'; | |||||
| content += '</tr>'; | |||||
| $(content).appendTo("#vertrek_trein"); | |||||
| return i<2; | |||||
| }); | |||||
| } | |||||
| }); | |||||
| // Bus Tijden opvragen en weergeven | |||||
| $.ajax({ | |||||
| url: 'https://api.vertrektijd.info/departures/_stopcode/65520012,65520210,65520011/', | |||||
| type: 'get', | |||||
| headers: { | |||||
| "Accept-Version": '1.3.0', | |||||
| "X-Vertrektijd-Client-Api-Key": 'cymk3fzZHYTiAl974wPMgqrGvDuU0p' | |||||
| }, | |||||
| dataType: 'json', | |||||
| success: function(data2) { | |||||
| $('#vertrek_bus').empty(); | |||||
| $.each(data2.BTMF, function(b,tijd2){ | |||||
| $.each(tijd2.Departures, function(i, data3){ | |||||
| if(i<1){ | |||||
| content = '<tr>'; | |||||
| content += '<td>' + data3.LineNumber + '</td>'; | |||||
| content += '<td>' + data3.Destination + '</td>'; | |||||
| var str = data3.PlannedDeparture; | |||||
| var res = str.slice(11, 16); | |||||
| content += '<td>' + res + '</td>'; | |||||
| content += '</tr>'; | |||||
| $(content).appendTo("#vertrek_bus"); | |||||
| } | |||||
| }); | |||||
| }); | |||||
| } | |||||
| }); | |||||
| @ -0,0 +1,67 @@ | |||||
| $(document).ready(function() { | |||||
| var switched = false; | |||||
| var updateTables = function() { | |||||
| if (($(window).width() < 767) && !switched ){ | |||||
| switched = true; | |||||
| $("table.responsive").each(function(i, element) { | |||||
| splitTable($(element)); | |||||
| }); | |||||
| return true; | |||||
| } | |||||
| else if (switched && ($(window).width() > 767)) { | |||||
| switched = false; | |||||
| $("table.responsive").each(function(i, element) { | |||||
| unsplitTable($(element)); | |||||
| }); | |||||
| } | |||||
| }; | |||||
| $(window).load(updateTables); | |||||
| $(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for | |||||
| $(window).on("resize", updateTables); | |||||
| function splitTable(original) | |||||
| { | |||||
| original.wrap("<div class='table-wrapper' />"); | |||||
| var copy = original.clone(); | |||||
| copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none"); | |||||
| copy.removeClass("responsive"); | |||||
| original.closest(".table-wrapper").append(copy); | |||||
| copy.wrap("<div class='pinned' />"); | |||||
| original.wrap("<div class='scrollable' />"); | |||||
| setCellHeights(original, copy); | |||||
| } | |||||
| function unsplitTable(original) { | |||||
| original.closest(".table-wrapper").find(".pinned").remove(); | |||||
| original.unwrap(); | |||||
| original.unwrap(); | |||||
| } | |||||
| function setCellHeights(original, copy) { | |||||
| var tr = original.find('tr'), | |||||
| tr_copy = copy.find('tr'), | |||||
| heights = []; | |||||
| tr.each(function (index) { | |||||
| var self = $(this), | |||||
| tx = self.find('th, td'); | |||||
| tx.each(function () { | |||||
| var height = $(this).outerHeight(true); | |||||
| heights[index] = heights[index] || 0; | |||||
| if (height > heights[index]) heights[index] = height; | |||||
| }); | |||||
| }); | |||||
| tr_copy.each(function (index) { | |||||
| $(this).height(heights[index]); | |||||
| }); | |||||
| } | |||||
| }); | |||||
| @ -0,0 +1,146 @@ | |||||
| Skip to content | |||||
| This repository | |||||
| Search | |||||
| Pull requests | |||||
| Issues | |||||
| Gist | |||||
| @inpothet | |||||
| Sign out | |||||
| Watch 37 | |||||
| Star 237 | |||||
| Fork 171 zurb/bower-foundation | |||||
| Code Pull requests 0 Projects 0 Pulse Graphs | |||||
| Branch: master Find file Copy pathbower-foundation/js/foundation/foundation.accordion.js | |||||
| 51a281e on Oct 14, 2015 | |||||
| @hellapixels hellapixels Foundation build to bower-foundation | |||||
| 2 contributors @mhayes @hellapixels | |||||
| RawBlameHistory | |||||
| 127 lines (105 sloc) 4.58 KB | |||||
| ;(function ($, window, document, undefined) { | |||||
| 'use strict'; | |||||
| Foundation.libs.accordion = { | |||||
| name : 'accordion', | |||||
| version : '5.5.3', | |||||
| settings : { | |||||
| content_class : 'content', | |||||
| active_class : 'active', | |||||
| multi_expand : false, | |||||
| toggleable : true, | |||||
| callback : function () {} | |||||
| }, | |||||
| init : function (scope, method, options) { | |||||
| this.bindings(method, options); | |||||
| }, | |||||
| events : function (instance) { | |||||
| var self = this; | |||||
| var S = this.S; | |||||
| self.create(this.S(instance)); | |||||
| S(this.scope) | |||||
| .off('.fndtn.accordion') | |||||
| .on('click.fndtn.accordion', '[' + this.attr_name() + '] > dd > a, [' + this.attr_name() + '] > li > a', function (e) { | |||||
| var accordion = S(this).closest('[' + self.attr_name() + ']'), | |||||
| groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()), | |||||
| settings = accordion.data(self.attr_name(true) + '-init') || self.settings, | |||||
| contentAttr = S(this).context.attributes['data-content'], | |||||
| target = S('#' + (contentAttr ? contentAttr.value : this.href.split('#')[1])), | |||||
| aunts = $('> dd, > li', accordion), | |||||
| siblings = aunts.children('.' + settings.content_class), | |||||
| active_content = siblings.filter('.' + settings.active_class); | |||||
| e.preventDefault(); | |||||
| if (accordion.attr(self.attr_name())) { | |||||
| siblings = siblings.add('[' + groupSelector + '] dd > ' + '.' + settings.content_class + ', [' + groupSelector + '] li > ' + '.' + settings.content_class); | |||||
| aunts = aunts.add('[' + groupSelector + '] dd, [' + groupSelector + '] li'); | |||||
| } | |||||
| if (settings.toggleable && target.is(active_content)) { | |||||
| target.parent('dd, li').toggleClass(settings.active_class, false); | |||||
| target.toggleClass(settings.active_class, false); | |||||
| S(this).attr('aria-expanded', function(i, attr){ | |||||
| return attr === 'true' ? 'false' : 'true'; | |||||
| }); | |||||
| settings.callback(target); | |||||
| target.triggerHandler('toggled', [accordion]); | |||||
| accordion.triggerHandler('toggled', [target]); | |||||
| return; | |||||
| } | |||||
| if (!settings.multi_expand) { | |||||
| siblings.removeClass(settings.active_class); | |||||
| aunts.removeClass(settings.active_class); | |||||
| aunts.children('a').attr('aria-expanded','false'); | |||||
| } | |||||
| target.addClass(settings.active_class).parent().addClass(settings.active_class); | |||||
| settings.callback(target); | |||||
| target.triggerHandler('toggled', [accordion]); | |||||
| accordion.triggerHandler('toggled', [target]); | |||||
| S(this).attr('aria-expanded','true'); | |||||
| }); | |||||
| }, | |||||
| create: function($instance) { | |||||
| var self = this, | |||||
| accordion = $instance, | |||||
| aunts = $('> .accordion-navigation', accordion), | |||||
| settings = accordion.data(self.attr_name(true) + '-init') || self.settings; | |||||
| aunts.children('a').attr('aria-expanded','false'); | |||||
| aunts.has('.' + settings.content_class + '.' + settings.active_class).addClass(settings.active_class).children('a').attr('aria-expanded','true'); | |||||
| if (settings.multi_expand) { | |||||
| $instance.attr('aria-multiselectable','true'); | |||||
| } | |||||
| }, | |||||
| toggle : function(options) { | |||||
| var options = typeof options !== 'undefined' ? options : {}; | |||||
| var selector = typeof options.selector !== 'undefined' ? options.selector : ''; | |||||
| var toggle_state = typeof options.toggle_state !== 'undefined' ? options.toggle_state : ''; | |||||
| var $accordion = typeof options.$accordion !== 'undefined' ? options.$accordion : this.S(this.scope).closest('[' + this.attr_name() + ']'); | |||||
| var $items = $accordion.find('> dd' + selector + ', > li' + selector); | |||||
| if ( $items.length < 1 ) { | |||||
| if ( window.console ) { | |||||
| console.error('Selection not found.', selector); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| var S = this.S; | |||||
| var active_class = this.settings.active_class; | |||||
| $items.each(function() { | |||||
| var $item = S(this); | |||||
| var is_active = $item.hasClass(active_class); | |||||
| if ( ( is_active && toggle_state === 'close' ) || ( !is_active && toggle_state === 'open' ) || toggle_state === '' ) { | |||||
| $item.find('> a').trigger('click.fndtn.accordion'); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| open : function(options) { | |||||
| var options = typeof options !== 'undefined' ? options : {}; | |||||
| options.toggle_state = 'open'; | |||||
| this.toggle(options); | |||||
| }, | |||||
| close : function(options) { | |||||
| var options = typeof options !== 'undefined' ? options : {}; | |||||
| options.toggle_state = 'close'; | |||||
| this.toggle(options); | |||||
| }, | |||||
| off : function () {}, | |||||
| reflow : function () {} | |||||
| }; | |||||
| }(jQuery, window, window.document)); | |||||
| Contact GitHub API Training Shop Blog About | |||||
| © 2017 GitHub, Inc. Terms Privacy Security Status Help | |||||
| @ -0,0 +1,335 @@ | |||||
| /** | |||||
| * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). | |||||
| * @version v4.0.4 | |||||
| * @link https://github.com/ten1seven/what-input | |||||
| * @license MIT | |||||
| */ | |||||
| (function webpackUniversalModuleDefinition(root, factory) { | |||||
| if(typeof exports === 'object' && typeof module === 'object') | |||||
| module.exports = factory(); | |||||
| else if(typeof define === 'function' && define.amd) | |||||
| define("whatInput", [], factory); | |||||
| else if(typeof exports === 'object') | |||||
| exports["whatInput"] = factory(); | |||||
| else | |||||
| root["whatInput"] = factory(); | |||||
| })(this, function() { | |||||
| return /******/ (function(modules) { // webpackBootstrap | |||||
| /******/ // The module cache | |||||
| /******/ var installedModules = {}; | |||||
| /******/ // The require function | |||||
| /******/ function __webpack_require__(moduleId) { | |||||
| /******/ // Check if module is in cache | |||||
| /******/ if(installedModules[moduleId]) | |||||
| /******/ return installedModules[moduleId].exports; | |||||
| /******/ // Create a new module (and put it into the cache) | |||||
| /******/ var module = installedModules[moduleId] = { | |||||
| /******/ exports: {}, | |||||
| /******/ id: moduleId, | |||||
| /******/ loaded: false | |||||
| /******/ }; | |||||
| /******/ // Execute the module function | |||||
| /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |||||
| /******/ // Flag the module as loaded | |||||
| /******/ module.loaded = true; | |||||
| /******/ // Return the exports of the module | |||||
| /******/ return module.exports; | |||||
| /******/ } | |||||
| /******/ // expose the modules object (__webpack_modules__) | |||||
| /******/ __webpack_require__.m = modules; | |||||
| /******/ // expose the module cache | |||||
| /******/ __webpack_require__.c = installedModules; | |||||
| /******/ // __webpack_public_path__ | |||||
| /******/ __webpack_require__.p = ""; | |||||
| /******/ // Load entry module and return exports | |||||
| /******/ return __webpack_require__(0); | |||||
| /******/ }) | |||||
| /************************************************************************/ | |||||
| /******/ ([ | |||||
| /* 0 */ | |||||
| /***/ function(module, exports) { | |||||
| module.exports = (function() { | |||||
| /* | |||||
| --------------- | |||||
| Variables | |||||
| --------------- | |||||
| */ | |||||
| // cache document.documentElement | |||||
| var docElem = document.documentElement; | |||||
| // last used input type | |||||
| var currentInput = 'initial'; | |||||
| // last used input intent | |||||
| var currentIntent = null; | |||||
| // form input types | |||||
| var formInputs = [ | |||||
| 'input', | |||||
| 'select', | |||||
| 'textarea' | |||||
| ]; | |||||
| // list of modifier keys commonly used with the mouse and | |||||
| // can be safely ignored to prevent false keyboard detection | |||||
| var ignoreMap = [ | |||||
| 16, // shift | |||||
| 17, // control | |||||
| 18, // alt | |||||
| 91, // Windows key / left Apple cmd | |||||
| 93 // Windows menu / right Apple cmd | |||||
| ]; | |||||
| // mapping of events to input types | |||||
| var inputMap = { | |||||
| 'keyup': 'keyboard', | |||||
| 'mousedown': 'mouse', | |||||
| 'mousemove': 'mouse', | |||||
| 'MSPointerDown': 'pointer', | |||||
| 'MSPointerMove': 'pointer', | |||||
| 'pointerdown': 'pointer', | |||||
| 'pointermove': 'pointer', | |||||
| 'touchstart': 'touch' | |||||
| }; | |||||
| // array of all used input types | |||||
| var inputTypes = []; | |||||
| // boolean: true if touch buffer timer is running | |||||
| var isBuffering = false; | |||||
| // map of IE 10 pointer events | |||||
| var pointerMap = { | |||||
| 2: 'touch', | |||||
| 3: 'touch', // treat pen like touch | |||||
| 4: 'mouse' | |||||
| }; | |||||
| // touch buffer timer | |||||
| var touchTimer = null; | |||||
| /* | |||||
| --------------- | |||||
| Set up | |||||
| --------------- | |||||
| */ | |||||
| var setUp = function() { | |||||
| // add correct mouse wheel event mapping to `inputMap` | |||||
| inputMap[detectWheel()] = 'mouse'; | |||||
| addListeners(); | |||||
| setInput(); | |||||
| }; | |||||
| /* | |||||
| --------------- | |||||
| Events | |||||
| --------------- | |||||
| */ | |||||
| var addListeners = function() { | |||||
| // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding | |||||
| // can only demonstrate potential, but not actual, interaction | |||||
| // and are treated separately | |||||
| // pointer events (mouse, pen, touch) | |||||
| if (window.PointerEvent) { | |||||
| docElem.addEventListener('pointerdown', updateInput); | |||||
| docElem.addEventListener('pointermove', setIntent); | |||||
| } else if (window.MSPointerEvent) { | |||||
| docElem.addEventListener('MSPointerDown', updateInput); | |||||
| docElem.addEventListener('MSPointerMove', setIntent); | |||||
| } else { | |||||
| // mouse events | |||||
| docElem.addEventListener('mousedown', updateInput); | |||||
| docElem.addEventListener('mousemove', setIntent); | |||||
| // touch events | |||||
| if ('ontouchstart' in window) { | |||||
| docElem.addEventListener('touchstart', touchBuffer); | |||||
| } | |||||
| } | |||||
| // mouse wheel | |||||
| docElem.addEventListener(detectWheel(), setIntent); | |||||
| // keyboard events | |||||
| docElem.addEventListener('keydown', updateInput); | |||||
| docElem.addEventListener('keyup', updateInput); | |||||
| }; | |||||
| // checks conditions before updating new input | |||||
| var updateInput = function(event) { | |||||
| // only execute if the touch buffer timer isn't running | |||||
| if (!isBuffering) { | |||||
| var eventKey = event.which; | |||||
| var value = inputMap[event.type]; | |||||
| if (value === 'pointer') value = pointerType(event); | |||||
| if ( | |||||
| currentInput !== value || | |||||
| currentIntent !== value | |||||
| ) { | |||||
| var activeInput = ( | |||||
| document.activeElement && | |||||
| formInputs.indexOf(document.activeElement.nodeName.toLowerCase()) === -1 | |||||
| ) ? true : false; | |||||
| if ( | |||||
| value === 'touch' || | |||||
| // ignore mouse modifier keys | |||||
| (value === 'mouse' && ignoreMap.indexOf(eventKey) === -1) || | |||||
| // don't switch if the current element is a form input | |||||
| (value === 'keyboard' && activeInput) | |||||
| ) { | |||||
| // set the current and catch-all variable | |||||
| currentInput = currentIntent = value; | |||||
| setInput(); | |||||
| } | |||||
| } | |||||
| } | |||||
| }; | |||||
| // updates the doc and `inputTypes` array with new input | |||||
| var setInput = function() { | |||||
| docElem.setAttribute('data-whatinput', currentInput); | |||||
| docElem.setAttribute('data-whatintent', currentInput); | |||||
| if (inputTypes.indexOf(currentInput) === -1) { | |||||
| inputTypes.push(currentInput); | |||||
| docElem.className += ' whatinput-types-' + currentInput; | |||||
| } | |||||
| }; | |||||
| // updates input intent for `mousemove` and `pointermove` | |||||
| var setIntent = function(event) { | |||||
| // only execute if the touch buffer timer isn't running | |||||
| if (!isBuffering) { | |||||
| var value = inputMap[event.type]; | |||||
| if (value === 'pointer') value = pointerType(event); | |||||
| if (currentIntent !== value) { | |||||
| currentIntent = value; | |||||
| docElem.setAttribute('data-whatintent', currentIntent); | |||||
| } | |||||
| } | |||||
| }; | |||||
| // buffers touch events because they frequently also fire mouse events | |||||
| var touchBuffer = function(event) { | |||||
| // clear the timer if it happens to be running | |||||
| window.clearTimeout(touchTimer); | |||||
| // set the current input | |||||
| updateInput(event); | |||||
| // set the isBuffering to `true` | |||||
| isBuffering = true; | |||||
| // run the timer | |||||
| touchTimer = window.setTimeout(function() { | |||||
| // if the timer runs out, set isBuffering back to `false` | |||||
| isBuffering = false; | |||||
| }, 200); | |||||
| }; | |||||
| /* | |||||
| --------------- | |||||
| Utilities | |||||
| --------------- | |||||
| */ | |||||
| var pointerType = function(event) { | |||||
| if (typeof event.pointerType === 'number') { | |||||
| return pointerMap[event.pointerType]; | |||||
| } else { | |||||
| return (event.pointerType === 'pen') ? 'touch' : event.pointerType; // treat pen like touch | |||||
| } | |||||
| }; | |||||
| // detect version of mouse wheel event to use | |||||
| // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel | |||||
| var detectWheel = function() { | |||||
| return 'onwheel' in document.createElement('div') ? | |||||
| 'wheel' : // Modern browsers support "wheel" | |||||
| document.onmousewheel !== undefined ? | |||||
| 'mousewheel' : // Webkit and IE support at least "mousewheel" | |||||
| 'DOMMouseScroll'; // let's assume that remaining browsers are older Firefox | |||||
| }; | |||||
| /* | |||||
| --------------- | |||||
| Init | |||||
| don't start script unless browser cuts the mustard | |||||
| (also passes if polyfills are used) | |||||
| --------------- | |||||
| */ | |||||
| if ( | |||||
| 'addEventListener' in window && | |||||
| Array.prototype.indexOf | |||||
| ) { | |||||
| setUp(); | |||||
| } | |||||
| /* | |||||
| --------------- | |||||
| API | |||||
| --------------- | |||||
| */ | |||||
| return { | |||||
| // returns string: the current input type | |||||
| // opt: 'loose'|'strict' | |||||
| // 'strict' (default): returns the same value as the `data-whatinput` attribute | |||||
| // 'loose': includes `data-whatintent` value if it's more current than `data-whatinput` | |||||
| ask: function(opt) { return (opt === 'loose') ? currentIntent : currentInput; }, | |||||
| // returns array: all the detected input types | |||||
| types: function() { return inputTypes; } | |||||
| }; | |||||
| }()); | |||||
| /***/ } | |||||
| /******/ ]) | |||||
| }); | |||||
| ; | |||||