diff --git a/Disco.Web/ClientSource/Scripts/Core.js b/Disco.Web/ClientSource/Scripts/Core.js index b76179b4..5756f593 100644 --- a/Disco.Web/ClientSource/Scripts/Core.js +++ b/Disco.Web/ClientSource/Scripts/Core.js @@ -39567,174 +39567,115 @@ jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, -1], [10, 20, 50, "All" var $menu = $('#menu'); if ($menu.length > 0) { - if (Modernizr.touch) { - // Touch Events - $menu - .on('mouseover', 'li.hasSubMenu', function (e) { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = $this.data('menuHideToken'); - if (hideToken) - window.clearTimeout(hideToken); - if (!$subMenu.is(':visible')) - $subMenu.show(); - }) - .on('mouseout', 'li.hasSubMenu', function (e) { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = window.setTimeout(function () { - $subMenu.hide(); - }, 250); - $this.data('menuHideToken', hideToken); - }) - .on('touchstart', 'li.hasSubMenu', function (e) { - var $this = $(this); - var $link = $this.children('a'); - var $subMenu = $this.children('ul.subMenu'); - if (!$subMenu.is(':visible')) { - $subMenu.show(); - e.preventDefault(); - e.stopPropagation(); - return false; + + function subMenuShow() { + var $this = $(this); + var $subMenu = $this.children('ul.subMenu'); + var hideToken = $this.data('menuHideToken'); + + if (hideToken) + window.clearTimeout(hideToken); + + if (!$subMenu.is(':visible')) + $subMenu.show(); + } + function subMenuHide() { + var $this = $(this); + var $subMenu = $this.children('ul.subMenu'); + + var hideToken = window.setTimeout(function () { + $subMenu.hide(); + }, 250); + + $this.data('menuHideToken', hideToken); + } + function subMenuTouchDown(e, preventClick) { + var $this = $(this); + var $link = $this.children('a'); + var $subMenu = $this.children('ul.subMenu'); + + if (!$subMenu.is(':visible')) { + + $subMenu.show(); + + e.preventDefault(); + e.stopPropagation(); + + if (preventClick) { + // Stop Click Event + if ($link.length > 0) { + var preventClick = function () { $link.off('click', preventClick); return false; } + $link.on('click', preventClick); } - }); - } else if (Modernizr.testProp('pointerEvents')) { + } + + return false; + } + } + + if (Modernizr.hasEvent('pointerdown')) { // Pointer Events $menu .on('pointerover', 'li.hasSubMenu', function (e) { - if (e.originalEvent.pointerType != 'touch') { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = $this.data('menuHideToken'); - if (hideToken) - window.clearTimeout(hideToken); - if (!$subMenu.is(':visible')) - $subMenu.show(); + if (e.originalEvent.pointerType !== 'touch') { + subMenuShow.call(this); } }) .on('pointerout', 'li.hasSubMenu', function (e) { - if (e.originalEvent.pointerType != 'touch') { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = window.setTimeout(function () { - $subMenu.hide(); - }, 250); - $this.data('menuHideToken', hideToken); + if (e.originalEvent.pointerType !== 'touch') { + subMenuHide.call(this); } }) .on('pointerdown', 'li.hasSubMenu', function (e) { - if (e.originalEvent.pointerType == 'touch') { - var $this = $(this); - var $link = $this.children('a'); - var $subMenu = $this.children('ul.subMenu'); - if (!$subMenu.is(':visible')) { - $subMenu.show(); - e.preventDefault(); - e.stopPropagation(); - - // Stop Click Event - if ($link.length > 0) { - var preventClick = function () { $link.off('click', preventClick); return false; } - $link.on('click', preventClick); - } - - return false; - } + if (e.originalEvent.pointerType === 'touch') { + return subMenuTouchDown.call(this, e, true); } }); $(document).on('pointerdown', function (e) { - if (e.originalEvent.pointerType == 'touch') { + if (e.originalEvent.pointerType === 'touch') { if ($(e.target).closest('#menu').length == 0) $menu.find('li.hasSubMenu>ul.subMenu:visible').hide(); } }); + } else if (Modernizr.hasEvent('mspointerdown')) { + // MS Pointer Events + $menu + .on('MSPointerOver', 'li.hasSubMenu', function (e) { + if (e.originalEvent.pointerType !== e.originalEvent.MSPOINTER_TYPE_TOUCH) { + subMenuShow.call(this); + } + }) + .on('MSPointerOut', 'li.hasSubMenu', function (e) { + if (e.originalEvent.pointerType !== e.originalEvent.MSPOINTER_TYPE_TOUCH) { + subMenuHide.call(this); + } + }) + .on('MSPointerDown', 'li.hasSubMenu', function (e) { + if (e.originalEvent.pointerType === e.originalEvent.MSPOINTER_TYPE_TOUCH) { + return subMenuTouchDown.call(this, e, true); + } + }); + $(document).on('MSPointerDown', function (e) { + if (e.originalEvent.pointerType === e.originalEvent.MSPOINTER_TYPE_TOUCH) { + if ($(e.target).closest('#menu').length == 0) + $menu.find('li.hasSubMenu>ul.subMenu:visible').hide(); + } + }); + } else if (Modernizr.touch) { + // Touch Events + $menu + .on('mouseover', 'li.hasSubMenu', subMenuShow) + .on('mouseout', 'li.hasSubMenu', subMenuHide) + .on('touchstart', 'li.hasSubMenu', function (e) { + return subMenuTouchDown.call(this, e, false); + }); } else { // Mouse Events $menu - .on('mouseover', 'li.hasSubMenu', function () { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = $this.data('menuHideToken'); - if (hideToken) - window.clearTimeout(hideToken); - if (!$subMenu.is(':visible')) - $subMenu.show(); - }) - .on('mouseout', 'li.hasSubMenu', function () { - var $this = $(this); - var $subMenu = $this.children('ul.subMenu'); - var hideToken = window.setTimeout(function () { - $subMenu.hide(); - }, 250); - $this.data('menuHideToken', hideToken); - }); + .on('mouseover', 'li.hasSubMenu', subMenuShow) + .on('mouseout', 'li.hasSubMenu', subMenuHide); } } - //var $menuItems = $menu.find('li'); - //var $menuItemParents = $menuItems.filter('.hasSubMenu'); - //var $menuSubMenus = $menuItems.filter('.subMenu'); - //var menuAllowTouchNavigation = null; - - //$menuItemParents.each(function () { - // var $parent = $(this); - // var $subMenu = $parent.children('ul.subMenu'); - // $parent.data('menuSubMenu', $subMenu); - //}).mouseover(function () { - // var $parent = $(this); - // var $subMenu = $parent.data('menuSubMenu'); - // var hideToken = $parent.data('menuHideToken'); - // if (hideToken) - // window.clearTimeout(hideToken); - // if (!$subMenu.is(':visible')) { - // $subMenu.show(); - // if (menuAllowTouchNavigation !== null) - // menuTouchPreventNavigation(); - // } - //}).mouseout(function () { - // var $parent = $(this); - // var $subMenu = $parent.data('menuSubMenu'); - // var hideToken = window.setTimeout(function () { - // $subMenu.hide(); - // }, 250); - // $parent.data('menuHideToken', hideToken); - //}); - - //if (Modernizr.touch) { - // menuAllowTouchNavigation = true; - // $menuItemParents.children('a').on('touchstart', menuTouchStarted); - //} else if (window.navigator.msPointerEnabled) { - // menuAllowTouchNavigation = true; - // $menuItemParents.children('a').on('MSPointerUp', menuTouchMSPointerUp); - //} - //function menuTouchPreventNavigation() { - // // Block Touch Navigation for 350ms - // allowTouchNavigation = false; - // window.setTimeout(function () { - // allowTouchNavigation = true; - // }, 350); - //} - //function menuTouchNavigationBlockClick(e) { - // $(this).off('click', menuTouchNavigationBlockClick); - // e.preventDefault(); - //} - ////#region TouchEvents Implementation - //function menuSubMenuVisible($element) { - // return $element.closest('li').data('menuSubMenu').is(':visible'); - //} - //function menuTouchStarted(e) { - // var $this = $(this); - // if (!menuSubMenuVisible($this)) - // $this.click(menuTouchNavigationBlockClick); - //} - ////#endregion - - ////#region MS Pointer Implementation - //function menuTouchMSPointerUp(e) { - // if (!allowTouchNavigation && e.originalEvent.pointerType == e.originalEvent.MSPOINTER_TYPE_TOUCH) - // $(this).click(menuTouchNavigationBlockClick); - //} - ////#endregion - }); })(jQuery, window, document, Modernizr); diff --git a/Disco.Web/ClientSource/Scripts/Core.min.js b/Disco.Web/ClientSource/Scripts/Core.min.js index fbeb7f7c..e8f4ecff 100644 --- a/Disco.Web/ClientSource/Scripts/Core.min.js +++ b/Disco.Web/ClientSource/Scripts/Core.min.js @@ -1,2 +1,4 @@ -window.Modernizr=function(n,t,i){function a(n){c.cssText=n}function vt(n,t){return a(y.join(n+";")+(t||""))}function h(n,t){return typeof n===t}function v(n,t){return!!~(""+n).indexOf(t)}function lt(n,t){var u,r;for(u in n)if(r=n[u],!v(r,"-")&&c[r]!==i)return t=="pfx"?r:!0;return!1}function yt(n,t,r){var f,u;for(f in n)if(u=t[n[f]],u!==i)return r===!1?n[f]:h(u,"function")?u.bind(r||t):u;return!1}function f(n,t,i){var r=n.charAt(0).toUpperCase()+n.slice(1),u=(n+" "+ot.join(r+" ")+r).split(" ");return h(t,"string")||h(t,"undefined")?lt(u,t):(u=(n+" "+st.join(r+" ")+r).split(" "),yt(u,t,i))}function pt(){u.input=function(i){for(var r=0,u=i.length;r',n,"<\/style>"].join(""),f.id=e,(h?f:o).innerHTML+=l,o.appendChild(f),h||(o.style.background="",o.style.overflow="hidden",v=s.style.overflow,s.style.overflow="hidden",s.appendChild(o)),a=i(f,n),h?f.parentNode.removeChild(f):(o.parentNode.removeChild(o),s.style.overflow=v),!!a},at=function(t){var i=n.matchMedia||n.msMatchMedia,r;return i?i(t).matches:(l("@media "+t+" { #"+e+" { position: absolute; } }",function(t){r=(n.getComputedStyle?getComputedStyle(t,null):t.currentStyle).position=="absolute"}),r)},ct=function(){function r(r,u){u=u||t.createElement(n[r]||"div");r="on"+r;var f=r in u;return f||(u.setAttribute||(u=t.createElement("div")),u.setAttribute&&u.removeAttribute&&(u.setAttribute(r,""),f=h(u[r],"function"),h(u[r],"undefined")||(u[r]=i),u.removeAttribute(r))),u=null,f}var n={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return r}(),it={}.hasOwnProperty,rt,k;rt=h(it,"undefined")||h(it.call,"undefined")?function(n,t){return t in n&&h(n.constructor.prototype[t],"undefined")}:function(n,t){return it.call(n,t)};Function.prototype.bind||(Function.prototype.bind=function(n){var t=this,i,r;if(typeof t!="function")throw new TypeError;return i=tt.call(arguments,1),r=function(){var f,e,u;return this instanceof r?(f=function(){},f.prototype=t.prototype,e=new f,u=t.apply(e,i.concat(tt.call(arguments))),Object(u)===u)?u:e:t.apply(n,i.concat(tt.call(arguments)))},r});r.flexbox=function(){return f("flexWrap")};r.flexboxlegacy=function(){return f("boxDirection")};r.canvas=function(){var n=t.createElement("canvas");return!!(n.getContext&&n.getContext("2d"))};r.canvastext=function(){return!!(u.canvas&&h(t.createElement("canvas").getContext("2d").fillText,"function"))};r.webgl=function(){return!!n.WebGLRenderingContext};r.touch=function(){var i;return"ontouchstart"in n||n.DocumentTouch&&t instanceof DocumentTouch?i=!0:l(["@media (",y.join("touch-enabled),("),e,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(n){i=n.offsetTop===9}),i};r.geolocation=function(){return"geolocation"in navigator};r.postmessage=function(){return!!n.postMessage};r.websqldatabase=function(){return!!n.openDatabase};r.indexedDB=function(){return!!f("indexedDB",n)};r.hashchange=function(){return ct("hashchange",n)&&(t.documentMode===i||t.documentMode>7)};r.history=function(){return!!(n.history&&history.pushState)};r.draganddrop=function(){var n=t.createElement("div");return"draggable"in n||"ondragstart"in n&&"ondrop"in n};r.websockets=function(){return"WebSocket"in n||"MozWebSocket"in n};r.rgba=function(){return a("background-color:rgba(150,255,150,.5)"),v(c.backgroundColor,"rgba")};r.hsla=function(){return a("background-color:hsla(120,40%,100%,.5)"),v(c.backgroundColor,"rgba")||v(c.backgroundColor,"hsla")};r.multiplebgs=function(){return a("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(c.background)};r.backgroundsize=function(){return f("backgroundSize")};r.borderimage=function(){return f("borderImage")};r.borderradius=function(){return f("borderRadius")};r.boxshadow=function(){return f("boxShadow")};r.textshadow=function(){return t.createElement("div").style.textShadow===""};r.opacity=function(){return vt("opacity:.55"),/^0.55$/.test(c.opacity)};r.cssanimations=function(){return f("animationName")};r.csscolumns=function(){return f("columnCount")};r.cssgradients=function(){var n="background-image:";return a((n+"-webkit- ".split(" ").join("gradient(linear,left top,right bottom,from(#9f9),to(white));"+n)+y.join("linear-gradient(left top,#9f9, white);"+n)).slice(0,-n.length)),v(c.backgroundImage,"gradient")};r.cssreflections=function(){return f("boxReflect")};r.csstransforms=function(){return!!f("transform")};r.csstransforms3d=function(){var n=!!f("perspective");return n&&"webkitPerspective"in s.style&&l("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t){n=t.offsetLeft===9&&t.offsetHeight===3}),n};r.csstransitions=function(){return f("transition")};r.fontface=function(){var n;return l('@font-face {font-family:"font";src:url("https://")}',function(i,r){var f=t.getElementById("smodernizr"),u=f.sheet||f.styleSheet,e=u?u.cssRules&&u.cssRules[0]?u.cssRules[0].cssText:u.cssText||"":"";n=/src/i.test(e)&&e.indexOf(r.split(" ")[0])===0}),n};r.generatedcontent=function(){var n;return l(["#",e,"{font:0/0 a}#",e,':after{content:"',g,'";visibility:hidden;font:3px/1 a}'].join(""),function(t){n=t.offsetHeight>=3}),n};r.video=function(){var i=t.createElement("video"),n=!1;try{(n=!!i.canPlayType)&&(n=new Boolean(n),n.ogg=i.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),n.h264=i.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),n.webm=i.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(r){}return n};r.audio=function(){var i=t.createElement("audio"),n=!1;try{(n=!!i.canPlayType)&&(n=new Boolean(n),n.ogg=i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),n.mp3=i.canPlayType("audio/mpeg;").replace(/^no$/,""),n.wav=i.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),n.m4a=(i.canPlayType("audio/x-m4a;")||i.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(r){}return n};r.localstorage=function(){try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(n){return!1}};r.sessionstorage=function(){try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(n){return!1}};r.webworkers=function(){return!!n.Worker};r.applicationcache=function(){return!!n.applicationCache};r.svg=function(){return!!t.createElementNS&&!!t.createElementNS(p.svg,"svg").createSVGRect};r.inlinesvg=function(){var n=t.createElement("div");return n.innerHTML="",(n.firstChild&&n.firstChild.namespaceURI)==p.svg};r.smil=function(){return!!t.createElementNS&&/SVGAnimate/.test(ft.call(t.createElementNS(p.svg,"animate")))};r.svgclippaths=function(){return!!t.createElementNS&&/SVGClipPath/.test(ft.call(t.createElementNS(p.svg,"clipPath")))};for(k in r)rt(r,k)&&(b=k.toLowerCase(),u[b]=r[k](),nt.push((u[b]?"":"no-")+b));return u.input||pt(),u.addTest=function(n,t){if(typeof n=="object")for(var r in n)rt(n,r)&&u.addTest(r,n[r]);else{if(n=n.toLowerCase(),u[n]!==i)return u;t=typeof t=="function"?t():t;typeof d!="undefined"&&d&&(s.className+=" "+(t?"":"no-")+n);u[n]=t}return u},a(""),ut=o=null,function(n,t){function p(n,t){var i=n.createElement("p"),r=n.getElementsByTagName("head")[0]||n.documentElement;return i.innerHTML="x