From 5ad908b4c9f5424ca89674b599d52aec7e9f6f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Fri, 27 Oct 2017 06:58:15 -0400 Subject: [PATCH] Add JQM for compatibility with touch --- static/jquery/jquery.mobile.vmouse.min.js | 3 +++ views/series.tpl | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 static/jquery/jquery.mobile.vmouse.min.js diff --git a/static/jquery/jquery.mobile.vmouse.min.js b/static/jquery/jquery.mobile.vmouse.min.js new file mode 100644 index 000000000..a56cb44e7 --- /dev/null +++ b/static/jquery/jquery.mobile.vmouse.min.js @@ -0,0 +1,3 @@ +/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */ + +(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;di||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x + @@ -190,7 +191,8 @@ $('table').tablesort(); - $('a, button:not(.cancel)').on('click touch', function(){ + $('a, button:not(.cancel)').bind('vtouch', function(e){ + e.preventDefault(); $('#loader').addClass('active'); }) @@ -200,19 +202,23 @@ }) ; - $('#update_series').on('click touch', function(){ + $('#update_series').bind('vtouch', function(e){ + e.preventDefault(); window.location = '{{base_url}}/update_series'; }) - $('#update_all_episodes').on('click touch', function(){ + $('#update_all_episodes').bind('vtouch', function(e){ + e.preventDefault(); window.location = '{{base_url}}/update_all_episodes'; }) - $('#add_new_episodes').on('click touch', function(){ + $('#add_new_episodes').bind('vtouch', function(e){ + e.preventDefault(); window.location = '{{base_url}}/add_new_episodes'; }) - $('.config').on('click touch', function(){ + $('.config').bind('vtouch', function(e){ + e.preventDefault(); sessionStorage.scrolly=$(window).scrollTop(); $('#series_form').attr('action', '{{base_url}}/edit_series/' + $(this).data("tvdbid"));