").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
/**
* samsung.com jQuery v1.11.3 - $.noConflict();
*/
if (window._isExist) {
jQuery.noConflict();
window._isExist = null;
}
/* Placeholders.js v4.0.1 */
/*!
* The MIT License
*
* Copyright (c) 2012 James Allardice
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
!function(a){"use strict";function b(){}function c(){try{return document.activeElement}catch(a){}}function d(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return!0;return!1}function e(a,b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):void 0}function f(a,b){var c;a.createTextRange?(c=a.createTextRange(),c.move("character",b),c.select()):a.selectionStart&&(a.focus(),a.setSelectionRange(b,b))}function g(a,b){try{return a.type=b,!0}catch(c){return!1}}function h(a,b){if(a&&a.getAttribute(B))b(a);else for(var c,d=a?a.getElementsByTagName("input"):N,e=a?a.getElementsByTagName("textarea"):O,f=d?d.length:0,g=e?e.length:0,h=f+g,i=0;h>i;i++)c=f>i?d[i]:e[i-f],b(c)}function i(a){h(a,k)}function j(a){h(a,l)}function k(a,b){var c=!!b&&a.value!==b,d=a.value===a.getAttribute(B);if((c||d)&&"true"===a.getAttribute(C)){a.removeAttribute(C),a.value=a.value.replace(a.getAttribute(B),""),a.className=a.className.replace(A,"");var e=a.getAttribute(I);parseInt(e,10)>=0&&(a.setAttribute("maxLength",e),a.removeAttribute(I));var f=a.getAttribute(D);return f&&(a.type=f),!0}return!1}function l(a){var b=a.getAttribute(B);if(""===a.value&&b){a.setAttribute(C,"true"),a.value=b,a.className+=" "+z;var c=a.getAttribute(I);c||(a.setAttribute(I,a.maxLength),a.removeAttribute("maxLength"));var d=a.getAttribute(D);return d?a.type="text":"password"===a.type&&g(a,"text")&&a.setAttribute(D,"password"),!0}return!1}function m(a){return function(){P&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)?f(a,0):k(a)}}function n(a){return function(){l(a)}}function o(a){return function(){i(a)}}function p(a){return function(b){return v=a.value,"true"===a.getAttribute(C)&&v===a.getAttribute(B)&&d(x,b.keyCode)?(b.preventDefault&&b.preventDefault(),!1):void 0}}function q(a){return function(){k(a,v),""===a.value&&(a.blur(),f(a,0))}}function r(a){return function(){a===c()&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)&&f(a,0)}}function s(a){var b=a.form;b&&"string"==typeof b&&(b=document.getElementById(b),b.getAttribute(E)||(e(b,"submit",o(b)),b.setAttribute(E,"true"))),e(a,"focus",m(a)),e(a,"blur",n(a)),P&&(e(a,"keydown",p(a)),e(a,"keyup",q(a)),e(a,"click",r(a))),a.setAttribute(F,"true"),a.setAttribute(B,T),(P||a!==c())&&l(a)}var t=document.createElement("input"),u=void 0!==t.placeholder;if(a.Placeholders={nativeSupport:u,disable:u?b:i,enable:u?b:j},!u){var v,w=["text","search","url","tel","email","password","number","textarea"],x=[27,33,34,35,36,37,38,39,40,8,46],y="#ccc",z="placeholdersjs",A=new RegExp("(?:^|\\s)"+z+"(?!\\S)"),B="data-placeholder-value",C="data-placeholder-active",D="data-placeholder-type",E="data-placeholder-submit",F="data-placeholder-bound",G="data-placeholder-focus",H="data-placeholder-live",I="data-placeholder-maxlength",J=100,K=document.getElementsByTagName("head")[0],L=document.documentElement,M=a.Placeholders,N=document.getElementsByTagName("input"),O=document.getElementsByTagName("textarea"),P="false"===L.getAttribute(G),Q="false"!==L.getAttribute(H),R=document.createElement("style");R.type="text/css";var S=document.createTextNode("."+z+" {color:"+y+";}");R.styleSheet?R.styleSheet.cssText=S.nodeValue:R.appendChild(S),K.insertBefore(R,K.firstChild);for(var T,U,V=0,W=N.length+O.length;W>V;V++)U=V
a;a++)U=a list before trying to add a new one.
//
// Usage:
//
// > jQuery.addOutsideEvent( event_name [, outside_event_name ] );
//
// Arguments:
//
// event_name - (String) The name of the originating event that the new
// "outside" event will be powered by. This event can be a native or
// custom event, as long as it bubbles up the DOM tree.
// outside_event_name - (String) An optional name for the new "outside"
// event. If omitted, the outside event will be named whatever the
// value of `event_name` is plus the "outside" suffix.
//
// Returns:
//
// Nothing.
$.addOutsideEvent = jq_addOutsideEvent;
function jq_addOutsideEvent( event_name, outside_event_name ) {
// The "outside" event name.
outside_event_name = outside_event_name || event_name + outside;
// A jQuery object containing all elements to which the "outside" event is
// bound.
var elems = $(),
// The "originating" event, namespaced for easy unbinding.
event_namespaced = event_name + '.' + outside_event_name + '-special-event';
// Event: outside events
//
// An "outside" event is triggered on an element when its corresponding
// "originating" event is triggered on an element outside the element in
// question. See the list for more information.
//
// Usage:
//
// > jQuery('selector').bind( 'clickoutside', function(event) {
// > var clicked_elem = $(event.target);
// > ...
// > });
//
// > jQuery('selector').bind( 'dblclickoutside', function(event) {
// > var double_clicked_elem = $(event.target);
// > ...
// > });
//
// > jQuery('selector').bind( 'mouseoveroutside', function(event) {
// > var moused_over_elem = $(event.target);
// > ...
// > });
//
// > jQuery('selector').bind( 'focusoutside', function(event) {
// > var focused_elem = $(event.target);
// > ...
// > });
//
// You get the idea, right?
$.event.special[ outside_event_name ] = {
// Called only when the first "outside" event callback is bound per
// element.
setup: function(){
// Add this element to the list of elements to which this "outside"
// event is bound.
elems = elems.add( this );
// If this is the first element getting the event bound, bind a handler
// to document to catch all corresponding "originating" events.
if ( elems.length === 1 ) {
$(doc).bind( event_namespaced, handle_event );
}
},
// Called only when the last "outside" event callback is unbound per
// element.
teardown: function(){
// Remove this element from the list of elements to which this
// "outside" event is bound.
elems = elems.not( this );
// If this is the last element removed, remove the "originating" event
// handler on document that powers this "outside" event.
if ( elems.length === 0 ) {
$(doc).unbind( event_namespaced );
}
},
// Called every time a "outside" event callback is bound to an element.
add: function( handleObj ) {
var old_handler = handleObj.handler;
// This function is executed every time the event is triggered. This is
// used to override the default event.target reference with one that is
// more useful.
handleObj.handler = function( event, elem ) {
// Set the event object's .target property to the element that the
// user interacted with, not the element that the "outside" event was
// was triggered on.
event.target = elem;
// Execute the actual bound handler.
old_handler.apply( this, arguments );
};
}
};
// When the "originating" event is triggered..
function handle_event( event ) {
// Iterate over all elements to which this "outside" event is bound.
$(elems).each(function(){
var elem = $(this);
// If this element isn't the element on which the event was triggered,
// and this element doesn't contain said element, then said element is
// considered to be outside, and the "outside" event will be triggered!
if ( this !== event.target && !elem.has(event.target).length ) {
// Use triggerHandler instead of trigger so that the "outside" event
// doesn't bubble. Pass in the "originating" event's .target so that
// the "outside" event.target can be overridden with something more
// meaningful.
elem.triggerHandler( outside_event_name, [ event.target ] );
}
});
};
};
})(jQuery,document,"outside");
/*!
* A simple jQuery plugin for creating animated drilldown menus.
*
* @name jQuery Drilldown
* @version 1.1.1
* @requires jQuery v1.7+
* @author Aleksandras Nelkinas
* @license [MIT]{@link http://opensource.org/licenses/mit-license.php}
*
* Copyright (c) 2015 Aleksandras Nelkinas
*
* @modify
* option : rtl
*
* @add trigger event
* animate change : trigger 'DRILLDOWN_ANIMATE_CHANGE'
*
* @add focus event
* animate change : focus
*
* @add separated
* @last 160825 - smg
*/
;(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($, undefined) {
'use strict';
var PLUGIN_NAME = 'drilldown';
var TRACK_PARENT_ATTR = 'data-next-parent';
var defaults = {
rtl: $('html').hasClass('rtl'),
event: 'click',
selector: 'a',
speed: 100,
cssClass: {
container: PLUGIN_NAME + '-container',
root: PLUGIN_NAME + '-root',
sub: PLUGIN_NAME + '-sub',
back: PLUGIN_NAME + '-back',
auth: PLUGIN_NAME + '-auth'
}
};
var Plugin = (function () {
function Plugin(element, options) {
var inst = this;
this._name = PLUGIN_NAME;
this._defaults = defaults;
this.element = element;
this.$element = $(element);
this.options = $.extend({}, defaults, options);
this._history = [];
this._auth = [];
if (this.options.rtl) {
this._css = {
float: 'right',
width: null
};
} else {
this._css = {
float: 'left',
width: null
};
}
this.$container = this.$element.find('.' + this.options.cssClass.container);
this.$root = this.$container.find('.' + this.options.cssClass.root);
this.$auth = this.$container.find('.' + this.options.cssClass.auth);
this.$element.on(this.options.event + '.' + PLUGIN_NAME, this.options.selector, function (e) {
handleAction.call(inst, e, $(this));
});
}
Plugin.prototype = {
/**
* Destroys plugin instance.
*/
destroy: function () {
this.reset();
this.$element.off(this.options.event + '.' + PLUGIN_NAME, this.options.selector);
},
/**
* Resets drilldown to its initial state.
*/
reset: function () {
var iter;
for (iter = this._history.length; iter > 0; iter--) {
up.call(this, { speed: 0 });
}
this._history = [];
if (this.options.rtl) {
this._css = {
float: 'right',
width: null
};
} else {
this._css = {
float: 'left',
width: null
};
}
}
};
/**
* Handles user action and decides whether or not and where to drill.
*
* @param {jQuery.Event} e
* @param {jQuery} $trigger
* @private
*/
function handleAction(e, $trigger) {
var $next = $trigger.nextAll('.' + this.options.cssClass.sub);
var preventDefault = true;
if ($next.length) {
down.call(this, $next);
} else if ($trigger.closest('.' + this.options.cssClass.back).length) {
up.call(this);
} else {
preventDefault = false;
}
if (preventDefault && $trigger.prop('tagName') === 'A') {
e.preventDefault();
}
}
/**
* Drills down (deeper).
*
* @param {jQuery} $next
* @param {Object} opts
* @private
*/
function down($next, opts, btnType) {
var speed = (opts && opts.speed !== undefined) ? opts.speed : this.options.speed;
if (!$next.length) {
return;
}
this._css.width = this.$element.outerWidth();
this.$container.width(this._css.width * 2);
// Track parent of the opened node
$next.parent().attr(TRACK_PARENT_ATTR, true);
$next = $next
.removeClass(this.options.cssClass.sub)
.addClass(this.options.cssClass.root);
this.$container.append($next);
this.$root.append(this.$auth);
if (this.options.rtl) {
animateDrilling.call(this, { marginRight: -1 * this._css.width, speed: speed }, function () {
var $current = $next.prev();
this._auth.push(this.$auth);
this._history.push($current.detach());
restoreState.call(this, $next);
$('body').trigger('DRILLDOWN_ANIMATE_CHANGE');
if($next.children().first().hasClass(this.options.cssClass.back))
{
$next.find('.'+this.options.cssClass.back+' a').focus();
} else {
$next.children().children().children().eq(0).focus();
}
}.bind(this));
} else {
animateDrilling.call(this, { marginLeft: -1 * this._css.width, speed: speed }, function () {
var $current = $next.prev();
this._auth.push(this.$auth);
this._history.push($current.detach());
restoreState.call(this, $next);
$('body').trigger('DRILLDOWN_ANIMATE_CHANGE');
if($next.children().first().hasClass(this.options.cssClass.back))
{
$next.find('.'+this.options.cssClass.back+' a').focus();
} else {
$next.children().children().children().eq(0).focus();
}
}.bind(this));
}
}
/**
* Drills up (back).
*
* @private
*/
function up(opts) {
var speed = (opts && opts.speed !== undefined) ? opts.speed : this.options.speed;
var $next = this._history.pop();
var $auth = this._auth.pop();
this._css.width = this.$element.outerWidth();
this.$container.width(this._css.width * 2);
this.$container.prepend($next);
$next.append($auth);
if (this.options.rtl) {
animateDrilling.call(this, { marginRight: 0, speed: speed }, function () {
var $current = $next.next();
$current
.addClass(this.options.cssClass.sub)
.removeClass(this.options.cssClass.root);
// Restore the node at its initial position in the DOM
this.$container.find('[' + TRACK_PARENT_ATTR + ']').last()
.removeAttr(TRACK_PARENT_ATTR)
.append($current)
restoreState.call(this, $next);
$('body').trigger('DRILLDOWN_ANIMATE_CHANGE');
if($next.children().first().hasClass(this.options.cssClass.back))
{
$next.find('.'+this.options.cssClass.back+' :first-child a').focus();
} else {
$next.children().children().children().eq(0).focus();
}
}.bind(this));
} else {
animateDrilling.call(this, { marginLeft: 0, speed: speed }, function () {
var $current = $next.next();
$current
.addClass(this.options.cssClass.sub)
.removeClass(this.options.cssClass.root);
// Restore the node at its initial position in the DOM
this.$container.find('[' + TRACK_PARENT_ATTR + ']').last()
.removeAttr(TRACK_PARENT_ATTR)
.append($current)
restoreState.call(this, $next);
$('body').trigger('DRILLDOWN_ANIMATE_CHANGE');
if($next.children().first().hasClass(this.options.cssClass.back))
{
$next.find('.'+this.options.cssClass.back+' a').focus();
} else {
$next.children().children().children().eq(0).focus();
}
}.bind(this));
}
}
/**
* Animates drilling process.
*
* @param {Object} opts
* @param {Function} callback
* @private
*/
function animateDrilling(opts, callback) {
var $menus = this.$container.children('.' + this.options.cssClass.root);
$menus.css(this._css);
if (this.options.rtl) {
$menus.first().animate({ marginRight: opts.marginRight }, opts.speed, callback);
} else {
$menus.first().animate({ marginLeft: opts.marginLeft }, opts.speed, callback);
}
}
/**
* Restores initial menu's state.
*
* @param {jQuery} $menu
* @private
*/
function restoreState($menu) {
if (this.options.rtl) {
$menu.css({
float: '',
width: '',
marginRight: ''
});
} else {
$menu.css({
float: '',
width: '',
marginLeft: ''
});
}
this.$container.css('width', '');
}
return Plugin;
})();
$.fn[PLUGIN_NAME] = function (options) {
return this.each(function () {
var inst = $.data(this, PLUGIN_NAME);
var method = options;
if (!inst) {
$.data(this, PLUGIN_NAME, new Plugin(this, options));
} else if (typeof method === 'string') {
if (method === 'destroy') {
$.removeData(this, PLUGIN_NAME);
}
if (typeof inst[method] === 'function') {
inst[method]();
}
}
});
};
}));
/*!
* samsung.com - Phase2 - Javascript Common
* src : common/js/src/smg/gnb/smg.gnb.common.js
*
* @version 1.0.0
* @since 2016.02.01
* @liast 2016.08.18
*/
var IS_WMC_AEM_VER_GNB = false;
;(function () {
IS_WMC_AEM_VER_GNB = ($('.gb-gnb').length) ? true : false;
})();
;(function(win) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
/**
* samsung.com namespace
* @name window.smg
* @namespace
*/
win.smg = {};
}
/**
* Phase2 AEM Namespace
* @name window.smg.aem
* @namespace
*/
win.smg.aem = win.smg.aem || {};
/**
* Phase2 AEM Static Values Defined
*/
win.smg.aem.varStatic = win.smg.aem.varStatic || {};
/**
* Phase2 AEM Custom Events Defined
*/
win.smg.aem.customEvent = win.smg.aem.customEvent || {};
/**
* Phase2 AEM Utility Script Defined
*/
win.smg.aem.util = win.smg.aem.util || {};
/**
* Phase2 AEM Common Script Defined
*/
win.smg.aem.common = win.smg.aem.common || {};
/**
* Phase2 AEM Components Namespace
* @name window.smg.aem.components
* @namespace
*/
//win.smg.aem.components = win.smg.aem.components || {};
/**
* Phase2 Home Components Namespace
* @name window.smg.aem.components.home
* @namespace
*/
//win.smg.aem.components.home = win.smg.aem.components.home || {};
/**
* Phase2 AboutSamsung Components Namespace
* @name window.smg.aem.components.aboutsamsung
* @namespace
*/
//win.smg.aem.components.aboutsamsung = win.smg.aem.components.aboutsamsung || {};
/**
* Phase2 AEM Templates Namespace
* @name window.smg.aem.templates
* @namespace
*/
//win.smg.aem.templates = win.smg.aem.templates || {};
/**
* Phase2 Home Templates Namespace
* @name window.smg.aem.templates.home
* @namespace
*/
//win.smg.aem.templates.home = win.smg.aem.templates.home || {};
/*!
* samsung.com - Phase2 - Javascript Namespace Defined
* src : js/src/smg/aem/namespace.js
*
* @version 1.0.0
* @since 2016.02.01
*/
})(window);
/*!
* samsung.com - Phase2 - Utility Script Defined
* src : js/src/smg/aem/static/smg.aem.util.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win, $) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.util) {
win.smg.aem.util = {};
}
var hasOwnProperty = Object.prototype.hasOwnProperty,
doc = win.document;
/**
* @name window.smg.aem.util
* @namespace
* @requires jQuery
* @requires namespace.js
*/
win.smg.aem.util = (function() {
return {
isArray : function(arr) {
return 'array' === $.type(arr);
},
def : function(org, src) {
for (var prop in src) {
if (!hasOwnProperty.call(src, prop)) continue;
if ('object' === $.type(org[prop])) {
org[prop] = (this.isArray(org[prop]) ? src[prop].slice(0) : this.def(org[prop], src[prop]));
} else {
org[prop] = src[prop];
}
}
return org;
},
winSize : function() {
var win_wh = {
w : win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth,
h : win.innerHeight || doc.documentElement.clientHeight || doc.body.clientHeight
};
return win_wh;
},
getQueryStr : function(href) {
href = href || win.location.href;
var vars = {};
href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
},
winOpener : function(args) {
var defParams = {
url : 'http://www.samsung.com',
name : 'smg_opener_' + new Date().getTime(),
width : 400,
height : 400,
left : null,
top : null,
scrollbars : 'no',
toolbar : 'no',
location : 'no',
directories : 'no',
status : 'no',
menubar : 'no',
resizable : 'no'
}, opener, setting, options;
options = win.smg.util.def(defParams, (args || {}));
options.left = options.left || ( screen.width / 2 - options.width / 2 );
options.top = options.top || ( screen.height / 2 - options.height / 2 );
setting = '';
for( var prop in options ) {
if( prop != 'url' && prop != 'name' ) {
setting += ',' + prop + '=' + options[ prop ];
}
}
setting = setting.substr( 1, setting.length );
opener = window.open( options.url, options.name, setting );
return opener;
},
imgLoader : function(img, callback) {
img.each(function() {
var cb = (callback || function() {});
/*for IE 10-*/
if (this.complete || $(this).height() > 0) {
cb.apply(img);
} else {
$(this).load(function() {
cb.apply(img);
});
}
});
},
vwOrientationUpdate : function(css) {
$(win).on('orientationchange', function() {
var vwElem = $(css || '.js-vw');
if (!vwElem.size()) {
return;
}
vwElem.css('display', 'none').height();
vwElem.css('display', '');
});
},
iPadVWRender : function() {
if (navigator.userAgent.match(/iPad/i)) {
this.vwOrientationUpdate('.js-vw');
}
},
Cookie : function() {
var defParams = {
expires : '', path: '/', domain : '', secure : ''
};
return {
setCookie : function(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + ((exdays || 0) * 24 * 60 * 60 * 1000));
var opt = win.smg.aem.util.def(defParams, { expires : d });
document.cookie = [
cname, '=', cvalue,
opt.expires ? '; expires=' + opt.expires.toUTCString() : '',
opt.path ? '; path=' + opt.path : '',
opt.domain ? '; domain=' + opt.domain : '',
opt.secure ? '; secure' : ''
].join('');
},
getCookie : function(cname) {
var name = cname + '=',
ca = document.cookie.split(';'),
c;
for(var i=0, leng=ca.length; i').attr({
'rel' : 'stylesheet', type : 'text/css',
href : url + (!!nocache ? '?_ts=' + new Date().getTime() : '')
}).appendTo(head).load(function() {
_dfd.resolve();
});
});
$.when.apply($, dfds).done(function() {
if ($.isFunction(cb)) cb();
});
},
getServerTime : function(callBack, serverUrl) {
serverUrl = serverUrl || window.location.href.toString();
callBack = callBack || function() {};
$.ajax({
url : serverUrl,
async : false,
cashe : false
})
.done(function(res, status, xhr) {
callBack(new Date(xhr.getResponseHeader('Date')));
});
},
getRestrictBytes : function(str, maxBytes) {
var strLeng = str.length,
rByte = 0,
rLen = 0,
strChar = '';
maxBytes = maxBytes || 100;
for (var i=0; i 4) {
rByte += 2;
} else {
rByte++;
}
if(rByte <= maxBytes) {
rLen = i+1;
}
}
return {
bytes : rByte,
rectLeng : rLen
}
},
isAemEditMode : function() {
var flag = false;
if (win.parent && win.frameElement && $(win.parent.document).find('.foundation-authoring-ui-mode').size()) {
flag = true;
}
return flag;
}
};
})();
win.smg.aem.util.cookie = new win.smg.aem.util.Cookie();
$(function() {
win.smg.aem.util.iPadVWRender();
});
})(window, jQuery);
/*!
* samsung.com - Phase2 - Static Values Defined
* src : js/src/smg/aem/static/smg.aem.static.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.varStatic) {
win.smg.aem.varStatic = {};
}
/**
* @name window.smg.aem.varStatic
* @namespace
* @requires namespace.js
*/
win.smg.aem.varStatic = {
CSS : {
VIDEO_OPEN : 'video-open',
SEARCH_POS : 'search-pos',
NAV_OPEN : 'nav-open',
NAV_CLOSE : 'nav-close',
HAS_ANIMATED : 'has-animated',
IS_SHOW : 'is-show',
IS_HIDE : 'is-hide',
IS_OPEN : 'is-open',
IS_SELECT : 'is-select',
JS_IMG_SRC : 'js-img-src',
JS_IMG_LAZY : 'js-img-lazy',
JS_IMG_LAZY_LOADED : 'js-img-lazy-loaded',
LAZY_LOADED : 'lazy-loaded',
SWITCH_MOBILE : 'switch-mobile',
SWITCH_TABLET : 'switch-tablet'
},
DATA_ATTR : {
SRC_PC : 'data-src-pc',
SRC_MOBILE : 'data-src-mobile',
DATA_SRC : 'data-src'
},
SUPPORT : {
NO_SVG : 'no-svg',
NO_CSS3 : 'no-css3',
IE_LT_8 : 'lt-ie8',
COOKIE_WARNING : 'cookie-warning',
TOUCH_DEVICE : 'touch-device'
},
RESPONSIVE : {
DESKTOP : {
NAME : 'desktop'
},
TABLET : {
NAME : 'tablet',
WIDTH : 1280
},
MOBILE : {
NAME : 'mobile',
WIDTH : 768
},
MIN_MOBILE : {
NAME : 'min_mobile',
WIDTH : 320
},
GNB : {
NAME : 'gnb_reponsive',
WIDTH : 1024
}
}
};
})(window);
/*!
* samsung.com - Phase2 - Custom Events Defined
* src : js/src/smg/aem/event/smg.aem.event.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.customEvent) {
win.smg.aem.customEvent = {};
}
/**
* @name window.smg.aem.customEvent
* @namespace
* @requires namespace.js
*/
win.smg.aem.customEvent = {
VIDEO : {
PLAY : 'AEM_VIDEO_PLAY',
CLOSE : 'AEM_VIDEO_CLOSE'
},
RESPONSIVE : {
GET_STATUS : 'AEM_RESPONSIVE_GET_STATUS',
CHANGE : 'AEM_RESPONSIVE_CHANGE'
}
};
})(window);
/*!
* samsung.com - Phase2 - Common Script Defined
* src : js/src/smg/aem/common/smg.aem.common.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win, $) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.common) {
win.smg.aem.common = {};
}
// Static Values
var V_STATIC = win.smg.aem.varStatic,
// Utility Script
UTIL = win.smg.aem.util,
// Custom Events
CST_EVENT = win.smg.aem.customEvent;
/**
* @name window.smg.aem.common
* @namespace
* @requires jQuery
* @requires namespace.js
* @requires window.smg.aem.static.js
* @requires window.smg.aem.util.js
* @requires window.smg.aem.event.js
*/
win.smg.aem.common = (function() {
return {
init : function() {
this.detection();
this.responsiveName = '';
this.responsiveNameEx = '';
this.responsiveGNB = '';
this.responsiveGNBEx = '';
$('body').on(CST_EVENT.RESPONSIVE.GET_STATUS, $.proxy(this.resizeListener, this));
$(win).on('resize', $.proxy(this.resizeListener, this));
this.resizeListener();
return this;
},
detection : function() {
// SVG Support Check
if (!document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1')) {
$('body').addClass(V_STATIC.SUPPORT.NO_SVG);
}
// IE lt 8 Check
if (document.all && !document.addEventListener) {
$('body').addClass(V_STATIC.SUPPORT.IE_LT_8);
}
// CSS3 Support Check
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
css3support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
if (!css3support) {
$('body').addClass(V_STATIC.SUPPORT.NO_CSS3);
}
// Touch Support Check
var supportsTouch = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
if (supportsTouch) {
$('body').addClass(V_STATIC.SUPPORT.TOUCH_DEVICE);
}
},
resizeListener : function(e) {
var winWidth = UTIL.winSize().w;
if (winWidth <= V_STATIC.RESPONSIVE.MOBILE.WIDTH) {
this.responsiveName = V_STATIC.RESPONSIVE.MOBILE.NAME;
} else if (winWidth <= V_STATIC.RESPONSIVE.TABLET.WIDTH) {
this.responsiveName = V_STATIC.RESPONSIVE.TABLET.NAME;
} else {
this.responsiveName = V_STATIC.RESPONSIVE.DESKTOP.NAME;
}
if (winWidth <= V_STATIC.RESPONSIVE.GNB.WIDTH) {
this.responsiveGNB = V_STATIC.RESPONSIVE.GNB.NAME;
} else {
this.responsiveGNB = '';
}
if (this.responsiveName !== this.responsiveNameEx || this.responsiveGNB !== this.responsiveGNBEx) {
this.responsiveNameEx = this.responsiveName;
this.responsiveGNBEx = this.responsiveGNB;
$('body').trigger(CST_EVENT.RESPONSIVE.CHANGE, { RESPONSIVE_NAME : this.responsiveName, RESPONSIVE_GNB_NAME : this.responsiveGNB, isMobile : winWidth <= V_STATIC.RESPONSIVE.MOBILE.WIDTH });
}
if (e && e.type === CST_EVENT.RESPONSIVE.GET_STATUS) {
$('body').trigger(CST_EVENT.RESPONSIVE.CHANGE, { RESPONSIVE_NAME : this.responsiveName, RESPONSIVE_GNB_NAME : this.responsiveGNB, isMobile : winWidth <= V_STATIC.RESPONSIVE.MOBILE.WIDTH });
}
}
};
})();
var common;
$(function() {
common = win.smg.aem.common.init();
});
// confrict samsung.min.js - resize
$(win).on('resize', function(e) {
if (!common || !common.resizeListener) return;
common.resizeListener.call(common, e);
});
})(window, jQuery);
/*!
* samsung.com - Phase2 - Accessibility Checkbox Script
* src : js/src/smg/aem/accessibility/placehoder/smg.aem.acc.checkbox.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win, $) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.accessibility) {
win.smg.aem.accessibility = {};
}
// Utility Script
var UTIL = win.smg.aem.util;
var namespace = win.smg.aem.accessibility;
/**
* @name window.smg.aem.accessibility.checkbox
* @namespace
* @requires jQuery
* @requires namespace.js
* @requires window.smg.aem.static.js
* @requires window.smg.aem.util.js
* @requires window.smg.aem.event.js
*/
namespace.checkbox = (function() {
/**
* @description Default Options
* @private
* @type {Object}
*/
var defParams = {
targets : '[data-accessibility=\'checkbox\']',
targetsValue : 'data-acc-checkbox-value',
holder : 'data-acc-checkbox',
holderTarget : 'data-acc-checkbox-target',
onClass : 'data-acc-onclass'
};
return {
init : function(container, args) {
if (!(this.container = container).size()) return;
this.opts = UTIL.def(defParams, (args || {}));
this.setElements();
this.setBindEvents();
},
setElements : function() {
this.targets = this.container.find(this.opts.targets);
this.holders = $('[' + this.opts.holder + ']');
$.each(this.targets, $.proxy(function(idx, elm) {
$(elm).attr(this.opts.targetsValue, $(elm).attr('checked'));
}, this));
},
setBindEvents : function() {
this.holders.on('click', $.proxy(this.onHolderClick, this));
this.targets.on('change', $.proxy(this.onTargetChange, this));
},
unElements : function() {
var target,
targetInfo;
$.each(this.targets, $.proxy(function(idx, elm) {
target = $(elm);
targetInfo = this.getTargetInfo(target);
target.removeAttr('checked', 'checked');
target.prop('checked', false);
if (targetInfo.onClass) {
targetInfo.holder.removeClass(targetInfo.onClass);
}
}, this));
this.targets = [];
this.holders = [];
},
unBindEvents : function() {
this.holders.off('click', $.proxy(this.onHolderClick, this));
this.targets.off('change', $.proxy(this.onTargetChange, this));
},
onHolderClick : function(e) {
var target = $(e.currentTarget);
target = $('[' + this.opts.holderTarget + '=\'' + target.attr(this.opts.holder) + '\']');
if (target.size()) {
target.trigger('click').focus();
}
},
onTargetChange : function(e) {
var target = $(e.currentTarget),
targetInfo = this.getTargetInfo(target),
holder = targetInfo.holder,
onClass = targetInfo.onClass,
isChecked = target.attr('checked');
if (!isChecked) {
target.attr('checked', 'checked');
target.prop('checked', true);
if (onClass) {
holder.addClass(onClass);
}
} else {
target.removeAttr('checked', 'checked');
target.prop('checked', false);
if (onClass) {
holder.removeClass(onClass);
}
}
},
getTargetInfo : function(target) {
target = $('[' + this.opts.holder + '=\'' + target.attr(this.opts.holderTarget) + '\']');
if (target.size()) {
return { holder : target, onClass : target.attr(this.opts.onClass) };
}
return { holder : '', onClass : '' };
},
destroy: function() {
this.unBindEvents();
this.unElements();
},
refresh : function(container, args) {
container = container || this.container;
this.destroy();
this.init(container, args);
}
};
})();
$(function() {
namespace.checkbox.init($('body'));
});
})(window, jQuery);
/*!
* samsung.com - Phase2 - Accessibility Placeholder Script
* src : js/src/smg/aem/accessibility/placehoder/smg.aem.acc.placeholder.js
*
* @version 1.0.0
* @since 2016.02.04
*/
;(function(win, $) {
'use strict';
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.accessibility) {
win.smg.aem.accessibility = {};
}
// Utility Script
var UTIL = win.smg.aem.util;
var namespace = win.smg.aem.accessibility;
/**
* @name window.smg.aem.accessibility.placeholder
* @namespace
* @requires jQuery
* @requires namespace.js
* @requires window.smg.aem.static.js
* @requires window.smg.aem.util.js
* @requires window.smg.aem.event.js
*/
namespace.placeholder = (function() {
/**
* @description Default Options
* @private
* @type {Object}
*/
var defParams = {
targets : '[data-accessibility=\'placeholder\']',
targetsValue : 'data-acc-placeholder-value',
holder : 'data-acc-placeholder',
holderTarget : 'data-acc-placeholder-target',
onClass : 'data-acc-onclass'
};
return {
init : function(container, args) {
if (!(this.container = container).size()) return;
this.opts = UTIL.def(defParams, (args || {}));
this.setElements();
this.setBindEvents();
},
setElements : function() {
this.targets = this.container.find(this.opts.targets);
$.each(this.targets, $.proxy(function(idx, elm) {
$(elm).attr(this.opts.targetsValue, $(elm).val());
}, this));
},
setBindEvents : function() {
this.targets.on('focus', $.proxy(this.onTargetsFocus, this))
.on('blur', $.proxy(this.onTargetsBlur, this))
.on('keydown keyup', $.proxy(this.onTargetsChange, this));
},
unElements : function() {
$.each(this.targets, $.proxy(function(idx, elm) {
$(elm).val($(elm).attr(this.opts.targetsValue));
}, this));
var target,
targetInfo;
$.each($('[' + this.opts.holder + ']'), $.proxy(function(idx, elm) {
target = $(elm);
targetInfo = this.getTargetInfo(target);
if (targetInfo.onClass) {
target.removeClass(targetInfo.onClass);
} else {
target.show();
}
}, this));
this.targets = [];
},
unBindEvents : function() {
this.targets.off('focus', $.proxy(this.onTargetsFocus, this))
.off('blur', $.proxy(this.onTargetsBlur, this));
},
onTargetsFocus : function(e) {
var target = $(e.currentTarget),
targetInfo = this.getTargetInfo(target),
holder = targetInfo.holder,
onClass = targetInfo.onClass;
if (!holder) {
return;
}
if (target.val()) {
if (onClass) {
holder.addClass(onClass);
} else {
holder.css({ 'visibility' : 'hidden' });
}
}
},
onTargetsBlur : function(e) {
var target = $(e.currentTarget),
targetInfo = this.getTargetInfo(target),
holder = targetInfo.holder,
onClass = targetInfo.onClass;
if (!holder) {
return;
}
if (!target.val()) {
if (onClass) {
holder.removeClass(onClass);
} else {
holder.css({ 'visibility' : 'visible' });
}
}
},
onTargetsChange : function(e) {
var target = $(e.currentTarget),
targetInfo = this.getTargetInfo(target),
holder = targetInfo.holder,
onClass = targetInfo.onClass;
if (!holder) {
return;
}
if (target.val()) {
if (onClass) {
holder.addClass(onClass);
} else {
holder.css({ 'visibility' : 'hidden' });
}
} else {
if (onClass) {
holder.removeClass(onClass);
} else {
holder.css({ 'visibility' : 'visible' });
}
}
},
getTargetInfo : function(target) {
target = $('[' + this.opts.holder + '=\'' + target.attr(this.opts.holderTarget) + '\']');
if (target.size()) {
return { holder : target, onClass : target.attr(this.opts.onClass) };
}
return { holder : '', onClass : '' };
},
destroy: function() {
this.unBindEvents();
this.unElements();
},
refresh : function(container, args) {
container = container || this.container;
this.destroy();
this.init(container, args);
}
};
})();
$(function() {
namespace.placeholder.init($('body'));
});
})(window, jQuery);
/*!
* samsung.com - Phase2 - Common GNB
* src : common/js/src/smg/gnb/smg.gnb.common-gnb.js
*
* @version 1.0.0
* @since 2016.08.19
* @last 2016.09.05 - 17:48
*/
;(function (win, $) {
'use strict'
if (!IS_WMC_AEM_VER_GNB) {return;}
if('undefined' === typeof win.smg) {
win.smg = {};
}
if('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if('undefined' === typeof win.smg.aem.common) {
win.smg.aem.common = {};
}
var namespace = win.smg.aem.common;
// V_STATIC Values
var V_STATIC = win.smg.aem.varStatic,
// Custom Events
CST_EVENT = win.smg.aem.customEvent;
namespace.gnb = (function()
{
var custom = {
body : 'body',
header : '#header',
evt : {
connect : {},
responsiveMgr : {
responsiveChange : 'responsiveChange'
}
},
clickedTarget: null
}
var orientationchangeManager = {
init : function() {
this.orientationchangeListener();
},
orientationchangeListener : function() {
$(win).on('orientationchange', function(e) {
$(win).trigger('resize');
});
}
}
var responsiveManager = {
init : function() {
this.constants();
this.bindEvts();
this.defSetup();
},
constants : function() {
this.device = {
mobile : { support : true, name : 'mobile', width : 768 },
tablet : { support : false, name : 'tablet', width : 1280 },
gnb : { support : false, name : 'gnb' , width : 1024 },
desktop : { support : true, name : 'desktop'}
}
this.evt = custom.evt.responsiveMgr;
},
bindEvts : function() {
this.resizeListener();
},
defSetup : function() {
this.responsiveChange();
},
resizeListener : function() {
var _ = this;
$(win).on('resize', function() {
_.responsiveChange();
});
},
responsiveChange : function() {
var doc = win.document,
w = win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth;
var responsiveName;
if( this.device.mobile.support && w <= this.device.mobile.width ) {
responsiveName = this.device.mobile.name;
} else if( this.device.tablet.support && w <= this.device.tablet.width ) {
responsiveName = this.device.tablet.name;
} else if( this.device.gnb.support && w <= this.device.gnb.width ) {
responsiveName = this.device.gnb.name;
} else if( this.device.desktop.support) {
responsiveName = this.device.desktop.name;
} else return;
var resObj = { responsiveName : '' };
if(!this.responsiveName) {
this.responsiveName = responsiveName;
//trigger, event custom
resObj.responsiveName = this.responsiveName;
$(custom.evt.connect).trigger(this.evt.responsiveChange, resObj);
} else {
if(this.responsiveName !== responsiveName) {
this.responsiveName = responsiveName;
//trigger, event custom
resObj.responsiveName = this.responsiveName;
$(custom.evt.connect).trigger(this.evt.responsiveChange, resObj);
}
}
}
}//responsiveManager
var header = $(custom.header);
var gnbMain = {
init : function(){
this.constants();
this.setElmts();
this.bindEvts();
},
constants : function() {
this.delay = 100;
},
setElmts : function() {
this.menus = header.find('.gb-gnb__drop-desktop').closest('li');
this.closeBtn = this.menus.find('.s-ico-close');
},
bindEvts : function() {
this.responsiveListener();
this.menusActiveListener();
this.outsideAreaMouseleaveListener();
this.closeBtnClickListener();
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.destroy, this));
},
menusActiveListener : function() {
var _ = this,
target;
this.menus.on('mouseenter keydown', function(e) {
if(e.type === 'keydown') {
var keyCode = e.keyCode || e.which;
if(keyCode !== 13) return;
}
target = $(e.currentTarget);
if(!target.find('.gb-gnb__drop-desktop').is(':visible')) {
var delay = _.menus.find('.gb-gnb__drop-desktop').is(':visible') ? 1 : _.delay;
_.offLayer(target, delay);
_.onLayer(target, delay);
_.onAria(target);
} else {
if(e.type === 'keydown') {
_.offLayer(undefined, this.delay);
_.offAria(target);
}
}
});
},
outsideAreaMouseleaveListener : function() {
var _ = this;
this.menus.on('mouseleave', function(e) {
_.offLayer();
_.onAria();
});
},
closeBtnClickListener : function() {
var _ = this;
this.closeBtn.on('click', function(e) {
_.offLayer(undefined, this.delay);
_.offAria();
$(e.currentTarget).closest('li').find('.s-btn-toggler').focus();
});
},
onLayer : function(target, delay) {
delay = delay || 1;
target.find('.gb-gnb__drop-desktop').fadeIn({
duration : delay,
complete : function() {
$(this).removeAttr('style').css('display', 'block');
}
});
var _ = this;
setTimeout(function() {
_.bindClickoutsideListener(target.closest('li'));
}, 50);
},
offLayer : function(target, delay) {
delay = delay || 1;
var targets = target ? target.closest('li').siblings() : this.menus;
targets.find('.gb-gnb__drop-desktop').fadeOut({
duration : delay,
complete : function() {
$(this).removeAttr('style').css('display', 'none');
}
});
this.unbindClickoutsideListener();
},
onAria : function(target) {
this.menus.attr('aria-selected', false);
if(target) target.closest('li').attr('aria-selected', true);
},
offAria : function() {
this.menus.attr('aria-selected', false);
},
bindClickoutsideListener : function(target) {
target.on('clickoutside', $.proxy(this.clickoutside, this));
},
unbindClickoutsideListener : function() {
this.menus.off('clickoutside', $.proxy(this.clickoutside, this));
},
clickoutside : function(e) {
this.offLayer();
this.offAria();
},
destroy : function() {
this.offLayer();
this.offAria();
}
}
var gnbMouseenterManager = {
init : function() {
this.setElmts();
this.bindEvts();
},
setElmts : function() {
this.menus = header.find('.gb-gnb__drop-desktop').closest('li')
.add(header.find('.gb-gnb__my-layer').closest('li'));
this.search = header.find('.gb-gnb__search .gb-gnb__search-bar');
// this.mymenu = header.find('.s-mymenu .gb-gnb__my-layer');
this.cart = header.find('.gb-gnb__cart .gb-gnb__cart-layer');
},
bindEvts : function() {
this.menusMouseenterListener();
},
menusMouseenterListener : function() {
var _ = this;
this.menus.on('mouseenter', function(e) {
_.outersideTrigger();
});
},
outersideTrigger : function() {
if(this.getSearchVisible() || /*this.getMymenuVisible() ||*/ this.getCartVisible()) {
header.find('.gb-gnb__main').trigger('click');
}
},
getSearchVisible : function() {
return this.search.is(':visible');
},/*
getMymenuVisible : function() {
return this.mymenu.is(':visible');
},*/
getCartVisible : function() {
return this.cart.is(':visible');
}
}
var gnbTogger = {
init : function() {
this.opts();
this.setElmt();
this.bindEvent();
},
opts : function() {
this.delay = 100;
},
setElmt : function() {
this.toggler = header.find('.s-gnb-toggler'),
this.layer = header.find('.gb-gnb__drop-mobile'),
this.dimmed = header.find('.gb-gnb__dimmed');
},
bindEvent : function() {
this.responsiveListener();
this.togglerClickListener();
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.destroy, this));
},
togglerClickListener : function() {
var _ = this;
this.toggler.on('click', function(e) {
if(_.layer.is(':visible')) {
_.offDrilldown();
} else {
_.onDrilldown();
}
});
},
onDrilldown : function() {
drilldown.reset();
this.onStatusAttr();
this.onDimmed();
this.onLayer();
},
offDrilldown : function(delay) {
this.offLayer(delay);
this.offStatusAttr();
this.offDimmed();
},
onStatusAttr : function() {
$(custom.body).addClass('gb-gnb-open');
},
offStatusAttr : function() {
$(custom.body).removeClass('gb-gnb-open');
},
onLayer : function() {
var _ = this;
this.layer.fadeIn({
duration : _.delay,
complete : function() {
_.fadeInComplete();
}
});
},
offLayer : function(delay) {
var _ = this,
delay = delay || this.delay;
if(delay === 1) {
this.layer.removeAttr('style').css('display', 'none');
} else {
this.layer.fadeOut({
duration : delay,
complete : function() {
var srhView = $('.gb-gnb__search .gb-gnb__search-bar').is(':visible'),
cartView = $('.gb-gnb__cart .gb-gnb__cart-layer').is(':visible');
if(!srhView && !cartView) _.toggler.focus();
}
});
}
},
onDimmed : function() {
this.dimmed.css('display','block');
},
offDimmed : function() {
this.dimmed.css('display','none');
},
fadeInComplete : function(e){
this.layer.find('.s-depth1-link').eq(0).focus();
this.bindClickoutsideListener();
},
bindClickoutsideListener : function() {
this.layer.on('clickoutside', $.proxy(this.onClickOutside, this));
},
unbindClickoutsideListener : function() {
this.layer.off('clickoutside', $.proxy(this.onClickOutside, this));
},
onClickOutside : function(e) {
var evtTarget = $(e.target);
if(evtTarget.hasClass('gb-gnb__dimmed') || evtTarget.hasClass('lightbox-skrim')) return;
this.offDrilldown(1);
this.unbindClickoutsideListener();
},
onCloseCallback : function(){
this.onClickOutside();
},
destroy : function() {
this.unbindClickoutsideListener();
this.offDrilldown(1);
}
}
var myMenu = {
isMobile : (function(){
return !!('ontouchstart' in win || (win.DocumentTouch && doc instanceof win.DocumentTouch));
})(),
init : function(){
this.opts();
this.setElements();
this.bindEventHandlers();
},
opts : function(){
this.delay = 100;
},
setElements : function(){
this.menuWrap = header.find('.gb-gnb__bar .gb-gnb__my-layer').closest('li');
this.menuLayer = header.find('.gb-gnb__my-layer');
this.loginBtns = header.find('.s-btn-login, a.s-login');
this.dimContainer = $('#dimContainer');
this.name = 'myMenu';
},
bindEventHandlers : function(){
this.menuWrap.on('mouseenter mouseleave', $.proxy(this.onMouseLayer, this));
this.menuWrap.on('click', '.s-btn-utility', $.proxy(this.onKeyboardLayer, this));
if (this.loginBtns.length) {
this.loginBtns.on('click.gnbCloseLayers', $.proxy(this.onLoginCloseLayers, this));
}
this.responsiveListener();
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.onClickOutside, this));
},
onMouseLayer : function(e){
if(this.isMobile) return;
var _this = this;
custom.clickedTarget = this.name;
if(e.type == 'mouseenter'){
this.mouseEnterType = true;
this.menuLayer.stop().fadeIn(_this.delay);
}else if(e.type == 'mouseleave'){
this.mouseEnterType = false;
this.menuLayer.stop().fadeOut(_this.delay);
}
},
onKeyboardLayer : function(e){
if(this.mouseEnterType) return;
var _this = this;
custom.clickedTarget = this.name;
if(!this.menuLayer.is(':visible')){
this.onAria();
this.menuLayer.stop().fadeIn(_this.delay);
this.menuWrap.on('clickoutside', $.proxy(this.onClickOutside, this));
}else{
this.offAria();
this.menuLayer.stop().fadeOut(_this.delay);
this.menuWrap.off('clickoutside', $.proxy(this.onClickOutside, this));
}
},
onLoginCloseLayers : function (e) {
this.dimContainer.on('click.gnbCloseLayersdim', $.proxy(this.onLoginCloseLayerDim, this));
myCart.offAria();
myCart.offLayer();
gnbSearch.offAria();
gnbSearch.offLayer();
},
onLoginCloseLayerDim : function (e) {
this.dimContainer.off('click.gnbCloseLayersdim', $.proxy(this.onLoginCloseLayerDim, this));
this.onLoginCloseLayers();
this.loginBtns.focus();
},
onClickOutside : function(e){
var _this = this,
$this = $(e.currentTarget);
this.offAria();
this.menuLayer.stop().fadeOut(_this.delay);
$this.off('clickoutside', $.proxy(this.onClickOutside, this));
if (this.name == custom.clickedTarget) {
this.loginBtns.focus();
}
},
onAria : function() {
this.menuWrap.find('.s-btn-utility').attr('aria-expanded', true);
},
offAria : function() {
this.menuWrap.find('.s-btn-utility').attr('aria-expanded', false);
}
}
var popAlign = {
init : function() {
this.setElmts();
this.bindEvents();
},
setElmts : function() {
this.layer = $('#loginLayerPopup .popAlign');
},
bindEvents : function() {
$(win).on('resize', $.proxy(this.resizeListener, this));
$(win).trigger('resize');
},
resizeListener : function() {
var winWidth = $(win).width(),
winHeight = win.innerHeight || document.documentElement.clientHeight ||document.body.clientHeight;
var popWidth = this.layer.outerWidth(),
popHeight = this.layer.outerHeight();
var left = (winWidth - popWidth) / 2,
top = 0;
if(popHeight < winHeight) {
top = (winHeight - popHeight) / 2;
}
this.layer.css({'left': left, 'top': top });
}
}
var myCart = {
init : function(){
this.opts();
this.setElements();
this.bindEventHandlers();
},
opts : function(){
this.delay = 100;
},
setElements : function(){
this.menuWrap = header.find('.gb-gnb__bar .s-ico-cart').closest('button')
.add(header.find('.gb-gnb__bar .s-ico-cart-empty').closest('button'));
this.menuLayer = header.find('.gb-gnb__cart-layer');
this.ssCartLi = $('#ss_cart');
this.name = 'myCart';
},
bindEventHandlers : function(){
this.responsiveListener();
this.menuWrapClickListener();
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.destroy, this));
},
menuWrapClickListener : function() {
var _ = this;
this.menuWrap.on('click', function(e) {
custom.clickedTarget = _.name;
if(_.menuLayer.is(':visible')) {
_.offDisplay();
} else {
_.onDisplay();
}
});
},
onLayer : function() {
this.menuLayer.stop().fadeIn(this.delay);
},
offLayer : function(delay) {
delay = delay || this.delay;
this.menuLayer.stop().fadeOut(delay);
this.ssCartLi.removeClass('on');
},
onDisplay : function() {
this.onLayer();
this.onAria();
var _ = this;
setTimeout(function() {
_.bindClickOutsideListener();
}, 50);
},
offDisplay : function(delay) {
delay = delay || this.delay;
this.offLayer(delay);
this.offAria();
this.unbindClickOutsideListener();
if (this.name == custom.clickedTarget) {
this.menuWrap.focus();
custom.clickedTarget = '';
}
},
onAria : function() {
this.menuWrap.attr('aria-expanded', true);
},
offAria : function() {
this.menuWrap.attr('aria-expanded', false);
},
onCloseCallback : function(){
this.offDisplay();
},
onClickOutside : function() {
this.offDisplay();
},
bindClickOutsideListener : function() {
this.menuLayer.closest('li').on('clickoutside', $.proxy(this.onClickOutside, this));
},
unbindClickOutsideListener : function() {
this.menuLayer.closest('li').off('clickoutside', $.proxy(this.onClickOutside, this));
},
destroy : function() {
this.offDisplay(1);
}
}
var gnbSearch = {
init : function(){
this.opts();
this.setElements();
this.bindEventHandlers();
this.removeAutocompelteStyle();
},
opts : function(){
this.delay = 0;
},
setElements : function(){
this.wrap = header.find('.gb-gnb__search'),
this.bar = this.wrap.find('.gb-gnb__search-bar'),
this.suggest = this.wrap.find('.gb-gnb__search-suggest'),
this.searchBtn = header.find('.js-ico-search'),
this.closeBtn = this.wrap.find('.s-ico-close'),
this.inputArea = this.wrap.find('#inp_srch'),
this.name = 'gnbSearch';
},
bindEventHandlers : function(){
this.responsiveListener();
this.searchBtnClickListener();
this.closeBtnClickListener();
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.destroy, this));
},
searchBtnClickListener : function() {
var _ = this;
this.searchBtn.on('click', function(e) {
custom.clickedTarget = _.name;
if(_.wrap.css('display') == 'block') {
_.offLayer();
_.offAria();
} else {
_.onLayer();
_.onAria();
}
});
},
closeBtnClickListener : function() {
this.closeBtn.on('click', $.proxy(this.offLayer, this));
},
onLayer : function() {
var _ = this;
this.wrap.stop().show({
duration: _.delay,
complete : function() {
setTimeout(function() {
_.bindClickoutsideListener();
}, 50);
}
});
},
offLayer : function() {
var _ = this;
this.wrap.stop().hide({
duration: _.delay,
complete : function() {
_.inputArea.val('');
_.suggest.hide();
if (_.name == custom.clickedTarget) {
_.searchBtn.focus();
custom.clickedTarget = '';
}
_.unbindClickoutsideListener();
}
});
},
onAria : function() {
this.searchBtn.attr('aria-expanded', true);
},
offAria : function() {
this.searchBtn.attr('aria-expanded', false);
},
bindClickoutsideListener : function() {
this.wrap.on('clickoutside', $.proxy(this.onClickOutside, this));
},
unbindClickoutsideListener : function() {
this.wrap.off('clickoutside', $.proxy(this.onClickOutside, this));
},
onClickOutside : function() {
this.offLayer();
this.offAria();
},
destroy : function() {
this.wrap.trigger('clickoutside');
},
removeAutocompelteStyle : function() {
// remove p4 auto-complete
this.wrap.find('.auto-complete').removeClass('auto-complete');
},
}
var ckBar = {
init : function(){
this.opts();
this.setElements();
this.bindResizeHandlers();
},
opts : function(){
this.utils = win.smg.aem.util;
this.responsiveType = (this.utils.winSize().w <= V_STATIC.RESPONSIVE.MOBILE.WIDTH) ? true : false;
},
setElements : function(){
this.header = $('#header');
this.ckBarWrap = this.header.find('.cookie-notice');
this.ckBarClose = this.ckBarWrap.find('.cookie-notice__btn-close');
this.gnbWrap = this.header.find('.gb-gnb');
},
bindResizeHandlers : function(){
$(win).on('resize', $.proxy(this.onResizeBrowser, this));
this.ckBarClose.on('click', $.proxy(this.onCkbarClose, this));
this.onResizeBrowser();
},
unBindResizeHandlers : function(){
$(win).off('resize', $.proxy(this.onResizeBrowser, this));
},
onResizeBrowser : function(){
this.ckBarHeight = this.ckBarWrap.outerHeight(true);
if(this.utils.winSize().w <= V_STATIC.RESPONSIVE.MOBILE.WIDTH){
if(this.responsiveType){
this.responsiveType = false;
}
}else{
this.gnbWrap.css('top','');
if(!this.responsiveType){
this.responsiveType = true;
}
}
},
onCkbarClose : function(e){
e.preventDefault();
var _this = this;
if(this.utils.winSize().w <= V_STATIC.RESPONSIVE.MOBILE.WIDTH){
if((this.gnbWrap.css('position') == 'absolute') && this.ckBarWrap.is(':visible')){
this.gnbWrap.css({
'position' : 'relative',
'top' : '',
'height' : '100%'
});
}
}
$.when(this.ckBarWrap.animate({
'marginTop' : - (_this.ckBarHeight)
})).done(function(){
_this.ckBarWrap.hide();
if(_this.utils.winSize().w <= V_STATIC.RESPONSIVE.MOBILE.WIDTH){
_this.gnbWrap.css({
'position' : '',
'top' : '',
'height' : ''
});
_this.unBindResizeHandlers();
};
Waypoint.refreshAll();
});
}
}
var promotionBar = {
init : function() {
this.setElmts();
this.closeBtnClickListener();
},
setElmts : function() {
var header = $('#header');
this.wrap = header.find('.gb-gnb__promotion');
this.closeBtn = this.wrap.find('.s-ico-close');
},
closeBtnClickListener : function() {
var _ = this;
this.closeBtn.on('click', function(e) {
_.wrap.css('display','none');
});
}
}
var gnbToggerHeightManager = {
init : function() {
this.setElmts();
this.stateInstance();
this.bindEvts();
},
stateInstance : function() {
this.scrollTop = 0;
this.defHeight = this.layer.outerHeight();
this.wrapHeight = this.defHeight;
},
setStateValue : function(callback) {
this.wrapHeight = $(win).height();
if(callback || typeof callback === 'function') callback();
},
setElmts : function() {
this.header = header;
this.layer = header.find('.gb-gnb__drop-mobile');
},
bindEvts : function() {
this.responsiveListener();
this.headerClickListener();
this.scrollListener();
if(responsiveManager.responsiveName === responsiveManager.device.mobile.name) {
this.resizeListener();
}
},
responsiveListener : function() {
$(custom.evt.connect).on(custom.evt.responsiveMgr.responsiveChange, $.proxy(this.responsiveBindEventHandlers, this));
},
headerClickListener : function() {
this.header.on('click', $.proxy(this.resizeHeight, this));
},
responsiveBindEventHandlers : function(e, data) {
if(data.responsiveName === responsiveManager.device.mobile.name) {
this.resizeListener();
} else {
this.unbindResizeListener();
}
},
resizeListener : function() {
$(win).on('resize', $.proxy(this.resizeListenerImpl, this));
},
resizeListenerImpl : function(e) {
if(this.layer.is(':visible')) this.resizeHeight();
},
unbindResizeListener : function() {
$(win).off('resize', $.proxy(this.resizeListenerImpl, this));
},
scrollListener : function() {
var _ = this;
$(win).on('scroll', function() {
_.scrollTop = $(this).scrollTop();
});
},
resizeHeight : function() {
this.resultHeight = $(win).height() - this.layer.offset().top;
this.layer.css('min-height', this.resultHeight);
}
}
var drilldown = (function()
{
var elmt = { wrap : '.drilldown'}
var opt = {speed: 1}
$(elmt.wrap).drilldown(opt);
var init = function() {
$(elmt.wrap).drilldown(opt);
}
var reset = function() {
$(elmt.wrap).drilldown('reset');
}
var destroy = function() {
$(elmt.wrap).drilldown('destroy');
}
return {
init : init,
reset : reset,
destroy : destroy
}
})();
var init = function(container)
{
if (!(this.container = container).size()) return;
orientationchangeManager.init();
responsiveManager.init();
gnbMain.init();
myMenu.init();
gnbTogger.init();
gnbToggerHeightManager.init();
ckBar.init();
gnbMouseenterManager.init();
myCart.init();
gnbSearch.init();
// promotionBar.init();
}
var changeCartState = function (isEmpty) {
if (!myCart.ssCartLi.size()) return; // $('#ss_cart');
var cartClass = {empty: 's-ico-cart-empty', exist: 's-ico-cart'},
$cartStateBtn = myCart.menuWrap.find('> span:eq(0)'); // $('.s-btn-utility')
if (isEmpty) {
$cartStateBtn
.removeClass(cartClass.exist)
.addClass(cartClass.empty);
} else {
$cartStateBtn
.removeClass(cartClass.empty)
.addClass(cartClass.exist);
}
};
return {
init : init,
changeCartState : changeCartState
}
})();
$(function() {
if ($('.gb-gnb').length) {
namespace.gnb.init($('body'));
}
});
})(window, jQuery);
/*!
* samsung.com - Phase2 - Common GNB
* src : common/js/src/smg/gnb/smg.gnb.promotionbar.js
*
* @version 1.0.0
* @since 2016.09.06
* @last 2016.09.08 - 10:32
*/
;
(function(win, $) {
'use strict'
if (!IS_WMC_AEM_VER_GNB) {
return;
}
if ('undefined' === typeof win.smg) {
win.smg = {};
}
if ('undefined' === typeof win.smg.aem) {
win.smg.aem = {};
}
if ('undefined' === typeof win.smg.aem.common) {
win.smg.aem.common = {};
}
var namespace = win.smg.aem.common;
// UTILS - COMMON
var UTILS = win.smg.aem.util;
namespace.promotionbar = (function() {
var PROMOTIONS = {
cookiesPromotion: 'cookies-promotion',
sessionCountryCode: 'cookie_country',
cookiePromotionClass: 'cookie-promotion'
}
return {
init: function (container) {
if (this.chkConfirmedLocation()) {
return;
}
this.assignedHTMLElements(container);
this.$container.addClass(PROMOTIONS.cookiePromotionClass);
this.bindEvents();
},
assignedHTMLElements: function (container) {
this.$container = container;
this.$closeButton = this.$container.find('.s-ico-close');
this.$samsungLogo = $('a.gb-gnb__logo');
},
chkConfirmedLocation: function () {
var chkValue = false;
this.disabledCountrys = this.getPromotionCookie();
this.sessionCode = this.getSessionCountryCode();
//win.location.href.indexOf('wwww') === -1 &&
if (this.getTestParameter('site_cd')) {
this.sessionCode = this.getTestParameter('site_cd');
}
if (this.disabledCountrys.indexOf(this.sessionCode) !== -1) {
chkValue = true;
} else {
chkValue = false;
}
return chkValue;
},
getSessionCountryCode: function () {
var cookieCountry = UTILS.cookie.getCookie(PROMOTIONS.sessionCountryCode).toLowerCase();
return cookieCountry;
},
getPromotionCookie: function () {
var cookiePromotion = UTILS.cookie.getCookie(PROMOTIONS.cookiesPromotion).toLowerCase();
return cookiePromotion;
},
setPromotionCookie: function () {
var cookieString = this.disabledCountrys;
var sessionString = this.sessionCode;
if (cookieString.length < 1) {
cookieString = sessionString;
} else {
cookieString = cookieString + '/' + sessionString;
}
UTILS.cookie.setCookie(PROMOTIONS.cookiesPromotion, cookieString, 90);
},
bindEvents: function () {
var _this = this;
this.$closeButton.on('click', function (e) {
_this.onCloseBtnClick();
return false;
});
},
onCloseBtnClick: function () {
this.setPromotionCookie();
this.closePromotionWrap();
},
closePromotionWrap: function () {
var _this = this,
mh = this.$container.height(),
offsetTop = this.$container.offset().top;
_this.$container.removeClass(PROMOTIONS.cookiePromotionClass);
//_this.$samsungLogo.focus();
/*if (offsetTop > 10) {
this.$container.css('height', mh);
this.$container.animate({'height': 0}, function () {
_this.$container.removeClass(PROMOTIONS.cookiePromotionClass);
_this.$samsungLogo.focus();
if (win.smg.page && win.Waypoint) {Waypoint.refreshAll();}
});
} else {
this.$container.animate({'margin-top': '-=' + mh}, function () {
_this.$container.removeClass(PROMOTIONS.cookiePromotionClass);
_this.$samsungLogo.focus();
if (win.smg.page && win.Waypoint) {Waypoint.refreshAll();}
});
} */
},
getTestParameter: function (qs) {
var value = '',
address = unescape(location.href),
param = (address.slice(address .indexOf('?') + 1, address .length)).split('&');
for (var i = 0; i < param.length; i++) {
var name = param[i].split('=')[0];
if (name.toUpperCase() == qs.toUpperCase()) {
value = param[i].split('=')[1];
break;
}
}
return value;
}
}
})();
$(function() {
win.smg.aem.common.promotionbar.init($('div.gb-gnb__promotion'));
});
})(window, jQuery);