Update: Improve TouchScreen Support

This commit is contained in:
Gary Sharp
2013-07-26 00:04:31 +10:00
parent cb30257c59
commit 760aba9cdf
19 changed files with 168 additions and 128 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2102")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2102")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2102")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2102")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
+59 -43
View File
@@ -39599,54 +39599,70 @@ jQuery.fn.DataTable.defaults.aLengthMenu = [[10, 20, 50, -1], [10, 20, 50, "All"
// Menu Functionality // Menu Functionality
var $menu = $('#menu'); var $menu = $('#menu');
var $menuSubVisible = []; var $menuItems = $menu.find('li');
$menu.find('li').each(function () { var $menuItemParents = $menuItems.filter('.hasSubMenu');
var $menuItem = $(this); var $menuSubMenus = $menuItems.filter('.subMenu');
var $subMenu = $menuItem.children('ul').first(); var menuAllowTouchNavigation = null;
if ($subMenu.length > 0) {
$menuItem.mouseover(function () {
menuShow($menuItem, $subMenu);
}).mouseout(function () {
menuHide($menuItem, $subMenu);
}).addClass('hasSubmenu');
// Touch-enabled browser $menuItemParents.each(function () {
if (Modernizr.touch) { var $parent = $(this);
$menuItem.on('touchstart', function (e) { var $subMenu = $parent.children('ul.subMenu');
// Already Open - allow 'click' $parent.data('menuSubMenu', $subMenu);
for (var i = 0; i < $menuSubVisible.length; i++) }).mouseover(function () {
if ($menuSubVisible[0] === $subMenu) var $parent = $(this);
return; var $subMenu = $parent.data('menuSubMenu');
var hideToken = $parent.data('menuHideToken');
// Show if (hideToken)
menuShow($menuItem, $subMenu); window.clearTimeout(hideToken);
$menuSubVisible.push($subMenu); if (!$subMenu.is(':visible')) {
$(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'))
$subMenu.show(); $subMenu.show();
} if (menuAllowTouchNavigation !== null)
function menuHide($menuItem, $subMenu) { menuTouchPreventNavigation();
var timeoutToken = subMenuHideToken = window.setTimeout(function () { }
}).mouseout(function () {
var $parent = $(this);
var $subMenu = $parent.data('menuSubMenu');
var hideToken = window.setTimeout(function () {
$subMenu.hide(); $subMenu.hide();
}, 250); }, 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); })(jQuery, window, document, Modernizr);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -14,54 +14,70 @@
// Menu Functionality // Menu Functionality
var $menu = $('#menu'); var $menu = $('#menu');
var $menuSubVisible = []; var $menuItems = $menu.find('li');
$menu.find('li').each(function () { var $menuItemParents = $menuItems.filter('.hasSubMenu');
var $menuItem = $(this); var $menuSubMenus = $menuItems.filter('.subMenu');
var $subMenu = $menuItem.children('ul').first(); var menuAllowTouchNavigation = null;
if ($subMenu.length > 0) {
$menuItem.mouseover(function () {
menuShow($menuItem, $subMenu);
}).mouseout(function () {
menuHide($menuItem, $subMenu);
}).addClass('hasSubmenu');
// Touch-enabled browser $menuItemParents.each(function () {
if (Modernizr.touch) { var $parent = $(this);
$menuItem.on('touchstart', function (e) { var $subMenu = $parent.children('ul.subMenu');
// Already Open - allow 'click' $parent.data('menuSubMenu', $subMenu);
for (var i = 0; i < $menuSubVisible.length; i++) }).mouseover(function () {
if ($menuSubVisible[0] === $subMenu) var $parent = $(this);
return; var $subMenu = $parent.data('menuSubMenu');
var hideToken = $parent.data('menuHideToken');
// Show if (hideToken)
menuShow($menuItem, $subMenu); window.clearTimeout(hideToken);
$menuSubVisible.push($subMenu); if (!$subMenu.is(':visible')) {
$(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'))
$subMenu.show(); $subMenu.show();
} if (menuAllowTouchNavigation !== null)
function menuHide($menuItem, $subMenu) { menuTouchPreventNavigation();
var timeoutToken = subMenuHideToken = window.setTimeout(function () { }
}).mouseout(function () {
var $parent = $(this);
var $subMenu = $parent.data('menuSubMenu');
var hideToken = window.setTimeout(function () {
$subMenu.hide(); $subMenu.hide();
}, 250); }, 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); })(jQuery, window, document, Modernizr);
+2 -2
View File
@@ -1377,8 +1377,8 @@ header nav ul#menu > li > ul li:hover,
#header nav ul#menu > li > ul li:hover { #header nav ul#menu > li > ul li:hover {
background-color: rgba(249, 228, 210, 0.75); 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-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-position: center right, top;
background-repeat: no-repeat, repeat-x; background-repeat: no-repeat, repeat-x;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -199,8 +199,8 @@ header nav ul#menu > li > ul li:hover,
#header nav ul#menu > li > ul li:hover { #header nav ul#menu > li > ul li:hover {
background-color: rgba(249, 228, 210, 0.75); 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-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-position: center right, top;
background-repeat: no-repeat, repeat-x; background-repeat: no-repeat, repeat-x;
+1 -1
View File
@@ -144,7 +144,7 @@ header, #header
background-position: top; background-position: top;
background-repeat: repeat-x; 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-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-position: center right, top;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0725.1725")] [assembly: AssemblyVersion("1.2.0725.2249")]
[assembly: AssemblyFileVersion("1.2.0725.1725")] [assembly: AssemblyFileVersion("1.2.0725.2249")]
+4 -4
View File
@@ -28,13 +28,13 @@
</div> </div>
<nav> <nav>
<ul id="menu"> <ul id="menu">
<li>@Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1") <li class="hasSubMenu">@Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1")
<ul> <ul class="subMenu">
<li>@Html.ActionLink("Devices Ready for Return", MVC.Job.DevicesReadyForReturn())</li> <li>@Html.ActionLink("Devices Ready for Return", MVC.Job.DevicesReadyForReturn())</li>
<li>@Html.ActionLink("Device Held Locations", MVC.Job.Locations())</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 User Action", MVC.Job.AwaitingUserAction())</li>
<li>@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance()) <li class="hasSubMenu">@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())
<ul> <ul class="subMenu">
<li>@Html.ActionLink("Accounting Charge", MVC.Job.AwaitingFinanceCharge())</li> <li>@Html.ActionLink("Accounting Charge", MVC.Job.AwaitingFinanceCharge())</li>
<li>@Html.ActionLink("Accounting Payment", MVC.Job.AwaitingFinancePayment())</li> <li>@Html.ActionLink("Accounting Payment", MVC.Job.AwaitingFinancePayment())</li>
<li>@Html.ActionLink("Agreement Breach", MVC.Job.AwaitingFinanceAgreementBreach())</li> <li>@Html.ActionLink("Agreement Breach", MVC.Job.AwaitingFinanceAgreementBreach())</li>
+22 -6
View File
@@ -192,16 +192,24 @@ WriteLiteral(" </div>\r\n </div>\r\n <nav>\
WriteLiteral(" id=\"menu\""); WriteLiteral(" id=\"menu\"");
WriteLiteral(">\r\n <li>"); WriteLiteral(">\r\n <li");
WriteLiteral(" class=\"hasSubMenu\"");
WriteLiteral(">");
#line 31 "..\..\Views\Shared\_Layout.cshtml" #line 31 "..\..\Views\Shared\_Layout.cshtml"
Write(Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1")); Write(Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1"));
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n <ul>\r\n <li>"); WriteLiteral("\r\n <ul");
WriteLiteral(" class=\"subMenu\"");
WriteLiteral(">\r\n <li>");
#line 33 "..\..\Views\Shared\_Layout.cshtml" #line 33 "..\..\Views\Shared\_Layout.cshtml"
@@ -228,16 +236,24 @@ WriteLiteral("</li>\r\n <li>");
#line default #line default
#line hidden #line hidden
WriteLiteral("</li>\r\n <li>"); WriteLiteral("</li>\r\n <li");
WriteLiteral(" class=\"hasSubMenu\"");
WriteLiteral(">");
#line 36 "..\..\Views\Shared\_Layout.cshtml" #line 36 "..\..\Views\Shared\_Layout.cshtml"
Write(Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())); Write(Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance()));
#line default #line default
#line hidden #line hidden
WriteLiteral("\r\n <ul>\r\n <li>"); WriteLiteral("\r\n <ul");
WriteLiteral(" class=\"subMenu\"");
WriteLiteral(">\r\n <li>");
#line 38 "..\..\Views\Shared\_Layout.cshtml" #line 38 "..\..\Views\Shared\_Layout.cshtml"