- big optimizations :

- remove nouislider and jquery-ui dependency (along with touch punch js hack for jqueryui)
 - rewrote slider and xy/rgb pads, lighter and faster, with  much better touch support/performances
This commit is contained in:
jean-emmanuel 2015-09-08 13:08:07 +02:00 • committed by bordun
parent a47307ad1e
commit b6254c954e
13 changed files with 563 additions and 2930 deletions

View file

@ -34,9 +34,9 @@ ipc.on('openSession',function(data){
require(data)
if (TABS!=false) {
$('#lobby').hide()
$('#container').append('<div class="spinner"></div>')
$('#container').append('<div id="loading"><div class="spinner"></div></div>')
setTimeout(function(){
init(function(){$('#container .spinner').hide()});
init(function(){$('#loading').hide()});
},1)
} else {

View file

@ -1,4 +1,5 @@
init = function(callback) {
parsetabs(TABS,false,false)
@ -55,12 +56,13 @@ init = function(callback) {
// horizontal scrolling with mousewheel
// if shift is pressed or if mouse is on h-scrollbar
// if shift is pressed (native), or if there is no vertical scrollbar,
// or if mouse is on h-scrollbar
$('.tab').on('mousewheel',function(e) {
// console.log(e)
var h = $('#container').innerHeight()-20-$(this).parents('.tab').length*5;
if (e.shiftKey) {
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaX);
if ($(this).get(0).scrollHeight+20 == $(this).height()) {
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaY);
e.preventDefault();
} else if (e.pageY>=h) {
$(this).scrollLeft($(this).scrollLeft()+e.originalEvent.deltaY);
@ -74,9 +76,9 @@ init = function(callback) {
$('#sidepanel').append('\
<div class="open-toggle">\
<a class="open-toggle">\
<span class="bars"></span>\
</div>\
</a>\
<ul id="options">\
<li><a class="saveState btn">Save</a></li>\
<li><a href="#" class="loadState btn">Load</a></li>\

View file

@ -1,5 +1,4 @@
parsetabs = function(tabs,parent,sub){
if (!sub) {
var $nav = $(document.createElement('div')).addClass('main navigation'),
$navtabs = $(document.createElement('ul')).addClass('tablist'),
@ -34,8 +33,8 @@ parsetabs = function(tabs,parent,sub){
$content.append($tabContent);
// console.log('OK parsing tab ' + title )
}
}
}
__widgets__ = {}

View file

@ -20,39 +20,43 @@ createWidget.stack = function(widgetData) {
return widget;
}
createWidget.button = function(widgetData) {
createWidget.toggle = createWidget.button = function(widgetData) {
widgetData.on = widgetData.on || 1
widgetData.off = widgetData.off || 0
var widget = $('\
<div class="button-wrapper">\
<div class="button"></div>\
<input disabled></input>\
<div class="toggle">\
<div class="value"><span>'+widgetData.off+'</span></div>\
</div>\
');
widget.input = widget.find('input')
widget.button = widget.find('.button')
widgetData.args = widgetData.args || {off:0,on:1}
widget.value = widget.find('.value')
widget.button.click(function(){
var newVal = widget.button.hasClass('on')?widgetData.args.off||0:widgetData.args.on||1
widget.click(function(){
var newVal = widget.hasClass('on')?widgetData.off:widgetData.on
widget.setValue(newVal,true)
})
widget.getValue = function() {
return widget.button.hasClass('on')?widgetData.args.on||1:widgetData.args.off||0
return widget.hasClass('on')?widgetData.on:widgetData.off
}
widget.setValue = function(v,send,sync) {
var on = widgetData.args.on||1,
off= widgetData.args.off||0
var on = widgetData.on,
off= widgetData.off
if (v==on) {
widget.button.addClass('on')
widget.addClass('on')
widget.value.text(on)
if (send) widget.sendValue(v)
} else if (v==off) {
widget.button.removeClass('on')
widget.removeClass('on')
widget.value.text(off)
if (send) widget.sendValue(v)
}
widget.input.val(widget.getValue())
if (send) widget.trigger('sync')
}
@ -66,6 +70,51 @@ createWidget.button = function(widgetData) {
}
createWidget.switch = function(widgetData) {
widgetData.on = widgetData.on || 1
widgetData.off = widgetData.off || 0
var widget = $('\
<div class="switch">\
</div>\
');
for (v in widgetData.values) {
widget.append('<div class="value" data-value="'+widgetData.values[v]+'"><span>'+widgetData.values[v]+'</span></div>')
}
widget.find('.value').click(function(){
if ($(this).hasClass('on')) return;
var newVal = $(this).data('value')
widget.setValue(newVal,true)
})
widget.getValue = function() {
return widget.find('.on').data('value')
}
widget.setValue = function(v,send,sync) {
var e = widget.find('.value[data-value="'+v+'"]')
if (e.length) {
widget.find('.on').removeClass('on')
e.addClass('on')
if (send) widget.sendValue(v)
if (send) widget.trigger('sync')
}
}
widget.sendValue = function(v) {
var t = widgetData.target,
p = widgetData.path
sendOsc([t,p,v]);
}
return widget;
}
createWidget.xy = function(widgetData) {
var widget = $('\
<div class="xy-wrapper">\
@ -77,40 +126,46 @@ createWidget.xy = function(widgetData) {
<input type="number" class="x"></input><input type="number" class="y"></input>\
</div>\
</div>\
');
widget.xy = widget.find('.xy')
widget.xy.handle = widget.find('.handle')
widget.xy.handle.css({top:0,left:0}).draggable({
addClasses: false,
scroll:false,
containment:'parent'
});
'),
handle = widget.find('.handle'),
pad = widget.find('.xy'),
value = {x:widget.find('.x'),y:widget.find('.y')}
widget.xy.value = {x:widget.find('.x'),y:widget.find('.y')}
widget.xy.on('drag',function(e, data){
var v = widget.getValue();
widget.sendValue(v);
widget.showValue(v)
widget.trigger('sync')
})
widgetData.range = widgetData.range || {x:{min:0,max:1},y:{min:0,max:1}}
handle.drag('init',function(){
offX = handle.width()
})
handle.drag(function( ev, dd ){
var h = pad.height()-dd.offsetY,
w = dd.deltaX+offX
handle.css({'height':h+'px','width':w+'px'})
var v = widget.getValue()
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
},{ relative:true });
widget.getValue = function() {
var x = mapToScale(widget.xy.handle.css('left'),[0,widget.xy.innerWidth()],[widgetData.range.x.min,widgetData.range.x.max]),
y = mapToScale(widget.xy.handle.css('top'),[0,widget.xy.innerHeight()],[widgetData.range.y.min,widgetData.range.y.max],true)
var x = mapToScale(handle.width(),[0,pad.innerWidth()],[widgetData.range.x.min,widgetData.range.x.max]),
y = mapToScale(handle.height(),[0,pad.innerHeight()],[widgetData.range.y.min,widgetData.range.y.max])
return [x,y]
}
widget.setValue = function(v,send,sync) {
if (v[1]==undefined) var v = [v,v]
var left = mapToScale(v[0],[widgetData.range.x.min,widgetData.range.x.max],[0,widget.xy.innerWidth()])
ytop = mapToScale(v[1],[widgetData.range.y.min,widgetData.range.y.max],[0,widget.xy.innerHeight()],true),
var w = mapToScale(v[0],[widgetData.range.x.min,widgetData.range.x.max],[0,pad.innerWidth()])
h = mapToScale(v[1],[widgetData.range.y.min,widgetData.range.y.max],[0,pad.innerHeight()]),
widget.xy.handle.css({'top':ytop+'px','left':left+'px'})
handle.css({'height':h+'px','width':w+'px'})
widget.showValue(v)
if (sync) widget.trigger('sync')
@ -123,50 +178,23 @@ createWidget.xy = function(widgetData) {
}
widget.showValue = function(v) {
widget.xy.value.x.val(v[0])
widget.xy.value.y.val(v[1])
value.x.val(v[0])
value.y.val(v[1])
}
widget.xy.value.x.change(function(){
value.x.change(function(){
var v = widget.getValue();
v[0] = limit($(this).val(),[widgetData.range.x.min,widgetData.range.x.max])
v[0] = clip(value.x.val(),[widgetData.range.x.min,widgetData.range.x.max])
widget.setValue(v,true,true)
})
widget.xy.value.y.change(function(){
value.y.change(function(){
var v = widget.getValue();
v[1] = limit($(this).val(),[widgetData.range.y.min,widgetData.range.y.max])
v[1] = clip(value.y.val(),[widgetData.range.y.min,widgetData.range.y.max])
widget.setValue(v,true,true)
})
return widget;
// alternate technique to jqueryui using css transform (hw accelerated)
// doesn't seem to increase performance (there's no transition to optimize)
// add require( __dirname + "/js/jquery.event.drag-2.2.js") to index.html to enable
// widget.xy.handle.drag(function( ev, dd ){
// var x = limit(dd.offsetX,[0,widget.xy.innerWidth()]),
// y = limit(dd.offsetY,[0,widget.xy.innerHeight()])
// $( this ).css({
// 'transform': 'translate3d('+x+'px,'+y+'px,0px)'
// });
//
// var v = widget.getValue([0,0,0,x,y]);
// widget.sendValue(v);
// widget.showValue(v)
// widget.trigger('sync')
// },{ relative:true });
//
// widgetData.range = widgetData.range || {x:{min:0,max:1},y:{min:0,max:1}}
//
// widget.getValue = function(css) {
// var css = css || widget.xy.handle.css('transform').split('(')[1].split(',')
// x = mapToScale(css[4],[0,widget.xy.innerWidth()],[widgetData.range.x.min,widgetData.range.x.max]),
// y = mapToScale(css[5],[0,widget.xy.innerHeight()],[widgetData.range.y.min,widgetData.range.y.max],true)
// return [x,y]
// }
}
@ -213,7 +241,7 @@ var rgbToHsb = function (rgb) {
};
var limit = function(value,range) {
var clip = function(value,range) {
var max = Math.max,
min = Math.min
@ -230,7 +258,7 @@ var mapToScale = function(value,rangeIn,rangeOut,reverse) {
value = max(min(rangeIn[0],rangeIn[1]),min(parseFloat(value),max(rangeIn[0],rangeIn[1])))
value = (value/rangeIn[1]-rangeIn[0]) * (rangeOut[1]-rangeOut[0]) + rangeOut[0]
value = ((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])) * (rangeOut[1]-rangeOut[0]) + rangeOut[0]
if (reverse) value = max(rangeOut[0],rangeOut[1])+min(rangeOut[0],rangeOut[1])-value
@ -244,10 +272,6 @@ var mapToScale = function(value,rangeIn,rangeOut,reverse) {
createWidget.rgb = function(widgetData) {
var widget = $('\
<div class="xy-wrapper rgb-wrapper">\
@ -261,63 +285,59 @@ createWidget.rgb = function(widgetData) {
<input disabled value="R"></input><input disabled value="G"></input><input disabled value="B"></input>\
<input class="r" type="number"></input><input class="g" type="number"></input><input class="b" type="number"></input>\
</div>\
</div>\
');
widget.xy = widget.find('.xy')
widget.xy.saturation = widget.find('.rgb .handle')
widget.xy.hue = widget.find('.hue .handle')
widget.xy.saturation.css({top:0,left:0}).draggable({
addClasses: false,
scroll:false,
containment:'parent'
});
widget.xy.hue.css({left:0}).draggable({
addClasses: false,
scroll:false,
containment:'parent'
});
widget.xy.value = {r:widget.find('input.r'),g:widget.find('input.g'),b:widget.find('input.b')}
widget.xy.hue.on('drag',function(e, data){
var h = parseFloat(widget.xy.hue.css('left'))/widget.xy.innerWidth()*360,
rgb = hsbToRgb({h:h,s:100,b:100}),
v = widget.getValue();
widget.xy.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
})
widget.xy.saturation.on('drag',function(e, data){
var v = widget.getValue();
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
})
widget.xy.saturation.on('stop',function(e, data){
var v = widget.getValue();
widget.sendValue(v);
widget.showValue(v);
//widget.trigger('sync')
})
</div>'),
rgbHandle = widget.find('.rgb .handle'),
hueHandle = widget.find('.hue .handle'),
pad = widget.find('.xy'),
value = {r:widget.find('input.r'),g:widget.find('input.g'),b:widget.find('input.b')}
widgetData.range = {r:{min:0,max:255},g:{min:0,max:255},b:{min:255}}
rgbHandle.drag('init',function(){
rgbOffX = rgbHandle.width()
})
rgbHandle.drag(function( ev, dd ){
var h = pad.height()-dd.offsetY,
w = dd.deltaX+rgbOffX
rgbHandle.css({'height':h+'px','width':w+'px'})
var v = widget.getValue()
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
},{ relative:true });
hueHandle.drag('init',function(){
rgbOffX = hueHandle.width()
})
hueHandle.drag(function( ev, dd ){
var w = dd.deltaX+rgbOffX
hueHandle.css({'width':w+'px'})
var h = parseFloat(hueHandle.width())/pad.innerWidth()*360,
rgb = hsbToRgb({h:h,s:100,b:100}),
v = widget.getValue();
pad.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
},{ relative:true });
widget.getValue = function() {
var s = mapToScale(widget.xy.saturation.css('left'),[0,widget.xy.innerWidth()],[0,100]),
l = mapToScale(widget.xy.saturation.css('top'),[0,widget.xy.innerHeight()],[0,100],true),
h = mapToScale(widget.xy.hue.css('left'),[0,widget.xy.innerWidth()],[0,360]),
var s = mapToScale(rgbHandle.width(),[0,pad.innerWidth()],[0,100]),
l = mapToScale(rgbHandle.height(),[0,pad.innerHeight()],[0,100]),
h = mapToScale(hueHandle.width(),[0,pad.innerWidth()],[0,360]),
rgb = hsbToRgb({h:h,s:s,b:l})
return [rgb.r,rgb.g,rgb.b]
}
@ -332,15 +352,16 @@ createWidget.rgb = function(widgetData) {
var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]})
var left = mapToScale(hsb.s,[0,100],[0,widget.xy.innerWidth()]),
top = mapToScale(hsb.b,[0,100],[0,widget.xy.innerHeight()],true),
leftHue = mapToScale(hsb.h,[0,360],[0,widget.xy.innerWidth()])
widget.xy.saturation.css({'top':top+'px','left':left+'px'})
widget.xy.hue.css({'left':leftHue+'px'})
var w = mapToScale(hsb.s,[0,100],[0,pad.innerWidth()]),
h = mapToScale(hsb.b,[0,100],[0,pad.innerHeight()]),
hueW = mapToScale(hsb.h,[0,360],[0,pad.innerWidth()])
rgbHandle.css({'height':h+'px','width':w+'px'})
hueHandle.css({'width':hueW+'px'})
var rgb = hsbToRgb({h:hsb.h,s:100,b:100})
widget.xy.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
pad.css('background-color','rgb('+rgb.r+','+rgb.g+','+rgb.b+')')
widget.showValue(v);
@ -358,24 +379,24 @@ createWidget.rgb = function(widgetData) {
widget.showValue = function(v) {
widget.xy.value.r.val(v[0])
widget.xy.value.g.val(v[1])
widget.xy.value.b.val(v[2])
value.r.val(v[0])
value.g.val(v[1])
value.b.val(v[2])
}
widget.xy.value.r.change(function(){
if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))}
value.r.change(function(){
var r = clip(value.r.val(),[0,255])
var v = widget.getValue()
widget.setValue([$(this).val(),v[1],v[2]],true,true)
widget.setValue([r,v[1],v[2]],true,true)
})
widget.xy.value.g.change(function(){
if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))}
value.g.change(function(){
var g = clip(value.g.val(),[0,255])
var v = widget.getValue()
widget.setValue([v[0],$(this).val(),v[2]],true,true)
widget.setValue([v[0],g,v[2]],true,true)
})
widget.xy.value.b.change(function(){
if (!0<=$(this).val()<=255) {$(this).val(Math.min(255,Math.max(0,$(this).val())))}
value.b.change(function(){
var b = clip(value.b.val(),[0,255])
var v = widget.getValue()
widget.setValue([v[0],v[1],$(this).val()],true,true)
widget.setValue([v[0],v[1],b],true,true)
})
@ -384,99 +405,129 @@ createWidget.rgb = function(widgetData) {
createWidget.fader = function(widgetData,parent) {
createWidget.fader = function(widgetData,parent){
var widget = $('\
<div class="fader-wrapper-outer">\
<div class="fader-wrapper">\
<div class="fader locked"></div>\
<div class="f-wrapper-outer">\
<div class="f-wrapper">\
<div class="f">\
<div class="handle"></div>\
<div class="pips"></div>\
</div>\
</div>\
<input value="0"></input>\
</div>\
');
'),
handle = widget.find('.handle'),
fader = widget.find('.f'),
pips = widget.find('.pips'),
input = widget.find('input'),
widget.fader = widget.find('.fader')
widget.lock = false
var range = (widgetData.range=='db'||!widgetData.range)?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:widgetData.range;
dimension = parent.hasClass('stack')?'width':'height';
handle.size = function() {
return (dimension=='height')?handle.height():handle.width()
}
fader.size = function() {
return (dimension=='height')?fader.height():fader.width()
}
var pips = function() {
if (widgetData.range=='db'||!widgetData.range) {
return [-70,-60,-50,-40,-30,-20,-10,-6,-3,0,3,6];
var offX=0
if (dimension=='width') {
handle.drag('init',function(){
offX = handle.size()
})
}
handle.drag(function( ev, dd ){
var d = (dimension=='height')?fader.size()-dd.offsetY:dd.deltaX+offX
handle.css(dimension, d+'px')
var v = widget.getValue()
widget.sendValue(v);
widget.showValue(v);
widget.trigger('sync')
},{ relative:true });
widgetData.range = widgetData.range || {'min':0,'100%':1}
widgetData.range = (widgetData.range=='db')?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'71%':-6,'78%':-3,'85%':0,'92%':3,'max': 6}:widgetData.range;
var range = {}
for (k in widgetData.range) {
if (k=='min') {
range[0]=widgetData.range[k]
} else if (k=='max') {
range[100]=widgetData.range[k]
} else {
var autopips = [];
var i=0;
for (key in range) {
autopips[i]=range[key];
i=i+1;
}
if (range.min<0 && 0<range.max){
autopips.push(0);
}
//autopips.push((range.max-range.min)/2);
//autopips.push((range.max-range.min)/4);
//autopips.push((range.max-range.min)*.75);
return autopips;
range[parseInt(k)]=widgetData.range[k]
}
}
var pips = pips();
var orientation = parent.hasClass('stack')?'horizontal':'vertical',
direction = parent.hasClass('stack')?'ltr':'rtl',
density = parent.hasClass('stack')?'2':'1';
widget.fader
.noUiSlider({
orientation:orientation,
direction: direction,
behaviour: "drag",
connect: "lower",
//animate:false,
start: 0,
range: range
})
.noUiSlider_pips({
mode: 'values',
density: density,
filter:function(v,t){return v==0?1:2;},
values: pips,
format: wNumb({})
})
.Link('lower').to(widget.find('input'))
.on('slide',function(){
if (!widget.lock) {
widget.sendValue();
}
})
.on('set',function(){
if (!widget.lock) {
widget.sendValue();
widget.trigger('sync')
}
});
widget.getValue = function(v,send){
return widget.fader.val();
var scale = []
for (var i=0;i<=100;i++) {scale.push(i)}
for (i in scale) {
var pip = $('<div class="pip"></div>')
if (range[i]!=undefined) {
pip.addClass('val').append('<span>'+range[i]+'</span>')
}
pips.append(pip)
}
if (dimension=='height') {
pips.append(pips.find('.pip').get().reverse())
}
widget.setValue = function(v,send,sync){
if (!send) {widget.lock=true}
widget.fader.val(v);
if (sync) widget.trigger('sync')
widget.lock=false;
var rangeKeys = Object.keys(range).map(function (key) {return parseInt(key)}),
rangeVals = Object.keys(range).map(function (key) {return parseInt(range[key])})
widget.getValue = function(){
var v
var h = handle.size() * 100 / fader.size()
for (var i=0;i<rangeKeys.length-1;i++) {
if (h <= rangeKeys[i+1] && h >= rangeKeys[i]) {
return mapToScale(h,[rangeKeys[i],rangeKeys[i+1]],[rangeVals[i],rangeVals[i+1]])
}
}
}
widget.sendValue = function(){
widget.setValue = function(v,send,sync) {
var h,
v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]])
for (var i=0;i<rangeVals.length-1;i++) {
if (v <= rangeVals[i+1] && v >= rangeVals[i]) {
h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]])
break
}
}
handle.css(dimension,h+'%')
widget.showValue(v);
if (sync) widget.trigger('sync');
if (send) widget.sendValue(v);
}
widget.sendValue = function(v) {
var t = widgetData.target,
p = widgetData.path,
v = widgetData.scale1?
Math.max(0,Math.round(10000*((Math.abs(range.min)/(range.max-range.min)) + widget.fader.val()/(range.max-range.min)))/10000)
: widget.fader.val();
sendOsc([t,p,parseFloat(v)]);
p = widgetData.path
sendOsc([t,p,v]);
}
widget.showValue = function(v) {
input.val(v)
}
input.change(function(){
widget.setValue(input.val(),true,true)
})
return widget
}

View file

@ -11,13 +11,7 @@ window.$ = window.jQuery = require( __dirname + "/jquery/jquery.min.js")
// third-party js libraries
require( __dirname + "/jquery/jquery.nouislider.all.js")
require( __dirname + "/jquery/jquery-ui.draggable.min.js")
require( __dirname + "/jquery/jquery.mousewheel.min.js")
// mouse to touch emulation
require( __dirname + "/jquery/jquery.ui.touch-punch.min.js")
require( __dirname + "/jquery/jquery.event.drag-2.2.js")
// main js
@ -31,7 +25,7 @@ var Sass = require( __dirname + "/sass/sass.js")
var sass = new Sass()
sass.options({style: Sass.style.compact})
var styles = ["/../css/style.scss","/../css/jquery.nouislider.scss"]
var styles = ["/../css/style.scss"]
, stylesdata = ''
, done = 0;

File diff suppressed because one or more lines are too long

View file

@ -1,8 +0,0 @@
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright 2015 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);