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('Current vehicleModel backgroundModel wheel') } else { if (this.settings.anniversary) { g('.module.mod-modelizer .cur-vehicle').html('Current vehicleModel backgroundModel wheel') } } 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 = '