Ombre argentée
Galaxy Z Fold6
- 256 Go | 12 Go
- 512 Go | 12Go
- 1 To | 12 Go
Souscrivez à Samsung Care+
Achetez le nouveau Galaxy Z Fold6 et obtenez une protection Samsung Care+ gratuite contre 1 dommage accidentel à l'écran*
*La disponibilité de Samsung Care+ peut varier en fonction du pays. Il est nécessaire d'activer Samsung Care+ dans les 30 jours suivant l'achat de l'appareil.
Valable pour une réparation d'écran sur une période de 12 mois. Des frais de réparation sont payables pour chaque incident. Sous réserve des conditions générales.
Les dates de promotion peuvent varier selon les pays
';
$('body').append(fixedElements);
this.fixedWrap = $('.' + fixedClass).last();
}
},
setOpts : function () {
var winWidth = UTIL.winSize().w,
winHeight = UTIL.winSize().h,
offsetTop = this.jsStickyWrap.offset().top - this.opts.body.offset().top,
stickyHeight = (this.stickyPos !== 'side') ? this.stickyWrap.outerHeight(true) : 0,
offsetBottom = offsetTop + stickyHeight,
alignBottomOffset = offsetBottom - winHeight;
this.opts.prop['offsetTop'] = Math.floor(offsetTop, 10);
this.opts.prop['offsetBottom'] = Math.floor(offsetBottom, 10);
this.opts.prop['stickyHeight'] = Math.ceil(stickyHeight, 10);
this.opts.prop['alignBottomOffset'] = Math.ceil(alignBottomOffset, 10);
var breakpoints = this.opts.breakpoints,
breakKeyMins = [],
breakKeyMin;
for (var key in breakpoints) {
if (key >= winWidth) {
breakKeyMins.push(key);
breakKeyMin = Math.min.apply(null, breakKeyMins);
} else {
breakKeyMin = null;
}
}
this.breakOpts = UTIL.def({}, this.opts);
if (breakKeyMin != null) {
this.breakOpts = UTIL.def(this.breakOpts, breakpoints[breakKeyMin]);
}
if (!UTIL.isSupportTransform) {
this.breakOpts['align'] = this.opts['align'];
this.breakOpts['spaceStickyElements'] = this.opts['spaceStickyElements'];
}
if (!UTIL.isSupportTransform || (UTIL.isSupportTransform && (winWidth > BREAKPOINTS.MOBILE))) {
if (this.breakOpts.overedElements !== null) {
var overedElements = this.breakOpts.overedElements,
overedElementsOffsetTop = overedElements.offset().top,
overedElementsHeight = overedElements.outerHeight(),
stickyWrap = this.stickyWrap,
stickyWrapHeight = stickyWrap.outerHeight();
this.opts.prop['overedElementsOffset'] = overedElementsOffsetTop + overedElementsHeight - stickyWrapHeight;
}
} else {
this.breakOpts.overedElements = null;
}
var spaceStickyElements = $(this.breakOpts.spaceStickyElements),
spaceStickyCondition = spaceStickyElements.length;
this.spaceStickyData = {
offsetTop : spaceStickyCondition ? this.spaceStickyElements.parent().offset().top : 0,
stickyHeight : spaceStickyCondition ? this.spaceStickyElements.outerHeight() : 0
};
if (typeof this.breakOpts.spaceBetween === 'string') {
var spaceBetweenElements = $(this.breakOpts.spaceBetween),
spaceBetweenCondition = spaceBetweenElements.length,
spaceBetweenHeight = (spaceBetweenCondition ? spaceBetweenElements.outerHeight() : 0);
this.spaceBetween = spaceBetweenHeight;
} else {
this.spaceBetween = this.breakOpts.spaceBetween;
}
for (var cssKey in this.opts.alignCss) {
this.opts.alignCss[cssKey][cssKey] = 0 + this.spaceBetween;
}
this.setLayout();
this.setAnchorOffset();
},
setLayout : function () {
var prop = this.opts.prop;
if (this.stickyPos !== 'side') {
this.jsStickyWrap.css('height', prop.stickyHeight);
this.opts.callbackData = prop;
} else {
this.opts.callbackData = {};
}
},
setAnchorOffset : function () {
if (!this.stickyAnchor.length) return;
var stickyAnchor = this.stickyAnchor,
prop = this.opts.prop,
spaceHeight = (this.breakOpts.align === 'bottom') ? 0 : prop.stickyHeight,
spaceBetween = (this.stickyPos !== 'side') ? this.spaceBetween : 0,
spaceStickyData = this.spaceStickyData;
this.anchorDatas = [];
for (var i = 0, max = stickyAnchor.length; i < max; i++) {
var targetHref = stickyAnchor.eq(i).attr('href'),
target = $(targetHref),
spaceStickyHeight = (target.offset().top >= spaceStickyData.offsetTop) ? spaceStickyData.stickyHeight : 0,
datas = {
ID : targetHref.replace('#', ''),
offset : target.offset().top,
minOffset : Math.ceil(target.offset().top - spaceHeight - spaceBetween - spaceStickyHeight, 10),
maxOffset : Math.ceil(target.offset().top + target.outerHeight(true) - spaceHeight - spaceBetween - spaceStickyHeight, 10)
};
this.anchorDatas.push(datas);
}
},
changeEvents : function (event) {
var events = [],
eventNames = event.split(' ');
for (var key in eventNames) {
events.push(eventNames[key] + this.opts.customEvent);
}
return events.join(' ');
},
bindEvents : function (type) {
if (type) {
$(win).on(this.changeEvents('scroll'), $.proxy(this.onScrollFunc, this));
$(win).on(this.changeEvents('resize'), $.proxy(this.onResizeFunc, this));
this.stickyAnchor.on(this.changeEvents('click'), $.proxy(this.onClickAnchor, this));
if (this.opts.anchor.hashnav && this.stickyAnchor.length) {
$(win).on(this.changeEvents('hashchange'), $.proxy(this.onHashChangeFunc, this));
}
} else {
$(win).off(this.changeEvents('scroll'));
$(win).off(this.changeEvents('resize'));
this.stickyAnchor.off(this.changeEvents('click'));
if (this.opts.anchor.hashnav && this.stickyAnchor.length) {
$(win).off(this.changeEvents('hashchange'));
}
}
},
onClickAnchor : function (e) {
e.preventDefault();
var target = $(e.currentTarget),
targetHref = target.attr('href');
this.anchorMove(targetHref.replace('#', ''));
},
onHashChangeFunc : function () {
var newHash = doc.location.hash.replace('#', ''),
newHashname = newHash.replace(this.opts.anchor.hashname, '');
if (newHashname !== this.anchorTarget) {
this.anchorMove(newHashname);
}
},
setHash : function () {
if (!this.opts.anchor.hashnav || !this.stickyAnchor.length) return;
var anchorTarget = this.anchorTarget,
optsAnchor = this.opts.anchor,
hashname = anchorTarget + optsAnchor.hashname,
currentHash = doc.location.hash.replace('#', '');
if (currentHash !== hashname && anchorTarget.length) {
doc.location.hash = hashname;
}
},
anchorMove : function (target) {
var _this = this,
optsAnchor = this.opts.anchor,
anchorDatas = this.anchorDatas,
offsetNum = null;
for (var key in anchorDatas) {
var data = anchorDatas[key];
if (data.ID === target) {
offsetNum = data.minOffset + 1;
}
}
this.anchorTarget = target;
this.outCallback('anchorMoveBefore');
if (optsAnchor.duration <= 0 || !optsAnchor.duration) {
$('html, body').stop().scrollTop(offsetNum);
this.anchorMoveAfterBugFunc();
} else {
$('html, body').stop().animate({
scrollTop : offsetNum
}, {
duration : optsAnchor.duration,
easing : optsAnchor.easing,
step : function (now, tween) {
_this.outCallback('anchorMove', now, tween);
},
complete : $.proxy(this.anchorMoveAfterBugFunc, this)
});
}
},
onAnchorMoveAfter : function () {
this.anchorFocus();
this.outCallback('anchorMoveAfter');
},
anchorMoveAfterBugFunc : function () {
if (this.opts.anchor.hashnav && this.stickyAnchor.length) {
this.setHash();
}
win.clearTimeout(this.anchorMoveAfterTimeout);
this.anchorMoveAfterTimeout = win.setTimeout($.proxy(this.onAnchorMoveAfter, this), 30);
},
anchorActive : function (num) {
var stickyAnchor = this.stickyAnchor,
anchorDatas = this.anchorDatas,
activeDatas = anchorDatas[num],
activeClass = this.opts.anchor.activeClass;
if ((typeof num) == undefined || num == null) {
stickyAnchor.removeClass(activeClass);
} else {
for (var i = 0, max = stickyAnchor.length; i < max; i++) {
var target = stickyAnchor.eq(i),
targetHref = target.attr('href');
if (targetHref.replace('#', '') === activeDatas.ID) {
if (!target.hasClass(activeClass)) {
target.addClass(activeClass);
this.opts.prop['activeID'] = activeDatas.ID;
}
} else {
if (target.hasClass(activeClass)) {
target.removeClass(activeClass);
}
}
}
}
},
anchorFocus : function () {
var stickyAnchor = this.stickyAnchor,
anchorTarget = $('#' + this.anchorTarget);
if (!anchorTarget.length) return;
var firstElement = anchorTarget.find('*').filter(':visible').first().css('outline', 'none');
firstElement.attr({
'role' : 'dialog',
'tabIndex' : -1
}).focus();
firstElement.on('focusout', function (e) {
var _this = $(e.currentTarget);
_this.removeAttr('tabIndex').css('outline', '');
_this.off('focusout');
});
win.setTimeout($.proxy(function () {
firstElement.removeAttr('role');
}, this), 150);
},
onScrollFunc : function () {
this.winScrollTop = $(win).scrollTop();
if (this.opts.scrollStart == null) {
this.opts.scrollStart = this.winScrollTop;
if (this.opts.easing == null) {
this.outCallback('stickyMoveBefore');
this.scrollAnimateFunc();
}
}
win.clearTimeout(this.scrollEndTimeout);
this.scrollEndTimeout = win.setTimeout($.proxy(this.onScrollEndFunc, this), 60);
},
onScrollEndFunc : function () {
this.opts.scrollStart = null;
if (!this.opts.destroyType) {
if (this.stickyAnchor.length) {
var anchorDatas = this.anchorDatas,
winScrollTop = this.winScrollTop,
activeKey,
maxActiveKey;
var lockScroll = $('html').data('lockScroll'),
lockType = (lockScroll != null) ? true : false,
scrollTop = (lockType) ? lockScroll.top : winScrollTop;
for (var key in anchorDatas) {
var data = anchorDatas[key];
if (data.minOffset <= scrollTop) {
activeKey = parseInt(key, 10);
}
if (data.maxOffset > scrollTop) {
maxActiveKey = parseInt(key, 10);
}
}
if (((typeof activeKey) == undefined || activeKey == null) || ((typeof maxActiveKey) == undefined || maxActiveKey == null)) {
activeKey = null;
}
if ((typeof maxActiveKey) == undefined || maxActiveKey == null) {
this.opts.prop['activeID'] = anchorDatas[anchorDatas.length - 1].ID;
} else {
if ((typeof activeKey) == undefined || activeKey == null) {
this.opts.prop['activeID'] = anchorDatas[0].ID;
}
}
this.anchorActive(activeKey);
}
if (this.opts.easing == null) {
this.stickyFixedFunc();
this.outCallback('stickyMoveAfter');
} else {
this.stickyEasingFunc();
}
}
UTIL.cancelAFrame.call(win, this.scrollRequestFrame);
},
scrollAnimateFunc : function () {
if (!this.opts.destroyType) {
this.stickyFixedFunc();
this.outCallback('stickyMove');
}
this.scrollRequestFrame = UTIL.requestAFrame.call(win, $.proxy(this.scrollAnimateFunc, this));
},
stickyFixedFunc : function () {
var prop = this.opts.prop,
align = this.breakOpts.align,
alignCss = this.opts.alignCss,
winScrollTop = this.winScrollTop,
spaceBetween = (this.stickyPos !== 'side') ? this.spaceBetween : 0;
var lockScroll = $('html').data('lockScroll'),
lockType = (lockScroll != null) ? true : false,
scrollTop = (lockType) ? lockScroll.top : winScrollTop;
if (align === 'top') {
var alignData = alignCss[align];
this.condition = scrollTop > (prop.offsetTop - spaceBetween);
if (this.breakOpts.overedElements !== null) {
this.overCondition = scrollTop > prop.overedElementsOffset;
}
} else if (align === 'bottom') {
var alignData = alignCss[align];
this.condition = scrollTop < (prop.alignBottomOffset + spaceBetween);
} else if (align === 'topAndBottom') {
this.condition = scrollTop > (prop.offsetTop - spaceBetween) ||
scrollTop < (prop.alignBottomOffset + spaceBetween);
if (scrollTop > (prop.offsetTop - spaceBetween)) {
var alignData = alignCss['top'];
} else if (scrollTop < (prop.alignBottomOffset + spaceBetween)) {
var alignData = alignCss['bottom'];
}
}
if (this.condition) {
if (!this.stickyWrap.hasClass(this.opts.fixedClass)) {
this.stickyWrap.addClass(this.opts.fixedClass);
if (this.opts.isFixedConflict && this.stickyPos !== 'side') {
this.fixedWrap.append(this.stickyWrap);
}
}
if (this.stickyPos !== 'side') {
this.stickyWrap.css(alignData);
}
} else {
if (this.stickyWrap.hasClass(this.opts.fixedClass)) {
if (this.stickyPos !== 'side') {
this.stickyWrap.css(this.alignRemoveCss);
}
this.stickyWrap.removeClass(this.opts.fixedClass);
if (this.opts.isFixedConflict && this.stickyPos !== 'side') {
this.jsStickyWrap.append(this.stickyWrap);
}
}
}
if (this.breakOpts.overedElements !== null) {
if (this.overCondition) {
if (!this.stickyWrap.hasClass(this.opts.overedClass)) {
this.stickyWrap.addClass(this.opts.overedClass);
}
this.stickyWrap.css({
'top' : 'auto',
'bottom' : 0
});
} else {
if (this.stickyWrap.hasClass(this.opts.overedClass)) {
this.stickyWrap.removeClass(this.opts.overedClass);
}
}
} else {
if (this.stickyWrap.hasClass(this.opts.overedClass)) {
this.stickyWrap.removeClass(this.opts.overedClass);
}
}
},
stickyEasingFunc : function () {
var _this = this,
prop = this.opts.prop,
align = this.breakOpts.align,
alignCss = this.opts.alignCss,
alignData = {},
winScrollTop = this.winScrollTop,
spaceBetween = this.spaceBetween,
sideStickyEasing = this.stickyPos === 'side' && this.opts.easing != null,
callbackData = {
duration : this.opts.duration,
easing : this.opts.easing,
step : function (now, tween) {
_this.outCallback('stickyMove', now, tween);
},
complete : $.proxy(this.moveAfterBugFunc, this)
};
var lockScroll = $('html').data('lockScroll'),
lockType = (lockScroll != null) ? true : false,
scrollTop = (lockType) ? lockScroll.top : winScrollTop;
if (align === 'top') {
if (sideStickyEasing) {
this.condition = scrollTop > prop.offsetTop;
} else {
this.condition = scrollTop > (prop.offsetTop - spaceBetween);
}
if (this.condition) {
alignData['top'] = scrollTop - (prop.offsetTop - spaceBetween);
} else {
alignData['top'] = (sideStickyEasing) ? spaceBetween : 0;
}
} else if (align === 'bottom') {
this.condition = scrollTop < (prop.alignBottomOffset + spaceBetween);
if (this.condition) {
alignData['top'] = scrollTop - (prop.alignBottomOffset + spaceBetween);
} else {
alignData['top'] = (sideStickyEasing) ? spaceBetween : 0;
}
} else if (align === 'topAndBottom') {
this.condition = scrollTop > (prop.offsetTop - spaceBetween) ||
scrollTop < (prop.alignBottomOffset + spaceBetween);
if (scrollTop > (prop.offsetTop - spaceBetween)) {
alignData['top'] = scrollTop - (prop.offsetTop - spaceBetween);
} else if (scrollTop < (prop.alignBottomOffset + spaceBetween)) {
alignData['top'] = scrollTop - (prop.alignBottomOffset + spaceBetween);
} else {
alignData['top'] = (sideStickyEasing) ? spaceBetween : 0;
}
}
if (this.condition) {
if (!this.stickyWrap.hasClass(this.opts.fixedClass)) {
this.stickyWrap.addClass(this.opts.fixedClass);
}
this.outCallback('stickyMoveBefore');
this.stickyWrap.stop().animate(alignData, callbackData);
} else {
if (this.stickyWrap.hasClass(this.opts.fixedClass)) {
this.stickyWrap.removeClass(this.opts.fixedClass);
this.outCallback('stickyMoveBefore');
this.stickyWrap.stop().animate(alignData, callbackData);
}
}
},
onStickyMoveAfter : function () {
this.outCallback('stickyMoveAfter');
},
moveAfterBugFunc : function () {
win.clearTimeout(this.moveAfterTimeout);
this.moveAfterTimeout = win.setTimeout($.proxy(this.onStickyMoveAfter, this), 30);
},
onResizeFunc : function () {
this.winWidth = UTIL.winSize().w;
if (this.opts.resizeStart == null) {
this.opts.resizeStart = this.winWidth;
this.resizeAnimateFunc();
}
win.clearTimeout(this.resizeEndTimeout);
this.resizeEndTimeout = win.setTimeout($.proxy(this.onResizeEndFunc, this), 60);
},
onResizeEndFunc : function () {
this.opts.resizeStart = null;
this.setOpts();
this.onScrollFunc();
UTIL.cancelAFrame.call(win, this.resizeRequestFrame);
},
resizeAnimateFunc : function () {
this.setOpts();
this.onScrollFunc();
this.resizeRequestFrame = UTIL.requestAFrame.call(win, $.proxy(this.resizeAnimateFunc, this));
},
loadControl : function () {
this.outCallback('loadAfter');
},
outCallback : function (ing) {
var callbackType = ing.search('anchor'),
callbackObj = (callbackType >= 0) ? this.opts.anchor[ing] : this.opts[ing],
condition = ing === 'stickyMove' || ing === 'anchorMove';
if (condition) {
this.emit(ing, arguments[1], arguments[2]);
} else {
this.emit(ing, this.opts.callbackData);
}
if (callbackObj == null) return;
if (condition) {
callbackObj(arguments[1], arguments[2]);
} else {
callbackObj(this.opts.callbackData);
}
},
bindCallBackEvents : function () {
this.stickyWrap.on('destroy', $.proxy(this.destroy, this));
this.stickyWrap.on('reInit', $.proxy(this.reInit, this));
},
destroy : function () {
this.opts.destroyType = true;
this.bindEvents(false);
},
reInit : function () {
this.opts.destroyType = false;
this.bindEvents(false);
this.bindEvents(true);
this.onResizeFunc();
}
}, UTIL.emitter);
$.fn[pluginName] = function (args) {
var _this = this;
for (var i = 0, max = this.length; i < max; i++) {
(function (index) {
new win.sg.components.hubbleNonShopRaw[pluginName](_this.eq(index), args);
})(i);
}
};
})(window, window.jQuery, window.document);
(function (win, $, doc) {
'use strict';
win.sg = win.sg || {};
win.sg.components = win.sg.components || {};
win.sg.components.hubbleNonShopRaw = win.sg.components.hubbleNonShopRaw || {};
win.sg.components.hubbleNonShopRaw.common = win.sg.components.hubbleNonShopRaw.common || {};
var UTIL = win.sg.components.hubbleNonShopRaw.common.util,
pluginName = 'SelectLibs';
win.sg.components.hubbleNonShopRaw[pluginName] = function (container, args) {
if (!(this instanceof win.sg.components.hubbleNonShopRaw[pluginName])) {
return new win.sg.components.hubbleNonShopRaw[pluginName](container, args);
}
var defParams = {
container : container || '.js-select-wrap',
selectBtn : '.hubble-pd-select__placeholder',
selectPush : 'span:eq(0)',
selectBlindText : '.blind',
selectWrap : '.hubble-pd-select__options',
selectParent : '>ul',
activeClass : 'is-opened',
selectClass : 'is-selected',
accessData : {
EXPANDED : 'aria-expanded',
HIDDEN : 'aria-hidden'
},
type2Class : 'select-type2',
jsAlignClass : 'js-align-placeholder',
selectMoBtn : '.s-select-text',
selectMo : '.s-select-mo',
selectMoParent : '.hubble-pd-select__options-mo',
selectMoActiveClass : 's-select-focus',
prop : {},
viewType : false,
slideSpeed : 200
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.container)).length) return;
this.init();
};
win.sg.components.hubbleNonShopRaw[pluginName].prototype = {
init : function () {
this.setElements();
this.initOpts();
this.initLayout();
this.bindEvents();
},
setElements : function () {
this.selectBtn = this.obj.find(this.opts.selectBtn);
this.selectPush = this.selectBtn.find(this.opts.selectPush);
this.selectBlindText = this.selectBtn.find(this.opts.selectBlindText);
this.selectWrap = this.obj.find(this.opts.selectWrap);
this.selectParent = this.selectWrap.find(this.opts.selectParent);
this.selectChild = this.selectParent.children();
this.selectMoBtn = this.obj.find(this.opts.selectMoBtn);
this.selectMoPush = this.selectMoBtn.find(this.opts.selectPush);
this.selectMo = this.obj.find(this.opts.selectMo);
this.selectMoParent = this.selectMo.closest(this.opts.selectMoParent);
},
initOpts : function () {
var globalText = this.obj.data('global-text');
this.globalText = {
Collapse : (globalText && globalText.Collapse) ? $.trim(globalText.Collapse) : '',
Expand : (globalText && globalText.Expand) ? $.trim(globalText.Expand) : ''
};
},
initLayout : function () {
this.obj.attr('data-select-init', true);
if (this.obj.hasClass(this.opts.type2Class)) {
this.selectPush.wrap('
');
}
this.selectWrap.hide();
this.obj.removeClass(this.opts.activeClass);
this.accessbilityFunc(false);
},
bindEvents : function () {
this.selectBtn.on('click', $.proxy(this.onClickFunc, this));
this.selectParent.on('click', '>li>a', $.proxy(this.onChangeText, this));
this.obj.on('onSelect', $.proxy(this.onSelectFunc, this));
this.selectMo.on('change', $.proxy(this.onChangeFunc, this));
this.selectMo.on('focusin focusout', $.proxy(this.onFocusFunc, this));
},
onClickFunc : function (e) {
e.preventDefault();
if (this.opts.viewType) {
this.selectWrap.stop().hide();
this.obj.removeClass(this.opts.activeClass);
this.obj.attr('tabIndex', '');
this.accessbilityFunc(false);
this.bindOutsideEvents(false);
} else {
this.selectWrap.stop().show();
this.obj.addClass(this.opts.activeClass);
this.obj.attr('tabIndex', 0);
this.accessbilityFunc(true);
this.bindOutsideEvents(true);
}
this.opts.viewType = !this.opts.viewType;
},
bindOutsideEvents : function (type) {
(type) ? this.obj.on('clickoutside focusoutside', $.proxy(this.outsideFunc, this)) : this.obj.off('clickoutside focusoutside');
},
outsideFunc : function () {
this.selectBtn.triggerHandler('click');
},
onSelectFunc : function (e, data) {
this.setDesktopSelect(data);
this.setMobileSelect(data);
},
onChangeFunc : function (e, data) {
var target = $(e.currentTarget),
targetSelected = target.find('option').filter(':selected'),
targetIndex = targetSelected.index(),
targetText = $.trim(targetSelected.text()),
prop = {
value : targetText,
valueIndex : targetIndex
};
this.setDesktopSelect(prop);
this.setMobileSelect(prop);
},
onFocusFunc : function (e) {
if (e.type === 'focusin') {
if (this.selectMoParent.hasClass(this.opts.selectMoActiveClass)) return;
this.selectMoParent.addClass(this.opts.selectMoActiveClass);
} else if (e.type === 'focusout') {
if (!this.selectMoParent.hasClass(this.opts.selectMoActiveClass)) return;
this.selectMoParent.removeClass(this.opts.selectMoActiveClass);
}
},
setDesktopSelect : function (prop) {
var selectClass = this.opts.selectClass;
this.selectChild.eq(prop.valueIndex).addClass(selectClass).siblings().removeClass(selectClass);
this.selectPush.text(prop.value);
this.selectMoPush.text(prop.value);
},
setMobileSelect : function (prop) {
this.selectMo.find('option').eq(prop.valueIndex).attr('selected', 'selected').siblings().removeAttr('selected');
this.selectPush.text(prop.value);
this.selectMoPush.text(prop.value);
},
onChangeText : function (e) {
e.preventDefault();
var target = $(e.currentTarget),
targetText = $.trim(target.text()),
targetParent = target.parent();
this.opts.prop['value'] = targetText;
this.opts.prop['valueIndex'] = targetParent.index();
this.obj.trigger('onSelect', this.opts.prop);
this.outsideFunc();
},
accessbilityFunc : function (type) {
var accessData = this.opts.accessData,
globalText = this.globalText;
if (type) {
this.selectBtn.attr(accessData.EXPANDED, 'true');
this.selectWrap.attr(accessData.HIDDEN, 'false');
this.selectBlindText.text(globalText.Collapse);
} else {
this.selectBtn.attr(accessData.EXPANDED, 'false');
this.selectWrap.attr(accessData.HIDDEN, 'true');
this.selectBlindText.text(globalText.Expand);
}
}
};
$.fn[pluginName] = function (args) {
var _this = this;
for (var i = 0, max = this.length; i < max; i++) {
(function (index) {
new win.sg.components.hubbleNonShopRaw[pluginName](_this.eq(index), args);
})(i);
}
};
$(function () {
$('.js-select-wrap').SelectLibs();
});
})(window, window.jQuery, window.document);
(function (win, $, doc) {
'use strict';
var COMMON = win.sg.components.hubbleNonShopRaw.common;
var UTIL = COMMON.util;
var pluginName = 'HubbleCarousel';
win.sg.components.hubbleNonShopRaw[pluginName] = function (container, args) {
if (!(this instanceof win.sg.components.hubbleNonShopRaw[pluginName])) {
return new win.sg.components.hubbleNonShopRaw[pluginName](container, args);
}
var defParams = {
carouselContainer : '.swiper-container',
carouselWrapper : '.swiper-wrapper',
carouselItem : '.swiper-slide',
carouselPagination : '.swiper-pagination',
carouselBtnPrev : '.swiper-button-prev',
carouselBtnNext : '.swiper-button-next',
carouselOpts : {
init : false,
rtl : $('html').hasClass('rtl')
},
customEvent : '.' + pluginName + (new Date()).getTime(),
resizeStart: null
};
this.opts = UTIL.def(defParams, {});
this.carouselOpts = UTIL.def(defParams.carouselOpts, (args || {}));
this.obj = $(container);
if (!this.obj.length) return;
this.init();
};
win.sg.components.hubbleNonShopRaw[pluginName].prototype = {
init : function () {
this.setElements();
this.initLayout();
this.bindEvents(true);
this.buildSwiper();
},
setElements : function () {
this.carouselItem = this.obj.find(this.opts.carouselItem);
this.carouselPagination = this.obj.find(this.opts.carouselPagination);
this.carouselBtnPrev = this.obj.find(this.opts.carouselBtnPrev);
this.carouselBtnNext = this.obj.find(this.opts.carouselBtnNext);
},
initLayout : function () {
this.swiper = null;
},
arrowTagging : function () {
var gacaMap = this.getGacaMap();
var attrLeftMap = $.extend({
'data-omni-type': 'microsite_pcontentinter',
'data-omni': 'rolling:left arrow',
'ga-ac': 'rolling:left arrow'
}, gacaMap);
var attrRightMap = $.extend({
'data-omni-type': 'microsite_pcontentinter',
'data-omni': 'rolling:right arrow',
'ga-ac': 'rolling:right arrow'
}, gacaMap);
this.carouselBtnPrev && this.carouselBtnPrev.attr(attrLeftMap);
this.carouselBtnNext && this.carouselBtnNext.attr(attrRightMap);
},
dotsTagging : function (dots) {
var gacaMap = this.getGacaMap();
dots.each(function(idx, dot) {
var index = idx + 1;
$(dot).attr($.extend({
'data-omni-type': 'microsite_pcontentinter',
'data-omni': 'rolling:index_' + index,
'ga-ac': 'rolling:index_' + index
}, gacaMap));
});
},
buildSwiper : function () {
if (this.swiper == null) {
var init = $.proxy(function () {
win.setTimeout($.proxy(function() {
if (this.carouselBtnPrev.length && this.carouselBtnNext.length) this.arrowTagging();
if (this.carouselPagination.children().length) {
this.dotsTagging(this.carouselPagination.children());
}
}, this), 50);
}, this);
this.carouselOpts.on = {
init : init
}
this.swiper = new Swiper(this.obj, this.carouselOpts);
this.swiper.init();
} else {
this.swiper.update();
}
},
bindEvents: function(type) {
if (type) {
$(win).on(this.changeEvents('resize orientationchange'), $.proxy(this.resizeFunc, this));
} else {
$(win).off(this.changeEvents('resize orientationchange'));
}
},
resizeFunc: function() {
this.winWidth = UTIL.winSize().w;
if (this.opts.resizeStart == null) {
this.opts.resizeStart = this.winWidth;
this.resizeAnimateFunc();
}
win.clearTimeout(this.resizeEndTime);
this.resizeEndTime = win.setTimeout($.proxy(this.resizeEndFunc, this), 150);
},
resizeEndFunc: function() {
this.opts.resizeStart = null;
UTIL.cancelAFrame.call(win, this.resizeRequestFrame);
},
resizeAnimateFunc: function() {
this.swiper.update();
this.resizeRequestFrame = UTIL.requestAFrame.call(win, $.proxy(this.resizeAnimateFunc, this));
},
getGacaMap: function() {
var taggingData = (typeof digitalData !== 'undefined') ? digitalData : undefined;
var gacaMap = (taggingData && _.has(taggingData, 'page.pageInfo.pageTrack'))
? { 'ga-ca': digitalData.page.pageInfo.pageTrack }
: {};
return gacaMap;
},
changeEvents: function(event) {
var events = [],
eventNames = event.split(' ');
for (var key in eventNames) {
events.push(eventNames[key] + this.opts.customEvent);
}
return events.join(' ');
},
destroy : function () {
if (this.swiper == null) return;
this.swiper.destroy(true, true);
this.swiper = null;
}
};
})(window, window.jQuery, window.document);
Number.prototype.ntostimerchar = function () {
var aNum = ['00','01','02','03','04','05','06','07','08','09'];
return (this < 10) ? aNum[this] : this;
};
(function (win, $, doc) {
'use strict';
var COMMON = win.sg.components.hubbleNonShopRaw.common;
var UTIL = COMMON.util;
var pluginName = 'HubbleOfferBannerTimer';
var HCOMPONENT = win.sg.components.hubbleNonShopRaw['HubbleOfferBanner'] || (win.sg.components.hubbleNonShopRaw['HubbleOfferBanner'] = {});
HCOMPONENT[pluginName] = function (container, args) {
if (!(this instanceof HCOMPONENT[pluginName])) {
return new HCOMPONENT[pluginName](container, args);
}
var defParams = {
obj : container,
bannerObj : '.hubble-offer-banner',
timerObj : '.s-timer',
timerEventsName : pluginName + '.timerAction',
timerStartType : false,
targetDays : null,
globalText : {},
customEvent : '.' + pluginName + (new Date()).getTime(),
countTimer : null,
viewType : null,
resizeStart : null,
loadAfter : null,
notDaysClass : 'is-not-days'
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
if (!this.obj.attr('data-start-time') || !this.obj.attr('data-end-time') || !this.obj.hasClass('is-active')) return;
this.init();
};
HCOMPONENT[pluginName].prototype = {
init : function () {
this.setElements();
this.initOpts();
this.initLayout();
this.bindEvents(true);
this.timerCall();
},
setElements : function () {
this.timerObj = this.obj.find(this.opts.timerObj);
this.bannerObj = $('.hubble-offer-banner');
},
initOpts : function () {
var globalText = this.bannerObj.data('global-text');
this.opts.globalText = {
DAY : (globalText && globalText.Day) ? $.trim(globalText.Day) : 'day',
DAYS : (globalText && globalText.Days) ? $.trim(globalText.Days) : 'days',
HOURS : (globalText && globalText.Hours) ? $.trim(globalText.Hours) : 'hours',
MINS : (globalText && globalText.Mins) ? $.trim(globalText.Mins) : 'mins',
SECS : (globalText && globalText.Secs) ? $.trim(globalText.Secs) : 'secs'
};
},
initLayout : function () {
var startTime = this.obj.attr('data-start-time'),
endTime = this.obj.attr('data-end-time'),
startDate = new Date(startTime).getTime(),
endDate = new Date(endTime).getTime(),
gapTime = endDate - startDate,
days = Math.floor(gapTime / (1000 * 60 * 60 * 24));
if (days <= 1) {
this.opts.globalText['DAYS'] = this.opts.globalText['DAY'];
}
var timeHtml = '
00'+ this.opts.globalText['DAYS'] +'00'+ this.opts.globalText['HOURS'] +'00'+ this.opts.globalText['MINS'] +'00'+ this.opts.globalText['SECS'] +'';
this.timerObj.text('');
this.timerObj.append(timeHtml);
},
bindEvents : function (type) {
if (type) {
this.obj.on(this.opts.timerEventsName, $.proxy(this.timerAction, this));
} else {
this.obj.off(this.opts.timerEventsName);
}
},
timerAction : function (e, data) {
var days = this.timerObj.find('.days .text'),
hours = this.timerObj.find('.hours .text'),
minutes = this.timerObj.find('.mins .text'),
seconds = this.timerObj.find('.seconds .text');
if (data.days <= 1 && this.timerObj.find('.days .date').text() === this.opts.globalText['DAYS']) {
this.timerObj.find('.days .date').text(this.opts.globalText['DAY']);
}
if (this.opts.targetDays === null && data.days <= 0) {
this.timerObj.find('.days').remove();
if (data.hours <= 24) {
this.timerObj.addClass(this.opts.notDaysClass);
}
} else {
days.text(data.days);
}
hours.text(data.hours);
minutes.text(data.minutes);
seconds.text(data.seconds);
},
timerCall : function () {
var startTime = this.obj.attr('data-start-time'),
endTime = this.obj.attr('data-end-time'),
startDate = new Date(startTime).getTime(),
endDate = new Date(endTime).getTime(),
gapTime = endDate - startDate;
if (startDate >= endDate) return;
var timerData = {
days: Math.floor(gapTime / (1000 * 60 * 60 * 24)),
hours: Math.floor((gapTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
minutes: Math.floor((gapTime % (1000 * 60 * 60)) / (1000 * 60)),
seconds: Math.floor((gapTime % (1000 * 60)) / 1000)
};
this.opts.timerStartType = true;
this.timerOpts(timerData);
},
timerOpts : function (data) {
this.opts.countTimer = win.setInterval($.proxy(function() {
if (data.hours <= 0 && data.minutes <= 0 && data.seconds <= 0) {
if (this.opts.targetDays == null && data.days <= 0) {
win.clearInterval(this.opts.countTimer);
this.outCallback('loadAfter');
this.opts.timerStartType = false;
}
}
if (this.opts.timerStartType) {
data.seconds--;
if (data.seconds < 0) {
data.minutes--;
data.seconds = 59;
}
if (data.minutes < 0) {
data.hours--;
data.minutes = 59;
}
if (data.hours < 0) {
data.days--;
data.hours = 23;
}
this.opts.targetDays = data.days;
if (this.opts.targetDays <= 0) {
this.opts.targetDays = null;
}
var timerData = {
days : data.days.ntostimerchar(),
hours : data.hours.ntostimerchar(),
minutes : data.minutes.ntostimerchar(),
seconds : data.seconds.ntostimerchar()
};
this.obj.trigger(this.opts.timerEventsName, timerData);
}
}, this), 1000);
},
outCallback : function (ing) {
var callbackObj = this.opts[ing];
if (callbackObj == null) return;
callbackObj();
},
destroy : function () {
this.bindEvents(false);
win.clearInterval(this.opts.countTimer);
}
};
})(window, window.jQuery, window.document);
(function(win, $, doc) {
'use strict';
var COMMON = win.sg.components.hubbleNonShopRaw.common;
var CST_EVENT = COMMON.customEvent;
var STICKYDATAS = COMMON.stickyDatas;
var UTIL = COMMON.util;
var pluginName = 'HubbleOfferBanner';
var HCOMPONENT = win.sg.components.hubbleNonShopRaw[pluginName] || (win.sg.components.hubbleNonShopRaw[pluginName] = {});
HCOMPONENT['component'] = function(container, args) {
var defParams = {
obj: container,
visual: '.hubble-product__visual',
spaceBetween: '.hubble-price-bar',
collapseClass: 'is-collapse',
fixedClass: 'is-fixed',
objDetail: '.hubble-offer-banner__detail',
objSimple: '.hubble-offer-banner__simple',
objSimpleTxtWrap : '.hubble-offer-banner__simple-txt-area',
objCtaWrap: '.hubble-offer-banner__cta',
objCta: '.s-offer-close',
objCtaBlindText: '.blind',
brightThemeClass: 's-theme-bright',
prop : {},
globalText: {
Expand: 'Click to Expand',
Collapse: 'Click to Collapse'
},
slideDuration: 250,
scrollSpeed: 350,
timerObj : [],
animateHideEndFunc : null,
customEvent: '.' + pluginName + (new Date()).getTime(),
scrollStart: null,
loadAfter: null
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['component'].prototype = {
init: function() {
var me = this;
this.setElements();
this.initLayout();
this.bindEvents(true);
this.bindCustomEvents();
this.documentReady().done(function() {
me.assignComponents();
me.bindCallBackEvents(true);
if (!me.isCollapsed) {
me.expandBanner();
} else {
me.collapseBanner();
}
});
},
setElements: function() {
this.spaceBetween = $(this.opts.spaceBetween);
this.objDetail = this.obj.find(this.opts.objDetail);
this.objSimple = this.obj.find(this.opts.objSimple);
this.objSimpleTxtWrap = this.obj.find(this.opts.objSimpleTxtWrap);
this.objCtaWrap = this.obj.find(this.opts.objCtaWrap);
this.objCta = this.objCtaWrap.find(this.opts.objCta);
this.objCtaBlindText = this.objCta.find(this.opts.objCtaBlindText);
},
initLayout: function() {
this.curScrollTop = $(win).scrollTop();
this.prevScrollTop = null;
this.globalText = UTIL.def(this.opts.globalText, this.checkJSONQuote(this.obj.data('global-text')));
this.objCtaBlindText.text(this.globalText['Expand']);
this.stickyObj = null;
this.hasVisual = $(this.opts.visual).length > 0;
this.isAnimating = false;
this.isCollapsed = this.obj.hasClass(this.opts.collapseClass);
this.isOpenedByClick = false;
this.viewState = this.isCollapsed ? 'simple' : 'detail';
if (this.viewState == 'detail') {
if (this.objDetail.hasClass(this.opts.brightThemeClass)) {
this.objCta.addClass(this.opts.brightThemeClass);
}
} else {
if (this.objSimple.hasClass(this.opts.brightThemeClass)) {
this.objCta.addClass(this.opts.brightThemeClass);
}
}
},
bindEvents: function(type) {
if (type) {
this.objCta.on(this.changeEvents('click clickCustom'), $.proxy(this.objCtaClickFunc, this));
$(win).on(this.changeEvents('scroll'), $.proxy(this.scrollFunc, this));
} else {
this.objCta.off(this.changeEvents('click clickCustom'));
$(win).off(this.changeEvents('scroll'));
}
},
bindCustomEvents: function() {
this.obj.on(this.changeEvents('rerun'), $.proxy(this.reRun, this));
},
assignComponents: function() {
this.callStickyPlugin();
this.callTimerPlugin();
},
callStickyPlugin: function() {
if (this.hasVisual) return;
if (this.stickyObj == null) {
this.stickyObj = new win.sg.components.hubbleNonShopRaw['HiveSticky'](this.obj, {
fixedClass: this.opts.fixedClass,
spaceBetween: '.hubble-price-bar'
});
this.objJsWrap = this.stickyObj.jsStickyWrap;
STICKYDATAS.push({
name: this.objJsWrap.get(0),
el: this.obj.get(0)
});
} else {
this.reInitSticky();
}
},
reInitSticky: function() {
this.stickyObj && this.stickyObj.reInit();
},
callTimerPlugin : function () {
var _this = this;
if (!this.opts.timerObj.length) {
for (var i = 0, max = this.objSimpleTxtWrap.length; i < max ; i++) {
(function (i) {
_this.opts.timerObj.push(new HCOMPONENT['HubbleOfferBannerTimer'](_this.objSimpleTxtWrap.eq(i)));
})(i);
}
}
},
destroyTimerPlugin : function () {
if (this.opts.timerObj.length) {
for (var i = 0, max = this.opts.timerObj.length; i < max; i++) {
this.opts.timerObj[i].destroy();
}
this.opts.timerObj = [];
}
},
objCtaClickFunc: function(e) {
e.preventDefault();
if (this.viewState === 'simple') {
this.isOpenedByClick = true;
this.expandBanner();
} else {
this.collapseBanner();
}
},
expandBanner: function() {
if (this.isAnimating) return;
var me = this;
var opts = this.opts;
this.isAnimating = true;
this.outCallback('loadAfter');
this.hideSimple().done(function() {
me.showDetail().done(function() {
me.viewState = 'detail';
me.obj.removeClass(opts.collapseClass);
me.isCollapsed = false;
me.objCtaBlindText.text(me.globalText['Collapse']);
me.isAnimating = false;
win.setTimeout(function () {
me.isOpenedByClick = false;
}, 200);
if (me.objDetail.hasClass(opts.brightThemeClass)) {
me.objCta.addClass(opts.brightThemeClass);
} else {
me.objCta.removeClass(opts.brightThemeClass);
}
});
});
setTimeout($.proxy(function () {
this.obj.on(this.changeEvents('focusoutside'), $.proxy(this.collapseBanner, this));
}, this), 30);
},
collapseBanner: function() {
if (this.isAnimating) return;
var me = this;
var opts = this.opts;
this.isAnimating = true;
this.outCallback('loadAfter');
this.hideDetail().done(function() {
me.showSimple().done(function() {
me.viewState = 'simple';
me.obj.addClass(opts.collapseClass);
me.isCollapsed = true;
me.objCtaBlindText.text(me.globalText['Expand']);
me.isAnimating = false;
if (me.objSimple.hasClass(opts.brightThemeClass)) {
me.objCta.addClass(opts.brightThemeClass);
} else {
me.objCta.removeClass(opts.brightThemeClass);
}
});
});
this.obj.off(this.changeEvents('focusoutside'));
},
hideSimple: function() {
return this.objSimple.stop().slideUp({
duration : this.opts.slideDuration,
step : $.proxy(this.controlAnimationStep, this)
}).promise();
},
showSimple: function() {
return this.objSimple.stop().slideDown({
duration : this.opts.slideDuration,
step : $.proxy(this.controlAnimationStep, this),
complete : $.proxy(function () {
this.controlAnimationEnd();
}, this)
}).promise();
},
hideDetail: function() {
return this.objDetail.stop().slideUp({
duration : this.opts.slideDuration,
step : $.proxy(this.controlAnimationStep, this)
}).promise();
},
showDetail: function() {
return this.objDetail.stop().slideDown({
duration : this.opts.slideDuration,
step : $.proxy(this.controlAnimationStep, this),
complete : $.proxy(function () {
this.controlAnimationEnd();
}, this)
}).promise();
},
controlAnimationStep : function () {
this.outCallback('loadAfter');
},
controlAnimationEnd : function () {
this.outCallback('loadAfter');
win.clearTimeout(this.anchorCallbackTime);
this.anchorCallbackTime = win.setTimeout($.proxy(function () {
this.anchorCallbackFunc();
}, this), 250);
},
scrollFunc: function() {
if (this.isAnimating) return;
this.prevScrollTop = this.curScrollTop;
this.curScrollTop = $(win).scrollTop();
if (this.opts.scrollStart == null) {
this.opts.scrollStart = this.curScrollTop;
this.scrollAnimateFunc();
}
win.clearTimeout(this.scrollEndTime);
this.scrollEndTime = win.setTimeout($.proxy(this.scrollEndFunc, this), 150);
},
scrollEndFunc: function() {
this.opts.scrollStart = null;
this.scrollAreaActive();
this.isOpenedByClick = false;
UTIL.cancelAFrame.call(win, this.scrollRequestFrame);
},
scrollAnimateFunc: function() {
this.scrollAreaActive();
this.scrollRequestFrame = UTIL.requestAFrame.call(win, $.proxy(this.scrollAnimateFunc, this));
},
scrollAreaActive: function() {
if (this.isCollapsed) return;
var spaceBetween = 0;
if (this.hasVisual) {
spaceBetween = this.spaceBetween.outerHeight();
} else {
spaceBetween = this.stickyObj.spaceBetween;
}
var targetScroll = this.obj.offset().top - spaceBetween;
var wasBeforeScroll = targetScroll > this.prevScrollTop;
var nowAfterScroll = targetScroll <= this.curScrollTop;
var isCrossedBackward = !wasBeforeScroll && !nowAfterScroll;
var isForward = this.prevScrollTop < this.curScrollTop;
if (!this.isOpenedByClick && isForward) this.collapseBanner();
},
anchorCallbackFunc : function () {
if (this.opts.animateHideEndFunc !== null) {
this.opts.animateHideEndFunc();
this.opts.animateHideEndFunc = null;
}
},
bindCallBackEvents : function (type) {
var spaceBetween = 0;
if (this.hasVisual) {
spaceBetween = this.spaceBetween.outerHeight();
} else {
spaceBetween = this.stickyObj.spaceBetween;
}
if (type) {
this.obj.on(this.changeEvents('animateHideEnd'), $.proxy(function (e, data) {
this.opts.animateHideEndFunc = data;
var prop = this.opts.prop,
winScrollTop = this.winScrollTop,
condition = (prop.offsetTop - spaceBetween) <= winScrollTop;
if (this.viewState == 'detail') {
if (condition) {
this.anchorCallbackFunc();
} else {
this.objCta.trigger('clickCustom');
}
} else {
this.anchorCallbackFunc();
}
}, this));
} else {
this.obj.off(this.changeEvents('animateHideEnd'));
}
},
checkJSONQuote: function(str) {
var res = str;
if (typeof res === 'string') {
try {
res = JSON.parse(res.replace(/\'/gi, '"'));
} catch (e) { console.warn(e) }
}
return res;
},
documentReady: function() {
return $.Deferred(function(dfd) {
$(doc).ready(dfd.resolve);
}).promise();
},
changeEvents: function(event) {
var events = [],
eventNames = event.split(' ');
for (var key in eventNames) {
events.push(eventNames[key] + this.opts.customEvent);
}
return events.join(' ');
},
outCallback: function(cbName) {
var callback = this.opts[cbName],
restArgs = Array.prototype.slice.call(arguments, 1);
if ($.isFunction(callback)) callback.apply(this, restArgs);
},
reInit: function() {
this.stickyObj && this.stickyObj.reInit();
},
reRun: function(e) {
e && e.stopPropagation();
this.bindCallBackEvents(false);
this.destroyTimerPlugin()
this.callTimerPlugin();
}
};
HCOMPONENT['componentCall'] = function(args) {
var defParams = {
obj: '.hubble-offer-banner'
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['componentCall'].prototype = {
init: function() {
this.callComponent();
this.globalObjs();
},
callComponent: function() {
this.callPlugins = [];
for (var i = 0, max = this.obj.length; i < max; i++) {
var ins = new HCOMPONENT['component'](this.obj.eq(i), {
loadAfter: $.proxy(this.globalObjsCall, this)
});
this.callPlugins.push(ins);
$.data(this.obj.eq(i).get(0), pluginName, ins);
}
},
globalObjs: function() {
for (var i = 0, max = this.callPlugins.length; i < max; i++) {
CST_EVENT.PAGEIS.PAGEOBJS.push(this.callPlugins[i]);
}
},
globalObjsCall: function() {
CST_EVENT.PAGEIS.EVENT_MANAGER.trigger(CST_EVENT.PAGEIS.REPOSITION);
}
};
$(function() {
new HCOMPONENT['componentCall']();
});
})(window, window.jQuery, window.document);
(function(win, $, doc) {
'use strict';
var COMMON = win.sg.components.hubbleNonShopRaw.common;
var CST_EVENT = COMMON.customEvent;
var STICKYDATAS = COMMON.stickyDatas;
var UTIL = COMMON.util;
var pluginName = 'HubbleNonshopTitle';
var HCOMPONENT = win.sg.components.hubbleNonShopRaw[pluginName] || (win.sg.components.hubbleNonShopRaw[pluginName] = {});
HCOMPONENT['component'] = function(container, args) {
var defParams = {
obj: container,
fixedClass: 'is-fixed',
customEvent: '.' + pluginName + (new Date()).getTime(),
loadAfter: null
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['component'].prototype = {
init: function() {
var me = this;
this.setElements();
this.initLayout();
this.bindEvents(true);
this.documentReady().done(function() {
me.assignComponent();
});
},
setElements: function() {
},
initLayout: function() {
this.stickyObj = null;
},
bindEvents: function(type) {
if (type) {
} else {
}
},
assignComponent: function() {
this.callStickyPlugin();
},
callStickyPlugin: function() {
if (this.stickyObj == null) {
this.stickyObj = new win.sg.components.hubbleNonShopRaw['HiveSticky'](this.obj, {
fixedClass: this.opts.fixedClass
});
this.objJsWrap = this.stickyObj.jsStickyWrap;
STICKYDATAS.push({
name: this.objJsWrap.get(0),
el: this.obj.get(0)
});
} else {
this.reInitSticky();
}
},
reInitSticky: function() {
this.stickyObj && this.stickyObj.reInit();
},
documentReady: function() {
return $.Deferred(function(dfd) {
$(doc).ready(dfd.resolve);
}).promise();
},
changeEvents: function(event) {
var events = [],
eventNames = event.split(' ');
for (var key in eventNames) {
events.push(eventNames[key] + this.opts.customEvent);
}
return events.join(' ');
},
reRun: function() {
},
reInit: function() {
this.reInitSticky();
}
};
HCOMPONENT['componentCall'] = function(args) {
var defParams = {
obj: '.hubble-nonshop-title'
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['componentCall'].prototype = {
init: function() {
this.callComponent();
this.globalObjs();
},
callComponent: function() {
this.callPlugins = [];
for (var i = 0, max = this.obj.length; i < max; i++) {
var ins = new HCOMPONENT['component'](this.obj.eq(i), {
loadAfter: $.proxy(this.globalObjsCall, this)
});
this.callPlugins.push(ins);
$.data(this.obj.eq(i).get(0), pluginName, ins);
}
},
globalObjs: function() {
for (var i = 0, max = this.callPlugins.length; i < max; i++) {
CST_EVENT.PAGEIS.PAGEOBJS.push(this.callPlugins[i]);
}
},
globalObjsCall: function() {
CST_EVENT.PAGEIS.EVENT_MANAGER.trigger(CST_EVENT.PAGEIS.REPOSITION);
}
};
$(function() {
new HCOMPONENT['componentCall']();
});
})(window, window.jQuery, window.document);
;(function (win, $, doc) {
'use strict';
var COMMON = window.sg.components.hubbleNonShopRaw.common;
var BREAKPOINTS_MOBILE = COMMON.breakpoints.MOBILE;
var CST_EVENT = COMMON.customEvent;
var UTIL = COMMON.util;
var _ = UTIL.lodash;
var pluginName = 'hubbleNonShopRaw';
var HCOMPONENT = win.sg.components.hubbleNonShopRaw[pluginName] || (win.sg.components.hubbleNonShopRaw[pluginName] = {});
HCOMPONENT['component'] = function(container, args) {
var defParams = {
obj: container,
productTabWrap: '.hubble-nonshop-raw__product',
productTabItems: '.hubble-nonshop-raw__product-tab-item',
productTabPanels: '.hubble-nonshop-raw__product-pannel-item',
alignCenterClass: 'is-align-center',
itemTabWrap: '.hubble-nonshop-raw__item',
itemTabItems: '.hubble-nonshop-raw__item-tab-menu',
itemTabPanels: '.hubble-nonshop-raw__item-pannel-img',
itemTabColor: '.blind',
itemTabContentColor: '.hubble-nonshop-raw__item-content-color',
activeClass: 'is-active',
productObj: '.hubble-nonshop-raw__product-list-item',
productItem: '.hubble-nonshop-raw__item',
bannerObj: '.hubble-nonshop-raw__banner',
bannerItem : '.hubble-nonshop-raw__banner-item',
ariaData: {
ariaHidden: 'aria-hidden',
ariaDescribedby: 'aria-describedby'
},
customEvent: '.' + pluginName + (new Date()).getTime(),
loadAfter: null
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['component'].prototype = {
init: function () {
var me = this;
this.setElements();
this.bindCustomEvents();
this.initLayout();
this.buildMatchHeight();
this.buildProductSwiper();
this.buildBannerSwiper();
this.documentReady().done(function() {
me.assignComponents();
});
},
setElements: function () {
this.productTabWrap = this.obj.find(this.opts.productTabWrap);
this.productTabPanels = this.productTabWrap.find(this.opts.productTabPanels);
this.itemTabWrap = this.obj.find(this.opts.itemTabWrap);
this.productObj = this.obj.find(this.opts.productObj);
this.productItem = this.productObj.find(this.opts.productItem);
this.bannerObj = this.obj.find(this.opts.bannerObj);
this.bannerItem = this.bannerObj.find(this.opts.bannerItem);
},
initLayout: function () {
var me = this;
this.winWidth = UTIL.winSize().w;
this.productTabPanels.each(function(idx, panel) {
var $panel = $(panel);
var itemLength = $panel.find('li').length;
if (itemLength <= 5) {
$panel.addClass(me.opts.alignCenterClass);
}
});
},
bindCustomEvents: function() {
this.obj.on(this.changeEvents('destroy'), $.proxy(this.destroy, this));
this.obj.on(this.changeEvents('rerun'), $.proxy(this.rerun, this));
},
assignComponents: function() {
this.assignTabs();
this.matchHeight.build();
this.productSwiper.build();
this.bannerSwiper.build();
},
assignTabs: function() {
this.productTabWrap.simpleTab({
activeClass: this.opts.activeClass,
tabItems: this.opts.productTabItems,
tabPanels: this.opts.productTabPanels
});
this.itemTabWrap.simpleTab({
activeClass: this.opts.activeClass,
tabItems: this.opts.itemTabItems,
tabPanels: this.opts.itemTabPanels,
onInit: $.proxy(this._onItemTabChange, this),
onChange: $.proxy(this._onItemTabChange, this)
});
},
_onItemTabChange: function(welTabs, welPanels, curIdx) {
var curTab = welTabs.eq(curIdx);
var txt = curTab.find(this.opts.itemTabColor).text();
var contentColor = curTab.parents(this.opts.itemTabWrap).find(this.opts.itemTabContentColor);
contentColor.text(txt);
},
buildMatchHeight: function() {
UTIL.def(this, {
matchHeight : {
instance : [],
build : $.proxy(function () {
if (this.matchHeight.instance.length) {
for (var i = 0, imax = this.matchHeight.instance.length; i < imax; i++) {
this.matchHeight.instance[i].reInit();
}
} else {
this.matchHeight.instance.push(new win.sg.components.hubbleNonShopRaw['matchHeight'](this.opts.itemTabWrap, {
matchSelector: [
'.hubble-nonshop-raw__item-content-name',
'.hubble-nonshop-raw__item-tab'
]
}));
this.matchHeight.instance.push(new win.sg.components.hubbleNonShopRaw['matchHeight'](this.opts.bannerItem, {
matchSelector: [
'.hubble-nonshop-raw__banner-content'
]
}));
}
}, this),
destroy : $.proxy(function () {
if (!this.matchHeight.instance.length) {
for (var i = 0, imax = this.matchHeight.instance.length; i < imax; i++) {
this.matchHeight.instance[i].destroy();
}
this.matchHeight.instance = [];
}
}, this)
}
});
},
buildProductSwiper : function () {
UTIL.def(this, {
productSwiper : {
instance : null,
commonOpts : {
obj : this.productItem,
pcItemMax : 3,
moItemMax : 1
},
swiperOpts : {
pagination : {
el : '.swiper-pagination',
type : 'bullets',
clickable : true
},
slidesPerView: 1,
slidesPerGroup : 1,
breakpoints : {
768 : {
slidesPerView : 3,
slidesPerGroup : 4,
navigation : {
nextEl : '.swiper-button-next',
prevEl : '.swiper-button-prev'
}
}
}
},
build : $.proxy(function () {
if (this.swiperActiveCondition(this.productSwiper.commonOpts)) {
this.productSwiper.instance = new win.sg.components.hubbleNonShopRaw.HubbleCarousel(this.productObj, this.productSwiper.swiperOpts);
}
}, this),
destroy : $.proxy(function () {
if (this.productSwiper.instance !== null) {
this.productSwiper.instance.destroy();
this.productSwiper.instance = null;
}
}, this)
}
});
},
buildBannerSwiper : function () {
UTIL.def(this, {
bannerSwiper : {
instance : null,
commonOpts : {
obj : this.bannerItem,
pcItemMax : 1,
moItemMax : 1
},
swiperOpts : {
pagination : {
el : '.swiper-pagination',
type : 'bullets',
clickable : true
},
slidesPerView: 1,
slidesPerGroup : 1,
breakpoints : {
768 : {
navigation : {
nextEl : '.swiper-button-next',
prevEl : '.swiper-button-prev'
}
}
}
},
build : $.proxy(function () {
if (this.swiperActiveCondition(this.bannerSwiper.commonOpts)) {
this.bannerSwiper.instance = new win.sg.components.hubbleNonShopRaw.HubbleCarousel(this.bannerObj, this.bannerSwiper.swiperOpts);
}
}, this),
destroy : $.proxy(function () {
if (this.bannerSwiper.instance !== null) {
this.bannerSwiper.instance.destroy();
this.bannerSwiper.instance = null;
}
}, this)
}
});
},
swiperActiveCondition : function (opts) {
var item = opts.obj
var winWidth = UTIL.winSize().w;
var isPc = (!UTIL.isSupportTransform || UTIL.isSupportTransform && (winWidth > BREAKPOINTS_MOBILE));
return (isPc && item.length > opts.pcItemMax) || (!isPc && item.length > opts.moItemMax)
},
documentReady: function() {
return $.Deferred(function(dfd) {
$(doc).ready(dfd.resolve);
}).promise();
},
changeEvents: function(event) {
var events = [],
eventNames = event.split(' ');
for (var key in eventNames) {
events.push(eventNames[key] + this.opts.customEvent);
}
return events.join(' ');
},
outCallback: function(cbName) {
var callback = this.opts[cbName],
restArgs = Array.prototype.slice.call(arguments, 1);
if ($.isFunction(callback)) callback.apply(this, restArgs);
},
destroy : function () {
this.matchHeight.destroy();
this.productSwiper.destroy();
this.bannerSwiper.destroy();
this.productTabWrap.trigger('destroy');
},
rerun: function() {
this.assignComponents();
},
reInit : function () {
}
};
HCOMPONENT['componentCall'] = function(args) {
var defParams = {
obj : '.hubble-nonshop-raw'
};
this.opts = UTIL.def(defParams, (args || {}));
if (!(this.obj = $(this.opts.obj)).length) return;
this.init();
};
HCOMPONENT['componentCall'].prototype = UTIL.def({
init: function() {
this.callComponent();
this.globalObjs();
},
callComponent: function() {
this.callPlugins = [];
for (var i = 0, max = this.obj.length; i < max; i++) {
this.callPlugins.push(new HCOMPONENT['component'](this.obj.eq(i), {
loadAfter : $.proxy(this.globalObjsCall, this)
}));
}
},
globalObjs: function() {
for (var i = 0, max = this.callPlugins.length; i < max; i++) {
CST_EVENT.PAGEIS.PAGEOBJS.push(this.callPlugins[i]);
}
},
globalObjsCall: function() {
CST_EVENT.PAGEIS.EVENT_MANAGER.trigger(CST_EVENT.PAGEIS.REPOSITION);
}
}, UTIL.emitter);
$(function() {
new HCOMPONENT['componentCall']();
});
})(window, window.jQuery, window.document);
}
function getJQueryReady() {
if (window.jQuery) {
initNonShop(window, window.jQuery, window.document);
} else {
setTimeout(function() {
getJQueryReady();
}, 500);
}
}
getJQueryReady();
})();