{"version":3,"file":"Home.js","sources":["Home.js"],"sourcesContent":["/**\r\n * HOME\r\n *\r\n * @file Client-side functionality specifically associated with the home page\r\n * @author Katherine Trunkey (katherine.trunkey@ignia.com)\r\n */\r\n\r\n$(function() {\r\n 'use strict';\r\n\r\n /**\r\n * Establish variables\r\n */\r\n var\r\n viewportWidth = $(window).width(),\r\n topOffset = $('#Header').height(),\r\n headingBuffer = $('#Introduction header:first-child').height();\r\n\r\n /**\r\n * Initializes Foundation smooth scrolling for homepage navigation arrows\r\n */\r\n var\r\n smoothScrollOptions = {\r\n animationDuration : 750,\r\n offset : (topOffset - 25)\r\n },\r\n splashSmoothScroll = new Foundation.SmoothScroll($('#SplashArrow'), smoothScrollOptions),\r\n clientsSmoothScroll = new Foundation.SmoothScroll($('#ClientsArrow'), smoothScrollOptions);\r\n\r\n /**\r\n * Adjusts height for panels needing additional buffer for scroll-based functionality or animations (see Home.Animations.js), for\r\n * tablet or larger screens\r\n */\r\n // Reduce height for Contact panel to account for footer\r\n var contactPanelAllowance = ($('#Header').outerHeight() + $('#Contact > .container').outerHeight() + $('#Footer').outerHeight());\r\n if (contactPanelAllowance <= $(window).outerHeight()) {\r\n var adjustedHeight = ($('#Contact').height() - $('#Footer').outerHeight());\r\n $('#Contact').height(adjustedHeight).css('min-height', adjustedHeight);\r\n }\r\n\r\n /**\r\n * Performs Contact form validation on load as well as during input\r\n */\r\n validateForm();\r\n $('input, textarea').on('keyup', validateForm);\r\n\r\n $('#ContactMessage').on('keyup, blur', function() {\r\n checkMessageLength();\r\n });\r\n\r\n /**\r\n * Sends Contact form data to the controller processing on submit\r\n */\r\n $(\"#ContactForm\").on('submit', function(e) {\r\n e.preventDefault();\r\n\r\n var contactFormData = $(this).serialize();\r\n\r\n $.ajax({\r\n type : 'POST',\r\n data : contactFormData,\r\n url : '/Contact/SendContactRequest'\r\n })\r\n .done(function(data, textStatus, jqXHR) {\r\n $('#SendSuccessMessage').removeClass('hidden');\r\n })\r\n .fail(function() {\r\n $('#SendErrorMessage').removeClass('hidden');\r\n })\r\n .always(function() {\r\n });\r\n\r\n });\r\n\r\n /**\r\n * Highlights the \"active\" navigation as the corresponding panel comes into view\r\n */\r\n $(window).scroll(function() {\r\n\r\n // Establish variables\r\n var\r\n menuItem,\r\n scrollPosition = $(window).scrollTop() + topOffset + headingBuffer;\r\n\r\n // Highlight 'About (01)' item\r\n if (scrollPosition >= $(\"#Introduction\").offset().top && scrollPosition <= $(\"#Services\").offset().top) {\r\n menuItem = '#IntroductionAnchor, #IntroductionAnchorSmallScreen';\r\n setActiveNavigation(menuItem);\r\n }\r\n\r\n // Highlight 'Services (02)' item\r\n if (scrollPosition >= $(\"#Services\").offset().top && scrollPosition <= $(\"#ClientHighlights\").offset().top) {\r\n menuItem = '#ServicesAnchor, #ServicesAnchorSmallScreen';\r\n setActiveNavigation(menuItem);\r\n }\r\n\r\n // Highlight 'Clients (03)' item\r\n if (scrollPosition >= $(\"#ClientHighlights\").offset().top && scrollPosition <= $(\"#Contact\").offset().top) {\r\n menuItem = '#ClientHighlightsAnchor, #ClientHighlightsAnchorSmallScreen';\r\n setActiveNavigation(menuItem);\r\n }\r\n\r\n // Highlight 'Contact (04)' item\r\n if (scrollPosition >= $('#Contact').offset().top) {\r\n menuItem = '#ContactAnchor, #ContactAnchorSmallScreen';\r\n setActiveNavigation(menuItem);\r\n }\r\n\r\n });\r\n\r\n /**\r\n * Handles Services panel click functionality in order to fire off selected Service\r\n */\r\n $('.panel.services .categories.navigation ul li a').click(function(event) {\r\n\r\n // Prevent anchor-based navigation\r\n event.preventDefault();\r\n\r\n // Select appropriate Service\r\n selectService($(this).attr('href'));\r\n\r\n });\r\n\r\n /**\r\n * Monitors the scroll position within the Services panel, in order to highlight sections and swap out the content.\r\n */\r\n\r\n // Establish variables\r\n var\r\n servicesAreaTop = ($('#Services').offset().top - topOffset),\r\n servicesAreaHeight = ($('#Services').height()),\r\n servicesAreaSectionHeight = (servicesAreaHeight / 3),\r\n servicesScrollRegion = (servicesAreaTop + servicesAreaHeight),\r\n sectionCloudStart = (servicesAreaTop + servicesAreaSectionHeight),\r\n sectionCmsStart = (sectionCloudStart + servicesAreaSectionHeight);\r\n\r\n // Calculate selected service on scroll\r\n $(window).scroll(function() {\r\n\r\n var scrollPosition = $(window).scrollTop();\r\n\r\n // Highlight Cloud-based APIs section\r\n if (scrollPosition >= sectionCloudStart && scrollPosition < sectionCmsStart) {\r\n selectService('#CloudAPIService');\r\n }\r\n\r\n // Highlight Responsive Web Apps section\r\n if (scrollPosition >= servicesAreaTop && scrollPosition < sectionCloudStart) {\r\n selectService('#DatabaseService');\r\n }\r\n\r\n // Highlight Content Management Systems section\r\n if (scrollPosition >= sectionCmsStart && scrollPosition < servicesScrollRegion) {\r\n selectService('#CMSService');\r\n }\r\n\r\n });\r\n\r\n});\r\n\r\n/**\r\n * Sets the \"active\" class on the Service category navigation as well as the associated details area on click of the category\r\n * navigation. Also moves the indicator arrow on the details area border.\r\n *\r\n * @param {string} selectedService - The HREF value for the selected service category.\r\n */\r\nfunction selectService(selectedService) {\r\n 'use strict';\r\n\r\n // Establish variables\r\n var arrowIndicator = '.panel.services div.details:before, .panel.services div.details:after';\r\n\r\n // Set the \"active\" class on the navigation and associated service category content\r\n $('.panel.services .categories.navigation ul li a, .panel.services .details article').blur().removeClass('active');\r\n $('nav.categories.navigation li a[href=\"' + selectedService + '\"], ' + selectedService).addClass('active');\r\n\r\n // Set position of indicator arrow on details area border\r\n if (selectedService === '#CloudAPIService') {\r\n $(arrowIndicator).css('left', '33%');\r\n }\r\n else if (selectedService === '#CMSService') {\r\n $(arrowIndicator).css('left', 'auto').css('right', '0');\r\n }\r\n else {\r\n $(arrowIndicator).css('left', '0');\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Performs Contact form validation\r\n */\r\nfunction validateForm() {\r\n var inputsWithValues = 0;\r\n\r\n // Get all input fields except for type='submit'\r\n var formInputs = $(\"input:not([type='submit']), textarea\");\r\n var messageBody = $('#ContactMessage');\r\n\r\n // Increment the counter for inputs that have a value\r\n formInputs.each(function (e) {\r\n if ($(this).val()) {\r\n inputsWithValues += 1;\r\n }\r\n });\r\n\r\n // If the form is valid, enable the submit button\r\n if (inputsWithValues == formInputs.length && messageBody.val().length >= 20) {\r\n $(\"button[type=submit]\").prop(\"disabled\", false);\r\n } else {\r\n $(\"button[type=submit]\").prop(\"disabled\", true);\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Ensures the length of the Contact form message field\r\n */\r\nfunction checkMessageLength() {\r\n if ($('#ContactMessage').val().length < 20) {\r\n $('#MessageLengthMessage').removeClass('hidden');\r\n }\r\n else {\r\n $('#MessageLengthMessage').addClass('hidden');\r\n }\r\n}\r\n\r\n"],"names":["selectService","selectedService","arrowIndicator","$","blur","removeClass","addClass","css","validateForm","inputsWithValues","formInputs","messageBody","each","e","this","val","length","prop","checkMessageLength","window","width","topOffset","height","headingBuffer","smoothScrollOptions","animationDuration","offset","servicesAreaTop","Foundation","SmoothScroll","outerHeight","adjustedHeight","on","preventDefault","contactFormData","serialize","ajax","type","data","url","done","textStatus","jqXHR","fail","always","scroll","menuItem","scrollPosition","scrollTop","top","setActiveNavigation","click","event","attr","servicesAreaHeight","servicesAreaSectionHeight","servicesScrollRegion","sectionCloudStart","sectionCmsStart"],"mappings":"AAsKA,SAASA,cAAcC,GACrB,aAGA,IAAIC,EAA4B,wEAGhCC,EAAE,kFAAkF,EAAEC,KAAK,EAAEC,YAAY,QAAQ,EACjHF,EAAE,wCAA0CF,EAAkB,OAASA,CAAe,EAAEK,SAAS,QAAQ,EAGjF,qBAApBL,EACFE,EAAED,CAAc,EAAEK,IAAI,OAAQ,KAAK,EAER,gBAApBN,EACPE,EAAED,CAAc,EAAEK,IAAI,OAAQ,MAAM,EAAEA,IAAI,QAAS,GAAG,EAGtDJ,EAAED,CAAc,EAAEK,IAAI,OAAQ,GAAG,CAGrC,CAKA,SAASC,eACP,IAAIC,EAA4B,EAG5BC,EAA4BP,EAAE,sCAAsC,EACp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