').appendTo(flyout.elem());var panelGroup=flyout.getName()+'SubCats';var hideTimeout=null;var sloppyTrigger=createSloppyTrigger($parent);var showParent=function(){if(hideTimeout){clearTimeout(hideTimeout);hideTimeout=null;} if(visible){return;} var height=$('#nav-flyout-shopAll').height();$parent.animate({width:'show'},{duration:200,complete:function(){$parent.css({overflow:'visible','height':height});}});visible=true;};var hideParentNow=function(){$parent.stop().css({overflow:'hidden',display:'none',width:'auto',height:'auto'});panels.hideAll({group:panelGroup});visible=false;if(hideTimeout){clearTimeout(hideTimeout);hideTimeout=null;}};var hideParent=function(){if(!visible){return;} if(hideTimeout){clearTimeout(hideTimeout);hideTimeout=null;} hideTimeout=setTimeout(hideParentNow,10);};flyout.onHide(function(){sloppyTrigger.disable();hideParentNow();this.elem().hide();});var addPanel=function($link,panelKey){var panel=dataPanel({className:'nav-subcat',dataKey:panelKey,groups:[panelGroup],spinner:false,visible:false});if(!flyoutDebug){var mouseout=mouseOutUtility();mouseout.add(flyout.elem());mouseout.action(function(){panel.hide();});mouseout.enable();} var a11y=a11yHandler({link:$link,onEscape:function(){panel.hide();$link.focus();}});var logPanelInteraction=function(promoID,wlTriggers){var logNow=$F.once().on(function(){var panelEvent=$.extend({},event,{id:promoID});if(config.browsePromos&&!!config.browsePromos[promoID]){panelEvent.bp=1;} logEvent(panelEvent);phoneHome.trigger(wlTriggers);});if(panel.isVisible()&&panel.hasInteracted()){logNow();}else{panel.onInteract(logNow);}};panel.onData(function(data){renderPromo(data.promoID,panel.elem());logPanelInteraction(data.promoID,data.wlTriggers);});panel.onShow(function(){var columnCount=$('.nav-column',panel.elem()).length;panel.elem().addClass('nav-colcount-'+columnCount);showParent();var $subCatLinks=$('.nav-subcat-links > a',panel.elem());var length=$subCatLinks.length;if(length>0){var firstElementLeftPos=$subCatLinks.eq(0).offset().left;for(var i=1;i
'+ catTitle+'');panel.elem().prepend($subPanelTitle);}} $link.addClass('nav-active');});panel.onHide(function(){$link.removeClass('nav-active');hideParent();a11y.disable();});panel.onShow(function(){a11y.elems($('a, area',panel.elem()));});sloppyTrigger.register($link,panel);if(flyoutDebug){$link.click(function(){if(panel.isVisible()){panel.hide();}else{panel.show();}});} var panelKeyHandler=onKey($link,function(){if(this.isEnter()||this.isSpace()){panel.show();}},'keydown',false);$link.focus(function(){panelKeyHandler.bind();}).blur(function(){panelKeyHandler.unbind();});panel.elem().appendTo($parent);};var hideParentAndResetTrigger=function(){hideParent();sloppyTrigger.disable();};for(var i=0;i
メインコンテンツにスキップ
"},"url":"/cart/ewc/compact?hostPageType=CustomerReviews&hostSubPageType=remoteSingleReviewPage&hostPageRID=STJQEMRHYJF41MXVF05B&prerender=0","cartCount":0,"freshCartCount":0,"almCartCount":0,"primeWardrobeCartCount":0,"isCompactViewEnabled":true,"isCompactEWCRendered":true,"isWiderCompactEWCRendered":true,"EWCBrowserCacheKey":"EWC_Cache_356-5556634-7799910__JPY_ja_JP","isContentRepainted":false,"clearCache":false,"loadFromCacheWithDelay":0,"delayRenderingTillATF":false};
var hasAui = window.P && window.P.AUI_BUILD_DATE;
var isRTLEnabled = (document.dir === 'rtl');
config.pinnable = config.pinnable && hasAui;
config.isMigrationTreatment = true;
config.flyout = (function() {
var navbelt = document.getElementById('nav-belt');
var navCart = document.getElementById('nav-cart');
var ewcFlyout = document.getElementById('nav-flyout-ewc');
var persistentClassOnBody = 'nav-ewc-persistent-hover nav-ewc-full-height-persistent-hover';
var flyout = {};
var getDocumentScrollTop = function() {
return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
};
var isWindow = function(obj) {
return obj != null && obj === obj.window;
};
var getWindow = function(elem) {
return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
};
var getOffset = function(elem) {
if (elem.getClientRects && !elem.getClientRects().length) {
return {top: 0};
}
var rect = elem.getBoundingClientRect
? elem.getBoundingClientRect()
: {top: 0};
if (rect.width || rect.height) {
var doc = elem.ownerDocument;
var win = getWindow(doc);
return {
top: rect.top + win.pageYOffset - doc.documentElement.clientTop
};
}
return rect;
};
flyout.align = function() {
var newTop = getOffset(navbelt).top - getDocumentScrollTop();
ewcFlyout.style.top = (newTop > 0 ? newTop + 'px' : 0);
};
flyout.hide = function() {
isRTLEnabled
? (ewcFlyout.style.left = '')
: (ewcFlyout.style.right = '');
};
if(typeof config.isCompactEWCRendered === 'undefined') {
if (
(config.isSmallScreenEnabled && viewportWidth() < 1400) ||
(config.isCompactViewEnabled && viewportWidth() >= 1400)
) {
config.isCompactEWCRendered = true;
config.isEWCStateExpanded = true;
config.url = config.url.replace("/gp/navcart/sidebar", "/cart/ewc/compact");
} else {
config.isCompactEWCRendered = false;
}
}
var viewportQualifyForPersistent = function () {
return (config.isCompactEWCRendered)
? true
: viewportWidth() >= 1400;
}
flyout.hasQualifiedViewportForPersistent = viewportQualifyForPersistent;
var getEWCRightOffset = function() {
if (!config.isCompactEWCRendered) {
return 0;
}
var $navbelt = document.getElementById('nav-belt');
if ($navbelt === undefined || $navbelt === null) {
return 0;
}
var EWCCompactViewWidth = (config.isWiderCompactEWCRendered && viewportWidth() >= 1280) ? 130 : 100;
var scrollLeft = (window.pageXOffset !== undefined)
? window.pageXOffset
: (document.documentElement || document.body.parentNode || document.body).scrollLeft;
var scrollXAxis = Math.abs(scrollLeft);
var windowWidth = document.documentElement.clientWidth;
var navbeltWidth = $navbelt.offsetWidth;
var isPartOfNavbarNotVisible = (navbeltWidth + EWCCompactViewWidth) > windowWidth;
if (isPartOfNavbarNotVisible) {
return 0 - (navbeltWidth - scrollXAxis - windowWidth + EWCCompactViewWidth);
} else {
return 0;
}
}
flyout.getEWCRightOffsetCssProperty = function () {
return getEWCRightOffset() + 'px';
}
if (config.isCompactEWCRendered) {
persistentClassOnBody = 'nav-ewc-persistent-hover nav-ewc-compact-view';
if (config.isWiderCompactEWCRendered) { persistentClassOnBody += ' nav-ewc-wider-compact-view'; }
}
flyout.show = function() {
isRTLEnabled
? (ewcFlyout.style.left = flyout.getEWCRightOffsetCssProperty())
: (ewcFlyout.style.right = flyout.getEWCRightOffsetCssProperty());
};
var isIOSDevice = function() {
return (/iPad|iPhone|iPod/.test(navigator.platform) ||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
!window.MSStream;
}
var checkForPersistent = function() {
if (!hasAui) {
return { result: false, reason: 'noAui' };
}
if (!config.enablePersistent) {
return { result: false, reason: 'config' };
}
if (!viewportQualifyForPersistent()) {
return { result: false, reason: 'viewport' };
}
if (isIOSDevice()) {
return { result: false, reason: 'iOS' };
}
if (!config.cartCount > 0) {
return { result: false, reason: 'emptycart' };
}
return { result: true };
};
flyout.ableToPersist = function() {
return checkForPersistent().result;
};
var persistentClassRegExp = '(?:^|\\s)' + persistentClassOnBody + '(?!\\S)';
flyout.applyPageLayoutForPersistent = function() {
if (!document.documentElement.className.match( new RegExp(persistentClassRegExp) )) {
document.documentElement.className += ' ' + persistentClassOnBody;
}
};
flyout.unapplyPageLayoutForPersistent = function() {
document.documentElement.className = document.documentElement.className.replace( new RegExp(persistentClassRegExp, 'g'), '');
};
flyout.persist = function() {
flyout.applyPageLayoutForPersistent();
flyout.show();
if (config.isCompactEWCRendered) {
flyout.align();
}
};
flyout.unpersist = function() {
flyout.unapplyPageLayoutForPersistent();
flyout.hide();
};
var persistentCheck = checkForPersistent();
var resizeCallback = function() {
if (flyout.ableToPersist()) {
flyout.persist();
}
else {
flyout.unpersist();
}
};
flyout.bindEvents = function() {
if (window.addEventListener) {
window.addEventListener('resize', resizeCallback, false);
if (config.isCompactEWCRendered) {
window.addEventListener('scroll', flyout.align, false);
}
}
};
flyout.unbindEvents = function() {
if (window.removeEventListener) {
window.removeEventListener('resize', resizeCallback, false);
if (config.isCompactEWCRendered) {
window.removeEventListener('scroll', flyout.align, false);
}
}
};
var ewcDefaultPersistence = function() {
if (persistentCheck.result) {
flyout.persist();
if (window.ue && ue.tag) {
ue.tag('ewc:persist');
}
} else {
if (window.ue && ue.tag) {
ue.tag('ewc:unpersist');
if (persistentCheck.reason === 'noAui') {
ue.tag('ewc:unpersist:noAui');
}
if (persistentCheck.reason === 'viewport') {
ue.tag('ewc:unpersist:viewport');
}
if (persistentCheck.reason === 'emptycart') {
ue.tag('ewc:unpersist:emptycart');
}
if (persistentCheck.reason === 'iOS') {
ue.tag('ewc:unpersist:iOS');
}
}
}
};
ewcDefaultPersistence();
if (window.ue && ue.tag) {
if (flyout.hasQualifiedViewportForPersistent()) {
ue.tag('ewc:bview');
}
else {
ue.tag('ewc:sview');
}
}
flyout.bindEvents();
flyout.cache = function () {
const cache = window.sessionStorage;
const CACHE_KEY = "EWCBrowserCacheKey";
const CACHE_EXPIRY = "EWCBrowserCacheExpiry";
const CACHE_VALUE = "EWCBrowserCacheValue";
const isSessionStorageValid = function () {
return window && cache && cache instanceof Storage;
};
const isCachePresent = function (key) {
return cache.length > 0 && cache.getItem(key);
}
const isValidType = function (value) {
// Prevents accessing empty key-value and internal methods(prototypes) of storage
// TODO: Log metrics for invalid access;
return value && value.constructor == String;
}
return {
getCache: function (key) {
const value = isCachePresent(key);
return (isValidType(value)) ? value : null;
},
setCache: function (key, value) {
const oldValue = isCachePresent(key);
const cacheExpiryTime = isCachePresent(CACHE_EXPIRY);
// Set the expiry when there's no existing cache - to prevent resetting expiry on page navigation
if (!cacheExpiryTime) {
var currentTime = new Date();
cache.setItem(CACHE_EXPIRY, new Date(currentTime.getTime() + 5 * 60000))
}
// TODO: Log length of old and new cache values when logMetrics is true
cache.setItem(key, value);
},
updateCacheAndEwcContainer: function (cacheKey, newEwcContent) {
const $ = $Nav.getNow("$");
const $currentEwc = $("#ewc-content");
if (!$currentEwc.length) {
var $content = $('#nav-flyout-ewc .nav-ewc-content');
$content.html(newEwcContent);
this.setCache(CACHE_KEY, cacheKey);
if (window.ue && window.ue.count) {
var current = window.ue.count("ewc-init-cache") || 0;
window.ue.count("ewc-init-cache", current + 1);
}
} else {
var $newEwcContent = $('');
var EWC_CONTENT_BODY_SCROLL_SELECTOR = ".ewc-scroller--selected";
if (newEwcContent) { // 1. Updates EWC container with new HTML
const $newEwcHtml = $newEwcContent.html(newEwcContent).find("#ewc-content");
const offSet = $currentEwc.find(EWC_CONTENT_BODY_SCROLL_SELECTOR).position().top - $currentEwc.find(".ewc-active-cart--selected").position().top;
$currentEwc.html($newEwcHtml.html());
$currentEwc.find(EWC_CONTENT_BODY_SCROLL_SELECTOR).scrollTop(offSet);
if (typeof window.uex === 'function') {
window.uex('ld', 'ewc-reflect-new-state', {wb: 1});
}
} else {
// 2. Fetches cached response and updates it's html with new state on EWC Update
const cachedEwc = this.getCache(CACHE_VALUE);
$newEwcContent = $newEwcContent[0];
$(cachedEwc).map(function (elementIndex, element) {
$newEwcContent.appendChild((element.id === "ewc-content") ? $currentEwc.clone()[0] : element);
});
newEwcContent = $newEwcContent.innerHTML;
if (window.ue && window.ue.count) {
var current = window.ue.count("ewc-update-cache") || 0;
window.ue.count("ewc-update-cache", current + 1);
}
}
$newEwcContent.remove();
}
this.setCache(CACHE_VALUE, newEwcContent);
},
removeCache: function (key) {
return cache.removeItem(key);
}
}
}
;
return flyout;
}());
const CACHE_KEY = "EWCBrowserCacheKey";
const CACHE_VALUE = "EWCBrowserCacheValue";
const CACHE_EXPIRY = "EWCBrowserCacheExpiry";
var cache = config.flyout.cache();
const isCacheValid = function () {
// Check for page types and tenure of the cache
const clearCache = config.clearCache;
const cacheExpiryTime = cache.getCache(CACHE_EXPIRY);
const isCacheExpired = new Date() > new Date(cacheExpiryTime);
const cacheKey = config.EWCBrowserCacheKey;
const oldCacheKey = cache.getCache(CACHE_KEY);
const isCacheValid = !clearCache && !isCacheExpired && cacheKey == oldCacheKey;
if (!isCacheValid && window.ue && window.ue.count) {
var current = window.ue.count("ewc-cache-invalidated") || 0;
window.ue.count("ewc-cache-invalidated", current + 1);
}
return isCacheValid;
}
function loadFromCache() {
if (window.uet && typeof window.uet === 'function') {
window.uet('bb', 'ewc-loaded-from-cache', {wb: 1});
}
if (cache) {
if (isCacheValid()) {
var content = cache.getCache(CACHE_VALUE);
if (content) {
var $ewcContainer = document.getElementById("nav-flyout-ewc").getElementsByClassName("nav-ewc-content")[0];
var $ewcContent = document.getElementById("ewc-content");
if ($ewcContainer && !$ewcContent) {
$ewcContainer.innerHTML = content;
// Execute scripts from cache
const ewcJavascript = document.getElementById("ewc-content").parentNode.querySelectorAll(':scope > script');
ewcJavascript.forEach(function (script) {
var scriptTag = document.createElement("script");
scriptTag.innerHTML = script.innerHTML;
document.body.appendChild(scriptTag);
});
if (typeof window.uex === 'function') {
window.uex('ld', 'ewc-loaded-from-cache', {wb: 1});
}
} else if (window.ue && window.ue.count && typeof window.ue.count === 'function') {
var currentFailure = window.ue.count("ewc-slow-cache") || 0;
window.ue.count("ewc-slow-cache", currentFailure + 1);
}
}
} else {
cache.removeCache(CACHE_VALUE);
cache.removeCache(CACHE_KEY);
cache.removeCache(CACHE_EXPIRY);
}
}
}
function delayBy(delayTime) {
if (delayTime) {
window.setTimeout(function() {
loadFromCache();
}, delayTime)
} else {
loadFromCache();
}
}
if(config.delayRenderingTillATF) {
(window.AmazonUIPageJS ? AmazonUIPageJS : P).when('atf').execute("EverywhereCartLoadFromCacheOnAtf", function () {
delayBy(config.loadFromCacheWithDelay);
});
} else {
delayBy(config.loadFromCacheWithDelay);
}
return config;
}()));
if (typeof uet === 'function') {
uet('x2', 'ewc', {wb: 1});
}
if (window.ue && ue.tag) {
ue.tag('ewc');
ue.tag('ewc:unrec');
ue.tag('ewc:cartsize:0');
if ( window.P && window.P.AUI_BUILD_DATE ) {
ue.tag('ewc:aui');
} else {
ue.tag('ewc:noAui');
}
}
}());