Air Canada - The Official Website (2024)

Offers

'; for (var j = 0; j < set.length; j++) { var unit = set[j]; carousHTML += '

' + loadingSvg; if (gamHeaderScript && unit.gamAdID) { carousHTML += '

'; carousHTML += "

"; gam_list.push(unit.gamAdID); } else if (unit.img && !unit.img.imageLink) { carousHTML += '

'; if (unit.img.newGenImg) { carousHTML += "

Air Canada - The Official Website (1)" } else { carousHTML += "Air Canada - The Official Website (2)" } } else if (unit.img) { carousHTML += '

'; if (unit.img.trackcode) { carousHTML += "'; } else { carousHTML += '

'; } if (unit.img.newGenImg) { carousHTML += "" } else { carousHTML += "" } carousHTML += '

'; } carousHTML += '

'; if (!(unit.gamAdID) || !gamHeaderScript) { carousHTML += '

'; carousHTML += '

' + unit.title + '

'; carousHTML += '

' + unit.text + '

'; if (unit.link && unit.link.trackcode) { carousHTML += "' + unit.link.text + ''; } else if (unit.link) { carousHTML += '' + unit.link.text + ''; } carousHTML += '

'; } carousHTML += '

'; } carousHTML += '

'; } carousHTML += '

'; if (carousJSON.length > 1) { carousHTML += '

'; carousHTML += '

'; carousHTML += ''; carousHTML += ''; carousHTML += ''; carousHTML += ''; carousHTML += ''; carousHTML += ''; carousHTML += '

'; carousHTML += '

'; carousHTML += ''; carousHTML += ''; for (var i = 0; i < carousJSON.length; i++) { carousHTML += ''; } carousHTML += '

'; carousHTML += "Previous"; carousHTML += '

'; carousHTML += '

' + (i + 1) + ' of ' + (carousJSON.length + 1) + '

'; carousHTML += '

'; carousHTML += "Next"; carousHTML += '

'; carousHTML += '

'; carousHTML += '

