{"version":3,"sources":["app/home.js"],"names":["define","$","document","ready","slick","slidesToShow","slidesToScroll","dots","arrows","autoplay","infinite","autoplaySpeed","initialSlide","articleHeight","$homeWrapper","$links","not","$close","$slideIn","$slideInContent","$homeMain","click","e","window","innerWidth","preventDefault","addClass","animate","right","scrollTo","left","guid","this","attr","type","ajaxUrl","ajax","url","done","p","html","event","trigger","opacity","outerHeight","css","removeClass","body","scrollTop","$showcaseEl","$showcaseLink","find","width","navigator","userAgent","match","on","mouseenter","mouseleave"],"mappings":"AAAAA,QAAQ,SAAU,SAAU,SAAUC,GAElCA,EAAEC,UAAUC,MAAM,WACdF,EAAE,oBAAoBG,OACpBC,aAAc,EACdC,eAAgB,EAChBC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVC,cAAe,IACfC,aAAc,MAIpB,IAMIC,EANAC,EAAeb,EAAE,gBACjBc,EAASd,EAAE,eAAee,IAAI,kBAAkBA,IAAI,aACpDC,EAAShB,EAAE,iCACXiB,EAAWjB,EAAE,gBACbkB,EAAkBlB,EAAE,kCACpBmB,EAAYnB,EAAE,aAMlBc,EAAOM,MAAM,SAAUC,GAInB,GAAIC,OAAOC,WAAa,IAAK,CAGzBF,EAAEG,iBAGFX,EAAaY,SAAS,eAGtBR,EAASS,SAAUC,MAAO,OAAS,WAC/BL,OAAOM,SAAS,EAAG,KAIvBT,EAAUO,SAAUG,KAAM,QAE1B,IAAIC,EAAO9B,EAAE+B,MAAMC,KAAK,aACpBC,EAAOjC,EAAE+B,MAAMC,KAAK,aACpBE,EAAU,qCAGVA,GADQ,cAARD,EACW,uCAAyCH,EACvC,WAARG,EACM,oCAAsCH,EAEtC,kCAAoCA,EAEnD9B,EAAEmC,MAAOC,IAAKF,IACXG,KAAK,SAAUC,GAGZpB,EAAgBqB,KAAKD,GAErBtC,EAAEwC,MAAMC,SACJR,KAAM,uBAIVhB,EAASS,SAAUgB,QAAS,GAAK,WAG7B9B,EAAgBM,EAAgByB,cAIhCxB,EAAUM,SAAS,eAAemB,IAAI,SAAUhC,EAAgB,YAOlFI,EAAOI,MAAM,WAETP,EAAagC,YAAY,eAGzB1B,EAAU0B,YAAY,eAAeD,IAAI,SAAU,QAEnD3B,EAASS,SAAUC,MAAO,QAAU,WAChC3B,EAAE+B,MAAML,SAAUgB,QAAS,MAI/B,IAAII,EAAO9C,EAAE,cACbmB,EAAUO,SAAUG,KAAM,MAC1BiB,EAAKpB,SAAUqB,UAAW,MAK9B,IAAIC,EAAchD,EAAE,aAChBiD,EAAgBD,EAAYE,KAAK,mBACvBlD,EAAEsB,QAIJ6B,QAAU,MACiC,MAAtCC,UAAUC,UAAUC,MAAM,UAMnCL,EAAcM,IACVC,WAAY,WACRR,EAAYvB,SAAS,iBACtBgC,WAAY,WACXT,EAAYH,YAAY","file":"home.js","sourcesContent":["define(['jquery', 'slick'], function ($) {\r\n\r\n    $(document).ready(function(){\r\n        $('.showcase-slides').slick({\r\n          slidesToShow: 1,\r\n          slidesToScroll: 1,\r\n          dots: true,\r\n          arrows: false,\r\n          autoplay: true,\r\n          infinite: false,\r\n          autoplaySpeed: 5000,\r\n          initialSlide: 0\r\n        });\r\n    });\r\n\r\n    var $homeWrapper = $('.homeWrapper'),\r\n        $links = $('.homeMain a').not('.site-footer a').not('.no-slide'),\r\n        $close = $('.shadowBox, .js-closeSlidein '),\r\n        $slideIn = $('.homeSlideIn'),\r\n        $slideInContent = $('.homeSlideIn .homeSlideContent'),\r\n        $homeMain = $('.homeMain'),\r\n        articleHeight;\r\n\r\n    //attach click event to all linked articles on the homepage, including hero image and featured stories\r\n    //excludes links that do not have an interior page\r\n\r\n    $links.click(function (e) {\r\n\r\n        //for mobile, linked articles will go straight to the detail page\r\n        //otherwise article content will slide and content will be pulled in via ajax\r\n        if (window.innerWidth > 749) {\r\n\r\n            //disable link\r\n            e.preventDefault();\r\n\r\n            //add class to container of main content\r\n            $homeWrapper.addClass('slideActive');\r\n\r\n            //pull Article Container into view, \r\n            $slideIn.animate({ right: '10%' }, function () {\r\n                window.scrollTo(0, 0);\r\n            });\r\n\r\n            //slide main content off canvas\r\n            $homeMain.animate({ left: '90%' });\r\n\r\n            var guid = $(this).attr(\"data-guid\");\r\n            var type = $(this).attr(\"data-type\");\r\n            var ajaxUrl = \"/layouts/WebUserControls/Main/home\";\r\n\r\n            if (type == \"experience\")\r\n                ajaxUrl += '/AjaxLoadExperienceDetail.aspx?Guid=' + guid;\r\n            else if (type == \"insight\")\r\n                ajaxUrl += '/AjaxLoadNewsPubDetail.aspx?Guid=' + guid;\r\n            else\r\n                ajaxUrl += '/AjaxLoadEventDetail.aspx?Guid=' + guid;\r\n\r\n            $.ajax({ url: ajaxUrl })\r\n              .done(function (p) {\r\n\r\n                  //populate pulled content into the article container\r\n                  $slideInContent.html(p);\r\n\r\n                  $.event.trigger({\r\n                      type: \"slideContentLoaded\"\r\n                  });\r\n\r\n                  //FadeIn Article\r\n                  $slideIn.animate({ opacity: 1 }, function () {\r\n\r\n                      //compute the height of the article after the content has loaded\r\n                      articleHeight = $slideInContent.outerHeight();\r\n\r\n                      //adjust the height of the main content thats offscreen to prevent the case when the \r\n                      //main content is much longer than the content from the article which produces a long scrolling window/white space. \r\n                      $homeMain.addClass('js-slideOut').css('height', articleHeight + 200);\r\n                  });\r\n              });\r\n        }\r\n    });\r\n\r\n    //clicking the shadow overlaying the content and the article X icon slides out the article\r\n    $close.click(function () {\r\n\r\n        $homeWrapper.removeClass('slideActive');\r\n\r\n        //remove height from main content\r\n        $homeMain.removeClass('js-slideOut').css('height', 'auto');\r\n\r\n        $slideIn.animate({ right: '100%' }, function () {\r\n            $(this).animate({ opacity: 0 });\r\n        });\r\n\r\n        //slide main content back in to its initial position\r\n        var body = $(\"html, body\");\r\n        $homeMain.animate({ left: '0' });\r\n        body.animate({ scrollTop: 0 });\r\n    });\r\n    //Desktop/Tablet View \r\n    //Adjust the height of the main highlight to take up 2/3 of the viewport\r\n\r\n    var $showcaseEl = $('.showcase'),\r\n        $showcaseLink = $showcaseEl.find('.showcase__link'),\r\n        $window = $(window);\r\n\r\n    //If the viewport fall corresponds to a table device width or desktop width \r\n    //Adjust the height of the showcase\r\n    if ($window.width() > 767) {\r\n        var isiPad = navigator.userAgent.match(/iPad/i) != null;\r\n\r\n        //dont run hover effect on an ipad to prevent double click\r\n        if (!isiPad) {\r\n            //Hover over the link title will add custom class to the container of the showcase which will adjust\r\n            //the opacity of the container\r\n            $showcaseLink.on({\r\n                mouseenter: function () {\r\n                    $showcaseEl.addClass(\"js-is-active\");\r\n                }, mouseleave: function () {\r\n                    $showcaseEl.removeClass(\"js-is-active\");\r\n                }\r\n            });\r\n\r\n        }\r\n    }\r\n});"]}