Skip to content

Commit

Permalink
Update: Improve TouchScreen Support
Browse files Browse the repository at this point in the history
  • Loading branch information
garysharp committed Jul 25, 2013
1 parent cb30257 commit 760aba9
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Disco.BI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
4 changes: 2 additions & 2 deletions Disco.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2102")]
[assembly: AssemblyFileVersion("1.2.0725.2102")]
4 changes: 2 additions & 2 deletions Disco.ClientBootstrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2102")]
[assembly: AssemblyFileVersion("1.2.0725.2102")]
4 changes: 2 additions & 2 deletions Disco.Data/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
4 changes: 2 additions & 2 deletions Disco.Models/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
4 changes: 2 additions & 2 deletions Disco.Services/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
4 changes: 2 additions & 2 deletions Disco.Web.Extensions/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
102 changes: 59 additions & 43 deletions Disco.Web/ClientSource/Scripts/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -39599,54 +39599,70 @@ jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, -1], [10, 20, 50, "All"

// Menu Functionality
var $menu = $('#menu');
var $menuSubVisible = [];
$menu.find('li').each(function () {
var $menuItem = $(this);
var $subMenu = $menuItem.children('ul').first();
if ($subMenu.length > 0) {
$menuItem.mouseover(function () {
menuShow($menuItem, $subMenu);
}).mouseout(function () {
menuHide($menuItem, $subMenu);
}).addClass('hasSubmenu');

// Touch-enabled browser
if (Modernizr.touch) {
$menuItem.on('touchstart', function (e) {
// Already Open - allow 'click'
for (var i = 0; i < $menuSubVisible.length; i++)
if ($menuSubVisible[0] === $subMenu)
return;

// Show
menuShow($menuItem, $subMenu);
$menuSubVisible.push($subMenu);
$(document).on('click', menuTouchHide)
e.preventDefault();
});
}
};
});
function menuTouchHide() {
while ($menuSubVisible.length > 0) {
var $subMenu = $menuSubVisible.pop();
$subMenu.hide();
}
}
function menuShow($menuItem, $subMenu) {
var timeoutToken = $menuItem.data('menuTimeoutToken');
if (timeoutToken)
window.clearTimeout(timeoutToken);
if (!$subMenu.is(':visible'))
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();
}
function menuHide($menuItem, $subMenu) {
var timeoutToken = subMenuHideToken = window.setTimeout(function () {
if (menuAllowTouchNavigation !== null)
menuTouchPreventNavigation();
}
}).mouseout(function () {
var $parent = $(this);
var $subMenu = $parent.data('menuSubMenu');
var hideToken = window.setTimeout(function () {
$subMenu.hide();
}, 250);
$menuItem.data('menuTimeoutToken', timeoutToken);
$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);
2 changes: 1 addition & 1 deletion Disco.Web/ClientSource/Scripts/Core.min.js

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions Disco.Web/ClientSource/Scripts/Core.min.js.map

Large diffs are not rendered by default.

100 changes: 58 additions & 42 deletions Disco.Web/ClientSource/Scripts/Core/disco.uicore.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,70 @@

// Menu Functionality
var $menu = $('#menu');
var $menuSubVisible = [];
$menu.find('li').each(function () {
var $menuItem = $(this);
var $subMenu = $menuItem.children('ul').first();
if ($subMenu.length > 0) {
$menuItem.mouseover(function () {
menuShow($menuItem, $subMenu);
}).mouseout(function () {
menuHide($menuItem, $subMenu);
}).addClass('hasSubmenu');
var $menuItems = $menu.find('li');
var $menuItemParents = $menuItems.filter('.hasSubMenu');
var $menuSubMenus = $menuItems.filter('.subMenu');
var menuAllowTouchNavigation = null;

// Touch-enabled browser
if (Modernizr.touch) {
$menuItem.on('touchstart', function (e) {
// Already Open - allow 'click'
for (var i = 0; i < $menuSubVisible.length; i++)
if ($menuSubVisible[0] === $subMenu)
return;

// Show
menuShow($menuItem, $subMenu);
$menuSubVisible.push($subMenu);
$(document).on('click', menuTouchHide)
e.preventDefault();
});
}
};
});
function menuTouchHide() {
while ($menuSubVisible.length > 0) {
var $subMenu = $menuSubVisible.pop();
$subMenu.hide();
}
}
function menuShow($menuItem, $subMenu) {
var timeoutToken = $menuItem.data('menuTimeoutToken');
if (timeoutToken)
window.clearTimeout(timeoutToken);
if (!$subMenu.is(':visible'))
$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();
}
function menuHide($menuItem, $subMenu) {
var timeoutToken = subMenuHideToken = window.setTimeout(function () {
if (menuAllowTouchNavigation !== null)
menuTouchPreventNavigation();
}
}).mouseout(function () {
var $parent = $(this);
var $subMenu = $parent.data('menuSubMenu');
var hideToken = window.setTimeout(function () {
$subMenu.hide();
}, 250);
$menuItem.data('menuTimeoutToken', timeoutToken);
$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);
4 changes: 2 additions & 2 deletions Disco.Web/ClientSource/Style/BundleSite.css
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,8 @@ header nav ul#menu > li > ul li:hover,
#header nav ul#menu > li > ul li:hover {
background-color: rgba(249, 228, 210, 0.75);
}
header nav ul#menu > li > ul li.hasSubmenu,
#header nav ul#menu > li > ul li.hasSubmenu {
header nav ul#menu > li > ul li.hasSubMenu,
#header nav ul#menu > li > ul li.hasSubMenu {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAYAAACgu+4kAAAAa0lEQVQoz2NgGBRg8uTJO4BYhxIDVgPxHyCeDcQS5BpiAcSHgfgzENcBMRe5BgUC8U0gfgrEiUDMRI4hLEBcA8T/gfgCqZolgLgb6pUDQOxArEY5IJ4CxN9J0gjVPBeIf5GsEckA8jQOCgAAAvdRUNet20oAAAAASUVORK5CYII=) /*Images/SubSubMenuIcon.png*/, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAABMDlehAAAAIUlEQVQI12NgYGBQYGJgYPgLJ/6gciEEMwMDAyMzA1kAAB/mByD2JQzYAAAAAElFTkSuQmCC) /*Images/SubMenuBackground.png*/;
background-position: center right, top;
background-repeat: no-repeat, repeat-x;
Expand Down
2 changes: 1 addition & 1 deletion Disco.Web/ClientSource/Style/BundleSite.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Disco.Web/ClientSource/Style/Site.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ header nav ul#menu > li > ul li:hover,
#header nav ul#menu > li > ul li:hover {
background-color: rgba(249, 228, 210, 0.75);
}
header nav ul#menu > li > ul li.hasSubmenu,
#header nav ul#menu > li > ul li.hasSubmenu {
header nav ul#menu > li > ul li.hasSubMenu,
#header nav ul#menu > li > ul li.hasSubMenu {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAYAAACgu+4kAAAAa0lEQVQoz2NgGBRg8uTJO4BYhxIDVgPxHyCeDcQS5BpiAcSHgfgzENcBMRe5BgUC8U0gfgrEiUDMRI4hLEBcA8T/gfgCqZolgLgb6pUDQOxArEY5IJ4CxN9J0gjVPBeIf5GsEckA8jQOCgAAAvdRUNet20oAAAAASUVORK5CYII=) /*Images/SubSubMenuIcon.png*/, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAABMDlehAAAAIUlEQVQI12NgYGBQYGJgYPgLJ/6gciEEMwMDAyMzA1kAAB/mByD2JQzYAAAAAElFTkSuQmCC) /*Images/SubMenuBackground.png*/;
background-position: center right, top;
background-repeat: no-repeat, repeat-x;
Expand Down
2 changes: 1 addition & 1 deletion Disco.Web/ClientSource/Style/Site.less
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ header, #header
background-position: top;
background-repeat: repeat-x;

&.hasSubmenu
&.hasSubMenu
{
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAYAAACgu+4kAAAAa0lEQVQoz2NgGBRg8uTJO4BYhxIDVgPxHyCeDcQS5BpiAcSHgfgzENcBMRe5BgUC8U0gfgrEiUDMRI4hLEBcA8T/gfgCqZolgLgb6pUDQOxArEY5IJ4CxN9J0gjVPBeIf5GsEckA8jQOCgAAAvdRUNet20oAAAAASUVORK5CYII=) /*Images/SubSubMenuIcon.png*/, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAUCAYAAABMDlehAAAAIUlEQVQI12NgYGBQYGJgYPgLJ/6gciEEMwMDAyMzA1kAAB/mByD2JQzYAAAAAElFTkSuQmCC) /*Images/SubMenuBackground.png*/;
background-position: center right, top;
Expand Down
2 changes: 1 addition & 1 deletion Disco.Web/ClientSource/Style/Site.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Disco.Web/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0725.1725")]
[assembly: AssemblyFileVersion("1.2.0725.1725")]
[assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.2249")]
8 changes: 4 additions & 4 deletions Disco.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
</div>
<nav>
<ul id="menu">
<li>@Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1")
<ul>
<li class="hasSubMenu">@Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1")
<ul class="subMenu">
<li>@Html.ActionLink("Devices Ready for Return", MVC.Job.DevicesReadyForReturn())</li>
<li>@Html.ActionLink("Device Held Locations", MVC.Job.Locations())</li>
<li>@Html.ActionLink("Awaiting User Action", MVC.Job.AwaitingUserAction())</li>
<li>@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())
<ul>
<li class="hasSubMenu">@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())
<ul class="subMenu">
<li>@Html.ActionLink("Accounting Charge", MVC.Job.AwaitingFinanceCharge())</li>
<li>@Html.ActionLink("Accounting Payment", MVC.Job.AwaitingFinancePayment())</li>
<li>@Html.ActionLink("Agreement Breach", MVC.Job.AwaitingFinanceAgreementBreach())</li>
Expand Down
Loading

0 comments on commit 760aba9

Please sign in to comment.