'; } var elementCarous = document.getElementById("carousal_0"); if (elementCarous) { elementCarous.innerHTML = carousHTML; } if (gamHeaderScript && !(window.flags && window.flags.enableNewOfferGrid)) { window.gamAdConfig = { script: headerScriptTag, ads: gam_list } } } this.isHomePageCheck = function() { if ( window.location.pathname.indexOf("home.html") === -1 || (window.location.hash.indexOf("#/") > -1 && window.location.hash.indexOf("#/home") === -1 && window.location.hash != "#/") ) { return false; } return true; }; var jsonObj = '{\x27carousels\x27:[{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dmotherday21.jpg?v1\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dmotherday21.webp?v1\x27,\x27alt\x27:\x27Make Mom\\u2019s day with the gift of travel \x27,\x27imageLink\x27:\x27\/ca\/en\/aco\/home\/book\/payment\u002Dmethods\/air\u002Dcanada\u002Dgift\u002Dcards.html?icid=INT:INTR:motherday\u002DgiftCard:210426::banneracdotcom|caen\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Make Mom\\u2019s day with the gift of travel \x27,\x27text\x27:\x27Treat her with the present that\\u2019s full of possibility and never expires. Give her an Air Canada Gift Card she can put toward flights, seat selection and more!\x27,\x27link\x27:{\x27href\x27:\x27\/ca\/en\/aco\/home\/book\/payment\u002Dmethods\/air\u002Dcanada\u002Dgift\u002Dcards.html?icid=INT:INTR:motherday\u002DgiftCard:210426::textacdotcom|caen\x27,\x27text\x27:\x27Buy now \x27,\x27trackcode\x27:\x27\x27},\x27dates\x27:[{\x27start\x27:\x27Mon Apr 26 12:00:00 GMT 2021\x27,\x27end\x27:\x27Tue Apr 27 04:00:00 GMT 2021\x27,\x27starttime\x27:1619438400000,\x27endtime\x27:1619496000000}]},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002DmotherDay\u002D21\u002Den.png\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002DmotherDay\u002D21\u002Den.webp\x27,\x27alt\x27:\x27Make Mom\\u2019s day and get up to 5X the points \x27,\x27imageLink\x27:\x27https:\/\/aeroplan.rewardops.com\/en\u002DCA\/category\u002Ddetails\/CAT_APM_000023\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Make Mom\\u2019s day and get up to 5X the points \x27,\x27text\x27:\x27This Mother\\u2019s Day, spoil mom with the perfect gift and earn up to 5X the points when you shop the Aeroplan eStore now through May 9, 2021. \x27,\x27link\x27:{\x27href\x27:\x27https:\/\/aeroplan.rewardops.com\/en\u002DCA\/category\u002Ddetails\/CAT_APM_000023\x27,\x27text\x27:\x27Shop now \x27,\x27trackcode\x27:\x27\x27},\x27dates\x27:[{\x27start\x27:\x27Mon Apr 26 04:00:00 GMT 2021\x27,\x27end\x27:\x27Mon May 03 04:00:00 GMT 2021\x27,\x27starttime\x27:1619409600000,\x27endtime\x27:1620014400000}]},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Destore\u002Dapple\u002Den.png\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Destore\u002Dapple\u002Den.webp\x27,\x27alt\x27:\x27Earn 7x points at Apple until Apr 30\x27,\x27imageLink\x27:\x27https:\/\/aeroplan.rewardops.com\/en\u002DCA\/affiliate\u002Ddetails\/apple\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Earn 7x points at Apple until April 30\x27,\x27text\x27:\x27From April 28\\u201330, earn 7X the Aeroplan points at Apple on all eligible products, including iPhone 12 models, Apple Watch and more.\x27,\x27link\x27:{\x27href\x27:\x27https:\/\/aeroplan.rewardops.com\/en\u002DCA\/affiliate\u002Ddetails\/apple\x27,\x27text\x27:\x27Shop now\x27,\x27trackcode\x27:\x27\x27},\x27dates\x27:[{\x27start\x27:\x27Wed Apr 28 04:00:00 GMT 2021\x27,\x27end\x27:\x27Sat May 01 04:00:00 GMT 2021\x27,\x27starttime\x27:1619582400000,\x27endtime\x27:1619841600000}]},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dac\u002Drefunds.png\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dac\u002Drefunds.webp\x27,\x27alt\x27:\x27Get your refund started\x27,\x27imageLink\x27:\x27https:\/\/www.aircanada.com\/refundrequest\/?lang=en\u002DCA\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Get your refund started\x27,\x27text\x27:\x27We are now processing refund requests for flights affected by COVID\u002D19.\x27,\x27link\x27:{\x27href\x27:\x27https:\/\/www.aircanada.com\/refundrequest\/?lang=en\u002DCA\x27,\x27text\x27:\x27Get started\x27,\x27trackcode\x27:\x27\x27},\x27dates\x27:[{\x27start\x27:\x27Wed Apr 28 04:00:00 GMT 2021\x27,\x27end\x27:\x27Sat Apr 30 04:00:00 GMT 2022\x27,\x27starttime\x27:1619582400000,\x27endtime\x27:1651291200000}]},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dnhl\u002Dcommunity.png\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dnhl\u002Dcommunity.webp\x27,\x27alt\x27:\x27Air Canada Fan Flight is back, in a unique way.\x27,\x27imageLink\x27:\x27\/ca\/en\/aco\/home\/book\/special\u002Doffers\/fan\u002Dflight.html?acid=:INT:DSP:fan\u002Dflight:ACO:042621::Carousel\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Air Canada Fan Flight is back, in a unique way.\x27,\x27text\x27:\x27We\\u2019re giving a shoutout to sports fans and leaders across the country that deserve all our appreciation, for making a difference in their communities.\x27,\x27link\x27:{\x27href\x27:\x27\/ca\/en\/aco\/home\/book\/special\u002Doffers\/fan\u002Dflight.html?acid=:INT:DSP:fan\u002Dflight:ACO:042621::Carousel\x27,\x27text\x27:\x27Watch now\x27,\x27trackcode\x27:\x27\x27},\x27dates\x27:[{\x27start\x27:\x27Tue Apr 27 04:00:00 GMT 2021\x27,\x27end\x27:\x27Tue Apr 27 04:00:00 GMT 2021\x27,\x27starttime\x27:1619496000000,\x27endtime\x27:1619496000000}]}],\x27fillers\x27:[{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Daeroplan\u002Dacquisition.jpg\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Daeroplan\u002Dacquisition.webp\x27,\x27alt\x27:\x27Be part of the transformed Aeroplan.\x27,\x27imageLink\x27:\x27\/ca\/en\/aco\/home\/aeroplan.html?acid=:INT:DSP:BrandSoftLaunch:ACO:11092020:123120:Carousel\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Be part of the transformed Aeroplan.\x27,\x27text\x27:\x27Earn faster. Fly sooner. Redeem for more. Aeroplan is made for members like you. \x27,\x27link\x27:{\x27href\x27:\x27\/ca\/en\/aco\/home\/aeroplan.html?acid=:INT:DSP:BrandSoftLaunch:ACO:11092020:123120:Carousel\x27,\x27text\x27:\x27Join now \x27,\x27trackcode\x27:\x27\x27}},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dglobal\u002Dtravel\u002Dawards.jpg\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/carousel\u002Dglobal\u002Dtravel\u002Dawards.webp\x27,\x27alt\x27:\x27Each award means the world\x27,\x27imageLink\x27:\x27\/ca\/en\/aco\/home\/book\/special\u002Doffers\/awards.html?icid=INT:INTR:global\u002Dtravel\u002Dawards:121520::bannerdotcomaco|caen\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Each award means the world\x27,\x27text\x27:\x27Winning nine new awards from Global Traveler, Trazee Travel<\\\/em>, and Wherever Family<\\\/em> has us flying, but none of it would be possible without you!\x27,\x27link\x27:{\x27href\x27:\x27\/ca\/en\/aco\/home\/book\/special\u002Doffers\/awards.html?icid=INT:INTR:global\u002Dtravel\u002Dawards:121520::textdotcomaco|caen\x27,\x27text\x27:\x27Learn more\x27,\x27trackcode\x27:\x27\x27}},{\x27img\x27:{\x27src\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/Preferred\u002DSeats.jpg\x27,\x27newGenImg\x27:\x27\/content\/dam\/aircanada\/portal\/images\/home\/carousel\/Preferred\u002DSeats.webp\x27,\x27alt\x27:\x27Extras worth the little extra\x27,\x27imageLink\x27:\x27\/ca\/en\/aco\/home\/fly\/onboard\/preferred\u002Dseats.html?icid=INT:INTR:preferred\u002Dseats:spOffer:090418:091218:textacdotcom|caen\x27,\x27trackcode\x27:\x27\x27},\x27title\x27:\x27Extras worth the little extra\x27,\x27text\x27:\x27Enjoy greater comfort on your flight with more space, early boarding and first access to overhead storage: relax with a Preferred Seat. \x27,\x27link\x27:{\x27href\x27:\x27\/ca\/en\/aco\/home\/fly\/onboard\/preferred\u002Dseats.html?icid=INT:INTR:preferred\u002Dseats:spOffer:090418:091218:textacdotcom|caen\x27,\x27text\x27:\x27Learn more\x27,\x27trackcode\x27:\x27\x27}}],\x27gam\x27:{\x27gamHeaderScript\x27:\x27var authState = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.authState!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.authState : \x26#39;NULL\x26#39;;\\nvar mrcFlag = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.aco \x26\x26 digitalDataAC.userInfo.aco.mrc!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.aco.mrc : \x26#39;NULL\x26#39;;\\nvar amh_flag = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.aco \x26\x26 digitalDataAC.userInfo.aco.amh_flag!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.aco.amh_flag : \x26#39;NULL\x26#39;;\\nvar thFlag = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.aco \x26\x26 digitalDataAC.userInfo.aco.th_flag!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.aco.th_flag : \x26#39;NULL\x26#39;;\\nvar chFlag = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.aco \x26\x26 digitalDataAC.userInfo.aco.ch_flag!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.aco.ch_flag : \x26#39;NULL\x26#39;;\\nvar aeroplanStatus = (digitalDataAC \x26\x26 digitalDataAC.userInfo \x26\x26 digitalDataAC.userInfo.aco \x26\x26 digitalDataAC.userInfo.aco.category!==\x26#39;\x26#39;) ? digitalDataAC.userInfo.aco.category : \x26#39;NULL\x26#39;;\\nvar mcid = (_satellite \x26\x26 _satellite.getVisitorId()) ? _satellite.getVisitorId().getMarketingCloudVisitorID() : \x26#39;NULL\x26#39;;\\nvar language = (digitalDataAC \x26\x26 digitalDataAC.siteInfo \x26\x26 digitalDataAC \x26\x26 digitalDataAC.siteInfo.language!==\x26#39;\x26#39;) ? digitalDataAC.siteInfo.language : \x26#39;NULL\x26#39;;\\nvar siteEdition = (digitalDataAC \x26\x26 digitalDataAC.siteInfo \x26\x26 digitalDataAC \x26\x26 digitalDataAC.siteInfo.siteEdition!==\x26#39;\x26#39;) ? digitalDataAC.siteInfo.siteEdition : \x26#39;NULL\x26#39;;\\n\\n \\nvar gptAdSlots = []; \/\/ Created the Array To Get BrowserSize,Ad Size\\n googletag.cmd.push(function() {\\n var adSizes = googletag.sizeMapping()\\n .addSize([1024,0],[390, 390])\\n .addSize([768,0],[236, 380])\\n .addSize([320,0],[355, 390])\\n .build();\\n gptAdSlots[0]=googletag.defineSlot(\x26#39;\/21884589357\/aircanada.com\/Air_Canada_Homepage\/Special_Offer_Carousel\/slot\u002D2\x26#39;, [[390, 390], [236, 380], [355, 390]], \x26#39;div\u002Dgpt\u002Dad\u002Dso\u002D2\x26#39;).\\n defineSizeMapping(adSizes)\\n.setTargeting(\x26#39;Auth\x26#39;, authState)\\n\\t.setTargeting(\x26#39;MRC\x26#39;, mrcFlag.toString())\\n\\t.setTargeting(\x26#39;AmH_Flag\x26#39;, amh_flag.toString())\\n\\t.setTargeting(\x26#39;TH_Flag\x26#39;, thFlag.toString())\\n\\t.setTargeting(\x26#39;CH_Flag\x26#39;, chFlag.toString())\\n\\t.setTargeting(\x26#39;Aeroplan_Status\x26#39;, aeroplanStatus)\\n\\t.setTargeting(\x26#39;Language\x26#39;, language)\\n\\t.setTargeting(\x26#39;Site_Edition\x26#39;, siteEdition)\\n\\t.setTargeting(\x26#39;MCID\x26#39;, mcid).addService(googletag.pubads());\\n googletag.pubads().collapseEmptyDivs();\\n googletag.pubads().enableSingleRequest();\\n googletag.enableServices();\\n});\x27,\x27gamAds\x27:[]}}'; var stepSize = 3; var interval = +('12'); // var serverTime = ServiceContext.get('server-time'); // var d = new Date(); var now = new Date(); var utc_now = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()); var serverTime = now.getTime(); try { jsonObj = JSON.parse(jsonObj.replace(/'/g, '\"')); } catch (error) { console.error(error); } var current = 0; var BY = stepSize; var isAttentionInCarousel = false; var isPaused = false; var sets = []; var browserVersion = 999; if (Function('/*@cc_on return document.documentMode===10@*/')()) { browserVersion = 10; } if (document.documentElement.className.indexOf('lt-ie10') >= 0) { browserVersion = 9; } if (document.documentElement.className.indexOf('lt-ie9') >= 0) { browserVersion = 8; } function isBetterThan(version) { return browserVersion > version; } var BREAKPOINT = { // xs 'sm': 768, // sm 'md': 1024, // md 'lg': 1200 // lg }; function isBreakpointLessThan(point) { return getWidth() < BREAKPOINT[point]; } function getWidth() { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; } // override step for `xs` var BY = isBreakpointLessThan('sm') ? 1 : BY; var units = jsonObj.carousels.filter(function (cUnit) { return cUnit.dates.some(function (cDate) { return cDate['starttime'] <= serverTime && serverTime <= cDate['endtime']; }) }); if (jsonObj && jsonObj.gam && jsonObj.gam.gamAds && window.google_tag_manager) { jsonObj.gam.gamAds.forEach(function(value, index) { if(value.gamAdPosition && value.gamAdPosition!='') { units.splice(parseInt(value.gamAdPosition)-1, 0, value); } else { units.push(value); } }); } /** PTR 10694491 [Medium]: WWW-AC-NWP-UAT: WWW-AC-NWP-UAT:Viewpoint issues - responsive design on window resize construct the carousel sets again and get everything to initial state **/ window.addEventListener('resize', function () { resetCarouselOnResize(); }); window.addEventListener('orientationchange', function () { resetCarouselOnResize(); }); resetCarouselOnResize = function () { setTimeout(function () { BY = stepSize; BY = isBreakpointLessThan('sm') ? 1 : BY; resetCarouselItems(); }, 0); } /** function resetCarouselItems @param ""; @returns ""; function to reset the carousel step to start and construct the carousel sets depending upon the viewport **/ resetCarouselItems = function () { current = 0; changeSetBy(0); constructCarouselSets(); updateStyle(); } // fill with fillers for (var i = 0; (units.length === 0 || units.length % this.BY !== 0) && i < jsonObj.fillers.length; i++) { units.push(Object.assign({}, (jsonObj.fillers[i]))); } // group into sets of step size constructCarouselSets = function () { sets = []; units.forEach(function (cUnit, index) { if (!sets[Math.floor(index / BY)]) { sets[Math.floor(index / BY)] = []; } sets[Math.floor(index / BY)].push(cUnit); }); } constructCarouselSets(); var updateStyle = function () { if (isBetterThan(10)) { var wrapperStyle = { width: sets.length * 100 + '%', transform: 'translateX(-' + 100 * current / sets.length + '%)' }; var setStyle = { width: 100 / sets.length + '%' }; if (document.getElementById('carousel-set-wrapper')) { document.getElementById('carousel-set-wrapper').style.width = wrapperStyle.width; document.getElementById('carousel-set-wrapper').style.msTransform = wrapperStyle.transform; document.getElementById('carousel-set-wrapper').style.mozTransform = wrapperStyle.transform; document.getElementById('carousel-set-wrapper').style.webkitTransform = wrapperStyle.transform; document.getElementById('carousel-set-wrapper').style.transform = wrapperStyle.transform; } for (var i = 0; i < sets.length; i++) { if (document.getElementById('carousel-set-' + i)) { document.getElementById('carousel-set-' + i).style.width = setStyle.width; } } } else { var wrapperStyle = { width: sets.length * 100 + '%' }; var setStyle = { width: 100 / sets.length + '%' }; } }; function hideElements(prevIndex) { for (var i = 0; i < sets[prevIndex].length; i++) { if (document.getElementById("carousel_" + prevIndex + "_unitlink_" + i)) { document.getElementById("carousel_" + prevIndex + "_unitlink_" + i).setAttribute('tabindex', -1); } } var el = document.getElementById("carousel_0_pager_" + prevIndex); if (el) { if (el.classList) { el.classList.remove("active"); } else { el.className = el.className.replace(new RegExp('(^|\\b)' + "active".split(' ').join('|') + '(\\b|$)', 'gi'), ' '); } el.setAttribute('aria-expanded', false); } el = document.getElementById("carousel-set-" + prevIndex); if (el) { el.setAttribute('aria-hidden', true); } } function showElements(nextIndex, clk) { for (var i = 0; i < sets[nextIndex].length; i++) { if (document.getElementById("carousel_" + nextIndex + "_unitlink_" + i)) { document.getElementById("carousel_" + nextIndex + "_unitlink_" + i).setAttribute('tabindex', 0); } } var el = document.getElementById("carousel_0_pager_" + nextIndex); if (el) { if (el.classList) { el.classList.add("active"); } else { el.className += ' active'; } el.setAttribute('aria-expanded', true); } el = document.getElementById("carousel-set-" + nextIndex); if (el) { el.setAttribute('aria-hidden', false); } if (typeof clk !== "undefined") { setTimeout(function () { $("#carousel_" + nextIndex + "_unitlink_0").parents(".carousel-unit").focus(); }, 100); } } var changeSet = function (targetIndex, clk) { hideElements(current); current = targetIndex; showElements(current, clk); updateStyle(); }; var changeSetBy = function (byCount) { var targetIndex = (current + sets.length + byCount) % sets.length; changeSet(targetIndex); }; //initialize function initCarousel() { generateCarouselHTML(sets); var el = document.getElementById("carousel_0_pager_0"); if (el) { if (el.classList) { el.classList.add("active"); } else { el.className += ' active'; } el.setAttribute('aria-expanded', true); } updateStyle(); } initCarousel(); setInterval(function () { if (!isAttentionInCarousel && !isPaused) { changeSetBy(+1); } }, interval * 1000); // events swipe and drag var xBeginPointer, isPointerDown = false, THRESHOLD_X = 20; var currElem = document.getElementById("carousal_0"); var pauseElem = document.getElementById("carouselPauseBtn"); var playElem = document.getElementById("carouselPlayBtn"); if(pauseElem && playElem) { pauseElem.addEventListener("click", function () { isPaused = true; pauseElem.setAttribute('style', 'display:none'); playElem.setAttribute('style', ''); playElem.focus(); }); playElem.addEventListener("click", function () { isPaused = false; playElem.setAttribute('style', 'display:none'); pauseElem.setAttribute('style', ''); pauseElem.focus(); }); } if (currElem) { currElem.addEventListener("pointerdown", function (event) { isPointerDown = true; xBeginPointer = event.clientX; }); currElem.addEventListener("mouseenter", function () { isAttentionInCarousel = true; }) currElem.addEventListener("focusin", function () { isAttentionInCarousel = true; }) currElem.addEventListener("mouseleave", function () { isAttentionInCarousel = false; }) currElem.addEventListener("focusout", function () { isAttentionInCarousel = false; }) }

'; parentEle ? parentEle.insertAdjacentHTML( 'beforeend', loadingSvg ) : ""; } } function isHomePageCheck() { if ( window.location.pathname.indexOf("home.html") === -1 || (window.location.hash.indexOf("#/") > -1 && window.location.hash.indexOf("#/home") === -1 && window.location.hash != "#/") ) { return false; } return true; }; createLoader(); function triggerOfferGridCreation() { if (!offerGridPrepared) { offerGridPrepared = true; } else { return false; } createOfferGrid(); } function createOfferGrid() { var listOfOffers = filteredJsonObj; var numberOfImageInRow = 0; if (isBreakpointLessThan('sm')) { numberOfImageInRow = imagePerRow.mobile; } else if (isBreakpointLessThan('md')) { numberOfImageInRow = imagePerRow.ipad; } else { numberOfImageInRow = imagePerRow.desktop } var initialNumberOfImage = Math.min(listOfOffers.length, numberOfImageInRow); var parentEle = document.getElementById("grid-container"); if (parentEle) { parentEle.innerHTML = ""; for (var i = 0; i < listOfOffers.length; i++) { var currentCard = createOfferCard(listOfOffers[i], i); parentEle.appendChild(currentCard); if (gamHeaderScript && listOfOffers[i] && listOfOffers[i].gamAdID) { window.gamAdConfig = { script: headerScriptTag, ads: gam_list } } } // add the news section after all offer cards added addNewsSection(); } } function addNewsSection() { var parentEle = document.getElementById("grid-container"); var newsEle = document.getElementsByClassName("travel-news-container"); if (parentEle && newsEle) { var newsWrap = document.createElement('div'); newsWrap.className += "news-card mob-12 ipad-mini-12 desktop-4"; newsWrap.tabIndex = "0"; newsWrap.appendChild(newsEle[0]); parentEle.appendChild(newsWrap); } } function createOfferCard(currentObj, index) { var offersCardDiv = document.createElement('div'); offersCardDiv.className += " offers-card mob-12 ipad-mini-6 desktop-4"; offersCardDiv.tabIndex = "0"; if (gamHeaderScript && currentObj.gamAdID) { offersCardDiv.className += " gam-ad-wrapper"; var descContainer = document.createElement('div'); descContainer.id = currentObj.gamAdID; gam_list.push(currentObj.gamAdID); offersCardDiv.appendChild(descContainer); } else if (currentObj && currentObj.img) { var imagePath = currentObj.img.src ? currentObj.img.src : currentObj.img.newGenImg; var analyticsIndex = index + 1; if (!isBreakpointLessThan('sm') && !isBreakpointLessThan('md')) { /*if last row has less than 3 element first elelemnt of last row will occupy two spaces*/ try { if (filteredJsonObj.length % 3 === 2 && index === filteredJsonObj.length - 2) { var dicoverImgIndex = filteredJsonObj.findIndex((fillerobj) => { return fillerobj.isDiscoverImg }); if (dicoverImgIndex) { var moveToLastImg = filteredJsonObj[dicoverImgIndex]; filteredJsonObj[dicoverImgIndex] = " "; filteredJsonObj[index] = Object.assign({}, (moveToLastImg)); currentObj = moveToLastImg; imagePath = currentObj.img.src ? currentObj.img.src : currentObj.img.newGenImg; } } } catch (error) { } } if (!isBreakpointLessThan('sm') && isBreakpointLessThan('md')) { // if index is last index and if that index is if ((index === filteredJsonObj.length - 1 && filteredJsonObj.length % 2 !== 0) || currentObj.isDiscoverImg) { offersCardDiv.className += " ipad-mini-12 discover-block"; } else { offersCardDiv.className += " ipad-mini-6"; } } else { offersCardDiv.className += " ipad-mini-6"; } if (!isBreakpointLessThan('sm') && !isBreakpointLessThan('md')) { if ((index === filteredJsonObj.length - 2 || index === filteredJsonObj.length - 1) && currentObj.isDiscoverImg) { offersCardDiv.className += " desktop-8 discover-block"; } else { offersCardDiv.className += " desktop-4"; } } else { offersCardDiv.className += " desktop-4"; } if (isBreakpointLessThan('sm')) { if ((index === filteredJsonObj.length - 2 || index === filteredJsonObj.length - 1) && currentObj.isDiscoverImg) { offersCardDiv.classList.remove("discover-block"); } } var anchorEle = document.createElement('a'); if (currentObj.img.trackcode) { anchorEle.href = "javascript:advTracking('" + currentObj.img.imageLink + "','" + currentObj.img.trackcode + "')"; } else { anchorEle.href = currentObj.img.imageLink; } anchorEle.setAttribute('aria-hidden', true); anchorEle.setAttribute('tabindex', -1); var img = document.createElement('img'); img.src = imagePath; img.alt = currentObj.img.alt; img.style.width = "100%"; anchorEle.appendChild(img); anchorEle.setAttribute("data-analytics-track", (currentObj.isDiscoverImg) ? "homepage-discover" : "homepage-carousel"); anchorEle.setAttribute("data-analytics-val", ((currentObj.isDiscoverImg) ? 1 : analyticsIndex) +":"+ imagePath); anchorEle.setAttribute("data-analytics-type", "aem-img"); offersCardDiv.appendChild(anchorEle); var descContainer = document.createElement('div'); descContainer.className += " desc-container"; var titleDiv = document.createElement("div"); titleDiv.className += " title"; titleDiv.innerHTML = currentObj.title; descContainer.appendChild(titleDiv); var subtextDiv = document.createElement("div"); subtextDiv.className += " Subtext"; subtextDiv.innerHTML = currentObj.text; var subtextDivAnchor = document.createElement('a'); subtextDivAnchor.setAttribute("data-analytics-track", (currentObj.isDiscoverImg) ? "homepage-discover" : "homepage-carousel"); subtextDivAnchor.setAttribute("data-analytics-val", ((currentObj.isDiscoverImg) ? 1 : analyticsIndex) +":"+ imagePath); subtextDivAnchor.setAttribute("data-analytics-type", "aem-cta"); subtextDivAnchor.innerText = currentObj.link.text; if (currentObj.link.trackcode) { subtextDivAnchor.href = "javascript:advTracking('" + currentObj.link.href + "','" + currentObj.link.trackcode + "')" } else { subtextDivAnchor.href = currentObj.link.href; } subtextDiv.appendChild(subtextDivAnchor); descContainer.appendChild(subtextDiv); offersCardDiv.appendChild(descContainer); } return offersCardDiv; }
Air Canada - The Official Website (2024)

References

Top Articles
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6275

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.