From a105312a4c0336cd481d77d173439ec98906b1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Thu, 21 Jan 2016 19:15:31 +0100 Subject: [PATCH 01/12] =?UTF-8?q?chore:=20add=20"node=5Fmodules"=20to=20th?= =?UTF-8?q?e=20cache=20=E2=9A=A1=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speeds up the tests. https://twitter.com/ag_dubs/status/ 690187790827536384 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index d9def5c..8e56fa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: node_js node_js: - '0.10' +cache: + directories: + - node_modules +before_cache: + - npm prune before_install: npm install -g grunt-cli notifications: From 2ed3c990a8dc6a0264b95da9a46d21a283c37556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 14:26:21 +0100 Subject: [PATCH 02/12] docs: simplify further reading section --- README.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c062483..e16531f 100644 --- a/README.md +++ b/README.md @@ -11,23 +11,14 @@ Check out the [examples](http://andreruffert.github.io/rangeslider.js/). * Supports all major browsers including IE8+ ## Install -Install with [Bower](http://bower.io/): -``bower install --save rangeslider.js`` +[📦](https://www.npmjs.org/): ``npm install --save rangeslider.js`` -Install with [npm](https://www.npmjs.org/): -``npm install --save rangeslider.js`` - -## Usage - -``` -// Initialize a new plugin instance for all -// e.g. $('input[type="range"]') elements. - -$('input[type="range"]').rangeslider(); -``` - -For more information check out the [website's section](http://andreruffert.github.io/rangeslider.js/#usage). For support visit the [gitter room](https://gitter.im/andreruffert/rangeslider.js). +[🐧](http://bower.io/): ``bower install --save rangeslider.js`` +## Further Reading +- Understand how [rangeslider.js](http://andreruffert.github.io/rangeslider.js/) works in general. +- File a [bug report](https://github.com/andreruffert/rangeslider.js/issues) for anything rangeslider.js related. +- Ask a question such as "How do I …?": open a [StackOverflow](http://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). ## License MIT © [André Ruffert](http://andreruffert.com) From 39ef82f35f3492e9828aa56be3ecb550d0c774ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 14:29:43 +0100 Subject: [PATCH 03/12] style: replace ":" with "." --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e16531f..3b7f1b3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Check out the [examples](http://andreruffert.github.io/rangeslider.js/). ## Further Reading - Understand how [rangeslider.js](http://andreruffert.github.io/rangeslider.js/) works in general. - File a [bug report](https://github.com/andreruffert/rangeslider.js/issues) for anything rangeslider.js related. -- Ask a question such as "How do I …?": open a [StackOverflow](http://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). +- Ask a question such as "How do I …?". Open a [StackOverflow](http://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). ## License MIT © [André Ruffert](http://andreruffert.com) From 77592f47d2254763a2d243cc74fac10f21824be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 14:45:48 +0100 Subject: [PATCH 04/12] chore: update badges add: npm downloads, npm version remove: grunt --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b7f1b3..58bba84 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -# rangeslider.js -[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![rangeslider.js](http://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://andreruffert.github.io/rangeslider.js/) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) +# rangeslider.js + +[![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) +[![rangeslider.js](http://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://andreruffert.github.io/rangeslider.js/) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) > Simple, small and fast JavaScript/jQuery [polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill) for the HTML5 `` slider element. From b0551d91c6dc2668595f74b0d3166a3f707cb409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 15:04:26 +0100 Subject: [PATCH 05/12] =?UTF-8?q?chore:=20add=20logo=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58bba84..ea707aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rangeslider.js +# rangeslider.js [![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) [![rangeslider.js](http://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://andreruffert.github.io/rangeslider.js/) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) From d0f48a6a921bdf749f761d612a8ed4e80c2256d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 15:09:00 +0100 Subject: [PATCH 06/12] =?UTF-8?q?chore:=20switch=20urls=20to=20https=20whe?= =?UTF-8?q?re=20possible=20=F0=9F=94=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ea707aa..1a06926 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# rangeslider.js +# rangeslider.js [![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) -[![rangeslider.js](http://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://andreruffert.github.io/rangeslider.js/) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) +[![rangeslider.js](https://img.shields.io/badge/rangeslider-.js-00ff00.svg)](https://andreruffert.github.io/rangeslider.js/) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) > Simple, small and fast JavaScript/jQuery [polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill) for the HTML5 `` slider element. -Check out the [examples](http://andreruffert.github.io/rangeslider.js/). +Check out the [examples](https://andreruffert.github.io/rangeslider.js/). * Touchscreen friendly * Recalculates `onresize` so suitable for use within responsive designs @@ -18,9 +18,9 @@ Check out the [examples](http://andreruffert.github.io/rangeslider.js/). [🐧](http://bower.io/): ``bower install --save rangeslider.js`` ## Further Reading -- Understand how [rangeslider.js](http://andreruffert.github.io/rangeslider.js/) works in general. +- Understand how [rangeslider.js](https://andreruffert.github.io/rangeslider.js/) works in general. - File a [bug report](https://github.com/andreruffert/rangeslider.js/issues) for anything rangeslider.js related. -- Ask a question such as "How do I …?". Open a [StackOverflow](http://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). +- Ask a question such as "How do I …?". Open a [StackOverflow](https://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). ## License MIT © [André Ruffert](http://andreruffert.com) From 6e1567669105a6421e52f32dd4d62f2c4bd95b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 15:15:45 +0100 Subject: [PATCH 07/12] =?UTF-8?q?chore:=20=F0=9F=91=89=202016=20?= =?UTF-8?q?=F0=9F=A6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 42d8351..754b79a 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2015 André Ruffert, http://andreruffert.com +Copyright (c) 2016 André Ruffert, http://andreruffert.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation From a4c300a85daa1bd82aabebb8c7b51c02fee4f079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 20:01:27 +0100 Subject: [PATCH 08/12] chore: reorder badges + add js.org --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a06926..e5d8c1b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # rangeslider.js -[![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) -[![rangeslider.js](https://img.shields.io/badge/rangeslider-.js-00ff00.svg)](https://andreruffert.github.io/rangeslider.js/) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) +[![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) > Simple, small and fast JavaScript/jQuery [polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill) for the HTML5 `` slider element. @@ -24,3 +23,5 @@ Check out the [examples](https://andreruffert.github.io/rangeslider.js/). ## License MIT © [André Ruffert](http://andreruffert.com) + +[![rangeslider.js](https://img.shields.io/badge/rangeslider-.js-00ff00.svg)](http://rangeslider.js.org) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/andreruffert/rangeslider.js) [![JS.ORG](https://img.shields.io/badge/js.org-rangeslider-ffb400.svg?style=flat-square)](http://js.org) \ No newline at end of file From 61dd77672960807c655676f35cd0fc34d7f6a84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Wed, 3 Feb 2016 20:08:51 +0100 Subject: [PATCH 09/12] chore: use http://rangeslider.js.org urls --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e5d8c1b..56545b8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# rangeslider.js +# rangeslider.js [![Build Status](https://travis-ci.org/andreruffert/rangeslider.js.svg?branch=develop)](https://travis-ci.org/andreruffert/rangeslider.js) [![npm downloads](https://img.shields.io/npm/dt/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) [![npm version](https://img.shields.io/npm/v/rangeslider.js.svg)](https://www.npmjs.com/package/rangeslider.js) > Simple, small and fast JavaScript/jQuery [polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill) for the HTML5 `` slider element. -Check out the [examples](https://andreruffert.github.io/rangeslider.js/). +Check out the [examples](http://rangeslider.js.org/). * Touchscreen friendly * Recalculates `onresize` so suitable for use within responsive designs @@ -17,7 +17,7 @@ Check out the [examples](https://andreruffert.github.io/rangeslider.js/). [🐧](http://bower.io/): ``bower install --save rangeslider.js`` ## Further Reading -- Understand how [rangeslider.js](https://andreruffert.github.io/rangeslider.js/) works in general. +- Understand how [rangeslider.js](http://rangeslider.js.org/) works in general. - File a [bug report](https://github.com/andreruffert/rangeslider.js/issues) for anything rangeslider.js related. - Ask a question such as "How do I …?". Open a [StackOverflow](https://stackoverflow.com/search?q=rangeslider.js) question with rangeslider.js tag or ask in the [Gitter chat room](https://gitter.im/andreruffert/rangeslider.js). From 53fa2d1b94ec5b99185cd4cdbe133650a1d41146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Tue, 12 Jul 2016 16:05:47 +0200 Subject: [PATCH 10/12] migrate(jQuery 3.x): use e.pageX/pageY instead of e.clientX/clientY jQuery 3.x removed the clientX/clientY calculations which caused some issues in iOS 9. https://jquery.com/upgrade-guide/3.0/#breaking-change-event-pagex-and-ev ent-pagey-normalization-removed close #224 --- dist/rangeslider.js | 7 ++++--- dist/rangeslider.min.js | 2 +- src/rangeslider.js | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/rangeslider.js b/dist/rangeslider.js index c780ec2..3a0e2a2 100644 --- a/dist/rangeslider.js +++ b/dist/rangeslider.js @@ -403,13 +403,14 @@ pageCoordinate = 0; if (typeof e['page' + ucCoordinate] !== 'undefined') { - pageCoordinate = e['client' + ucCoordinate]; + pageCoordinate = e['page' + ucCoordinate]; } + // IE8 support :) else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') { pageCoordinate = e.originalEvent['client' + ucCoordinate]; } - else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined') { - pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate]; + else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['page' + ucCoordinate] !== 'undefined') { + pageCoordinate = e.originalEvent.touches[0]['page' + ucCoordinate]; } else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') { pageCoordinate = e.currentPoint[this.COORDINATE]; diff --git a/dist/rangeslider.min.js b/dist/rangeslider.min.js index 73ed2f7..37db409 100644 --- a/dist/rangeslider.min.js +++ b/dist/rangeslider.min.js @@ -1,2 +1,2 @@ /*! rangeslider.js - v2.1.1 | (c) 2016 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function c(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function d(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function e(a){return a&&(0===a.offsetWidth||0===a.offsetHeight||a.open===!1)}function f(a){for(var b=[],c=a.parentNode;e(c);)b.push(c),c=c.parentNode;return b}function g(a,b){function c(a){"undefined"!=typeof a.open&&(a.open=a.open?!1:!0)}var d=f(a),e=d.length,g=[],h=a[b];if(e){for(var i=0;e>i;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;e>j;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('
'),this.$handle=a('
'),this.$range=a('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&ba?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a["page"+b]?d=a["client"+b]:"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["client"+b]?d=a.originalEvent.touches[0]["client"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){(a!==this.value||""===this.$element[0].value)&&this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"}); \ No newline at end of file +!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function c(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function d(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function e(a){return a&&(0===a.offsetWidth||0===a.offsetHeight||a.open===!1)}function f(a){for(var b=[],c=a.parentNode;e(c);)b.push(c),c=c.parentNode;return b}function g(a,b){function c(a){"undefined"!=typeof a.open&&(a.open=!a.open)}var d=f(a),e=d.length,g=[],h=a[b];if(e){for(var i=0;e>i;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;e>j;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('
'),this.$handle=a('
'),this.$range=a('
').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&ba?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a["page"+b]?d=a["page"+b]:"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["page"+b]?d=a.originalEvent.touches[0]["page"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){a===this.value&&""!==this.$element[0].value||this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"}); \ No newline at end of file diff --git a/src/rangeslider.js b/src/rangeslider.js index 259b297..dd9bf32 100644 --- a/src/rangeslider.js +++ b/src/rangeslider.js @@ -402,13 +402,14 @@ pageCoordinate = 0; if (typeof e['page' + ucCoordinate] !== 'undefined') { - pageCoordinate = e['client' + ucCoordinate]; + pageCoordinate = e['page' + ucCoordinate]; } + // IE8 support :) else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') { pageCoordinate = e.originalEvent['client' + ucCoordinate]; } - else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined') { - pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate]; + else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['page' + ucCoordinate] !== 'undefined') { + pageCoordinate = e.originalEvent.touches[0]['page' + ucCoordinate]; } else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') { pageCoordinate = e.currentPoint[this.COORDINATE]; From 562ae37be6e1cd4889980e956f65a936a3b3dd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ruffert?= Date: Tue, 12 Jul 2016 16:07:30 +0200 Subject: [PATCH 11/12] chore: update examples to use jQuery 3.1 --- example/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/index.html b/example/index.html index 8314aca..548a3f1 100644 --- a/example/index.html +++ b/example/index.html @@ -205,7 +205,7 @@

Combination with native <details> element

- +