if (!window.Easing) { window.Easing = { def: 'easeOutQuad', easeOutQuad: function (e, f, a, h, g) { return - h * (f /= g) * (f - 2) + a } } }(function (c, a, d) { function e(f) { return !!f && (typeof f === 'object') && !!f.nodeName && f.nodeName === 'IMG' } c.FrameSwitcher = b; function b(f) { this._init(f) } b.prototype = { _init: function (f) { this._target = (f.async === d) ? { } : f.target; this._currFrame = d; this._fullLoadCallback = d; this._images = [ ]; this._labels = { }; this._numLoadingImages = 0; this._async = (f.async === d) ? true : f.async; this._loadingQueue = [ ] }, _checkLoadComplete: function () { if (typeof this._fullLoadCallback === 'function' && this._numLoadingImages <= 0) { this._fullLoadCallback() } }, _loadFinished: function () { var f; this._numLoadingImages--; if (typeof this._async == 'number' && this._async > this._numLoadingImages) { f = this._loadingQueue.shift(); if (f) { f() } } this._checkLoadComplete() }, _preload: function (g, h, i, k) { var j = this; var f = function () { var l = false; g.onerror = function () { j._loadFinished.call(j) }; g.onload = function () { if (g.width < 1) { return g.onerror() } k(g); j._loadFinished.call(j) }; g.src = h }; if (i) { if (typeof i == 'number' && i <= this._numLoadingImages) { this._loadingQueue.push(function () { this._numLoadingImages++; setTimeout(f, 1) }) } else { this._numLoadingImages++; setTimeout(f, 1) } } else { this._numLoadingImages++; f() } }, pushFrame: function (h, i, f) { var g = this; return g.setFrame(this._images.length, h, i, f) }, setFrame: function (g, j, k, f) { var i = this, h = this._async; if (typeof j === 'object' && e(j)) { if (!this._images[g]) { this._images[g] = new Image() } this._images[g].src = j.src; if (this._currFrame == d) { this._currFrame = g } if (typeof k === 'function') { k(this._images[g], g) } i.setLabel(g, f); return this } else { if (typeof j === 'string') { if (!this._images[g]) { this._images[g] = new Image(); i.setLabel(g, f); if (this._currFrame == d) { this._currFrame = g } } this._preload(this._images[g], j, h, function (l) { if (typeof k === 'function') { k(l, g) } }); return this } } throw 'Bad resource passed to setFrame() method' }, setLabel: function (j, g) { var h = this, i = j; if (((typeof this._images[j] === 'object' && e(this._images[j])) || (typeof this._images[(i = this._labels[g])] === 'object' && e(this._images[i]))) && typeof g === 'string') { this._labels[g] = i } return this }, appendTo: function (g, h) { if (typeof HTMLElement === 'object' ? g instanceof HTMLElement : typeof g === 'object' && g.nodeType === 1 && typeof g.nodeName === 'string') { var f = this; this._target = a.createElement('img'); this._target.setAttribute('src', this._images[this._currFrame].src); g.appendChild(this._target); this._fullLoadCallback = function () { if (typeof h === 'function') { h(f) } }; this._checkLoadComplete() } return this }, showFrame: function (i) { var g = this, h = i; if (i == d) { return this } if ((typeof this._images[i] === 'object' && e(this._images[i]) || typeof this._images[(h = this._labels[i])] === 'object' && e(this._images[h])) && this._target) { this._target.src = this._images[h].src; this._currFrame = h } else { return this } return this }, stepFrame: function (f) { var h = this; f = ~~f; if (f == 0) { return this } else { if (f > 0) { h.showFrame((this._currFrame + f) % h.getLength()) } else { var g = (this._currFrame + f) % h.getLength(); g += g < 0 ? h.getLength() : 0; h.showFrame(g) } } return this }, nextFrame: function () { this.stepFrame(1); return this }, prevFrame: function () { this.stepFrame( - 1); return this }, getCurrentFrame: function () { return this._currFrame }, getFrameImage: function (h) { var g = this, f = null; if (h == d) { return null } if (e((f = this._images[h])) || e((f = this._images[this._labels[h]]))) { return f } else { return null } }, animate: function (l, j, q, n) { n = n || c.Easing.def; l = ~~l; j = ~~j; var o = this, h = this._currFrame, p = l - h, g = Math.abs(j / p), i = 0, k = c.Easing[n], m = o.getLength(); if (typeof k === 'function') { var f = function () { this._animationTimer = setTimeout(function () { i += g; if (i <= j) { var r = Math.floor(k(this._currFrame, i, h, p, j) % m); r += (r < 0) ? m : 0; o.showFrame(r); f() } else { var r = Math.floor(l % m); r += (r < 0) ? m : 0; o.showFrame(r); if (typeof q === 'function') { q(o) } } }, g) }; f() } return this }, stop: function () { interval = 0; return this }, mapCoordToFrame: function (j, f) { var h = this, g = ~~f || 1, i = Math.floor((j / g) % h.getLength()); if (this._currFrame != i) { h.showFrame(i) } return this }, getLength: function () { return this._images.length }, getElement: function () { return this._target } }; return b }) (this, this.document); /** Manages the Hero for VLP modules to include proper BG positioning and tabbing, if necessary. @requires @author [Matt Przybylski](mailto:mprzybylski@sapient.com) @example $('.module').hero(); **/ ; (function ($, window, document, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Private Properties \* ----------------------------------------------------------------------------- */ var pluginName = 'hero', defaults = { }; /* ----------------------------------------------------------------------------- *\ Constructor \* ----------------------------------------------------------------------------- */ /** @constructor **/ function Hero(element, options) { this.settings = $.extend(true, { }, defaults, options); this.element = element; this.$el = $(element); this.$bgContainer = $('#page-background'); this.$details = $('.details', this.$el); this.$tabContainer = $('.tabs', this.$details); this.$tabs = $('a[data-tab]', this.$tabContainer); this.$info = $('.info ', this.$details); if (cllc.context.get('vehicle') == 'grand_cherokee') { $('.white[data-tab="left"]').css('display', 'block'); $('.white[data-tab="right"]').css('display', 'none'); } if (cllc.context.get('vehicle') == 'grand_cherokee') { this.$currentBG = $('img[data-tab="left"]', this.$bgContainer); this.$currentInfo = $('div[data-tab="left"]', this.$info); } else if (cllc.context.get('vehicle') == 'renegade') { this.$currentBG = $('img[data-tab="left"]', this.$bgContainer); this.$currentInfo = $('div[data-tab="left"]', this.$info); } else { this.$currentBG = $('img[data-tab="right"]', this.$bgContainer); this.$currentInfo = $('div[data-tab="right"]', this.$info); } this._init(); } /* ----------------------------------------------------------------------------- *\ Private Methods \* ----------------------------------------------------------------------------- */ /** @method _init @return {null} **/ Hero.prototype._init = function () { var self = this, bgHeight = (this.$currentBG.height() < 620) ? 620 : this.$currentBG.height(); // some browsers report height as 0 or even 21 (?) so if thats the case set it explicitly to the agreed 620px bg height (made by designers) // if more than one tab exists, init the tab functionality if (this.$tabs.length > 1) { this.$info.removeClass('rounded'); this.$tabContainer.show(); this.$tabs.on('click', function (evt) { evt.preventDefault(); var $this = $(this), direction = $this.data('tab'); if ($this.hasClass('active')) { return; } self.$tabs.removeClass('active'); $this.addClass('active'); self.$currentBG.fadeOut(300); self.$currentBG = $('img[data-tab="' + direction + '"]', self.$bgContainer); self.$currentBG.fadeIn(300, function () { // update the height after the fade self.$bgContainer.css('height', $(this).height()); }); self.$currentInfo.toggle(); self.$currentInfo = $('div[data-tab="' + direction + '"]', self.$info); self.$currentInfo.toggle(); if (cllc.context.get('vehicle') == 'grand_cherokee') { self._incentive_bucket_switch(direction); $('.white[data-tab="right"]').toggle(); $('.white[data-tab="left"]').toggle(); } if (cllc.context.get('vehicle') == 'renegade') { self._incentive_bucket_switch(direction); } if (typeof self.$currentIncentiveModule != 'undefined' && self.$currentIncentiveModule.length > 0) { self.$currentIncentiveModule.toggle(); self.$currentIncentiveModule = $('.module.mod-incentives .mod-container[data-tab="' + direction + '"]'); self.$currentIncentiveModule.toggle(); } }); }; Hero.prototype._incentive_bucket_switch = function (getTab) { console.log('aa') $('.mod-container').find('div[data-tab="right"],div[data-tab="left"]').hide(); $('.mod-container').find('div[data-tab="' + getTab + '"]').show(); }; $(window).on('resize', function () { self._onResize(); }); // initialize the correct size this._onResize(); // we assumed a width on the image to ensure it displays (esp in IE), so now remove it and also reset the image height this.$bgContainer.css({ width: 'auto', height: bgHeight }); }; /** Calculates the amount of the the image that's offscreen and sets the right position the negative amount. @method handleResize @param {object} evt The resize event from the window @returns {null} **/ Hero.prototype._onResize = function (evt) { var right = this.$bgContainer.position().left - this.$bgContainer.offset().left; this.$bgContainer.css('right', right - 10); // negative value is to compensate with improper value that caused gutter at the right. if (navigator.platform.indexOf('iPad') != - 1) { this.$bgContainer.css('right', right - 30); } }; /* ----------------------------------------------------------------------------- *\ Plugin Initialization \* ----------------------------------------------------------------------------- */ $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, new Hero(this, options)); } }); }; }) (jQuery, window, document); (function (g, i, p, h) { function n() { var t; var s = cllc.context.get('trim'); if (s === 'srt') { t = '20-inch-polished-aluminium-5-spoke' } else { t = '' } return t } var a = 'modelizer', j = { model: null, color: null, top: null, wheels: null, doors: null, backupTop: n() }, d = false, l = false, m = false, q = true, f = false, e = false, r = false, c = false; function b(t, s) { this.settings = g.extend(true, { }, j, s); this.element = t; this.$el = g(t); this.$image = g('.current-vehicle', this.$el); this.$details = g('.details', this.$el); this.$selectedModelArrow = g('.selected-model', this.$el); this.$modelSelectorContainer = g('.model-items', this.$el); this.$modelSelectors = g('a', this.$modelSelectorContainer); this.$modelContainers = g('.info', this.$el); this.$bg = g('.model_bg', this.$el); this.$modelWheels = g('.wheels', this.$el); this.$modelDoors = g('.doors', this.$el); this.$modelTops = g('.tops', this.$el); this.$colors = g('.colors a', this.$el); this.$tops = g('.tops a', this.$el); this.$wheels = g('.wheels a', this.$el); this.$feature_tab = g('.feature_tab span', this.$el); this.$doors = g('.doors a', this.$el); this.$driveToggle = g('.drive-toggle a', this.$el); this.$disclaimer = g('.disclaimer p', this.$el); this.$msrps = g('.msrp', this.$modelContainers); this.$currentModel = null; this.$currentColor = null; this.$currentTop = null; this.$currentWheel = null; this.checkFlag = false; this.ufaColor = { brand: 'event126', vehicle: 'event156' }; this.pathNameArray = i.location.pathname.split('/'); if (g.inArray('75th-anniversary', this.pathNameArray) >= 0) { this.settings.anniversary = true } else { this.settings.anniversary = false } this._year = cllc.context.get('year'); /* this._vehicle = cllc.context.get('vehicle').replace('_', '-'); 경로:grand_cherokeeì—서 _ 그대로 사용하게 변경 _160502cl */ this._vehicle = cllc.context.get('vehicle').replace('_', '_'); this._currentDrive = '4x2'; g('.selected-model', this.$el).hide(); i.category = 'standard'; if ((cllc.context.get('trim') !== h && cllc.context.get('trim') !== 'srt') || this.settings.anniversary) { if (cllc.context.get('trim') !== h) { this._trim = cllc.context.get('trim').replace(/\s/g, '-') } this.settings.buzzModel = true; this._initBuzzModel() } else { console.log('insied else'); this._init() } } b.prototype._initBuzzModel = function () { if (g('#model .cur-vehicle img').size() === 0 && !this.settings.anniversary) { g('#model .cur-vehicle').html('
') } else { if (this.settings.anniversary) { g('.module.mod-modelizer .cur-vehicle').html('
') } } this.$image = g('.current-vehicle', this.$el); this.$bg = g('.model_bg', this.$el); if (i.location.hash !== '') { if (g.deparam) { g.extend(this.settings, g.deparam.fragment(i.location.hash)) } if (!this.settings.model) { this.settings.model = g('.module.mod-modelizer .info').data('model') } else { this.$currentModel = this.$modelSelectors.filter('[data-model="' + this.settings.model + '"]').parent() } this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); if (!this.settings.category) { var s = g('.model-items a[data-model="' + this.settings.model + '"]'); i.category = s.closest('li').data('category') } else { i.category = this.settings.category } if (cllc.context.get('trim') !== h || this.settings.anniversary) { this.settings.buzzModel = true } else { this.settings.buzzModel = false } this._setModelSelectedBuzzModel(); this._setColorSelectedBuzzModel() } else { if (cllc.context.get('trim') !== h || this.settings.anniversary) { this.settings.buzzModel = true } else { this.settings.buzzModel = false } this.settings.model = g('.module.mod-modelizer .info').data('model'); this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); this.settings.color = this.$modelContainers.data('default-color'); this._setModelSelectedBuzzModel(); this._setColorSelectedBuzzModel() } this._filterCategory(); this.$currentModelContainer.show(); this._loadImageBuzzModel(); var t = this; this.$colors.each(function (w, x) { var v = jQuery(x); var u = (t.ufaColor.brand); var y = (t.ufaColor.vehicle); v.attr('data-brand-event', u); v.attr('data-vehicle-event', y); v.attr('data-adobe-events', 'event71') }); if (i.category != 'standard') { g('a[data-categoryfilter$=\'' + i.category + '\']').trigger('click') } this.$driveToggle.on('click', g.proxy(this._handleDriveSelected, this)); this.$modelSelectors.on('click', g.proxy(this._handleModelSelected, this)); g('li', this.$modelSelectorContainer).on('click', g.proxy(this._handleModelSelected, this)); this._featureTab(); this._accordianClick() }; b.prototype._loadImageBuzzModel = function () { var u, y, v, A, s = g('.model_top'), t = g('.model_door'), x = g('.model_wheel'), C = '', B = '/limited-editions/assets/images/vehicles/2016/no-top.png', z = ''; if (this.settings.buzzModel && this.settings.anniversary == false) { var w = ''; C = '/limited-editions/assets/images/vehicles/limited-editions/' + this._year + '/' + this.settings.model + '/Modelizer/'; w = '/limited-editions/assets/images/vehicles/limited-editions/' + this._year + '/' + this.settings.model + '/wheels/'; if (this.settings.top == 'hard-top' || this.settings.top == 'color-top' || this.settings.top == 'spatter-hard-top') { this.settings.doors = 'full-doors'; this._setDoorsSelectedBuzzModel() } u = this.settings.color + '-' + this.settings.doors + '-' + this.settings.top; this.$image.attr({ src: C + u + '.png' }); console.log(C + u + '.png'); x.attr({ src: w + this.settings.wheels + '.png' }); s.hide(); x.show() } else { if (this.settings.anniversary) { C = '/limited-editions/assets/images/vehicles/limited-editions/' + this._year + '/' + this._vehicle + '_' + this.settings.model + '/Modelizer/'; u = this.settings.color + '-' + this.settings.doors + '-' + this.settings.top; u = this.settings.color; this.$image.attr({ src: C + u + '.png' }); console.log(C + u + '.png'); console.log(this.settings.model); s.hide(); x.hide() } else { u = this.settings.color + '-' + this.settings.top + '-' + this.settings.doors; this.$image.attr({ src: C + u + '.png' }); if (this.settings.wheels) { y = this.settings.wheels; x.attr({ src: C + y + '.png' }); if (x.attr('src') === '') { x.error(function () { g(this).attr({ src: B }) }) } } if (this.settings.top) { if (this.settings.top == 'soft-top' || this.settings.top == 'hardtop' || this.settings.top == 'no-top') { A = this.settings.top } else { A = this.settings.color + '-' + this.settings.top } s.attr({ src: C + A + '.png' }); if (s.attr('src') === '') { s.error(function () { g(this).attr({ src: B }) }) } } } } this._updateHash() }; b.prototype._setModelSelectedBuzzModel = function () { if (this.$currentModel) { this.$modelSelectorContainer.find('li').removeClass('selected') } this.$currentModel = g('a[data-model="' + this.settings.model + '"]', this.$modelSelectorContainer).parent(); this.$currentModel.addClass('selected'); this.$selectedModelArrow.attr('data-model', this.settings.model); this.$currentModelContainer.hide().removeClass('active'); this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); this.$currentModelDetails = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]').find('.details:first'); this.$currentModelContainer.show().addClass('active'); this.$currentModelDetails.show(); var s = g('.module.mod-modelizer').find('.info').data('bg'); this.$bg.attr('src', s); if (g('.tops li[data-top*=\'top\']').size() >= 1) { if (f) { this.settings.top = g('.info.active .tops li').data('top'); f = true } else { this.settings.top = (this.$modelTops.data('default-top') !== '') ? g('.info.active ul.tops').attr('data-default-top') : this.settings.backupTop; f = false } this._setTopSelectedBuzzModel() } else { g('.tops').css('display', 'none') } if ((g('.wheels li[data-wheel]').size() >= 1)) { if (r) { this.settings.wheels = g('.info.active .wheels li').data('wheel'); r = true } else { this.settings.wheels = (this.$modelWheels.data('default-wheel') !== '') ? g('.info.active .wheels li').data('wheel') : this.settings.backupTop; r = false } this._setWheelsSelectedBuzzModel() } else { g('.wheels').css('display', 'none'); this.settings.wheels = 'default_wheels' } if ((g('.doors li[data-door]').size() >= 1)) { if (e) { this.settings.doors; e = true } else { this.settings.doors = (this.$modelDoors.data('default-door') !== '') ? this.$modelDoors.data('default-door') : this.settings.backupTop; e = false } this._setDoorsSelectedBuzzModel() } else { g('.doors').css('display', 'none') } if (q) { this.settings.color = this.$currentModelContainer.data('default-color'); this._setColorSelected() } if (g('div[data-model*=\'' + this.settings.model + '\'] .details .lease .incentive-lease').contents().length >= 1) { if (this.$details.css('display') === 'none') { this.$details.show() } } else { this.$details.hide() } }; b.prototype._setColorSelectedBuzzModel = function () { if (this.$currentColor) { this.$currentColor.removeClass('selected') } var s = g('.colors li[data-color="' + this.settings.color + '"]'); if (!s.length) { this.settings.color = this.$modelContainers.data('default-color'); s = g('.colors li[data-color="' + this.settings.color + '"]') } this.$currentColor = g('.colors li[data-color="' + this.settings.color + '"]'); this.$currentColor.addClass('selected'); var v = this.$currentColor.width(); var u = this.$currentColor.find('span').width(); var t = (v - u) * 0.5; g('.colors li').find('span').css({ width: 'auto', left: 'auto' }); if (u !== 0) { this.$currentColor.find('span').css({ width: u, left: t }) } }; b.prototype._setTopSelectedBuzzModel = function () { if (this.$currentTop) { this.$currentTop.removeClass('selected') } var v = g('.tops li[data-top="' + this.settings.top + '"]'); if (!v.length || this.$currentTop && this.$currentTop.css('display') === 'none') { this.settings.top = this.settings.backupTop; v = g('.tops li[data-top="' + this.settings.top + '"]') } this.$currentTop = v; this.$currentTop.addClass('selected'); var u = this.$currentTop.width(); var t = this.$currentTop.find('span').width(); var s = (u - t) * 0.5; g('.tops li').find('span').css({ width: 'auto', left: 'auto' }); if (t !== 0) { this.$currentTop.find('span').css({ width: t, left: s }) } }; b.prototype._setWheelsSelectedBuzzModel = function () { if (this.$currentWheel) { this.$currentWheel.removeClass('selected') } var v = g('.wheels li[data-wheel="' + this.settings.wheels + '"]'); if (!v.length || this.$currentWheel && this.$currentWheel.css('display') === 'none') { v = g('.wheels li[data-wheel="' + this.settings.wheels + '"]') } this.$currentWheel = v; this.$currentWheel.addClass('selected'); var u = this.$currentWheel.width(); var t = this.$currentWheel.find('span').width(); var s = (u - t) * 0.5; g('.wheels li').find('span').css({ width: 'auto', left: 'auto' }); if (t !== 0) { this.$currentWheel.find('span').css({ width: t, left: s }) } }; b.prototype._setDoorsSelectedBuzzModel = function () { if (this.$currentDoor) { this.$currentDoor.removeClass('selected') } var s = g('.doors li[data-door="' + this.settings.doors + '"]'); if (!s.length || this.$currentDoor && this.$currentDoor.css('display') === 'none') { s = g('.doors li[data-door="' + this.settings.doors + '"]') } this.$currentDoor = s; this.$currentDoor.addClass('selected'); var v = this.$currentDoor.width(); var u = this.$currentDoor.find('span').width(); var t = (v - u) * 0.5; g('.doors li').find('span').css({ width: 'auto', left: 'auto' }); if (u !== 0) { this.$currentDoor.find('span').css({ width: u, left: t }) } }; b.prototype._init = function () { if (i.location.hash !== '') { if (g.deparam) { g.extend(this.settings, g.deparam.fragment(i.location.hash)) } if (!this.settings.model) { this.settings.model = this.$modelSelectorContainer.data('default-model') } this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); if (!this.settings.category) { var s = g('.model-items a[data-model="' + this.settings.model + '"]'); i.category = s.closest('li').data('category') } else { i.category = this.settings.category } if (cllc.context.get('trim') !== h && cllc.context.get('trim') !== 'srt') { this.settings.buzzModel = true } else { this.settings.buzzModel = false } this._setModelSelected(); this._setColorSelected() } else { if (cllc.context.get('trim') !== h && cllc.context.get('trim') !== 'srt') { this.settings.buzzModel = true } else { this.settings.buzzModel = false } this.settings.model = this.$modelSelectorContainer.data('default-model'); this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); this.settings.color = this.$currentModelContainer.data('default-color'); this._setModelSelected(); this._setColorSelected() } this._filterCategory(); this.$currentModelContainer.show(); this._loadImage(); var t = this; this.$colors.each(function (w, x) { var v = jQuery(x); var u = (t.ufaColor.brand); var y = (t.ufaColor.vehicle); v.attr('data-brand-event', u); v.attr('data-vehicle-event', y); v.attr('data-adobe-events', 'event71') }); if (i.category != 'standard') { g('a[data-categoryfilter$=\'' + i.category + '\']').trigger('click') } this.$driveToggle.on('click', g.proxy(this._handleDriveSelected, this)); this.$modelSelectors.on('click', g.proxy(this._handleModelSelected, this)); this._featureTab(); this._accordianClick(); if (!this.settings.buzzModel) { this._scrollTopControll(); this.$driveToggle.on('click', g.proxy(this._handleDriveSelected, this)); this.$modelSelectors.on('click', g.proxy(this._handleModelSelected, this)) } }; b.prototype._scrollTopControll = function () { var w = g('.model-item-scroll-window').offset().top, y = g('.info.active .full-width').offset().top, x = 0, v = 0, u = g('.offers-content'), t = g('.model-item-scroll-container'), s; g('.mod-modelizer .model-item-scroll-container h4').on('click', function () { var z = g(this).parent().find('a').data('model'); g('.mod-modelizer .model-item-scroll-container a[data-model="' + z + '"]').trigger('click') }); g(i).on('scroll', function () { if (u.is(':visible')) { var A = parseInt(u.css('height')); x = w + A; v = y + A - (A - 500) } else { x = w; v = y } if (t.css('opacity') == 0 && this.checkFlag == false) { t.animate({ opacity: 1 }) } if (g(i).scrollTop() >= (x + 10) && g(i).scrollTop() <= v - 150) { this.checkFlag = false; t.addClass('is-fixedscroll'); z = g('.model-items li[data-category]').size(); if (z > 4) { t.addClass('more-items'); var z, B; z = g('.model-items li[data-category]').size(); B = z * 219 + 100; g('.model-items').css({ width: B }) } } else { if (g(i).scrollTop() >= v) { this.checkFlag = true; if (t.css('opacity') == 1) { t.animate({ opacity: 0 }) } } else { this.checkFlag = false; t.removeClass('is-fixedscroll'); t.removeClass('more-items') } } }) }; b.prototype._filterCategory = function () { o(); k(); i.maxMove = g('.model-item-scroll-window .model-items').width() - g('.model-item-scroll-window').width(); i.lWidth = g('.model-item-scroll-window .model-items li').eq(0).width() + 15 }; b.prototype._featureTab = function () { this.$feature_tab.on('click', function () { var t = this, u = g(this).data('activetab'); var s = g(this).data('activetab'); g('.tabs ul').removeClass('active'); g('.feature_tab span').removeClass('selected'); g('.' + s).addClass('active'); g('.feature_tab span[data-activetab="' + s + '"]').addClass('selected'); if (cllc.context.get('vehicle') === 'wrangler' || cllc.context.get('vehicle') === 'wrangler_unlimited') { if (s === 'wheels') { g('.tabs .' + u + ' li.selected a').trigger('click') } } else { g('.tabs .' + u + ' li.selected a').trigger('click') } /* DATALAYER.linkTrack(true, { lid: s, lpos: 'model-content' }) */ }); this.$colors.on('click', g.proxy(this._handleColorSelected, this)); this.$tops.on('click', g.proxy(this._handleTopSelected, this)); this.$wheels.on('click', g.proxy(this._handleWheelsSelected, this)); this.$doors.on('click', g.proxy(this._handleDoorsSelected, this)) }; b.prototype._accordianClick = function () { var w = g('.module.mod-modelizer').attr('id'); if (w == '') { w = 'models' } var z = this, C = g('.module.mod-modelizer .info.active .modelizer-accordion li'), x = '800', u = 300, y = 950, t = g('#' + w + ' .hover_text .hover_content'), D = g('#' + w + ' .hover_text .hover_content .close'), v = g('#' + w + ' .hover_text .content_left'), A = g('#' + w + ' .hover_text .content_right'), s = 'highlight', B = false; C.each(function () { g(this).data({ left: g(this).css('left') }) }); g(p).on('mouseenter', '#' + w + ' .info.active .modelizer-accordion li', function () { B = true; var E = g('.hover_text .close:visible'); if (B == true && E.length <= 0) { g(this).find('.learn-more').fadeIn(100); g('.modelizer-accordion li h3').css('visibility', 'hidden'); g(this).find('h3').css('visibility', 'visible'); if (g(this).index() === 1) { g(this).css({ 'z-index': '10' }).stop().animate({ right: '0px', width: '356px' }, u, function () { g(this).css('border-left', '2px solid #ebebeb') }) } else { if (g(this).index() === 3) { g(this).css({ 'z-index': '10' }).stop().animate({ right: '0px', width: '356px' }, u, function () { g(this).css('border-left', '2px solid #ebebeb') }) } else { g(this).css({ 'z-index': '10' }).stop().delay(305).animate({ width: '356px' }, u, function () { g(this).css('border-right', '2px solid #ebebeb') }) } } /* DATALAYER.linkTrack(true, { lid: g(this).find('h3').text(), lpos: 'content', vars: { eVar68: 'hover' } }) */ } }); g(p).on('click', '#' + w + ' .info.active .modelizer-accordion li', function (I) { B = true; g(this).find('.learn-more').hide(); var F = g('.hover_text .close:visible'); if (F.length <= 0) { var H = g(this).data('item'); var E = t.data('hover', H).width(); var G = t.data('hover', H).width() * y; /* DATALAYER.linkTrack(true, { lid: g(this).data('lid'), lpos: 'model-content' }); */ if (g(this).attr('data-item') === 'item_2') { g(this).animate({ width: '474px', 'border-left': '0px' }, 300) } else { g(this).animate({ width: '474px', 'border-right': '0px' }, 300) } if (H === 'item_1' || H === 'item_2') { g('.hover_text .hover_content[data-hover=' + H + ']').addClass('hovered').animate({ width: 50 + '%', right: '0px' }, u, function () { t.data('hover', H).find(v).fadeIn(x); t.data('hover', H).find(D).show() }) } else { g('.hover_text .hover_content[data-hover=' + H + ']').addClass('hovered').animate({ width: 50 + '%', left: '0px' }, u, function () { t.data('hover', H).find(v).fadeIn(x); t.data('hover', H).find(D).show() }) } g('#' + w + ' .info.active .modelizer-accordion li').find('h3').addClass(s).css('cursor', 'auto') } }); g(p).on('mouseleave', '#' + w + ' .info.active .modelizer-accordion li', function () { B = false; var E = g('.hover_text .close:visible'); if (B === false && E.length <= 0) { g('.modelizer-accordion li h3').css('visibility', 'visible'); if (g(this).index() === 1) { g(this).stop().animate({ right: '0px', width: '236px' }, u, function () { g(this).css({ 'z-index': '1' }) }) } else { g(this).stop().animate({ width: '236px' }, u, function () { g(this).css({ 'z-index': '1' }) }) } g(this).find('.learn-more').hide() } }); D.off('click.acc').on('click.acc', function (E) { E.preventDefault(); E.stopPropagation(); /* DATALAYER.linkTrack(true, { lid: 'close', lpos: 'model-content' }); */ t.find(v).fadeOut(); t.find(A).fadeOut(); g(this).hide(); t.fadeOut(function () { if (B === false) { g('#' + w + ' .info.active .modelizer-accordion li').each(function () { g(this).find('.learn-more').hide(); if (g(this).attr('data-item') === 'item_2') { g(this).css({ left: 'auto' }).stop().animate({ width: '236px', right: '0px' }, u, function () { g(this).css({ 'z-index': '1' }) }) } else { g(this).stop().animate({ width: '236px' }, u, function () { g(this).css({ 'z-index': '1' }) }) } }) } g(this).removeClass('hovered') }) }); g(p).on('click', '#' + w + ' .info.active .modelizer-accordion li h3', function (E) { E.stopPropagation() }); g(p).on('click', 'body', function (E) { / * hover mod-modelizer triggering close clicked */; if (!g(E.target).parents().hasClass('accordion')) { g('.hover_text .close:visible').trigger('click') } }) }; function o() { i.scrollCompelete = true; g(p).on('click', '.model-item-scroll-nav .left-arrow', function (s) { if (i.scrollCompelete) { if (i.lWidth <= Math.abs(parseFloat(g('.model-item-scroll-window .model-items').css('margin-left')))) { g('.model-item-scroll-nav .left-arrow').css({ display: 'block', opacity: '', 'pointer-events': '' }); g('.model-item-scroll-nav .right-arrow').css({ display: 'block', opacity: '', 'pointer-events': '' }); i.scrollCompelete = false; g('.model-item-scroll-window .model-items').animate({ 'margin-left': '+=' + i.lWidth }, 350, function () { i.scrollCompelete = true; if (i.lWidth > Math.abs(parseFloat(g('.model-item-scroll-window .model-items').css('margin-left')))) { g('.model-item-scroll-nav .left-arrow').css({ 'pointer-events': 'none', opacity: 0.25 }) } }) } else { g('.model-item-scroll-nav .left-arrow').css({ 'pointer-events': 'none', opacity: 0.25 }) } } }); g(p).on('click', '.model-item-scroll-nav .right-arrow', function (s) { if (i.scrollCompelete) { if (i.maxMove > Math.abs(parseFloat(g('.model-item-scroll-window .model-items').css('margin-left')))) { g('.model-item-scroll-nav .left-arrow').css({ display: 'block', opacity: '', 'pointer-events': '' }); g('.model-item-scroll-nav .right-arrow').css({ display: 'block', opacity: '', 'pointer-events': '' }); i.scrollCompelete = false; g('.model-item-scroll-window .model-items').animate({ 'margin-left': '-=' + i.lWidth }, 350, function () { i.scrollCompelete = true; if (i.maxMove - 1 <= Math.abs(parseFloat(g('.model-item-scroll-window .model-items').css('margin-left')))) { g('.model-item-scroll-nav .right-arrow').css({ 'pointer-events': 'none', opacity: 0.25 }) } }) } else { g('.model-item-scroll-nav .right-arrow').css({ 'pointer-events': 'none', opacity: 0.25 }) } } }) } function k(t) { var s; s = g('.model-items li[data-category]').size(); i.scrollCompelete = false; g('.model-item-scroll-window .model-items').animate({ 'margin-left': 0 }, 350, function () { i.scrollCompelete = true }); if (s < 5) { if (s < 5) { g('.mod-modelizer .model-items').addClass('pillar-4'); g('.model-item-scroll-nav').hide() } else { g('.model-items').css({ width: '950px', position: 'relative' }); g('.model-item-scroll-nav').hide() } } else { g('.model-items').css({ width: s * 219 }); g('.mod-modelizer .model-items li').css({ width: '205px' }); g('.mod-modelizer .model-item-scroll-window').css({ width: '92%' }); g('.model-item-scroll-nav').show(); g('.model-item-scroll-nav .left-arrow').css({ opacity: 0.2, 'pointer-events': 'none' }) } } b.prototype._loadImage = function () { var u, x, v, y, s = g('.model_top'), t = g('.model_door'), w = g('.model_wheel'), A = '/assets/images/vehicles/' + this._year + '/' + this._vehicle + '/vlp/mod-modelizer/' + this.settings.model.replace('_', '-') + '/', z = '/assets/images/vehicles/2016/no-top.png'; if (cllc.context.get('vehicle') === 'cherokee' || cllc.context.get('vehicle') === 'patriot' || cllc.context.get('vehicle') === 'compass' || cllc.context.get('vehicle') === 'renegade' || cllc.context.get('vehicle') === 'grand_cherokee' && !this.settings.buzzModel) { u = this.settings.color + '-' + this.settings.wheels; this.$image.attr({ src: A + u + '.png' }) } else { if (!this.settings.doors) { this.settings.doors = this.$modelDoors.data('default-door') } u = this.settings.color + '-' + (this.settings.top ? this.settings.top : '') + '-' + this.settings.doors; this.$image.attr({ src: A + u + '.png' }); if (this.settings.wheels) { x = this.settings.wheels; w.attr({ src: A + x + '.png' }); if (w.attr('src') === '') { w.error(function () { g(this).attr({ src: z }) }) } } if (this.settings.top) { if (this.settings.top == 'soft-top' || this.settings.top == 'hardtop' || this.settings.top == 'no-top') { y = this.settings.top } else { y = this.settings.color + '-' + this.settings.top } s.attr({ src: A + y + '.png' }); if (s.attr('src') === '') { s.error(function () { g(this).attr({ src: z }) }) } } } this._updateHash() }; b.prototype._setModelSelected = function () { if (this.$currentModel) { this.$currentModel.removeClass('selected') } this.$currentModel = g('a[data-model="' + this.settings.model + '"]', this.$modelSelectorContainer).parent(); this.$currentModel.addClass('selected'); this.$selectedModelArrow.attr('data-model', this.settings.model); this.$currentModelContainer.hide().removeClass('active'); this.$currentModelContainer = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]'); this.$currentModelDetails = this.$modelContainers.filter('[data-model="' + this.settings.model + '"]').find('.details:first'); this.$currentModelContainer.show().addClass('active'); this.$currentModelDetails.show(); var s = this.$currentModelContainer.data('bg'); this.$bg.attr('src', s); if (g('.tops li[data-top*=\'top\']', this.$currentModelContainer).size() >= 1) { if (f) { this.settings.wheels = g('.info.active .tops li').data('top'); f = true } else { this.settings.top = (this.$modelSelectorContainer.data('default-top') !== '') ? g('.info.active ul.tops').attr('data-default-top') : this.settings.backupTop; f = false } this._setTopSelected() } else { g('.tops', this.$currentModelContainer).css('display', 'none') } if ((g('.wheels li[data-wheel]', this.$currentModelContainer).size() >= 1)) { if (r) { this.settings.wheels = g('.info.active .wheels li').data('wheel'); r = true } else { this.settings.wheels = (this.$modelWheels.data('default-wheel') !== '') ? g('.info.active .wheels li').data('wheel') : this.settings.backupTop; r = false } this._setWheelsSelected() } else { g('.wheels', this.$currentModelContainer).css('display', 'none'); this.settings.wheels = g('.info.active .tabs .wheels').data('default-wheel') } if ((g('.doors li[data-door]', this.$currentModelContainer).size() >= 1)) { if (e) { this.settings.doors; e = true } else { this.settings.doors = (this.$modelDoors.data('default-door') !== '') ? this.$modelDoors.data('default-door') : this.settings.backupTop; e = false } this._setDoorsSelected() } else { g('.doors', this.$currentModelContainer).css('display', 'none') } if (q) { this.settings.color = this.$currentModelContainer.data('default-color'); this._setColorSelected() } if (g('div[data-model*=\'' + this.settings.model + '\'] .details .lease .incentive-lease').contents().length >= 1) { if (this.$details.css('display') === 'none') { this.$details.show() } } else { this.$details.hide() } }; b.prototype._setColorSelected = function () { if (this.$currentColor) { this.$currentColor.removeClass('selected') } var s = g('.colors li[data-color="' + this.settings.color + '"]', this.$currentModelContainer); if (!s.length) { this.settings.color = this.$currentModelContainer.data('default-color'); s = g('.colors li[data-color="' + this.settings.color + '"]', this.$currentModelContainer) } this.$currentColor = g('.colors li[data-color="' + this.settings.color + '"]', this.$currentModelContainer); this.$currentColor.addClass('selected'); var v = this.$currentColor.width(); var u = this.$currentColor.find('span').width(); var t = (v - u) * 0.5; g('.colors li').find('span').css({ width: 'auto', left: 'auto' }); if (u !== 0) { this.$currentColor.find('span').css({ width: u, left: t }) } }; b.prototype._setTopSelected = function () { if (this.$currentTop) { this.$currentTop.removeClass('selected') } var v = g('.tops li[data-top="' + this.settings.top + '"]', this.$currentModelContainer); if (!v.length || this.$currentTop && this.$currentTop.css('display') === 'none') { this.settings.top = this.settings.backupTop; v = g('.tops li[data-top="' + this.settings.top + '"]', this.$currentModelContainer) } this.$currentTop = v; this.$currentTop.addClass('selected'); var u = this.$currentTop.width(); var t = this.$currentTop.find('span').width(); var s = (u - t) * 0.5; g('.tops li').find('span').css({ width: 'auto', left: 'auto' }); if (t !== 0) { this.$currentTop.find('span').css({ width: t, left: s }) } }; b.prototype._setWheelsSelected = function () { if (this.$currentWheel) { this.$currentWheel.removeClass('selected') } var v = g('.wheels li[data-wheel="' + this.settings.wheels + '"]', this.$currentModelContainer); if (!v.length || this.$currentWheel && this.$currentWheel.css('display') === 'none') { v = g('.wheels li[data-wheel="' + this.settings.wheels + '"]', this.$currentModelContainer) } this.$currentWheel = v; this.$currentWheel.addClass('selected'); var u = this.$currentWheel.width(); var t = this.$currentWheel.find('span').width(); var s = (u - t) * 0.5; g('.wheels li').find('span').css({ width: 'auto', left: 'auto' }); if (t !== 0) { this.$currentWheel.find('span').css({ width: t, left: s }) } }; b.prototype._setDoorsSelected = function () { if (this.$currentDoor) { this.$currentDoor.removeClass('selected') } var s = g('.doors li[data-door="' + this.settings.doors + '"]', this.$currentModelContainer); if (!s.length || this.$currentDoor && this.$currentDoor.css('display') === 'none') { s = g('.doors li[data-door="' + this.settings.doors + '"]', this.$currentModelContainer) } this.$currentDoor = s; this.$currentDoor.addClass('selected'); var v = this.$currentDoor.width(); var u = this.$currentDoor.find('span').width(); var t = (v - u) * 0.5; g('.doors li').find('span').css({ width: 'auto', left: 'auto' }); if (u !== 0) { this.$currentDoor.find('span').css({ width: u, left: t }) } }; b.prototype._setDriveSelected = function () { var s = g('.msrp_detials', this.$currentModelContainer), t = g('.msrp_drive', this.$currentModelContainer); g('.drive-toggle a', this.$currentModelContainer).filter('.active').removeClass('active'); g('.drive-toggle a[data-drive="' + this._currentDrive + '"]', this.$currentModelContainer).addClass('active'); if (this._currentDrive === '4x2') { t.removeClass('toggled'); g('.msrp_drive[data-drive=' + this._currentDrive + ']').addClass('toggled') } else { t.removeClass('toggled'); g('.msrp_drive[data-drive=' + this._currentDrive + ']').addClass('toggled') } this.getSlectedLi = this.$modelSelectorContainer.find('li.selected') }; b.prototype._handleDriveSelected = function (s) { s.preventDefault(); var t = g(s.currentTarget); this._currentDrive = g(s.currentTarget).data('drive'); this._setDriveSelected() }; b.prototype._handleModelSelected = function (s) { s.preventDefault(); var t; if (s.target.nodeName === 'LI') { t = g(s.target).find('a') } else { if (s.target.nodeName === 'IMG') { t = g(s.target).parent() } else { t = g(s.target).parent().find('a') } } this.settings.model = t.data('model'); if (this.settings.buzzModel) { this._setModelSelectedBuzzModel(); this._setColorSelectedBuzzModel(); this._setTopSelectedBuzzModel(); this._setWheelsSelectedBuzzModel(); this._setDoorsSelectedBuzzModel(); this._setDriveSelected(); this._loadImageBuzzModel() } else { this._setModelSelected(); this._setColorSelected(); this._setTopSelected(); this._setWheelsSelected(); this._setDoorsSelected(); this._setDriveSelected(); this._loadImage() } if (g('div[data-model*=\'' + this.settings.model + '\'] .details .lease .incentive-lease').contents().length >= 1) { if (this.$details.css('display') === 'none') { this.$details.show() } } else { this.$details.hide() } }; b.prototype._handleColorSelected = function (s) { s.preventDefault(); var t = g(s.target); t.attr('data-brand-event', 'event126').attr('data-vehicle-event', 'event156').attr('data-adobe-events', 'event71'); this.settings.color = t.parent().data('color'); if (this.settings.buzzModel) { this._setColorSelectedBuzzModel(); this._loadImageBuzzModel() } else { this._setColorSelected(); this._loadImage() } if (g('div[data-model*=\'' + this.settings.model + '\'] .details .lease').contents().length >= 1) { if (this.$details.css('display') === 'none') { this.$details.show() } } else { this.$details.hide() } q = false }; b.prototype._handleTopSelected = function (s) { s.preventDefault(); d = true; var t = g(s.target); if (cllc.context.get('vehicle') === 'wrangler' || cllc.context.get('vehicle') === 'wrangler_unlimited') { if (t.parent('li').data('top') === 'no-top' && c != true) { g('.info.active .tabs ul.doors li[data-door="no-doors"] a').trigger('click') } if ((t.parent('li').data('top') === 'soft-top' || t.parent('li').data('top') === 'hardtop' || t.parent('li').data('top') === 'color-top') && c != true) { g('.info.active .tabs ul.doors li[data-door="full-doors"] a').trigger('click') } c = false } this.settings.top = t.parent().data('top'); if (this.settings.buzzModel) { this._settingRelatedValue(t.data('related-to-default')); this._setTopSelectedBuzzModel(); this._loadImageBuzzModel() } else { this._setTopSelected(); this._loadImage() } }; b.prototype._settingRelatedValue = function (v) { if (v.trim('') != '') { var u = v.trim('').split(','), t = ''; for (var s = 0; s < u.length; s++) { t = u[s].split('_'); if (t[0] == 'doors') { this.settings.doors = t[1]; this._setDoorsSelectedBuzzModel() } else { if (t[0] == 'wheels') { this.settings.wheels = t[1]; this._setWheelsSelectedBuzzModel() } else { if (t[0] == 'tops') { this.settings.top = t[1]; this._setTopSelectedBuzzModel() } } } } } }; b.prototype._handleWheelsSelected = function (s) { s.preventDefault(); var t = g(s.target); this.settings.wheels = t.parent().data('wheel'); if (this.settings.buzzModel) { this._settingRelatedValue(t.data('related-to-default')); this._setWheelsSelectedBuzzModel(); this._loadImageBuzzModel() } else { this._setWheelsSelected(); this._loadImage() } }; b.prototype._handleDoorsSelected = function (s) { s.preventDefault(); l = true; var t = g(s.target); if (cllc.context.get('vehicle') === 'wrangler' || cllc.context.get('vehicle') === 'wrangler_unlimited') { if (t.parent('li').data('door') === 'no-doors') { c = true; g('.info.active .tabs ul.tops li[data-top="no-top"] a').trigger('click') } if (t.parent('li').data('door') === 'half-doors') { c = true; g('.info.active .tabs ul.tops li[data-top="no-top"] a').trigger('click') } if (t.parent('li').data('door') === 'full-doors') { c = true; g('.info.active .tabs ul.tops li[data-top="soft-top"] a').trigger('click') } } this.settings.doors = t.parent().data('door'); if (this.settings.buzzModel) { this._settingRelatedValue(t.data('related-to-default')); this._setDoorsSelectedBuzzModel(); this._loadImageBuzzModel() } else { this._setDoorsSelected(); this._loadImage() } }; b.prototype._updateHash = function () { var s = this.settings.model; var t = this.settings.color; var u = g('.info.active .wheels li').data('wheel'); if (m) { setTimeout(function () { i.location.hash = g.param({ model: s, color: t, wheel: u, category: i.category }); if (i.category == 'limited') { g('.cur-vehicle .model_top').css('visibility', 'hidden'); g('.cur-vehicle .model_top').attr('src', '') } else { g('.cur-vehicle .model_top').css('visibility', 'visible') } }, 10) } else { setTimeout(function () { i.location.hash = g.param({ model: s, color: t, category: i.category }); if (i.category == 'limited') { g('.cur-vehicle .model_top').css('visibility', 'hidden'); g('.cur-vehicle .model_top').attr('src', '') } else { g('.cur-vehicle .model_top').css('visibility', 'visible') } }, 10) } }; g.fn[a] = function (s) { return this.each(function () { if (!g.data(this, 'plugin_' + a)) { g.data(this, 'plugin_' + a, new b(this, s)) } }) }; g(p).ready(function () { var t = navigator.userAgent, s = /iPad/i.test(t); if (s) { g('.feature_tab .tabs .wheels li a').each(function () { g(this).removeAttr('class') }) } }) }) (jQuery, window, document); (function (c, b, a, d) { c.sideNavigation = function (g) { var n = { content: c('.main-content, #outer-wrapper #content'), topOffset: 550, trackingLPOS: 'side_nav_click' }, t = c.extend(n, g), u = null, e = { CHANGE: 'sidenav.change', INIT: 'sidenav.init', VISIBLE: 'sidenav.visible', HIDDEN: 'sidenav.hidden' }, o = '', h = true, s = 0, j = 0, p = false, l = { gallery: { brand: 'event113', vehicle: 'event143', counter: 'event31' }, interior: { brand: 'event114', vehicle: 'event144', counter: 'event33' }, exterior: { brand: 'event115', vehicle: 'event145', counter: 'event34' }, engines: { brand: 'event116', vehicle: 'event146', counter: 'event73' }, capability: { brand: 'event116', vehicle: 'event146', counter: 'event73' }, safety_and_security: { brand: 'event117', vehicle: 'event147', counter: 'event74' }, safety_security: { brand: 'event117', vehicle: 'event147', counter: 'event74' }, technology: { brand: 'event118', vehicle: 'event148', counter: 'event500' }, performance: { brand: 'event119', vehicle: 'event149', counter: 'event501' }, fuel_efficiency: { brand: 'event120', vehicle: 'event150', counter: 'event502' }, packages: { brand: 'event121', vehicle: 'event151', counter: 'event503' }, warranty: { brand: 'event122', vehicle: 'event152', counter: 'event504' }, durability: { brand: 'event123', vehicle: 'event153', counter: 'event505' }, explore: { brand: 'event125', vehicle: 'event155', counter: 'event506' }, highlights: { brand: 'event130', vehicle: 'event160', counter: 'event507' }, ratings_and_reviews: { brand: 'event131', vehicle: 'event161', counter: 'event508' } }; function q() { var C, z = cllc.context.get('pageName'); if (z !== 'photos-videos' && z !== 'gallery' && z !== '2015/renegade/gallery' && z !== 'photos and videos') { C = '
HIGHLIGHTS
' } else { C = '
' } var B = c('.module', t.content), y = null, x = 0, w = [ '
®
', '
®
', '
™
' ], A = null; if (B.length) { c.each(B, function (D, G) { y = c(G); A = y.data('side-nav'); var F = ''; for (var E = 0; E < w.length; E++) { if (G.id.contains(w[E])) { G.id = G.id.replace(w[E], '') } } if (l.hasOwnProperty(G.id)) { F = 'data-brand-event=\'' + l[G.id].brand + '\' data-vehicle-event=\'' + l[G.id].vehicle + '\' data-adobe-events=\'' + l[G.id].counter + '\'' } if (A !== '' && typeof A !== 'undefined') { if (D === 0) { C += '
' + A + '
' } else { C += '
' + A + '
' } } else { y.removeAttr('data-side-nav') } }); C += '
Top
'; t.nav = c(C); t.content.prepend(t.nav); s = t.nav.outerHeight(); c('.back-to-top').click(function (D) { D.stopPropagation(); /* DATALAYER.linkTrack(b.location.href, { lpos: t.trackingLPOS, lid: 'top', vars: { eVar68: 'click', eVar75: t.trackingLPOS + ':top', prop25: 'top' }, events: 'event70' }); */ clearTimeout(u); c('html, body').animate({ scrollTop: 0 }, 500) }); x = parseInt(t.nav.css('top'), 10); p = c('body').hasClass('ie8'); j = (!p) ? x : x - 1; t.nav.find('a').on('click', m); c(b).scroll(f); c(b).resize(i); c(b).on('mousewheel', function (D) { clearTimeout(u) }); c.each(t.nav.find('a'), function (D, F) { var E = '#' + c(F).attr('href').split('#') [1]; c(F).attr('href', E) }); v(e.INIT) } } function m(B, y) { B.preventDefault(); clearTimeout(u); var z = c(B.target).attr('href'), A = z.substring(1); var C = c(B.target).text(); C = C.replace(/-/g, ' '); C = C.replace(/[^0-9a-zA-Z ]/g, ''); C = C.replace(/\s+/g, ' '); C = C.replace(/ /g, '_'); c(z).scrollTo({ speed: 'slow', topOffset: 65, afterScroll: function () { var F = t.nav.offset().top - j + 1; u = setTimeout(function () { if (k(F) !== A) { c(z).scrollTo({ speed: 'slow', topOffset: 65 }) } }, 2000) } }); if (typeof y === 'undefined' || !y) { if (C === 'Capability') { C = 'Capabilities' } if (C === 'Safety_and_Security') { C = 'Safety_Security' } var x = c(B.target).attr('data-brand-event'); var D = c(B.target).attr('data-vehicle-event'); var E = c(B.target).attr('data-adobe-events'); var w = { lpos: t.trackingLPOS, lid: C, vars: { eVar68: 'click', eVar75: t.trackingLPOS + ':' + C, prop25: C }, events: E, }; if (!!x) { w.mediaEvents = [ { name: x, // value: DATALAYER.getMediaEvent('brand') }, { name: D, // value: DATALAYER.getMediaEvent('vehicle') } ] } // DATALAYER.linkTrack(b.location.href, w) } } function r(w) { t.nav.find('li').removeClass('selected'); w.parent().addClass('selected') } function v(x, w) { c('body').trigger(x, w) } function f(w) { w.preventDefault(); var A = t.nav.offset().top - j + 1, y = t.content.outerHeight(), z = k(A); if (typeof z !== 'undefined' && z !== o) { v(e.CHANGE, [ z ]); r(c('a[href="#' + z + '"]', t.nav)); o = z; var x = c('#' + o).data('side-nav'); x = x.replace(/\
\â„¢\<\/sup\>/g, ''); x = x.replace(/-/g, ' '); x = x.replace(/[^0-9a-zA-Z ]/g, ''); x = x.replace(/\s+/g, ' '); x = x.replace(/ /g, '_'); x = x.replace(/supregsup/gi, ''); x = x.replace(/subregsub/gi, ''); x = x.replace(/subtradesub/gi, ''); x = x.replace(/suptradesup/gi, ''); x = x.replace(/suptmsup/gi, '') } if (A + s < t.topOffset - 65 || A + s + j > y) { if (!h) { t.nav.css('visibility', 'hidden'); v(e.HIDDEN, [ z ]); h = true } } else { if (h) { t.nav.css('visibility', 'visible'); v(e.VISIBLE, [ z ]); h = false } } } function i() { (c(b).width() < 1160) ? t.nav.hide() : t.nav.show() } function k(x) { var w = c('[data-side-nav]').map(function () { var B = c(this), C = B.offset(), A = C.top - 65, y = B.height(), z = A + y; return (x <= z && x >= A) ? B : null }); if (typeof w !== 'undefined' && typeof w[0] !== 'undefined') { return w[0][0].id } } c(function () { q() }); return this } }) (jQuery, window, document); /*** Feature Overlay updates for Jeep only at the moment ***/ /** Activates the Feature Availability buttons to load the proper set of features in a cllc.ui.modal instance. @example
Feature Availability
if ($('.features-overlay').length) { $('.features-overlay').featureOverlay(); } **/ ; (function ($, window, document, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Private Properties \* ----------------------------------------------------------------------------- */ var pluginName = 'featureOverlay', defaults = { yearToggle: false }; /* ----------------------------------------------------------------------------- *\ Constructor \* ----------------------------------------------------------------------------- */ /** @constructor **/ function featureOverlay(element, options) { var _this = this; this.settings = $.extend(true, { }, defaults, options); this.element = element; this.$el = $(element); this._year = cllc.context.get('year'); this._vehicle = cllc.context.get('vehicle'); this._modelYearCode = Vehicles.getModelYearCode({ year: _this._year, vehicle: _this._vehicle, }); this._availableYears = (this.settings.yearToggle === true) ? Vehicles.getAvailableYears({ vehicle: _this._vehicle }) : [ this._year ]; this._init(); } /* ----------------------------------------------------------------------------- *\ Private Methods \* ----------------------------------------------------------------------------- */ /** @method _init @return {null} **/ featureOverlay.prototype._init = function () { var _this = this; this.rebuild = true; this.models = [ ]; this.trims = [ ]; this.context = { }; this.mouseEnterEq; this.currentTr; // initialize the button click this.$el.on('click', function (e) { e.preventDefault(); var $this = $(this); _this.featureCodes = $this.data('features').split(','); _this._drive = $this.data('drive'); _this._cab = $this.data('cab'); if (!_this.featureCodes || _this.featureCodes === '') { return; } _this.modal = new cllc.ui.modal({ height: '100%', width: '100%', autoCenter: false, position: { x: 0, y: 0 } }); _this._scripts(); }); }; /** @method _build @return {null} **/ featureOverlay.prototype._build = function () { var _this = this; if (this.rebuild) { this.template = Handlebars.templates['featureOverlay.tmpl']; // add class to modal for styling $(this.modal.window).addClass('full-screen'); // Disable page scrolling when overlay is open $('body').css('overflow', 'hidden'); this.modal.open(_this.template(_this.context)); this.modal.onclose = function () { _this._close(); }; this.rebuild = false; } else { $(this.modal.window).find('.feature-overlay-container').replaceWith(_this.template(_this.context)); } // CGMAIN-4659: Fixed header position // Once the table is built & overlay is opened // Remove the previously created static-header $(this.modal.window).find('table.static-header').remove(); // clone the Table headers and form a new table with absolute position var $mainTable = $(this.modal.window).find('table[class^=\'col-\']'); // Generate markup var $tableHeaders = '' + $mainTable.find('table > thead > tr').html() + ''; // windows Safari browser hack if (navigator.userAgent.indexOf('Chrome') === - 1 && navigator.userAgent.indexOf('Safari') > - 1) { // If browser is Safari with Windows then need to fix the width of the sticky header. $($tableHeaders).insertAfter($mainTable).wrap('
'); } else { // insert the cloned markup below the existing table & apply required classes $($tableHeaders).insertAfter($mainTable).wrap('
'); } /* Due to the Scrollbar, sometimes the header will have a different width compared to the content to avoid this, we need to re-calculate the width of the main table on resize event Need to trigger window.resize on overlay open to calculate the first-time width */ $(window).on('resize', function (e) { $mainTable.next().width($mainTable.width() - 1); }); $(window).trigger('resize'); $('.feature-overlay-content').removeClass('loading'); this._activateCTAs(); //this._centerTable(); }; /** @method _activateCTAs @return {null} **/ featureOverlay.prototype._activateCTAs = function () { var _this = this; // change function -- cab select $('.feature-overlay-container').on('change', 'select', function (event) { event.preventDefault(); var $this = $(this).find('option:selected'), type = $this.data('type'), value = $this.val(); _this.rebuild = false; _this['_' + type] = value; _this._load(); }); $('.feature-overlay-container').on('click', '.gc-button-toggle a', function (event) { event.preventDefault(); var $this = $(this), $li = $this.parent(), type = $this.data('type'), value = $this.data('value'); if (!$li.hasClass('gc-button-toggle-active')) { linkTrack('content', $this.text()); //btn theme logic $li.siblings().removeClass('gc-button-toggle-active'); $li.addClass('gc-button-toggle-active'); //add your code here _this.rebuild = false; _this['_' + type] = value; _this._load(); } }); }; /** @method _scripts @return {null} **/ featureOverlay.prototype._scripts = function () { var _this = this, scripts = [ ]; //modelcompare if (typeof ModelCompare !== 'object') { scripts.push({ src: '/limited-editions/crossbrand/model-compare/javascript/ModelCompare.js' }); } //handlebars if (typeof Handlebars === 'undefined') { scripts.push({ src: '/limited-editions/crossbrand/javascript/lib/handlebars-v1.3.0.js' }); } //template needs to be pushed after we know handlebars is loaded //scripts.push({ src: "/crossbrand/widgets/feature-overlay/assets/javascript/template.tmpl.js" }); //css file //scripts.push({ href: "/crossbrand/widgets/feature-overlay/assets/css/featureOverlay.css" }); if (scripts.length) { cllc.lazy.requires(scripts, function () { _this._load(); }); } else { this._load(); } }; /** Load proper model information based on context, 0 = 4x4, 1 = 4x2. @method _load @return {null} **/ featureOverlay.prototype._load = function () { var _this = this, wsParams = [ ]; //load template now that handlebars is loaded cllc.lazy.requires([{ src: '/assets/js/feature-chart/template/featureOverlay.tmpl.js' } ], function () { $('.feature-overlay-content').addClass('loading'); //set year -- used for MY toggle click _this._year = _this._modelYearCode.slice(3, 7); //ModelCompare.load caches the script which breaks the year/drive toggle //ModelCompare.load(this._modelYearCode, [this._index], this._handleLoaded, this); $.getScript('/hostb/assets/data/compare/' + _this._modelYearCode + '.categories.js', function () { for (var i = 0; i < ModelCompare.variations.length; i++) { var variation = ModelCompare.variations[i]; _this.context[variation.id] = { }; for (var x = 0; x < variation['values'].length; x++) { _this.context[variation.id][x] = { name: variation['values'][x].name, id: x } }; }; // hack for ram :( // doing this till the forms in TS are upated to include box and cab if (cllc.config.brand == 'ramtrucks' && _this.rebuild) { var highestModel = Vehicles.getHighestModel(cllc.context.get()), variations = Vehicles.getVariation({ year: _this._year, vehicle: _this._vehicle, model: highestModel }), variation = variations.split('-'); _this._drive = variation[0]; _this._cab = variation[1]; } if (_this.context.drive) { var obj = (_this._drive) ? _this._drive : _this.context.drive[0].id; _this._drive = obj; _this.context.drive[_this._drive].cssClass = 'gc-button-toggle-active'; wsParams.push(_this._drive); } if (_this.context.cab) { var obj = (_this._cab) ? _this._cab : _this.context.cab[0].id; _this._cab = obj; wsParams.push(_this._cab); _this.context.cab[_this._cab].selected = true; } $.getJSON('/hostb/assets/data/compare/' + _this._modelYearCode + '.models.' + wsParams.join('-') + '.json', function (data) { ModelCompare.models = [ ]; for (var i = 0; i < data.length; i++) { ModelCompare.models.push(data[i]); }; _this._handleLoaded(); }); }); }); }; /** @method _handleLoaded @return {null} **/ featureOverlay.prototype._handleLoaded = function () { var _this = this; _this.context.option = { }; // setup feature codes oject for template for (var x = 0; x < _this.featureCodes.length; x++) { // feature code var code = _this.featureCodes[x], feature = ModelCompare.getFeature(code); //check if feature exists in model compare data if (feature) { _this.context.option[x] = { }; _this.context.option[x].name = feature.name; _this.context.option[x].data = { }; // loop models from model compare data for (var i = 0; i < ModelCompare.models.length; i++) { var option = ModelCompare.models[i].features[code], display = '–', packageAvailability = '', displayPackage = '', packageName = '', style = 'gc-font-color-quaternary'; if (option) { display = (option.avail === 1) ? 'O' : 'S'; packageAvailability = option; style = ''; if (packageAvailability.package.name != undefined) { packageName = packageAvailability.package.name; displayPackage = 'show-package'; } else { displayPackage = 'hide-package'; } } _this.context.option[x].data[i] = { display: display, cssClass: style, displayPackage: displayPackage, packageName: packageName } // 0 = standard // 1 = avaialbe // 3 = not }; } else { console.log('FEATURE OVERLAY ERROR: -- ' + code); } }; // setup model object for template _this.context.model = { }; for (var i = 0; i < ModelCompare.models.length; i++) { _this.context.model[i] = Vehicles.getTrimDisplay({ year: _this._year, vehicle: _this._vehicle, model: Vehicles.getModelFromCcode(ModelCompare.models[i].id) }); } // number of cols in table -- number of models + 1 for feature headings _this.context.cols = ModelCompare.models.length + 1; // setup model year toggle data if (_this._availableYears.length > 1) { this.context.year = { }; for (var i = 0; i < _this._availableYears.length; i++) { this.context.year[i] = { }; this.context.year[i].name = _this._availableYears[i]; this.context.year[i].value = Vehicles.getModelYearCode({ year: _this._availableYears[i], vehicle: _this._vehicle }); //set active if (_this._availableYears[i] === _this._year) { this.context.year[i].cssClass = 'gc-button-toggle-active'; } }; } this._build(); this.hoverHighlight(); this.tableCarousel(); this.favorite(); }; /** @method _close @return {null} **/ featureOverlay.prototype._close = function () { linkTrack('content', 'close'); /*Adobe Analytics Link Track*/ /* DATALAYER.linkTrack(this, { 'lpos': 'content', 'lid': 'close' }); */ this.rebuild = true; // Reset body overflow $('body').css('overflow', 'auto'); }; featureOverlay.prototype._centerTable = function () { var _this = this, timeout; $(window).resize(function () { clearTimeout(timeout); timeout = setTimeout(setTableTopPosition, 500); }); function setTableTopPosition() { var $overlay = $(_this.modal.window), $table = $overlay.find('.feature-overlay-content > table'), $window = $(window).outerHeight(), $top = $overlay.find('.feature-overlay-top').outerHeight(), $bottom = $overlay.find('.feature-overlay-bottom').outerHeight(), $content = $window - $top - $bottom, topPos = 0; if ($content > $table.outerHeight()) { topPos = ($content - $table.outerHeight()) / 2; } $table.css('top', topPos); } setTableTopPosition(); } featureOverlay.prototype.hoverHighlight = function () { var $contenHolder = $('table tbody'), hoverStatetd, that = this; $contenHolder.on('mouseenter', 'td', function () { var indx = $(this).index(); if (indx != 0) { $contenHolder.find('th:eq(' + indx + ')').addClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + indx + ')').addClass('hover'); //console.log($contenHolder.find('tr.fav-bar td:eq(' + indx + ')')) $contenHolder.find('tr').find('td:eq(' + indx + ')').addClass('hover'); $(this).parent('tr').find('td').addClass('gc-border-color-a'); hoverStatetd = true; } }); $contenHolder.on('mouseleave', 'td', function () { var indx = $(this).index(); hoverStatetd = false; if (hoverStatetd == false && indx != 0) { $contenHolder.find('th:eq(' + indx + ')').removeClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + indx + ')').removeClass('hover'); $contenHolder.delay('500').find('tr').find('td:eq(' + indx + ')').removeClass('hover') $(this).delay('500').parent('tr').find('td').removeClass('gc-border-color-a'); } /** added for the fix **/ if (that.mouseEnterEq !== undefined) { $contenHolder.find('th:eq(' + that.mouseEnterEq + ')').addClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + that.mouseEnterEq + ')').addClass('hover'); //console.log($contenHolder.find('tr.fav-bar td:eq(' + indx + ')')) $contenHolder.find('tr').find('td:eq(' + that.mouseEnterEq + ')').addClass('hover'); $(that.currentTr).parent('tr').find('td').addClass('gc-border-color-a'); } hoverStatetd = true; }); $('.package-availability').mouseenter(function () { $(this).find('.package-title-balloon').fadeIn(); }); $('.package-availability').mouseleave(function () { $(this).find('.package-title-balloon').fadeOut(); }); }; function hideBorder() { var $visibleVehicles = $('.feature-overlay-container .feature-overlay-content table thead tr td:visible'); $visibleVehicles.removeClass('no-right-border'); $($visibleVehicles).eq(4).addClass('no-right-border'); } featureOverlay.prototype.tableCarousel = function () { var columnsPerView = 5, modelCount = ModelCompare.models.length, $tr = $('.feature-overlay-content table tr tr'); if (modelCount > columnsPerView || modelCount == columnsPerView) { $('.feature-overlay-content table tr th').addClass('sticky') $('.feature-overlay-content table tr tr td, .feature-overlay-content table thead tr').hide(); $tr.show(); hideBorder(); $('.feature-overlay-content table thead tr').each(function (i, v) { $(this).find('td:not(.sticky):nth-child(-n+' + columnsPerView + ')').show(); $(this).find('td:not(.sticky)').each(function (j, v) { $(this).attr('data-ind', j).addClass('chart-data'); }); }); $tr.each(function (i, v) { $(this).find('td:first-child').addClass('sticky'); $(this).find('td:not(.sticky)').each(function (j, v) { $(this).attr('data-ind', j).addClass('chart-data'); }); $(this).find('td:not(.sticky):nth-child(-n+' + ( + columnsPerView + + 1) + '), td.sticky').show(); }); // Carousel Navigation var countIndex = 0; if (modelCount == columnsPerView) { $('.table-row.next').hide(); } else { $('.table-row.next').show(); } $('.table-row.next').click(function (e) { e.stopPropagation(); if ($(this).hasClass('disabled')) { e.preventDefault(); } else { $tr.find('td[data-ind="' + countIndex + '"]').hide(); $tr.find('td[data-ind="' + (columnsPerView + countIndex) + '"]').fadeIn(); $('.table-row.prev').removeClass('disabled'); countIndex++; if ((columnsPerView + countIndex) === modelCount) { $('.table-row.next').addClass('disabled'); } } }); $('.table-row.prev').click(function (e) { e.stopPropagation(); if ($(this).hasClass('disabled')) { e.preventDefault(); } else { countIndex--; $tr.find('td[data-ind="' + (columnsPerView + countIndex) + '"]').hide(); $tr.find('td[data-ind="' + countIndex + '"]').fadeIn(); $('.table-row.next').removeClass('disabled'); if (countIndex === 0) { $('.table-row.prev').addClass('disabled'); } if ($tr.find('td:visible:first-child').data('ind') === 0) { $('.table-row.prev').addClass('disabled'); } } }); } else { $('.feature-overlay-content table tr th').removeClass('sticky'); $('.feature-overlay-content table tr th').addClass('span-' + modelCount); $('.table-row.next').hide(); if (modelCount === 3) { $tr.each(function (i, v) { $(this).find('td:first-child').attr('colspan', 7); }); } else { $tr.each(function (i, v) { $(this).find('td:first-child').attr('colspan', columnsPerView + 1) //.removeClass('sticky'); }); } var isIE11 = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./); if (isIE11) { $('.feature-overlay-container .feature-overlay-content').addClass('skip-ie-edge'); } if (navigator.userAgent.indexOf('MSIE 10') > - 1) { $('.feature-overlay-container .feature-overlay-content').addClass('skip-ie-edge'); } } }; featureOverlay.prototype.favorite = function () { function getCookie(c_name) { var i, x, y, ARRcookies = document.cookie.split(';'); for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf('=')); y = ARRcookies[i].substr(ARRcookies[i].indexOf('=') + 1); x = x.replace(/^\s+|\s+$/g, ''); if (x == c_name) { return unescape(y); } } } var favModel = getCookie(cllc.context.get('vehicle') + '_favModel'); var $contenHolder = $('table tbody'), hoverStatetd, that = this, indx = $('.fav-bar .fav[data-fav="' + favModel + '"]').index(); if (favModel !== undefined) { $('.fav-bar .fav[data-fav="' + favModel + '"]').addClass('active'); /** added for the fix **/ that.mouseEnterEq = indx; that.currentTr = this; $contenHolder.find('th:eq(' + indx + ')').addClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + indx + ')').addClass('hover'); $contenHolder.find('tr').find('td:eq(' + indx + ')').addClass('hover'); $(this).parent('tr').find('td').addClass('gc-border-color-a'); hoverStatetd = true; } else { $('.fav-bar .fav').removeClass('active'); } /** added for the fix ( click event attached overlay ) **/ $('.feature-overlay-container').click(function (e) { if ($(e.target).hasClass('feature-overlay-container')) { $('.cllc-modal-button').trigger('click'); } }); // Highlight fav icon on click. $('.fav-bar .fav').click(function (e) { e.stopPropagation(); var indx = $(this).index(); /** added for the fix **/ if (indx != 0) { // remove active hover for previous if (that.mouseEnterEq !== undefined) { $contenHolder.find('th:eq(' + that.mouseEnterEq + ')').removeClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + that.mouseEnterEq + ')').removeClass('hover'); $contenHolder.delay('500').find('tr').find('td:eq(' + that.mouseEnterEq + ')').removeClass('hover') $(that.currentTr).delay('500').parent('tr').find('td').removeClass('gc-border-color-a'); } that.mouseEnterEq = indx; that.currentTr = this; $contenHolder.find('th:eq(' + indx + ')').addClass('hover'); $contenHolder.find('tr.fav-bar td:eq(' + indx + ')').addClass('hover'); //console.log($contenHolder.find('tr.fav-bar td:eq(' + indx + ')')) $contenHolder.find('tr').find('td:eq(' + indx + ')').addClass('hover'); $(this).parent('tr').find('td').addClass('gc-border-color-a'); hoverStatetd = true; } $('.fav-bar .fav').removeClass('active'); $(this).addClass('active'); document.cookie = cllc.context.get('vehicle') + '_favModel=' + $(this).data('fav') + '; path=/'; }); } /* ----------------------------------------------------------------------------- *\ Plugin Initialization \* ----------------------------------------------------------------------------- */ $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, new featureOverlay(this, options)); } }); }; }) (jQuery, window, document); jQuery(document).ready(function () { jQuery('.features-overlay').featureOverlay(); }); (function (e, h, i, b) { var a = e('#wheels').length; if (a > 0) { var g = 'carouselSourceSwap', d = { carousel: '.swap-items-container', previous: '.swap-btn-previous', next: '.swap-btn-next', viewport: '.swap-items-viewport', container: 'ul' }, k = 720; c = 30, f = 240 } else { var g = 'carouselSourceSwap', d = { carousel: '.swap-items-container', previous: '.swap-btn-previous', next: '.swap-btn-next', viewport: '.swap-items-viewport', container: 'ul' }, k = 800, c = 30, f = 200 } function j(m, l) { this.settings = e.extend(true, { }, d, l); this.element = m; this.$el = e(m); this.$carousel = e(this.settings.carousel, this.$el); this.$previous = e(this.settings.previous, this.$el); this.$next = e(this.settings.next, this.$el); this.$viewport = e(this.settings.viewport, this.$el); this.$container = e(this.settings.container, this.$viewport); this._numItems = this.$container.children().length; this._isAnimating = false; this._init() } j.prototype._init = function () { var l = this; if (a > 0) { if (this._numItems < 4) { this.$carousel.css({ width: (c * 2) + (this._numItems * f) }); this.$viewport.css({ width: (this._numItems * f) }); l.$next.hide(); l.$previous.hide() } else { this.$container.css({ width: this._numItems * f }); this.$viewport.css({ width: (k) }); this.$previous.css({ display: 'block' }).addClass('disabled').on('click', function (m) { m.preventDefault(); if (e(this).hasClass('disabled') || l._isAnimating) { return } l._isAnimating = true; if (l.$next.hasClass('disabled')) { l.$next.removeClass('disabled') } TweenMax.to(l.$container, 0.25, { left: '+=240', onComplete: function () { if (parseInt(l.$container.css('left'), 10) === 0) { l.$previous.addClass('disabled') } l._isAnimating = false } }) }); this.$next.css({ display: 'block' }).on('click', function (m) { m.preventDefault(); if (e(this).hasClass('disabled') || l._isAnimating) { return } l._isAnimating = true; if (l.$previous.hasClass('disabled')) { l.$previous.removeClass('disabled') } TweenMax.to(l.$container, 0.25, { left: '-=240', onComplete: function () { if (parseInt(l.$container.css('left'), 10) === (l._numItems * f * - 1) + k) { l.$next.addClass('disabled') } l._isAnimating = false } }) }) } } else { if (this._numItems <= 4) { this.$carousel.css({ width: (c * 2) + (this._numItems * f) }); this.$viewport.css({ width: (this._numItems * f) }); l.$next.hide(); l.$previous.hide() } else { this.$container.css({ width: this._numItems * f }); this.$viewport.css({ width: (k) }); this.$previous.css({ display: 'block' }).addClass('disabled').on('click', function (m) { m.preventDefault(); if (e(this).hasClass('disabled') || l._isAnimating) { return } l._isAnimating = true; if (l.$next.hasClass('disabled')) { l.$next.removeClass('disabled') } TweenMax.to(l.$container, 0.25, { left: '+=200', onComplete: function () { if (parseInt(l.$container.css('left'), 10) === 0) { l.$previous.addClass('disabled') } l._isAnimating = false } }) }); this.$next.css({ display: 'block' }).on('click', function (m) { m.preventDefault(); if (e(this).hasClass('disabled') || l._isAnimating) { return } l._isAnimating = true; if (l.$previous.hasClass('disabled')) { l.$previous.removeClass('disabled') } TweenMax.to(l.$container, 0.25, { left: '-=200', onComplete: function () { if (parseInt(l.$container.css('left'), 10) === (l._numItems * f * - 1) + k) { l.$next.addClass('disabled') } l._isAnimating = false } }) }) } } this.$el.sourceSwap() }; e.fn[g] = function (l) { return this.each(function () { if (!e.data(this, 'plugin_' + g)) { e.data(this, 'plugin_' + g, new j(this, l)) } }) } }) (jQuery, window, document); (function (e, c, b, g) { var d = 'accordion', f = { accordion: '.accordion' }; function a(i, h) { this.settings = e.extend(true, { }, f, h); this.element = i; this.$el = e(i); this.$accordion = e(this.settings.accordion, this.$el); this._width = Number(this.$accordion.data('cols-img-width').split('-') [1]); this._init() } a.prototype._init = function () { var h = this; this.$accordion.kwicks({ max: this._width, spacing: 2, size: 950 }); e('li', this.$accordion).on('mouseenter', function (i) { var l = e(this), k = l.data('lid'), j = l.data('lpos'); e('h3', h.$accordion).hide(); l.find('h3').show(); /* DATALAYER.linkTrack(this, { lpos: j, lid: k }) */ }).on('mouseleave', function (i) { e('h3', h.$accordion).show() }) }; e.fn[d] = function (h) { return this.each(function () { if (!e.data(this, 'plugin_' + d)) { e.data(this, 'plugin_' + d, new a(this, h)) } }) } }) (jQuery, window, document); (function (d, b, a, g) { var c = 'gallerySlider', f = { container: '.gallery-container', slides: '.slides', item: '.slide', previous: '.btn-previous', next: '.btn-next', pagination: '.pagination', lpos: 'gallery', itemsToShow: 1, slideshow: false, mobileSwipe: true, scroll: 'linear' }; function e(i, h) { this.settings = d.extend(true, { }, f, h); this.element = i; this.$el = d(i); this.$container = d(this.settings.container, this.$el); this.$items = d(this.settings.item, this.$container); this.$previous = d(this.settings.previous, this.$container); this.settings.lpos = (typeof this.$previous.data('lpos') !== 'undefined') ? this.$previous.data('lpos') : this.settings.lpos; this._slides = '#' + d(this.settings.slides, this.$container).attr('id'); this._previous = '#' + this.$previous.attr('id'); this._next = '#' + d(this.settings.next, this.$container).attr('id'); this._pagination = '#' + d(this.settings.pagination, this.$container).attr('id'); this._slideWidth = this.$container.data('slide-width'); this._slideHeight = this.$container.data('slide-height'); this._init() } e.prototype._init = function () { var h = this; d('.btn-previous').attr('data-brand-event', 'event113').attr('data-vehicle-event', 'event143').attr('data-adobe-events', 'event31'); d('.btn-next').attr('data-brand-event', 'event113').attr('data-vehicle-event', 'event143').attr('data-adobe-events', 'event31'); d(this._slides).carouFredSel({ items: this.settings.itemsToShow, auto: this.settings.slideshow, width: this._slideWidth, height: this._slideHeight, swipe: this.settings.mobileSwipe, scroll: this.settings.scroll, prev: this._previous, next: this._next, pagination: { container: this._pagination, anchorBuilder: function (i) { return '
' + i + '
' } }, onCreate: function (i) { d.each(h.$items, function (k, j) { d(j).css({ position: 'relative' }) }) } }) }; d.fn[c] = function (h) { return this.each(function () { if (!d.data(this, 'plugin_' + c)) { d.data(this, 'plugin_' + c, new e(this, h)) } }) } }) (jQuery, window, document); /** This plugin switches a panel of items first (while switching the target image to reflect the first item in the panel) and then shows swatches that switch the image further based on their data-new-src values. @author [Matt Przybylski](mailto:mprzybylski@sapient.com) @example **/ ; (function ($, window, document, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Private Properties \* ----------------------------------------------------------------------------- */ var pluginName = 'optionsSourceSwap', defaults = { container: '.choices', options: '.options', swatches: '.swatches', targetImage: '.swap-target' }; /* ----------------------------------------------------------------------------- *\ Constructor \* ----------------------------------------------------------------------------- */ /** @constructor **/ function OptionsSourceSwap(element, options) { this.settings = $.extend(true, { }, defaults, options); this.element = element; this.$el = $(element); this.$container = $(this.settings.container, this.$el); this.$options = $(this.settings.options, this.$container); this.$swatches = $(this.settings.swatches, this.$container); this.$target = $(this.settings.targetImage, this.$el); this.$currentOption = this.$options.find('li').first(); this.$currentSwatches = this.$swatches.first(); this.$currentSwatch = this.$currentSwatches.find('li').first(); this._lpos = this.$container.data('lpos'); this._init(); } /* ----------------------------------------------------------------------------- *\ Private Methods \* ----------------------------------------------------------------------------- */ /** @method _init @return {null} **/ OptionsSourceSwap.prototype._init = function () { $('a', this.$options).on('click', $.proxy(this._handleOptionSelected, this)); $('a', this.$swatches).on('click', $.proxy(this._handleSwatchSelected, this)); }; /* ----------------------------------------------------------------------------- *\ Event Handlers \* ----------------------------------------------------------------------------- */ /** @method _handleOptionSelected @return {null} **/ OptionsSourceSwap.prototype._handleOptionSelected = function (evt) { evt.preventDefault(); var $this = $(evt.currentTarget), category = $this.data('category'); if (this.$currentOption) { this.$currentOption.removeClass('active'); } this.$currentOption = $this.parent(); this.$currentOption.addClass('active'); $this.addClass('active'); // update swatches if (this.$currentSwatches) { this.$currentSwatches.removeClass('active'); } this.$currentSwatches = this.$swatches.filter('[data-category="' + category + '"]'); this.$currentSwatches.addClass('active'); // highlight 1st swatch if (this.$currentSwatch) { this.$currentSwatch.removeClass('active'); } this.$currentSwatch = this.$currentSwatches.find('li').first(); this.$currentSwatch.addClass('active'); // update image this.$target.attr('src', this.$currentSwatches.first().find('img').data('new-src')); // linkTrack(this._lpos, category); }; /** @method _handleSwatchSelected @return {null} **/ OptionsSourceSwap.prototype._handleSwatchSelected = function (evt) { evt.preventDefault(); var $this = $(evt.currentTarget), $parent = $this.parent(), swatchID = $('li', this.$currentSwatches).index($parent), category = $this.closest('.swatches').data('category'), name = $this.find('p').text().toLowerCase(); if (this.$currentSwatch) { this.$currentSwatch.removeClass('active'); } this.$currentSwatch = $parent; this.$currentSwatch.addClass('active'); // update image this.$target.attr('src', $('img', $this).data('new-src')); // linkTrack(this._lpos, category + '_' + name); }; /* ----------------------------------------------------------------------------- *\ Plugin Initialization \* ----------------------------------------------------------------------------- */ $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, new OptionsSourceSwap(this, options)); } }); }; }) (jQuery, window, document); (function (d, b, a, g) { var c = 'awards', f = { container: '.slides', item: '.slide', itemsToShow: 1, slideWidth: 900, slideHeight: 'variable', showTime: 3000, transition: 'fade' }; function e(i, h) { var j = cllc.context.get('vehicle'); if (j == 'wrangler') { f.showTime = 6000 } this.settings = d.extend(true, { }, f, h); this.element = i; this.$el = d(i); this.$container = d(this.settings.container, this.$el); this.$items = d(this.settings.item, this.$container); this._awards = '#' + this.$container.attr('id'); this._init() } e.prototype._init = function () { var h = this; d(this._awards).carouFredSel({ items: this.settings.itemsToShow, auto: { timeoutDuration: this.settings.showTime }, width: this.settings.slideWidth, height: this.settings.slideHeight, scroll: { fx: this.settings.transition, onAfter: function () { if (d('#awards').data('hover') == '1') { d('#disclaimer').hide() } } }, onCreate: function (i) { d.each(h.$items, function (k, j) { d(j).css({ position: 'relative' }) }) } }) }; d.fn[c] = function (h) { return this.each(function () { if (!d.data(this, 'plugin_' + c)) { d.data(this, 'plugin_' + c, new e(this, h)) } }) } }) (jQuery, window, document); /** Creates a carousel with no transition between slides for the incentives offer banners. @requires *** (THIS SCRIPT IS INCLUDED GLOBALLY!!! NO NEED TO INCLUDE IN YOUR FILE UNLESS ITS EVENTUALLY REMOVED FOR SOME REASON) *** @author [Matt Przybylski](mailto:mprzybylski@sapient.com) @example
$('.module').incentives(); **/ ; (function ($, window, document, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Private Properties \* ----------------------------------------------------------------------------- */ var pluginName = 'incentives', dotHeight = 6, dotSpacing = 5, defaults = { container: '.slides', item: '.slide', pagination: '.pagination', lpos: 'content', // the default lpos for tracking pagination itemsToShow: 1, slideWidth: 270, slideHeight: 75, showTime: 4000, transition: 'fade' }; /* ----------------------------------------------------------------------------- *\ Constructor \* ----------------------------------------------------------------------------- */ /** @constructor **/ function Incentives(element, options) { this.settings = $.extend(true, { }, defaults, options); this.element = element; this.$el = $(element); this.$container = $(this.settings.container, this.$el); this.$items = $(this.settings.item, this.$container); this.$pagination = $(this.settings.pagination, this.$el); this.settings.lpos = (typeof this.$items.first().find('a').data('lpos') !== 'undefined') ? this.$items.first().find('a').data('lpos') : this.settings.lpos; this._offers = '#' + this.$container.attr('id'); this._pagination = '#' + this.$pagination.attr('id'); this._init(); } /* ----------------------------------------------------------------------------- *\ Private Methods \* ----------------------------------------------------------------------------- */ /** @method _init @return {null} **/ Incentives.prototype._init = function () { var self = this; $(this._offers).carouFredSel({ items: this.settings.itemsToShow, auto: { timeoutDuration: this.settings.showTime }, width: this.settings.slideWidth, height: this.settings.slideHeight, scroll: { fx: this.settings.transition, // fix to hide tooltip coming in award section onAfter: function () { if ($('#offers-slideshow').data('hover') == '1') { $('#disclaimer').hide(); } } }, pagination: { container: this._pagination, anchorBuilder: function (id) { return '
' + id + '
'; } }, onCreate: function (data) { // re-align the pagination dots to fit properly vertically var paginationHeight = (self.$items.length * (dotHeight + dotSpacing)) - dotSpacing, yPos = Math.round((self.settings.slideHeight - paginationHeight) * 0.5); self.$pagination.css({ marginTop: yPos }); // fixes bug where items were showing up and setting display: none and then setting it here to block wasn't actually showing them :( $.each(self.$items, function (id, item) { $(item).css({ position: 'relative' }); }); } }); }; /* ----------------------------------------------------------------------------- *\ Plugin Initialization \* ----------------------------------------------------------------------------- */ $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, new Incentives(this, options)); } }); }; }) (jQuery, window, document); (function (h, m, v, j) { var e = 270, b = 'videoReveal', p = { btnOpen: '.btn-view-video', btnClose: '.btn-close-video', sourceURL: '', container: h('#video-container'), endcard: h('.crossbrand-video-endcard'), width: 950, height: 534, playerID: 1, maxPlaylistLength: 20, trackingLPOS: 'videos_content' }, A = null, C = null, t = false, s = null, B = null, n = null, o = 0, u = null, d = null, z = 0, r = false, c = 1, l = true, g = null, q = null, x = null, i = null, y = null, F = null, f = null, k = null, a = null, D = null, w = null; function E(H, G) { this.settings = h.extend(true, { }, p, G); this.element = H; this.$el = h(H); this.$container = h(this.settings.container, this.$el); this.$btnOpen = h(this.settings.btnOpen, this.$el); this.$btnClose = h(this.settings.btnClose, this.$el); this.$playlistPrevious = null; this.$playlistNext = null; this.vidPlayer = null; this.$endcard = null; this.$endcardTitle = null; this.$playlist = null; this.$playlistItems = null; this.vidListLength = 0; this.playlistWidth = 0; this._init() } E.prototype._init = function () { var G = this; this.$btnOpen.on('click', function (H) { H.preventDefault(); G._play(); G.$btnOpen.hide(); G.$btnClose.show(); if (Modernizr.touch) { G.$container.css({ position: 'relative', opacity: 1 }) } else { G.$container.show() } }); this.$btnClose.on('click', function (H) { H.preventDefault(); G._stop(); G.$btnOpen.show(); G.$btnClose.hide(); if (Modernizr.touch) { G.$container.css({ position: 'absolute', opacity: 0 }) } else { G.$container.hide() } }); if (Modernizr.touch) { this.$btnClose.css({ top: - 40 }) } h.getJSON(this.settings.sourceURL, function (H) { G._parse(H) }) }; E.prototype._parse = function (G) { if (typeof G.feed !== 'undefined') { t = true } s = (t) ? G.feed.entry : G.entry; this.vidListLength = (s.length < this.settings.maxPlaylistLength) ? s.length : this.settings.maxPlaylistLength; u = (t) ? s[0].media$group : s.media$group; this.playlistWidth = (this.vidListLength * e); if (!t) { this.vidListLength = 1 } var I = this, J = (t) ? G.feed.title.$t : G.entry.title.$t, H = h('
'), K = h('
Loading the player...
Please click on the play button first to disable security restrictions for iOS.
Close
'); H.append(K); I.$endcard = this.settings.endcard.clone(); x = this.settings.container; x.html(''); x.append(H); if (I.$endcard.length) { x.find('.ios-play-prompt').before(I.$endcard); I.$endcardTitle = I.$endcard.find('p').find('span') } if (this.vidListLength > 1) { this._createPlaylist() } A = new crossbrand.media.Loader({ version: this.settings.playerVersion }); h(m).one(crossbrand.media.Loader.Events.ON_SUCCESS, function (L) { I.vidPlayer = new crossbrand.media.Video({ container: H, src: u.yt$videoid.$t, width: I.settings.width, height: I.settings.height, resizePoster: true, lpos: I.settings.trackingLPOS }); H.on(crossbrand.media.Player.Events.ON_PLAY, function (M) { if (I.$playlist) { I._setCaptionState(I.$playlistItems.filter('.active')) } }).on(crossbrand.media.Player.Events.ON_COMPLETE, function (N) { if (I.$endcard.length) { var Q = I.$endcard.find('.crossbrand-video-replay'), M = I.$endcard.find('.crossbrand-video-next'), P = ''; if (I.$playlist) { var O = I.$playlistItems.filter('.active'); P = O.attr('title'); if (O.data('playlist-position') === (this.vidListLength - 1)) { Q.css('margin-left', '45px'); M.hide() } else { Q.css('margin-left', '0'); M.show() } } else { P = H.data('video-title'); Q.css('margin-left', '45px'); M.hide() } I.$endcardTitle.html(P) } }) }); h(m).one(crossbrand.media.Loader.Events.ON_ERROR, function (L) { throw new Error('crossbrand.media.Loader: Could not load the player.') }) }; E.prototype._play = function () { var G = this; if (!Modernizr.touch) { setTimeout(function () { G.vidPlayer.play() }, 1000) } else { if (!l) { G.vidPlayer.play() } l = false } }; E.prototype._stop = function () { this.vidPlayer.stop(); if (this.vidPlayer.endcard.isShowing) { this.vidPlayer.endcard.hide() } if (this.$playlistItems && !Modernizr.touch) { c = 1; this.$playlistItems.filter('.active').removeClass('active'); var G = this.$playlistItems.first(); G.addClass('active'); this._setCaptionState(G); this.$playlist.css({ left: 0 }); if (h('.crossbrand-video-playlist-previous').length) { this._managePlaylistArrows() } } }; E.prototype._createPlaylist = function () { var H = this; y = h('
'); F = h('
'); H.$playlist = h('
'); for (var J = 0; J < this.vidListLength; J++) { d = s[J]; var G = d.media$group, K = G.yt$videoid.$t, I = G.media$title.$t; if (J === 0) { H.$playlist.append('
' + I + '
Play
') } else { H.$playlist.append('
' + I + '
Play
') } } F.append(H.$playlist); y.append(F); x.find('.ios-play-prompt').after(y); H.$playlistItems = h('li', H.$playlist); H.$playlist.css({ width: H.playlistWidth }); h.each(H.$playlistItems, function (L) { var O = h(this), P = O.find('.caption'), N = O.find('.play-btn'), M = H._truncate(P.html(), 45, '...'); P.html(M + '
Click to Play
'); setTimeout(function () { N.remove(); N = h('
Play
'); O.append(N) }, 1000); O.on('click', function (Q) { c = (Number(O.data('playlist-position')) + 1) }) }); H.$container.find('.crossbrand-video-next').on('click', function (L) { H._setCurrentPlaylistPosition() }); if (H.vidListLength > 3) { this.$playlistPrevious = h('
Previous
'); this.$playlistNext = h('
Next
'); y.append(this.$playlistPrevious, this.$playlistNext); H.$playlistPrevious.addClass('disabled'); H.$playlistPrevious.on('click', function (L) { L.preventDefault(); if (r) { return } if (H.$playlist.position().left < 0) { r = true; H.$playlist.animate({ left: '+=' + e }, function () { r = false; H._managePlaylistArrows() }) } }); H.$playlistNext.on('click', function (L) { L.preventDefault(); if (r) { return } if (H.$playlist.position().left > - (H.playlistWidth - (3 * e))) { r = true; H.$playlist.animate({ left: '-=' + e }, function () { r = false; H._managePlaylistArrows() }) } }) } }; E.prototype._setCaptionState = function (G) { if (w) { w.find('.caption').find('span').html('Click to Play') } w = G; w.find('.caption').find('span').html('Now Playing ' + (Number(w.data('playlist-position')) + 1) + '/' + this.vidListLength) }; E.prototype._setCurrentPlaylistPosition = function () { var G = this, H = G.$playlist.position().left - (3 * e), I = - (c * e); if (I <= H) { r = true; G.$playlist.animate({ left: '-=' + e }, function () { r = false; G._managePlaylistArrows() }) } c += 1 }; E.prototype._managePlaylistArrows = function () { var G = this; if (G.$playlistPrevious !== null) { if (G.$playlist.position().left >= 0 && !G.$playlistPrevious.hasClass('disabled')) { G.$playlistPrevious.addClass('disabled') } if (G.$playlist.position().left < 0 && G.$playlistPrevious.hasClass('disabled')) { G.$playlistPrevious.removeClass('disabled') } if (G.$playlist.position().left > - (G.playlistWidth - (3 * e)) && G.$playlistNext.hasClass('disabled')) { G.$playlistNext.removeClass('disabled') } if (G.$playlist.position().left <= - (G.playlistWidth - (3 * e)) && !G.$playlistNext.hasClass('disabled')) { G.$playlistNext.addClass('disabled') } } }; E.prototype._truncate = function (I, H, G) { return (I.length > H) ? I.substring(0, H) + G : I }; h.fn[b] = function (G) { return this.each(function () { if (!h.data(this, 'plugin_' + b)) { h.data(this, 'plugin_' + b, new E(this, G)) } }) } }) (jQuery, window, document); (function (k, o, p, g) { var c = 0.12, i = 'easeOutQuad', l = - 0.0001, q = 0.03, e = Modernizr.touch, n = 'gallery360', h = { initialized: false, active: false }, j = [ { time: 0, pos: 0 } ], m = false, f = 1, b = false, d = 0; function a(t, s) { this.settings = k.extend(true, { }, h, s); this.element = t; this.$el = k(t); this.$frames = k('.frames', this.$el); this.$btnOpen = k('.btn-open', this.$el); this.$btnClose = k('.btn-close', this.$el); this._isLoaded = false; this._heightBeforeOpening = this.$frames.outerHeight(); this._type = this.$frames.data('type'); this._totalFrames = this.$frames.data('num-frames'); this._path = this.$frames.data('img-path'); this._frameWidth = this.$frames.data('frame-width'); this._frameHeight = this.$frames.data('frame-height'); this._lid = this.$frames.data('tracking-lid'); this._lpos = this.$frames.data('tracking-lpos'); var r = this; this.$el.waypoint(function (u) { if (!r._isLoaded) { r._init(); r._isLoaded = true } }, { offset: '99%' }); if (this._type === 'exterior') { this.$frames.css({ height: this._frameHeight }) } } a.prototype._init = function () { if (this._type === 'interior') { this.$btnOpen.on('click touchstart', k.proxy(this._handleOpenend, this)); this.$btnClose.on('click touchstart', k.proxy(this._close, this)) } else { this._handleOpenend(null) } }; a.prototype._moveHome = function (t) { this._initSwitcher(); var s = this._switcher.getCurrentFrame(), r = (s < this._switcher.getLength() * 0.5) ? 0 : this._totalFrames; this._switcher.animate(r + 2, Math.sqrt( - 2 * Math.abs(s - this._totalFrames) / l), t, i) }; a.prototype._initSwitcher = function (t) { this._switcher = new FrameSwitcher({ async: false, width: this._frameWidth, height: this._frameHeight }); this._switcher.pushFrame(this._path + 'frame-' + (this._totalFrames - 1) + '.jpg'); this._switcher.pushFrame(this._path + 'frame-' + this._totalFrames + '.jpg'); this._switcher.pushFrame(this._path + 'frame-1.jpg'); this._switcher.animate(2, 500); var r = this, s = 2; for (s; s <= (this._totalFrames - 2); s++) { this._switcher.pushFrame(this._path + 'frame-' + s + '.jpg') } this._switcher.appendTo(this.$frames[0], function () { r._enable(); r.settings.initialized = true }) }; a.prototype._enable = function () { if (e) { this.$frames.on('touchstart', k.proxy(this._handleMouseDown, this)).on('touchend', k.proxy(this._handleMouseUp, this)).on('touchcancel', k.proxy(this._handleMouseLeave, this)).on('touchmove', k.proxy(this._handleMouseMove, this)) } else { this.$frames.on('mousedown', k.proxy(this._handleMouseDown, this)).on('mouseup', k.proxy(this._handleMouseUp, this)).on('mouseleave', k.proxy(this._handleMouseLeave, this)).on('mousemove', k.proxy(this._handleMouseMove, this)) } }; a.prototype._reset = function () { if (!this.settings.initialized) { this._initSwitcher() } this.settings.active = true }; a.prototype._close = function (r) { if (r) { r.preventDefault() } if (this._type === 'exterior') { return } this.$frames.css({ height: this._heightBeforeOpening }).removeClass('active').addClass('default'); this.$btnOpen.show(); this.$btnClose.hide(); k('img', this.$frames).remove() }; a.prototype._handleAnimationComplete = function () { this._switcher.stop(); b = false }; a.prototype._handleOpenend = function (r) { if (r) { r.preventDefault() } if (this._type === 'interior') { this.$frames.css({ height: this._frameHeight }).removeClass('default').addClass('active'); this.$btnOpen.hide(); this.$btnClose.show() } if (this.settings.active) { this._moveHome() } else { this._reset(); this._switcher.animate(2, 500) } }; a.prototype._handleMouseDown = function (r) { if (r) { r.preventDefault() } if (b) { this._handleAnimationComplete() } m = true; this._storePos(r.pageX); /* DATALAYER.linkTrack(this, { lpos: this._lpos, lid: this._lid, events: 'event72' }) */ }; a.prototype._handleMouseUp = function (r) { var t = this._calcVelocity(), s = 0; if (Math.abs(t) > 0) { var u = - Math.abs(t) / l, v = 0.5 * f * l * u * u + t * u + this._switcher.getCurrentFrame(); b = true; this._switcher.animate(v, u) } m = false }; a.prototype._handleMouseMove = function (r) { if (r) { r.preventDefault() } d = (e) ? r.originalEvent.changedTouches[0].clientX : r.clientX; if (m) { this._reset(); if (d > j[0].pos) { f = - 1 } else { if (d < j[0].pos) { f = 1 } } this._storePos(d); this._switcher.stepFrame(f) } }; a.prototype._handleMouseLeave = function (r) { if (m) { this._handleMouseUp() } }; a.prototype._storePos = function (t) { var s = new Date(), r = { time: s.getSeconds() / 1000 + s.getMilliseconds(), pos: t }; j[1] = j[0]; j[0] = r }; a.prototype._calcVelocity = function () { return Math.max(Math.min(((j[0].pos - j[1].pos) / (j[0].time - j[1].time)) * q, c), - c) }; k.fn[n] = function (r) { return this.each(function () { if (!k.data(this, 'plugin_' + n)) { k.data(this, 'plugin_' + n, new a(this, r)) } }) } }) (jQuery, window, document); /** @requires @author [Matt Przybylski](mailto:mprzybylski@sapient.com) @example **/ ; (function ($, window, document, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Private Properties \* ----------------------------------------------------------------------------- */ var pluginName = 'threeColumn', defaults = { headerEl: 'h4' }; /* ----------------------------------------------------------------------------- *\ Constructor \* ----------------------------------------------------------------------------- */ /** @constructor **/ function ThreeColumn(element, options) { this.settings = $.extend(true, { }, defaults, options); this.element = element; this.$el = $(element); this._init(); } /* ----------------------------------------------------------------------------- *\ Private Methods \* ----------------------------------------------------------------------------- */ /** Loops through all the headerEl's (h4 by default) and sets the height for the tallest. Then sets all the h4s' to the same height. @method _init @return {null} **/ ThreeColumn.prototype._init = function () { var maxHeight = 0; $(this.settings.headerEl, this.element).each(function () { if ($(this).height() > maxHeight) { maxHeight = $(this).height(); } }); $(this.settings.headerEl, this.element).css('height', maxHeight); }; /* ----------------------------------------------------------------------------- *\ Plugin Initialization \* ----------------------------------------------------------------------------- */ $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, new ThreeColumn(this, options)); } }); }; }) (jQuery, window, document); (function (a) { function b() { var c = window.innerHeight; var d = document.compatMode; if ((d || !a.support.boxModel)) { c = (d == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight } return c } a(window).scroll(function () { var e = b(), c = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop), d = [ ]; a.each(a.cache, function () { if (this.events && this.events.inview) { d.push(this.handle.elem) } }); if (d.length) { a(d).each(function () { var g = a(this), j = g.offset().top, f = g.height(), i = g.data('inview') || false, h = c + a(window).height() / 2; if (h > (j + f) || h + e < j) { if (i) { g.data('inview', false); g.trigger('inview', [ false ]) } } else { if (h < (j + f)) { if (!i) { g.data('inview', true); g.trigger('inview', [ true ]) } } } }) } }); a(function () { a(window).scroll(); c(); function c() { var g = a('.anim'), d = a('.normal'), f = a('.swap'), e = 300; g.on('inview', function (h, i) { if (i == true) { f.fadeOut(e); d.fadeIn(e) } else { d.fadeOut(e); f.fadeIn(e) } }) } }) }) (jQuery); var offer_module = offer_module || { }; offer_module = { offers_data: '', $pricing_drawer_content_bg: $('.pricing-drawer-content-bg'), bg_height_lt_3: $('.offers-content').outerHeight(), vehicleData: '', zipCodeFlag: false, intialised: false, init: function () { offer_module.vehicleData = offer_module.getModels(); offer_module.populateVehicleDropDown({ selector: '#offers-vehicle-trim' }); offer_module.populateVehicleDrive({ selector: '#offers-vehicle-drive', index: 0 }); this.registerHBhelper(); this.events() }, registerHBhelper: function () { if (typeof Handlebars === 'undefined') { cllc.lazy.requires([{ src: '/limited-editions/crossbrand/javascript/handlebars/handlebars-v1.3.0.js' } ], function () { Handlebars.registerHelper('compare', function (a, operator, b, options) { var operators, result; if (arguments.length < 3) { throw new Error('Handlerbars Helper \'compare\' needs 2 parameters') } if (options === undefined) { options = a; a = operator; operator = '==' } var operators = { '==': function (l, r) { return l == r }, '===': function (l, r) { return l === r }, '!=': function (l, r) { return l != r }, '<': function (l, r) { return l < r }, '>': function (l, r) { return l > r }, '<=': function (l, r) { return l <= r }, '>=': function (l, r) { return l >= r }, '%': function (l, r) { return l % r == 0 }, rx: function (l, r) { return eval(l).test(r) == true }, 'typeof': function (l, r) { return typeof l == r } }; if (!operators[operator]) { throw new Error('Handlerbars Helper \'compare\' doesn\'t know the operator ' + operator) } var result = operators[operator](a, b); if (result) { return options.fn(this) } else { return options.inverse(this) } }); Handlebars.registerHelper('disclaimer', function (object) { var disclaimer = object.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'); return new Handlebars.SafeString(disclaimer) }) }) } }, showDisclaimer: function () { $('.disclaimer-holder').hide(); $('body').on('mouseenter', 'a.disclaimer-info', function (a) { a.preventDefault(); $(this).find('.disclaimer-holder').fadeIn() }); $('body').on('mouseleave', 'a.disclaimer-info', function (a) { a.preventDefault(); $(this).find('.disclaimer-holder').fadeOut() }) }, checkZipcode: function () { if (!cllc.context.get('zipcode')) { this.ZipCodeOverlay.render() } else { if ($('.offers-content .zipcode-value')) { $('.offers-content .zipcode-value').html(cllc.context.get('zipcode')); $('input#offers-zipcode').val(cllc.context.get('zipcode')) } } offer_module.template.getJSONData() }, success_callback: function () { offer_module.intialised = true }, getOffers: function (a, b) { var c; var d = new cllc.request.ajax(String.format('/hostd/incentives/getoffers.json?zip={0}&ccode={1}', cllc.context.get('zipcode'), Vehicles.getCcode(cllc.context.get()))); d.responseType = 'json'; d.onsuccess = function (f) { if (f.result.result == 'SUCCESS') { offer_module.success_callback(); c = f.result.data.offerTypes; var e = 0; var l = c.filter(function (j) { return (j.type == 'subv_lease') }).length; for (var k = 0; k < c.length; k++) { if (c[k].type == 'subv_lease') { (function (j) { offer_module.calculateLeasePayment(c[k], function (m) { e++; if (m) { c[j].offers[0].offerDetails.monthlyPayment = m.payment; c[j].offers[0].offerDetails.numberOfPayment = m.term; c[j].offers[0].offerDetails.amount = (m.cash ? m.cash.format('#,#') : m.cash) } if (e == l && k >= c.length - 1) { a(c, b) } else { l = 0 } }) }) (k) } if (c[k].type == 'total_savings_value') { var h = 0; for (var g = 0; g < c[k].offers[0].incentives.length; g++) { h += c[k].offers[0].incentives[g].value } c[k].offers[0].offerDetails.amount = h.format('#,#') } if (c[k].type == 'lease_promo') { console.log(c[k]); c[k].offers[0].offerDetails.securityDeposit = window.parseInt(c[k].offers[0].offerDetails.securityDeposit); c[k].offers[0].offerDetails.securityDeposit = (c[k].offers[0].offerDetails.securityDeposit ? c[k].offers[0].offerDetails.securityDeposit.format('#,#') : c[k].offers[0].offerDetails.securityDeposit) } } } if (l == 0) { a(c, b) } }; d.onerror = function (e) { pageTrack('no_available_offers') }; d.send() }, getPaymentParams: function (e) { var d; var g = { cash: 0 }; if (e.category == 'lease') { for (var c = 0; c < e.offers[0].incentives.length; c++) { if (e.offers[0].incentives[c].category == 'res') { d = e.offers[0].incentives[c].terms; d = d.sort(function (j, h) { return j.mileage - h.mileage }); break } } } for (var c = 0; c < e.offers[0].incentives.length; c++) { if (e.offers[0].incentives[c].category == 'cash') { g.cash += e.offers[0].incentives[c].value } if (e.offers[0].incentives[c].category == 'lse' || e.offers[0].incentives[c].category == 'apr') { var f = 1000000; var a = e.offers[0].incentives[c].terms; if (d) { a = a.filter(function (h) { for (var j = 0; j < d.length; j++) { if (h.duration == d[j].duration) { return true } } return false }) } for (var b = 0; b < a.length; b++) { if (a[b].ppk < f) { g.term = window.parseFloat(a[b].duration); g.rate = window.parseFloat(a[b].value); f = a[b].ppk } } } } if (e.category == 'lease') { d = d.filter(function (h) { return (h.duration == g.term) }); if (d.length > 0) { g.residual = window.parseFloat(d[0].value) } else { g = null } } if (g) { g.destination = e.offers[0].vehicles[0].desCharge; g.downPayment = (e.offers[0].vehicles[0].configuredPrice + e.offers[0].vehicles[0].desCharge) * 0.1; g.vehiclePrice = e.offers[0].vehicles[0].configuredPrice - g.cash; g.disclaimer = e.offers[0].disclaimer } return g }, calculateLeasePayment: function (a, c) { if (a) { var b = offer_module.getPaymentParams.call(this, a); if (b) { cllc.lazy.requires([{ src: '/hostc/bmo/resources/js/net/autodata/chrysler/pe/PaymentCalculator.js' } ], function () { c({ payment: Math.ceil(net.autodata.chrysler.pe.PaymentCalculator.getLeasePayment(b).payment), term: b.term, cash: b.cash, disclaimer: b.disclaimer }) }) } else { c() } } else { c() } }, filterOffersForDisplay: function (c, g) { var e = c.filter(function (h) { return (['lease_promo', 'subv_lease', 'subv_apr', 'subv_apr2', 'subv_apr_combo', 'cash_allowance', 'total_savings_value', 'misc_cash'].contains(h.type)) }); e = e.filter(function (h) { return (h.type != 'subv_lease' || (h.type == 'subv_lease' && h.offers[0].offerDetails.monthlyPayment)) }); if (e.filter(function (h) { return h.type == 'lease_promo' }) [0]) { e = e.filter(function (h) { return (h.type != 'subv_lease') }) } if (e.filter(function (h) { return h.type == 'cash_allowance' }) [0]) { e = e.filter(function (h) { return (h.type != 'misc_cash') }) } if (e.length == 0) { e = c.filter(function (h) { return (h.type == 'std_apr') }) } var b = 0, d = 0, f = 0, a = [ ]; a = e.filter(function (h) { if (h.category === 'cash' && b < 1) { b++; return true } else { if (h.category === 'apr' && d < 1) { d++; return true } else { if (h.category === 'lease' && f < 1) { f++; return true } else { return false } } } }); a.sort(function (j, h) { if (h.category == 'lease') { return 1 } else { if (h.category == 'apr' && j.category == 'cash') { return 1 } else { return - 1 } } }); console.log('sorted-offers'); console.log(a); g(a) }, populateVehicleDropDown: function (a) { var b = ''; var d; var c = offer_module.vehicleData; if (cllc.context.get('vehicle') == 'wrangler_unlimited' || cllc.context.get('vehicle') == 'grand_cherokee') { d = cllc.context.get('vehicle').replace('_', ' ') } else { d = cllc.context.get('vehicle') } for (i = 0; i < c.length; i++) { b += '
' + d + ' ' + c[i].name + '
' } $(a.selector).html(b) }, populateVehicleDrive: function (a) { var c = ''; var d = offer_module.vehicleData; for (var b = 0; b < d[a.index].drives.length; b++) { c += '
' + d[a.index].drives[b].name + '
' } $(a.selector).html(c) }, getModels: function () { var d = Vehicles.getAvailableTrims(cllc.context.get()); var c = new Array(); var b; for (var a = 0; a < d.length; a++) { b = { year: cllc.context.get('year'), vehicle: cllc.context.get('vehicle'), trim: d[a] }; c.push({ index: a, id: d[a], name: Vehicles.getTrimDisplay(b), msrp: Vehicles.getMSRP((function () { var e = cllc.utils.cloneObject(b); if (cllc.context.get('trim') == d[a]) { e.drive = cllc.context.get('drive') } return e }) ()), drives: Vehicles.getAvailableDrives(b) }) } return c }, template: { getJSONData: function () { offer_module.getOffers(offer_module.filterOffersForDisplay, offer_module.template.renderTemplate) }, renderTemplate: function (c) { var a = $('#hb-template-offers').html(), b = '', d = { offers: c }; b = Handlebars.compile(a); $('.offers-template').html(b(d)); offer_module.addSeparatorClass() } }, ZipCodeOverlay: { render: function () { var a = new cllc.ui.modal(); a.onclose = function () { if (offer_module.zipCodeFlag == false) { $('.zipcode-container, .error-check').fadeOut(); $('#zip-enter').fadeIn() } linkTrack('zipcode_overlay', 'close_btn') }; a.open('
Please enter your ZIP code:
'); $('#offers-zipcode-overlay form').on('submit', function (c) { c.preventDefault(); var b = this.zipcode.value; offer_module.zipCodeFlag = false; if (/^\d{5}$/.test(b)) { offer_module.zipCodeFlag = true; cllc.context.set('zipcode', b); a.onclose = null; a.close(); $('.offers-content .zipcode-value').html(cllc.context.get('zipcode')); $('input#offers-zipcode').val(cllc.context.get('zipcode')); $('.zipcode-container, .error-check').fadeIn(); offer_module.template.getJSONData() } else { offer_module.zipCodeFlag = false; alert('Please enter a valid zipcode') } }) }, validate: function () { var c = $('.change-zipcode'), a = $('.submit-zipcode'); var b = $('.offers-content #offers-zipcode').val(); if (/^\d{5}$/.test(b)) { a.removeClass('error'); a.hide(); c.show(); cllc.context.set('zipcode', b); $('.offers-content .zipcode-value').html(cllc.context.get('zipcode')); offer_module.template.getJSONData(); /* DATALAYER.linkTrack(true, { lid: b, lpos: 'model-content' }) */ } else { a.addClass('error') } } }, addSeparatorClass: function () { var d = $('.offers-template ul li').find('a[href=\'#app-incentives\']'), e = ''; if (cllc.context.get('trim') === undefined) { cllc.context.set('trim', 'sport') } e = '{"trim":"' + cllc.context.get('trim') + '","vehicle":"' + cllc.context.get('vehicle') + '","year":' + cllc.context.get('year') + '}'; d.attr('data-context', e); var c = $('.offers-template ul li').length, a = $('.offers-template ul li:first-child'), b = $('.offers-template ul li:last-child'); switch (true) { case (c >= 3) : $('.offers-template ul li.type-apr').addClass('or-separator'); $('.offers-template ul li.type-cash').addClass('and-separator'); break; case (c === 2) : if (a.hasClass('type-lease') && b.hasClass('type-apr')) { $('.offers-template ul li.type-apr').addClass('or-separator') } else { if (a.hasClass('type-apr') && b.hasClass('type-cash')) { $('.offers-template ul li.type-cash').addClass('and-separator') } else { $('.offers-template ul li.type-cash').addClass('and-separator') } } } offer_module.$pricing_drawer_content_bg.animate({ height: offer_module.bg_height_lt_3 }) }, events: function () { var d = $('.change-zipcode'), c = $('.offers-drawer-heading .offers-title'), b = $('.offers-content'), a = $('.submit-zipcode'); $(document).on('submit', '#zip-enter form', function (f) { f.preventDefault(); var e = this.zipcode.value; if (/^\d{5}$/.test(e)) { cllc.context.set('zipcode', e); $('.offers-content .zipcode-value').html(cllc.context.get('zipcode')); $('input#offers-zipcode').val(cllc.context.get('zipcode')); $('.zipcode-container, .error-check').fadeIn(); offer_module.template.getJSONData() } else { alert('Please enter a valid zipcode') } }); $('.offers-drawer-heading').on('click', function () { if (b.is(':visible')) { offer_module.$pricing_drawer_content_bg.animate({ height: 0 }); b.slideUp(400, function () { c.removeClass('active') }); /* DATALAYER.linkTrack(true, { lid: 'see-local-offers-collapse', lpos: 'pricing-content' }) */ } else { /* DATALAYER.linkTrack(true, { lid: 'see-local-offers-expand', lpos: 'pricing-content' }); */ if (cllc.context.get('vehicle') === 'cherokee') { $('#offers-vehicle-trim').find('option[data-id="latitude"]').attr('selected', true) } else { if (window.location.pathname.split('/') [2] === 'limited-editions' && typeof cllc.context.get('trim') != 'undefined') { var e = $('#offers-vehicle-trim').find('option[data-id=' + cllc.context.get('trim').replace(/\s/g, '-') + ']'); if (e.size() > 0) { e.attr('selected', true) } } } offer_module.$pricing_drawer_content_bg.animate({ height: offer_module.bg_height_lt_3 }); b.slideDown(400, function () { if (offer_module.intialised === false) { offer_module.checkZipcode() } c.addClass('active'); if ($('.secondary-navigation').hasClass('secnav-shrink')) { $('html,body').animate({ scrollTop: $('.incentives-bg').offset().top - 50 }, 500) } else { $('html,body').animate({ scrollTop: $('.incentives-bg').offset().top - 80 }, 500) } }); $('#offers-vehicle-trim').trigger('change') } setTimeout(function () { if ($('.main-content .offers-content .local-offers-selector .gc-forms-select-label a').size() > 0) { try { $('.main-content .offers-content .local-offers-selector .gc-forms-select-label a') [0].style.cssText = 'width: auto !important'; $('.main-content .offers-content .local-offers-selector .gc-forms-select-label a') [1].style.cssText = 'width: auto !important' } catch (f) { console.log(f) } } }, 5) }); $('.change-zipcode a').on('click', function (f) { f.preventDefault(); d.hide(); $('.submit-zipcode input').val(cllc.context.get('zipcode')); a.show() }); $('.submit-zipcode a').on('click', function (f) { f.preventDefault(); offer_module.ZipCodeOverlay.validate() }); $('#offers-zipcode').on('keyup', function (f) { if (f.which === 13) { offer_module.ZipCodeOverlay.validate() } }); $('.local-offers-selector #offers-vehicle-trim').on('change', function () { var e = $('option:selected', $(this)).attr('data-id'); var f = $('option:selected').index(); /* DATALAYER.linkTrack(true, { lid: e, lpos: 'pricing-content' }); */ offer_module.populateVehicleDrive({ selector: '#offers-vehicle-drive', index: f }); cllc.context.set('drive', $('option:selected', $('.local-offers-selector #offers-vehicle-drive')).val()); cllc.context.set('trim', e); offer_module.template.getJSONData(); setTimeout(function () { if ($('.main-content .offers-content .local-offers-selector .gc-forms-select-label a').size() > 0) { try { $('.main-content .offers-content .local-offers-selector .gc-forms-select-label a') [0].style.cssText = 'width: auto !important'; $('.main-content .offers-content .local-offers-selector .gc-forms-select-label a') [1].style.cssText = 'width: auto !important' } catch (g) { console.log(g) } } }, 5) }); $('.local-offers-selector #offers-vehicle-drive').on('change', function () { var e = $('option:selected', $('.local-offers-selector #offers-vehicle-drive')).text(); /* DATALAYER.linkTrack(true, { lid: 'drive-' + e, lpos: 'pricing-content' }); */ cllc.context.set('drive', $('option:selected', $(this)).val()); offer_module.template.getJSONData() }) } }; offer_module.init(); offer_module.showDisclaimer(); $(window).on('scroll', function () { if ($('.offers-content').is(':visible')) { var a = $('.offers-content'); var b = a.offset().top + a.height(); if ($(window).scrollTop() > b) { $('.offers-drawer-heading').trigger('click') } } }); (function (e, a, d, f) { if (e('#hero-slideshow li').length > 1) { e('#page-background').append('
') } if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { e('#hero_gallery').gallerySlider({ slideshow: { timeoutDuration: 7000 }, scroll: { fx: 'fade', ease: 'quadratic', duration: 1000 } }) } else { e('#hero_gallery').gallerySlider({ slideshow: { timeoutDuration: 7000 }, scroll: { fx: 'fade', ease: 'quadratic', duration: 1000 } }) } var c = 1; var b = 1; d.heroCarouselArrow = function (g, i, h) { if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if (e('#hero-slideshow li').length > 1) { if ((/MSIE/i.test(navigator.userAgent)) && (parseInt(navigator.userAgent.split('MSIE') [1]) <= 10)) { e('#cursor').attr('id', 'arrows'); e('#arrows').css('cursor', 'pointer'); e('#arrows').html('
') } else { e('#hero_gallery').on('mousemove', function (k) { var j = e(this), m = k.pageX - 10, l = k.pageY - e('#hero_gallery').offset().top - 10; e('#cursor').css({ transform: 'translate(' + m + 'px,' + l + 'px)' }) }); e('#hero-slideshow-previous').on('mouseenter', function (j) { e('#cursor').addClass('isActive'); e('body').css('cursor', 'none'); e('#cursor').removeClass('right').addClass('left') }).on('mouseleave', function (j) { e('#cursor').removeClass('isActive'); e('body').css('cursor', 'auto') }); e('#hero-slideshow-next').on('mouseenter', function (j) { e('#cursor').addClass('isActive'); e('body').css('cursor', 'none'); e('#cursor').removeClass('left').addClass('right') }).on('mouseleave', function (j) { e('#cursor').removeClass('isActive'); e('body').css('cursor', 'auto') }); e('#hero-slideshow-previous').on('click', function (j) { var k = e('#hero-slideshow').triggerHandler('currentPage') + 1; if (c === 1) { c = 2; /* DATALAYER.linkTrack(true, { lid: 'previous', lpos: cllc.context.get('year') + '-' + cllc.context.get('vehicle') + '-landing:hero:' + k }); */ setTimeout(function () { c = 1 }, 500); console.log('previous metric') } }); e('#hero-slideshow-next').on('click', function (j) { var k = e('#hero-slideshow').triggerHandler('currentPage') + 1; if (b === 1) { b = 2; /* DATALAYER.linkTrack(true, { lid: 'next', lpos: cllc.context.get('year') + '-' + cllc.context.get('vehicle') + '-landing:hero:' + k }); */ setTimeout(function () { b = 1 }, 500); console.log('next metric') } }); e('.actions').on('mouseenter', function (j) { e('#cursor').removeClass('isActive'); e('body').css('cursor', 'auto') }).on('mouseleave', function (j) { e('#cursor').addClass('isActive'); e('body').css('cursor', 'none') }); if (e('#hero_gallery').css('background-color') == 'transparent') { e('#cursor').addClass('isActive'); e('body').css('cursor', 'none'); e('#cursor').css({ transform: 'translate(-1000px, -1000px)' }) } e(a).on('mouseleave', '#hero_gallery', function () { e('body').css('cursor', 'auto') }) } } e('#hero_gallery .slide').on('mouseenter', '.info_desc', function (j) { e(this).find('span').css('display', 'block') }).on('mouseleave', '.info_desc', function (j) { e(this).find('span').css('display', 'none') }) } } }) (jQuery, document, window); $(document).ready(function () { var e = 720, q = 1280, o = (window.screen.width / window.screen.height), k = (($('.global-nav').height()) + + ($('.secondary-navigation').height())), h = (window.innerHeight - k), g = Math.round(h * q / e), b = $('.main-content .mod-incentives.module'), c = $('#pricing-bg'), n, m; var f = $('video'), a = $('#hero-module li.slide[data-type=image] img:not(.logo)'), l; for (var j = 0; j < a.length; j++) { l = a.eq(j).attr('src'); $('#hero-module li.slide[data-type=image]').eq(j).css('background-image', 'url("' + l + '")'); a.hide() } for (var j = 0; j < a.length; j++) { l = a.eq(j).attr('src'); $('#hero-module li.slide[data-type=image]').eq(j).css('background-image', 'url("' + l + '")'); a.hide() } f.click(function () { f[0].play() }); n = function (i) { if (h < 500) { $('#hero-module').css({ 'min-height': 'auto' }); b.css({ display: 'block', 'margin-top': '-135px' }); c.css({ display: 'block', bottom: 0 }) } else { if (i == true) { b.css({ display: 'block', 'margin-top': '-135px' }); c.css({ display: 'block', bottom: 0 }) } else { b.css({ display: 'block', 'margin-top': '20px' }); c.css({ display: 'block', bottom: '-167px' }) } } }; m = function (i) { if (i == true) { var r = $('.main-content').offset(); if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { $('#hero-module, #hero-container, #hero_gallery, #hero-slideshow li').css({ height: h - $('header').height() + 'px' }); $('#hero_gallery').css('width', window.innerWidth + 'px'); if (h < 500) { $('#hero-slideshow-pagination').css('bottom', '10px') } else { $('#hero-slideshow-pagination').css('bottom', h - (h - $('header').height())) } $('.hero-content').css('height', h - $('header').height() + 'px') } $('.pricing-drawer-content-bg').css({ width: $('body').innerWidth() + 'px', left: - r.left }) } }; resizeToCover = function () { var i = 300; vid_w_orig = 640, vid_h_orig = 360, scale_h = $(window).width() / vid_w_orig, scale_v = $(window).height() / vid_h_orig, scale = scale_h > scale_v ? scale_h : scale_v; if (scale * vid_w_orig < i) { scale = i / vid_w_orig } $('video').width(scale * vid_w_orig); $('video').height(scale * vid_h_orig) }; $(window).resize(function () { h = (window.innerHeight - k); m(true); n(true); resizeToCover() }); if (o > 1 && o < 1.7777) { m(true); n(true); window.heroCarouselArrow(360, 1100, 215) } else { if (o >= 1.7777) { m(false); n(true); window.heroCarouselArrow(360, 1100, 215); if (window.screen.width >= 1900) { window.heroCarouselArrow(460, 1500, 215) } } else { if (o < 0.99) { n(true); m(false) } } } resizeToCover(); $('#hero-slideshow').carouFredSel({ responsive: true, width: '100%', swipe: { onTouch: true }, scroll: { items: 1, duration: 500, onAfter: function (s) { p(s.items.old); d(s.items.visible); var r = $('#hero-slideshow .slide.active'); if (r.eq(0).attr('data-type') === 'video') { if ($('body').hasClass('ie8')) { } else { $('video').get(0).play() } } var t = $('#hero-slideshow').triggerHandler('currentPage'); $disclaimer = $('.mod-wrapper.price .disclaimer'); $cta = $('.mod-wrapper.cta-container .cta-comp'); var i = $disclaimer.data('slide'); dataSlide2 = $cta.data('slide'); // console.log(dataSlide2); if (typeof (t) !== 'undefined' && typeof (i) !== 'undefined' && i != 'none') { $disclaimer.removeClass('active').fadeOut('400'); $('.mod-wrapper.price .disclaimer[data-slide=slide_' + t + ']').fadeIn('400') } if (typeof (t) !== 'undefined' && typeof (dataSlide2) !== 'undefined' && dataSlide2 != 'none') { $cta.removeClass('active').fadeOut('400'); $('.mod-wrapper.cta-container .cta-comp[data-slide=slide_' + t + ']').fadeIn('400') } } }, pagination: '#hero-slideshow-pagination', prev: '#hero-slideshow-previous.btn-previous', next: '#hero-slideshow-next.btn-next', auto: { timeoutDuration: 9000 } }); $('#hero-slideshow-pagination a').each(function (r) { var i = r + 1; $(this).attr('data-lpos', 'hero-content').attr('data-lid', 'indicator_' + i) }); $('.btn-previous').removeAttr('data-lpos').removeAttr('data-lid'); $('.btn-next').removeAttr('data-lpos').removeAttr('data-lid'); function p(i) { $(i).removeClass('active') } function d(i) { $(i).filter(':eq(0)').addClass('active') } m(true); if ($('video').size() > 0) { $('video').get(0).play() } $('.mod-incentives .bucket a[href="#app-bmo"]').on('click', function (i) { i.preventDefault(); var r = '', s = '', t = location.href.indexOf('75th-anniversary'); if ($('.disclaimer.content:visible').size() > 0 && t == - 1) { r = $('.disclaimer.content:visible').find('.actual-msrp').data(); s = '{"vehicle":"' + r.vehicle + '", "year":"' + r.year + '", "model":"' + r.trim + '"}' } else { if (t > - 1) { r = $('.mod-container .vehicle .info.active').find('a[href="#app-bmo"]:visible').data('context'); s = JSON.stringify(r) } else { r = $('.mod-wrapper.price .msrp.bucket').find('.num.actual-msrp').data(); s = '{"vehicle":"' + r.vehicle + '", "year":"' + r.year + '", "trim":"' + cllc.context.get('trim') + '"}' } } $(this).attr('data-context', s) }) }); (function () { $('.hotspots-container .hotspot').each(function () { $(this).animate({ left: $(this).data('xpos'), top: $(this).data('ypos') }); $(this).find('.hotspot-content').addClass($(this).data('direction')) }); $('.hotspots-container .hotspot').mouseenter(function () { $(this).find('.hotspot-content').fadeIn(); var a = $(this).find('.hotspot-content p').text(); /* DATALAYER.linkTrack(true, { lid: a.split(' ') [0] + '-' + a.split(' ') [1] + '-' + a.split(' ') [2] + '-' + a.split(' ') [3], lpos: 'enhanced_gallery', vars: { eVar68: 'hover', } }) */ }); $('.hotspots-container .hotspot').mouseleave(function () { $(this).find('.hotspot-content').fadeOut() }) }) (); $(document).ready(function () { setTimeout(function () { $('.mod-incentives .mod-wrapper .cta-comp').hide(); $('.mod-incentives .mod-wrapper .cta-comp').eq(0).show() }, 100) });