1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

clean related files when deleting items

This commit is contained in:
Luke Pulverenti 2017-02-18 03:32:17 -05:00
parent 0902f2ce98
commit 419975b71e
10 changed files with 13 additions and 12 deletions

View file

@ -0,0 +1 @@
define(["dom","events"],function(dom,events){"use strict";function getTouches(e){return e.changedTouches||e.targetTouches||e.touches}function TouchHelper(elem){var touchTarget,touchStartX,touchStartY,self=this,swipeXThreshold=50,swipeXMaxY=30,touchStart=function(e){var touch=getTouches(e)[0];touchTarget=null,touchStartX=0,touchStartY=0,touch&&(touchStartX=touch.clientX,touchStartY=touch.clientY,touchTarget=touch.target)},touchEnd=function(e){if(touchTarget){var deltaX,deltaY,touch=getTouches(e)[0];if(touch){var touchEndX=touch.clientX||0,touchEndY=touch.clientY||0;deltaX=touchEndX-(touchStartX||0),deltaY=touchEndY-(touchStartY||0)}else deltaX=0,deltaY=0;deltaX>swipeXThreshold&&Math.abs(deltaY)<swipeXMaxY?events.trigger(self,"swiperight",[touchTarget]):deltaX<0-swipeXThreshold&&Math.abs(deltaY)<swipeXMaxY&&events.trigger(self,"swipeleft",[touchTarget])}touchTarget=null,touchStartX=0,touchStartY=0};this.touchStart=touchStart,this.touchEnd=touchEnd,dom.addEventListener(elem,"touchstart",touchStart,{passive:!0}),dom.addEventListener(elem,"touchend",touchEnd,{passive:!0}),dom.addEventListener(elem,"touchcancel",touchEnd,{passive:!0})}return TouchHelper.prototype.destroy=function(){var elem=this.elem,touchStart=this.touchStart,touchEnd=this.touchEnd;dom.removeEventListener(elem,"touchstart",touchStart,{passive:!0}),dom.removeEventListener(elem,"touchend",touchEnd,{passive:!0}),dom.removeEventListener(elem,"touchcancel",touchEnd,{passive:!0}),this.touchStart=null,this.touchEnd=null,this.elem=null},TouchHelper});