vendor/assets/javascripts/uikit/components/sortable.js in uikit2-rails-0.1.8 vs vendor/assets/javascripts/uikit/components/sortable.js in uikit2-rails-0.1.9

- old
+ new

@@ -1,6 +1,6 @@ -/*! UIkit 2.26.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ /* * Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable */ (function(addon) { @@ -18,11 +18,11 @@ })(function(UI){ "use strict"; - var supportsTouch = ('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch), + var supportsTouch = ('ontouchstart' in window || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch), draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement; function closestSortable(ele) { ele = UI.$(ele); @@ -79,11 +79,10 @@ UI.$html.on('mousemove touchmove', function(e) { if (delayIdle) { var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e; - if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) { delayIdle.apply(src); } } @@ -171,16 +170,22 @@ if (!handle.length) return; } e.preventDefault(); - if (!supportsTouch && $link.length) { + if ($link.length) { $link.one('click', function(e){ e.preventDefault(); - }).one('mouseup', function(){ - if(!moved) $link.trigger('click'); + }).one('mouseup touchend', function(){ + + if (!moved) { + $link.trigger('click'); + if (supportsTouch && $link.attr('href').trim()) { + location.href = $link.attr('href'); + } + } }); } e.data = e.data || {}; @@ -325,10 +330,10 @@ var $current = UI.$(currentlyDraggingElement), offset = $current.offset(); delayIdle = { pos : { x:e.pageX, y:e.pageY }, - threshold : $this.options.handleClass ? 0 : $this.options.threshold, + threshold : $this.options.handleClass ? 1 : $this.options.threshold, apply : function(evt) { draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({ display : 'none', top : offset.top,