"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
(function () {
'use strict';
function polyfill() {
var w = window;
var d = document;
if ('scrollBehavior' in d.documentElement.style &&
w.__forceSmoothScrollPolyfill__ !== true) {
return;
}
var Element = w.HTMLElement || w.Element;
var SCROLL_TIME = 468;
var original = {
scroll: w.scroll || w.scrollTo,
scrollBy: w.scrollBy,
elementScroll: Element.prototype.scroll || scrollElement,
scrollIntoView: Element.prototype.scrollIntoView
};
var now = w.performance && w.performance.now
? w.performance.now.bind(w.performance)
: Date.now;
function isMicrosoftBrowser(userAgent) {
var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
return new RegExp(userAgentPatterns.join('|')).test(userAgent);
}
var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
function scrollElement(x, y) {
this.scrollLeft = x;
this.scrollTop = y;
}
function ease(k) {
return 0.5 * (1 - Math.cos(Math.PI * k));
}
function shouldBailOut(firstArg) {
if (firstArg === null ||
typeof firstArg !== 'object' ||
firstArg.behavior === undefined ||
firstArg.behavior === 'auto' ||
firstArg.behavior === 'instant') {
return true;
}
if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
return false;
}
throw new TypeError('behavior member of ScrollOptions ' +
firstArg.behavior +
' is not a valid value for enumeration ScrollBehavior.');
}
function hasScrollableSpace(el, axis) {
if (axis === 'Y') {
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
}
if (axis === 'X') {
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
}
}
function canOverflow(el, axis) {
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
return overflowValue === 'auto' || overflowValue === 'scroll';
}
function isScrollable(el) {
var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
return isScrollableY || isScrollableX;
}
function findScrollableParent(el) {
while (el !== d.body && isScrollable(el) === false) {
el = el.parentNode || el.host;
}
return el;
}
function step(context) {
var time = now();
var value;
var currentX;
var currentY;
var elapsed = (time - context.startTime) / SCROLL_TIME;
elapsed = elapsed > 1 ? 1 : elapsed;
value = ease(elapsed);
currentX = context.startX + (context.x - context.startX) * value;
currentY = context.startY + (context.y - context.startY) * value;
context.method.call(context.scrollable, currentX, currentY);
if (currentX !== context.x || currentY !== context.y) {
w.requestAnimationFrame(step.bind(w, context));
}
}
function smoothScroll(el, x, y) {
var scrollable;
var startX;
var startY;
var method;
var startTime = now();
if (el === d.body) {
scrollable = w;
startX = w.scrollX || w.pageXOffset;
startY = w.scrollY || w.pageYOffset;
method = original.scroll;
}
else {
scrollable = el;
startX = el.scrollLeft;
startY = el.scrollTop;
method = scrollElement;
}
step({
scrollable: scrollable,
method: method,
startTime: startTime,
startX: startX,
startY: startY,
x: x,
y: y
});
}
w.scroll = w.scrollTo = function () {
if (arguments[0] === undefined) {
return;
}
if (shouldBailOut(arguments[0]) === true) {
original.scroll.call(w, arguments[0].left !== undefined
? arguments[0].left
: typeof arguments[0] !== 'object'
? arguments[0]
: w.scrollX || w.pageXOffset, arguments[0].top !== undefined
? arguments[0].top
: arguments[1] !== undefined
? arguments[1]
: w.scrollY || w.pageYOffset);
return;
}
smoothScroll.call(w, d.body, arguments[0].left !== undefined
? ~~arguments[0].left
: w.scrollX || w.pageXOffset, arguments[0].top !== undefined
? ~~arguments[0].top
: w.scrollY || w.pageYOffset);
};
w.scrollBy = function () {
if (arguments[0] === undefined) {
return;
}
if (shouldBailOut(arguments[0])) {
original.scrollBy.call(w, arguments[0].left !== undefined
? arguments[0].left
: typeof arguments[0] !== 'object' ? arguments[0] : 0, arguments[0].top !== undefined
? arguments[0].top
: arguments[1] !== undefined ? arguments[1] : 0);
return;
}
smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset));
};
Element.prototype.scroll = Element.prototype.scrollTo = function () {
if (arguments[0] === undefined) {
return;
}
if (shouldBailOut(arguments[0]) === true) {
if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
throw new SyntaxError('Value could not be converted');
}
original.elementScroll.call(this, arguments[0].left !== undefined
? ~~arguments[0].left
: typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft, arguments[0].top !== undefined
? ~~arguments[0].top
: arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop);
return;
}
var left = arguments[0].left;
var top = arguments[0].top;
smoothScroll.call(this, this, typeof left === 'undefined' ? this.scrollLeft : ~~left, typeof top === 'undefined' ? this.scrollTop : ~~top);
};
Element.prototype.scrollBy = function () {
if (arguments[0] === undefined) {
return;
}
if (shouldBailOut(arguments[0]) === true) {
original.elementScroll.call(this, arguments[0].left !== undefined
? ~~arguments[0].left + this.scrollLeft
: ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined
? ~~arguments[0].top + this.scrollTop
: ~~arguments[1] + this.scrollTop);
return;
}
this.scroll({
left: ~~arguments[0].left + this.scrollLeft,
top: ~~arguments[0].top + this.scrollTop,
behavior: arguments[0].behavior
});
};
Element.prototype.scrollIntoView = function () {
if (shouldBailOut(arguments[0]) === true) {
original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]);
return;
}
var scrollableParent = findScrollableParent(this);
var parentRects = scrollableParent.getBoundingClientRect();
var clientRects = this.getBoundingClientRect();
if (scrollableParent !== d.body) {
smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
w.scrollBy({
left: parentRects.left,
top: parentRects.top,
behavior: 'smooth'
});
}
}
else {
w.scrollBy({
left: clientRects.left,
top: clientRects.top,
behavior: 'smooth'
});
}
};
}
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = { polyfill: polyfill };
}
else {
polyfill();
}
}());
if (document.documentMode) {
!function () {
var prototype = CustomEvent.prototype;
function CustomEvent(type, option) {
var eve = document.createEvent("Event");
option = option || {};
eve.initEvent(type, !!option.bubbles, !!option.cancelable);
return eve;
}
CustomEvent.prototype = prototype;
window.CustomEvent = CustomEvent;
}();
}
var FF;
(function (FF) {
var FontLoader = (function () {
function FontLoader() {
}
FontLoader.init = function () {
if (!window.Ts) {
var through = function () {
};
window.Ts = {
onFontLoaded: through,
setQuerySelector: through,
loadFont: through,
};
}
Ts.onFontLoaded(function (e) {
if (FontLoader.list.length > 0) {
requestAnimationFrame(FontLoader.startWaitLoad);
}
else {
FontLoader.wait = false;
FF.Common.firestInit = true;
document.dispatchEvent(new Event(FF.Common.COMPONENT_INIT_COMPLETE));
}
});
};
FontLoader.allLoad = function () {
Ts.setQuerySelector("*");
Ts.loadFont();
FontLoader.clear();
};
FontLoader.partsLoad = function (fontLoad) {
FontLoader.list = FontLoader.list.concat(fontLoad);
if (!FontLoader.wait) {
FontLoader.startWaitLoad();
}
};
FontLoader.startWaitLoad = function () {
for (var _i = 0, _a = FontLoader.list; _i < _a.length; _i++) {
var element = _a[_i];
if ("h1,h2,h3,h4,h5,h6,p,span,a,button".indexOf(element.tagName.toLowerCase()) >= 0) {
element.classList.add("font-load-que");
}
else {
for (var _b = 0, _c = element.querySelectorAll("h1,h2,h3,h4,h5,h6,p,span,a,button"); _b < _c.length; _b++) {
var item = _c[_b];
item.classList.add("font-load-que");
}
}
}
var all = document.querySelectorAll(".font-load-que");
if (all.length == 0)
return;
Ts.setQuerySelector(".font-load-que");
Ts.loadFont();
FontLoader.clear();
};
FontLoader.clear = function () {
FontLoader.list = [];
var all = document.querySelectorAll(".font-load-que");
for (var _i = 0, _a = all; _i < _a.length; _i++) {
var element = _a[_i];
element.classList.remove("font-load-que");
}
};
FontLoader.list = [];
FontLoader.wait = true;
FontLoader.que = [];
return FontLoader;
}());
FF.FontLoader = FontLoader;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Common = (function () {
function Common() {
var _this = this;
this.environmentDependent();
FF.FontLoader.init();
this.medicalCheck(Common.parameter.site_code.toLowerCase(), function () {
FF.CookieController.init();
_this.viewedProducts();
FF.HashController.init();
});
this.userTypeSelector();
Common.DispatchComponentInitialize();
}
Common.prototype.environmentDependent = function () {
try {
if (!HTMLTemplateElement.prototype.hasOwnProperty("content"))
new Error();
}
catch (e) {
for (var _i = 0, _a = document.querySelectorAll("template"); _i < _a.length; _i++) {
var element = _a[_i];
}
}
};
Common.prototype.viewedProducts = function () {
var key = "viewed-products_" + Common.parameter.site_code + "-" + Common.parameter.lang_code + "-" + Common.parameter.product_type;
if (FF.CookieController.mode == "manager-ff" && !FF.CookieController.storageData.func) {
localStorage.removeItem(key);
return;
}
try {
var param = Common.parameter.history;
if (param.node_id) {
var template = document.querySelector("#invisible_elements");
var div = document.createElement("div");
div.innerHTML = template.innerHTML;
var img = div.querySelector("#page_thumbnail_image");
var dataEle = {
node_id: param.node_id,
img: img.getAttribute("src"),
url: param.url,
date: +new Date().getTime()
};
div.innerHTML = param.title;
dataEle.title = div.innerText;
div.innerHTML = param.description;
dataEle.description = div.innerText;
var data = void 0;
try {
data = JSON.parse(localStorage.getItem(key));
}
catch (e) {
}
if (!data)
data = {};
data[param.node_id] = dataEle;
localStorage.setItem(key, JSON.stringify(data));
}
}
catch (e) {
console.log(e);
}
};
Common.prototype.medicalCheck = function (site_code, complete) {
try {
if (document.head.querySelector("[name=\"x-page-medical-flag\"]").getAttribute("content").toLowerCase() != "true"
|| navigator.userAgent.indexOf("Syncbot-") >= 0
|| navigator.userAgent.indexOf("Googlebot") >= 0
|| (Common.parameter.site_type === "www"
&& (location.pathname.indexOf("jp/ja/healthcare/pharmacy-and-health-support") != -1
|| location.pathname.indexOf("jp/ja/healthcare/emr") != -1
|| location.pathname.indexOf("jp/ja/healthcare/regenerative") != -1
|| location.pathname.indexOf("jp/ja/healthcare/veterinary") != -1))) {
complete();
return;
}
var listStr_1 = "";
var cookieValue = (document.cookie + ';').match("healthcare_verified=([^¥S;]*)");
if (cookieValue) {
listStr_1 = cookieValue[1];
if (listStr_1.indexOf(site_code) >= 0) {
complete();
return;
}
}
var template = document.querySelector("[data-js-healthcare-confirm=\"template\"]");
var parentNode_1 = template.parentNode;
var div = document.createElement("div");
div.innerHTML = template.innerHTML;
var element_1 = div.firstElementChild;
parentNode_1.insertBefore(element_1, template);
parentNode_1.removeChild(template);
FF.ScrollController.lock("healthcare-confirm");
FF.FontLoader.partsLoad([element_1]);
element_1.querySelector("[data-js-healthcare-confirm=\"yes\"]").addEventListener("click", function () {
element_1.classList.add("m-healthcare-confirm--hide");
element_1.addEventListener("transitionend", function () {
parentNode_1.removeChild(element_1);
FF.ScrollController.unlock("healthcare-confirm");
});
var list = listStr_1.split(",");
list.push(site_code);
list = list.filter(function (v) { return v; });
document.cookie = "healthcare_verified=" + list.join(",") + ";"
+ " domain=.fujifilm.com;"
+ " secure=true;"
+ " path=/";
complete();
});
element_1.querySelector("[data-js-healthcare-confirm=\"no\"]").addEventListener("click", function () {
if (document.referrer.indexOf(location.host) >= 0) {
history.back();
}
else {
location.href = "/" + Common.parameter.site_code.toLowerCase() + "/" + Common.parameter.lang_code.toLowerCase() + "/";
}
});
}
catch (e) {
console.log(e);
complete();
return;
}
};
Common.prototype.userTypeSelector = function () {
var element = new AttrNode(document.body, "data-user-type-selector");
if (!element.$)
return;
document.addEventListener("click", function (e) {
var via = e.target;
while (via && via != element.$)
via = via.parentNode;
if (via && element.v != "checked") {
element.v = "checked";
}
else {
element.v = "";
}
}, true);
};
Common.DispatchComponentInitialize = function (opt) {
var evt = document.createEvent("Events");
evt.initEvent("load", true, true);
var inModal = document.querySelectorAll("[data-js-modal] [data-js-initialize]");
master: for (var _i = 0, _a = document.querySelectorAll("[data-js-initialize]"); _i < _a.length; _i++) {
var element = _a[_i];
for (var _b = 0, inModal_1 = inModal; _b < inModal_1.length; _b++) {
var via = inModal_1[_b];
if (element == via)
continue master;
}
element.removeAttribute("data-js-initialize");
element.dispatchEvent(evt);
element.onload = null;
}
FF.CheckDate.newIcon();
FF.HashController.refresh();
if (opt && opt.fontLoad)
FF.FontLoader.partsLoad(opt.fontLoad);
else
FF.FontLoader.allLoad();
};
Common.scrollLock = function (keyName) {
FF.ScrollController.lock(keyName);
};
;
Common.scrollUnlock = function (keyName) {
FF.ScrollController.unlock(keyName);
};
Common.COMPONENT_INIT_COMPLETE = "componentInitComplete";
Common.firestInit = false;
Common.parameter = function () {
try {
return JSON.parse(document.querySelector("[data-js-parameter]").innerHTML);
}
catch (e) {
return {};
}
}();
return Common;
}());
FF.Common = Common;
var Utils = (function () {
function Utils() {
}
Utils.remove = function (item) {
if (item && item.parentNode) {
item.parentNode.removeChild(item);
}
};
return Utils;
}());
FF.Utils = Utils;
var AttrNode = (function () {
function AttrNode(parent, label, isQuerySelect) {
if (isQuerySelect === void 0) { isQuerySelect = true; }
this.label = label;
if (isQuerySelect) {
this.$ = parent.querySelector("[" + this.label + "]");
}
else {
this.$ = parent;
}
}
Object.defineProperty(AttrNode.prototype, "v", {
get: function () {
return this.$.getAttribute(this.label);
},
set: function (value) {
if (value != this._v) {
this.$.setAttribute(this.label, this._v = value);
}
},
enumerable: false,
configurable: true
});
return AttrNode;
}());
FF.AttrNode = AttrNode;
var Animation = (function () {
function Animation(getter, setter) {
this.value = 0;
this.speed = 0;
this.accel = 0;
this.runing = false;
if (getter) {
this.getter = getter;
this.value = getter();
}
this.setter = setter;
}
Animation.prototype.chancel = function () {
this.runing = false;
};
Animation.prototype.update = function () {
if (this.runing)
return;
else
this.runing = true;
this.speed = 0;
this.accel = 0;
this.run();
};
Animation.prototype.run = function () {
var _this = this;
if (!this.runing || !this.getter || !this.setter)
return;
var current = this.getter();
this.accel += 0.25;
this.speed += this.accel;
var move = (this.value - current) / 8;
var leng = Math.abs(move);
if (leng < .5) {
this.setter(this.value);
this.runing = false;
return;
}
else if (leng > this.speed) {
this.setter(move > 0 ? current + this.speed : current - this.speed);
}
else {
this.setter(move > 0 ? Math.ceil(current + move) : Math.floor(current + move));
}
requestAnimationFrame(function () { return _this.run(); });
};
return Animation;
}());
FF.Animation = Animation;
})(FF || (FF = {}));
document.addEventListener("DOMContentLoaded", function () {
new FF.Common();
});
var FF;
(function (FF) {
var Accordion = (function () {
function Accordion(self) {
var _this = this;
this.opened = false;
this.self = new FF.AttrNode(self, "data-js-accordion", false);
this.next = new FF.AttrNode(self.nextElementSibling, "style", false);
if (!this.next.$)
return;
this.opened = this.self.v === "opened";
if (this.opened) {
}
else {
this.self.v = "";
this.next.v = "height:0";
}
this.self.$.addEventListener("click", function () {
_this.opened = _this.self.v !== "opened";
_this.update();
_this.self.$.blur();
});
this.self.$.addEventListener("change", function () {
_this.opened = _this.self.v == "opened";
_this.update();
});
this.next.$.addEventListener("transitionend", function () {
if (_this.opened) {
_this.next.v = "";
}
});
}
Accordion.prototype.update = function () {
var _this = this;
var currentH = this.next.$.clientHeight;
if (this.opened) {
this.next.v = "visibility: hidden;\n transition-duration:0s;\n transition-delay: 0s;";
this.next.v = "visibility: hidden;\n width:" + this.next.$.clientWidth + "px;\n position: absolute;\n transition-duration:0s;\n transition-delay: 0s;";
var targetH_1 = this.next.$.clientHeight;
this.next.v = "height:" + currentH + "px;\n transition-duration:0s;\n transition-delay: 0s;";
setTimeout(function () {
_this.next.v = "height:" + targetH_1 + "px";
_this.self.v = "opened";
}, 1000 / 60);
}
else {
this.next.v = "height:0px;\n transition-duration:0s;\n transition-delay: 0s;";
var targetH_2 = this.next.$.clientHeight;
this.next.v = "height:" + currentH + "px;\n transition-duration:0s;\n transition-delay: 0s;";
setTimeout(function () {
_this.next.v = "height:" + targetH_2 + "px";
_this.self.v = "";
}, 1000 / 60);
}
};
return Accordion;
}());
FF.Accordion = Accordion;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Carousel = (function () {
function Carousel(element) {
var _this = this;
this.items = [];
this.bulletList = [];
this.moving = false;
this.touching = false;
this.timerId = 0;
this.self = new FF.AttrNode(element, "data-js-carousel", false);
this.isAuto = element.getAttribute("data-js-carousel-auto") !== "false";
this.body = new FF.AttrNode(this.self.$, "data-js-carousel-body");
for (var i = 0; i < this.body.$.children.length; i++) {
this.items.push(new FF.AttrNode(this.body.$.children[i], "data-js-carousel-item", false));
}
this.total = this.items.length;
this.current = Number(this.self.v);
this.self.v = this.current;
var prev = new FF.AttrNode(this.self.$, "data-js-carousel-prev");
var next = new FF.AttrNode(this.self.$, "data-js-carousel-next");
this.bullets = new FF.AttrNode(this.self.$, "data-js-carousel-bullets");
if (this.total <= 1) {
if (prev.$)
FF.Utils.remove(prev.$);
if (next.$)
FF.Utils.remove(next.$);
if (this.bullets.$)
FF.Utils.remove(this.bullets);
return;
}
if (prev.$)
prev.$.addEventListener("click", function () {
_this.change(_this.current - 1, "prev");
}, { passive: true });
if (next.$)
next.$.addEventListener("click", function () {
_this.change(_this.current + 1, "next");
}, { passive: true });
if (this.bullets.$) {
var temp = this.bullets.$.querySelector("template");
var board = document.createElement("div");
var _loop_1 = function (i) {
board.innerHTML = temp.innerHTML;
var bullet = board.firstElementChild;
bullet = this_1.createBullet(i, bullet);
bullet.addEventListener("click", function () {
_this.change(i, _this.current < i ? "next" : "prev");
});
this_1.bullets.$.appendChild(bullet);
this_1.bulletList.push(new FF.AttrNode(bullet, "data-js-carousel-bullet", false));
};
var this_1 = this;
for (var i = 0; i < this.total; i++) {
_loop_1(i);
}
}
this.body.$.addEventListener("transitionend", function () { return _this.changed(); });
this.touch();
this.reset(this.current);
this.timerReset();
}
Carousel.prototype.timerReset = function () {
var _this = this;
if (!this.isAuto)
return;
clearInterval(this.timerId);
this.timerId = setTimeout(function () {
if (!_this.touching && !_this.moving) {
_this.change(_this.current + 1, "next");
}
else {
_this.timerReset();
}
}, Carousel.TIME);
};
Carousel.prototype.change = function (newIndex, nextPrev, option) {
if (option === void 0) { option = ""; }
if (newIndex == this.current || this.moving)
return;
newIndex = this.loop(newIndex);
this.moving = true;
var beforeNP = this.items[this.current + (nextPrev == "next" ? 1 : -1)];
if (beforeNP)
beforeNP.v = "hidden";
this.items[newIndex].v = nextPrev;
this.body.v = nextPrev + option;
if (this.bulletList.length) {
this.bulletList[this.current].v = "";
this.bulletList[newIndex].v = "current";
}
this.current = newIndex;
this.self.v = this.current;
};
Carousel.prototype.changed = function () {
this.body.v = "";
this.reset(this.current);
this.moving = false;
this.timerReset();
};
Carousel.prototype.reset = function (index) {
var nextI = this.loop(index + 1);
var prevI = this.loop(index - 1);
for (var i = 0; i < this.total; i++) {
if (i == index) {
this.items[i].v = "current";
if (this.bulletList.length)
this.bulletList[i].v = "current";
}
else {
if (this.bulletList.length)
this.bulletList[i].v = "";
switch (i) {
case prevI:
this.items[this.loop(index - 1)].v = "prev";
break;
case nextI:
this.items[this.loop(index + 1)].v = "next";
break;
default:
this.items[i].v = "hidden";
break;
}
}
}
};
Carousel.prototype.loop = function (val) {
if (val >= this.total) {
return 0;
}
else if (val < 0) {
return this.total - 1;
}
return val;
};
Carousel.prototype.touch = function () {
var _self = this;
this.body.$.addEventListener("touchstart", start);
this.body.$.addEventListener("touchmove", move);
window.addEventListener("touchend", end);
var beforeX = 0;
var afterX = 0;
var value = 0;
function start(e) {
_self.touching = true;
beforeX = afterX = e.touches[0].pageX;
}
function move(e) {
_self.touching = true;
if (_self.moving)
return;
afterX = e.touches[0].pageX;
value -= beforeX - afterX;
beforeX = afterX;
_self.body.$.setAttribute("style", "transform: translateX(" + value + "px);");
}
function end(e) {
if (!_self.touching)
return;
if (!_self.moving) {
if (value < window.outerWidth / -3) {
_self.change(_self.current + 1, "next", "-quick");
}
else if (value > window.outerWidth / 3) {
_self.change(_self.current - 1, "prev", "-quick");
}
}
_self.body.$.setAttribute("style", "");
value = 0;
_self.touching = false;
}
};
Carousel.prototype.createBullet = function (i, bullet) {
return bullet;
};
Carousel.TIME = 1000 * 10;
return Carousel;
}());
FF.Carousel = Carousel;
})(FF || (FF = {}));
var FF;
(function (FF) {
var CheckDate = (function () {
function CheckDate() {
}
CheckDate.newIcon = function () {
var now = new Date().getTime() / 1000;
a: for (var _i = 0, _a = document.querySelectorAll("[data-js-check-date]"); _i < _a.length; _i++) {
var element = _a[_i];
try {
var n = element.parentNode;
while (n && n.tagName) {
if (n.tagName.toLowerCase() == "template") {
continue a;
}
n = n.parentNode;
}
var p = parseInt(element.getAttribute("data-js-check-date"));
var isAfter = element.getAttribute("data-js-check-date-show") == "after";
if ((now <= p) != isAfter) {
element.removeAttribute("data-js-check-date");
}
else {
FF.Utils.remove(element);
}
}
catch (e) {
FF.Utils.remove(element);
}
}
};
return CheckDate;
}());
FF.CheckDate = CheckDate;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Folding = (function () {
function Folding(element) {
this.self = element;
this.$body = this.self.querySelector('[data-js="body"]');
if (!this.$body)
return;
var via = this.self;
var arr = [];
while (true) {
via = via.nextElementSibling;
if (!via) {
break;
}
else if (via.hasAttribute("data-js-folding")) {
if (via.className.indexOf("c-end") >= 0)
FF.Utils.remove(via);
break;
}
else {
arr.push(via);
}
}
for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
var element_2 = arr_1[_i];
this.$body.appendChild(element_2);
}
new FF.Accordion(this.self.querySelector("[data-js-accordion]"));
}
return Folding;
}());
FF.Folding = Folding;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Follow = (function () {
function Follow(self) {
var _this = this;
this._height = 0;
this.self = new FF.AttrNode(self, "data-js-follow", false);
this.body = new FF.AttrNode(self, "data-js-follow-body", true);
window.addEventListener("scroll", function () { return _this.onScroll(); }, !document.documentMode ? { passive: true } : false);
this.onScroll();
}
Follow.prototype.onScroll = function () {
var v = document.documentElement.scrollTop || document.body.scrollTop;
if (v > this.self.$.offsetTop) {
this._height = this.self.$.clientHeight;
this.self.$.setAttribute("style", "height:" + this._height + "px");
this.self.v = "follow";
}
else {
this.self.$.removeAttribute("style");
this.self.v = "";
}
};
return Follow;
}());
FF.Follow = Follow;
})(FF || (FF = {}));
var FF;
(function (FF) {
var MediaFile = (function () {
function MediaFile(self) {
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
var dom = document.createElement("div");
dom.innerHTML = req.responseText;
var str = self.innerHTML;
try {
str = str.replace(/{{ href }}/g, dom.querySelector("[data-component-href]").getAttribute("href"));
}
catch (e) {
}
try {
str = str.replace(/{{ meta }}/g, dom.querySelector("[data-component-meta]").innerHTML);
}
catch (e) {
}
try {
str = str.replace(/{{ filename }}/g, dom.querySelector("[data-component-filename]").innerHTML);
}
catch (e) {
}
try {
str = str.replace(/{{ ver }}/g, dom.querySelector("[data-component-ver]").innerHTML);
}
catch (e) {
}
try {
str = str.replace(/{{ extension }}/g, dom.querySelector("[data-component-extension]").innerHTML);
}
catch (e) {
}
self.innerHTML = str;
FF.FontLoader.partsLoad([self]);
}
};
req.open("GET", self.getAttribute("data-js-url"), true);
req.send(null);
self.removeAttribute("data-js-url");
}
return MediaFile;
}());
FF.MediaFile = MediaFile;
})(FF || (FF = {}));
var FF;
(function (FF) {
var MediaImg = (function () {
function MediaImg(self) {
var url = self.getAttribute("data-js-url");
self.removeAttribute("data-js-url");
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
var dom = document.createElement("div");
dom.innerHTML = req.responseText;
var $img = dom.querySelector("[data-component-img]");
self.setAttribute("src", $img.getAttribute("src"));
self.setAttribute("alt", $img.getAttribute("alt"));
}
};
req.open("GET", url, true);
req.send(null);
}
return MediaImg;
}());
FF.MediaImg = MediaImg;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Modal = (function () {
function Modal(target, closedCallBack, newHash) {
var _this = this;
if (newHash === void 0) { newHash = ""; }
if (Modal.current)
Modal.current.close();
Modal.current = this;
this.target = target;
this.closedCallBack = closedCallBack;
Modal.board.innerHTML = Modal.TEMPLATE;
this.modal = Modal.board.firstElementChild;
var size = this.target.getAttribute("data-js-modal--size");
if (size)
this.modal.setAttribute("data-js-modal--size", size);
this.modal.setAttribute("data-js-modal-hash", newHash);
this.modal.querySelector(".m-modal__body").appendChild(this.target.cloneNode(true));
document.body.appendChild(this.modal);
for (var _i = 0, _a = this.modal.querySelectorAll("[data-js-modal-close]"); _i < _a.length; _i++) {
var element = _a[_i];
element.addEventListener("click", function () { return _this.close(); });
}
FF.ShareModule.hidden();
FF.ScrollController.lock("modal");
this.target.dispatchEvent(new CustomEvent(Modal.OPEN));
setTimeout(function () {
_this.modal.className = _this.modal.className.replace("m-modal--hide", "");
}, 1000 / 60);
var transitionend = function () {
_this.modal.removeEventListener("transitionend", transitionend);
FF.Common.DispatchComponentInitialize({ fontLoad: [_this.modal] });
};
this.modal.addEventListener("transitionend", transitionend);
}
Modal.prototype.close = function () {
var _this = this;
Modal.current = null;
for (var _i = 0, _a = this.modal.querySelectorAll("[data-js-modal-close]"); _i < _a.length; _i++) {
var element = _a[_i];
element.removeEventListener("click", this.close);
}
this.modal.addEventListener("transitionend", function (e) { return _this.transitionend(e); });
this.modal.className += " m-modal--hide";
if (this.closedCallBack)
this.closedCallBack();
this.target.dispatchEvent(new CustomEvent(Modal.CLOSE));
};
Modal.prototype.transitionend = function (e) {
FF.ShareModule.usable();
FF.ScrollController.unlock("modal");
if (e.currentTarget) {
e.currentTarget.removeEventListener("transitionend", this.transitionend);
FF.Utils.remove(e.currentTarget);
delete this.modal;
}
delete this.closedCallBack;
};
Modal.open = function (btn, selecter) {
try {
var str = btn.tagName;
if (btn.className)
str += "." + btn.className.split(" ").join(".");
str += " " + selecter;
var target = btn.parentElement.querySelector(str);
new Modal(target);
}
catch (e) {
console.log(e);
}
};
Modal.close = function () {
if (Modal.current)
Modal.current.close();
};
Modal.OPEN = "open";
Modal.CLOSE = "close";
Modal.board = document.createElement("div");
Modal.TEMPLATE = "\n
\n ";
return Modal;
}());
FF.Modal = Modal;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Slider = (function () {
function Slider(element, columnNum) {
var _this = this;
if (columnNum === void 0) { columnNum = 3; }
this.items = [];
this.bullets = [];
this.current = 0;
this.moving = false;
this.columnNum = columnNum;
this.self = new FF.AttrNode(element, "data-js-slider", false);
this.body = new FF.AttrNode(this.self.$, "data-js-slider-body");
for (var i = 0; i < this.body.$.children.length; i++) {
this.items.push(new FF.AttrNode(this.body.$.children[i], "data-js-slider-item", false));
}
this.total = this.items.length;
this.totalSet = Math.ceil(this.total / this.columnNum);
this.prev = new FF.AttrNode(this.self.$, "data-js-slider-prev");
this.next = new FF.AttrNode(this.self.$, "data-js-slider-next");
var bullets = new FF.AttrNode(this.self.$, "data-js-slider-bullets");
if (this.total <= columnNum) {
if (this.prev.$)
FF.Utils.remove(this.prev.$);
if (this.next.$)
FF.Utils.remove(this.next.$);
if (bullets.$)
FF.Utils.remove(bullets.$);
return;
}
if (this.prev.$)
this.prev.$.addEventListener("click", function () {
_this.change(_this.current - 1, "prev");
}, { passive: true });
if (this.next.$)
this.next.$.addEventListener("click", function () {
_this.change(_this.current + 1, "next");
}, { passive: true });
this.current = this.loop(Number(this.self.v) || 0);
if (bullets.$) {
var temp = bullets.$.querySelector("template");
var board = document.createElement("div");
var _loop_2 = function (i) {
board.innerHTML = temp.innerHTML;
var bullet = board.firstElementChild;
bullets.$.appendChild(bullet);
bullet.addEventListener("click", function () {
_this.change(i, _this.current < i ? "next" : "prev");
});
this_2.bullets.push(new FF.AttrNode(bullet, "data-js-slider-bullet", false));
};
var this_2 = this;
for (var i = 0; i < this.totalSet; i++) {
_loop_2(i);
}
this.bullets[this.current].v = "current";
}
this.body.$.addEventListener("transitionend", function () { return _this.changed(); });
}
Slider.prototype.change = function (newIndex, nextPrev, option) {
if (option === void 0) { option = ""; }
if (newIndex == this.current || this.moving)
return;
newIndex = this.loop(newIndex);
this.moving = true;
this.body.$.setAttribute("style", "transform:translateX(-" + newIndex * 100 + "%);");
if (this.bullets.length) {
this.bullets[this.current].v = "";
this.bullets[newIndex].v = "current";
}
this.current = newIndex;
this.self.v = this.current;
};
Slider.prototype.changed = function () {
this.body.v = "";
this.moving = false;
};
Slider.prototype.loop = function (val) {
if (this.prev.$)
this.prev.v = "";
if (this.next.$)
this.next.v = "";
if (val >= this.totalSet - 1) {
if (this.next.$)
this.next.v = "hidden";
return this.totalSet - 1;
}
else if (val <= 0) {
if (this.prev.$)
this.prev.v = "hidden";
return 0;
}
return val;
};
return Slider;
}());
FF.Slider = Slider;
})(FF || (FF = {}));
var FF;
(function (FF) {
var Toggle = (function () {
function Toggle(self) {
var _this = this;
this.self = new FF.AttrNode(self, "data-js-toggle", false);
this.self.$.addEventListener("click", function () {
_this.self.v = _this.self.v === "checked" ? "" : "checked";
});
}
return Toggle;
}());
FF.Toggle = Toggle;
})(FF || (FF = {}));
var FF;
(function (FF) {
var CommonContentComponent = (function () {
function CommonContentComponent(self) {
var url = self.getAttribute("data-js-url");
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
var fragment = document.createDocumentFragment();
var div = document.createElement("div");
div.innerHTML = req.responseText;
var fontLoad = [];
while (div.children.length) {
var element = div.children[0];
fragment.appendChild(element);
fontLoad.push(element);
}
self.parentNode.insertBefore(fragment, self);
FF.Utils.remove(self);
req.abort();
FF.Common.DispatchComponentInitialize({ fontLoad: fontLoad });
}
};
req.open("GET", url, true);
req.send(null);
}
return CommonContentComponent;
}());
FF.CommonContentComponent = CommonContentComponent;
})(FF || (FF = {}));
var FF;
(function (FF) {
var GalleryComponent = (function (_super) {
__extends(GalleryComponent, _super);
function GalleryComponent(element) {
var _this = _super.call(this, element) || this;
_this.animation = new FF.Animation(function () {
return _this.bullets.$.scrollLeft;
}, function (v) {
_this.bullets.$.scrollLeft = v;
});
_this.bullets.$.addEventListener("mousedown", function () { return _this.animation.chancel(); });
_this.bullets.$.addEventListener("touchstart", function () { return _this.animation.chancel(); });
return _this;
}
GalleryComponent.prototype.createBullet = function (i, bullet) {
var $img = this.items[i].$.querySelector("[data-src-thumb]");
var v = $img.getAttribute("data-src-thumb");
bullet.querySelector("img")
.setAttribute("src", v);
$img.setAttribute("src", v);
$img.removeAttribute("data-src-thumb");
return _super.prototype.createBullet.call(this, i, bullet);
};
GalleryComponent.prototype.change = function (newIndex, nextPrev, option) {
if (option === void 0) { option = ""; }
_super.prototype.change.call(this, newIndex, nextPrev, option);
this.moveThumbCurrent();
};
GalleryComponent.prototype.reset = function (index) {
var _this = this;
_super.prototype.reset.call(this, index);
_run(this.items[index], function () {
_run(_this.items[index + 1]);
_run(_this.items[index - 1]);
});
function _run(attrNode, callback) {
if (callback === void 0) { callback = null; }
if (!attrNode)
return;
var $img = attrNode.$.querySelector("[data-src]");
if (!$img)
return callback && callback();
$img.addEventListener("load", function (e) {
e.currentTarget.setAttribute("data-js", "img-loaded");
if (callback) {
callback();
}
});
$img.setAttribute("src", $img.getAttribute("data-src") || "");
$img.removeAttribute("data-src");
}
};
GalleryComponent.prototype.moveThumbCurrent = function () {
if (!this.animation)
return;
var $current = this.bulletList[this.current].$;
var scrollLeft = this.bullets.$.scrollLeft;
var parentW = this.bullets.$.clientWidth;
var currentX = $current.offsetLeft;
var currentW = $current.clientWidth;
var v;
if (scrollLeft + parentW < currentX + currentW + currentW) {
v = currentX - parentW + currentW;
}
else if (scrollLeft > currentX - currentW) {
v = currentX - currentW * 2;
}
else {
return;
}
this.animation.setter(v);
this.animation.value = this.animation.getter();
this.animation.setter(scrollLeft);
this.animation.update();
};
return GalleryComponent;
}(FF.Carousel));
FF.GalleryComponent = GalleryComponent;
})(FF || (FF = {}));
var FF;
(function (FF) {
var MapComponent = (function () {
function MapComponent(self) {
var _this = this;
this.self = self;
this.center = {
lat: Number.parseFloat(self.getAttribute("data-js-lat")),
lng: Number.parseFloat(self.getAttribute("data-js-lng"))
};
this.labelText = self.getAttribute("data-js-text") || "";
this.labelTitle = self.getAttribute("data-js-title") || "";
this.labelSupply = self.getAttribute("data-js-supply") || "";
this.radius = Number.parseFloat(self.getAttribute("data-js-radius")) || 1;
MapComponent.createMap(this.self, this.self.getAttribute("data-js-key"), {
center: this.center,
}, function (map) {
_this.init(map);
});
}
MapComponent.prototype.init = function (map) {
map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(this.center.lat + (0.0090133729745762 * this.radius), this.center.lng), new google.maps.LatLng(this.center.lat - (0.0090133729745762 * this.radius), this.center.lng)), 0);
var marker = new google.maps.Marker({
position: this.center,
map: map
});
var label = "";
if (this.labelTitle)
label += "" + this.labelTitle + "
";
if (this.labelText)
label += "" + this.labelText + "
";
if (this.labelSupply)
label += "" + this.labelSupply + "
";
if (label) {
var infoWindow = new google.maps.InfoWindow({
content: "" + label + "
"
});
infoWindow.open(map, marker);
}
};
MapComponent.prototype.onPlayerReady = function (e) {
};
MapComponent.createMap = function (el, key, opt, callBack) {
opt.styles = [
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#454545"
}
]
},
{
"featureType": "poi",
"elementType": "labels.icon",
"stylers": [
{
"color": "#999999"
}
]
}
];
var onGooglemapAPIReady = function () {
window.removeEventListener("googlemapAPIReady", onGooglemapAPIReady);
var map = new google.maps.Map(el, opt);
callBack(map);
};
switch (MapComponent.pluginStatus) {
case "none":
MapComponent.pluginStatus = "loading";
var tag = document.createElement('script');
var str = "https://maps.googleapis.com/maps/api/js?key=" + key;
if (FF.Common.parameter.country_code == "JP")
str += "®ion=JP";
str += "&callback=initMap";
tag.src = str;
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
window.initMap = function () {
MapComponent.pluginStatus = "complete";
onGooglemapAPIReady();
window.dispatchEvent(new Event("googlemapAPIReady"));
delete window.initMap;
};
break;
case "loading":
window.addEventListener("googlemapAPIReady", onGooglemapAPIReady);
break;
case "complete":
onGooglemapAPIReady();
break;
}
};
MapComponent.pluginStatus = "none";
return MapComponent;
}());
FF.MapComponent = MapComponent;
})(FF || (FF = {}));
var FF;
(function (FF) {
var YoutubeComponent = (function () {
function YoutubeComponent(self) {
var _this = this;
this.self = self;
this.videoId = self.getAttribute("data-js");
this.uid = this.videoId + new Date().getTime();
if (YoutubeComponent.pluginStatus === "none") {
YoutubeComponent.pluginStatus = "loading";
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
window.onYouTubeIframeAPIReady = function () {
YoutubeComponent.pluginStatus = "complete";
window.dispatchEvent(new CustomEvent("youTubeIframeAPIReady"));
};
}
if (YoutubeComponent.pluginStatus != "complete") {
window.addEventListener("youTubeIframeAPIReady", function () { return _this.init(); });
}
else {
this.init();
}
}
YoutubeComponent.prototype.init = function () {
window.removeEventListener("youTubeIframeAPIReady", this.init);
this.self.id = this.uid;
this.player = new YT.Player(this.uid, {
videoId: this.videoId,
events: {},
playerVars: {
rel: 0,
enablejsapi: 1,
playlist: this.videoId,
loop: 1
}
});
};
YoutubeComponent.prototype.onPlayerReady = function (e) {
};
YoutubeComponent.pluginStatus = "none";
return YoutubeComponent;
}());
FF.YoutubeComponent = YoutubeComponent;
})(FF || (FF = {}));
var FF;
(function (FF) {
var CookieController = (function () {
function CookieController() {
}
CookieController.init = function () {
if (navigator.userAgent.indexOf("Syncbot-") >= 0
|| navigator.userAgent.indexOf("Googlebot") >= 0)
return;
this.mode = document.head.querySelector("[name=\"x-page-cookie-notice-type\"]")
.getAttribute("content").toLowerCase();
this.key = "cookie-controller-" + FF.Common.parameter.site_code;
try {
this.storageData = JSON.parse(localStorage.getItem(this.key));
var before = new Date(this.storageData.ts);
var now = new Date();
if (now.getTime() - before.getTime() >= 1000 * 60 * 60 * 24 * 30 * 6) {
(function () {
throw new Error("Expired");
})();
}
}
catch (e) {
localStorage.removeItem(this.key);
this.storageData = {
perf: false,
func: false,
target: false,
ts: ""
};
this.notice();
}
this.manager();
FF.ShareModule.checkAuth();
};
CookieController.notice = function () {
var _this = this;
switch (CookieController.mode) {
case "notice":
case "manager-ff":
break;
case "manager-ot":
default:
return;
}
var template = document.querySelector("[data-js-cookie-confirm=\"template\"]");
var div = document.createElement("div");
div.innerHTML = template.innerHTML;
var confirm = div.firstElementChild;
template.parentNode.insertBefore(confirm, template);
template.parentNode.removeChild(template);
confirm.setAttribute("data-js-mode", CookieController.mode);
confirm.addEventListener("closing", close);
confirm.querySelector("[data-js-cookie-confirm=\"close\"]").addEventListener("click", function () {
close();
_this.save();
});
var acceptAll = confirm.querySelector("[data-js-cookie-confirm=\"acceptAll\"]");
if (acceptAll) {
acceptAll.addEventListener("click", function (e) {
e.preventDefault();
close();
CookieController.acceptAll();
});
}
FF.FontLoader.partsLoad([confirm]);
function close() {
confirm.classList.add("m-cookie-confirm--hide");
confirm.addEventListener("transitionend", function () {
document.body.removeChild(confirm);
});
}
};
CookieController.manager = function () {
var _this = this;
var modalBody = document.querySelector("#cookie-manager .c-modal__body");
if (!modalBody)
return;
modalBody.addEventListener(FF.Modal.OPEN, function (e) {
var modal = FF.Modal.current;
var form = modal.modal.querySelector("[data-js-cookie-confirm=\"options\"]");
var cookieSN = form.querySelector("[name=\"cookieSN\"]");
var acceptAll = modal.modal.querySelector("[data-js-cookie-confirm=\"acceptAll\"]");
cookieSN.checked = true;
cookieSN.setAttribute("disabled", "disabled");
form.cookiePerf.checked = !!_this.storageData.perf;
form.cookieFunc.checked = !!_this.storageData.func;
form.cookieTarget.checked = !!_this.storageData.target;
form.addEventListener("change", function () { return check(); });
check();
function check() {
if (form.cookiePerf.checked && form.cookieFunc.checked && form.cookieTarget.checked) {
acceptAll.setAttribute("disabled", "disabled");
}
else {
acceptAll.removeAttribute("disabled");
}
}
modal.modal.querySelector("[data-js-cookie-confirm=\"save\"]").addEventListener("click", function (e) {
e.preventDefault();
_this.storageData.perf = form.cookiePerf.checked;
_this.storageData.func = form.cookieFunc.checked;
_this.storageData.target = form.cookieTarget.checked;
_this.save();
close();
});
acceptAll.addEventListener("click", function (e) {
e.preventDefault();
form.cookiePerf.checked = true;
form.cookieFunc.checked = true;
form.cookieTarget.checked = true;
CookieController.acceptAll();
close();
});
function close() {
var confirm = document.querySelector(".m-cookie-confirm");
if (confirm)
confirm.dispatchEvent(new CustomEvent("closing"));
modal.close();
}
});
};
CookieController.acceptAll = function () {
this.storageData.perf = true;
this.storageData.func = true;
this.storageData.target = true;
this.save();
};
CookieController.save = function () {
switch (CookieController.mode) {
case "manager-ff":
if (!this.storageData.perf) {
}
var url = "/utility/api/cookie-manager/v1" +
FF.Common.parameter.site_home_path.toLowerCase() +
"/targeting-cookie/" +
(this.storageData.target ? "on" : "off");
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
};
req.open("GET", url, false);
req.send(null);
break;
case "notice":
break;
case "manager-ot":
default:
break;
}
this.storageData.ts = new Date().toUTCString();
localStorage.setItem(this.key, JSON.stringify(this.storageData));
};
CookieController.key = "";
return CookieController;
}());
FF.CookieController = CookieController;
})(FF || (FF = {}));
var FF;
(function (FF) {
var HashController = (function () {
function HashController() {
}
HashController.init = function () {
if (FF.Common.firestInit) {
_weit();
}
else {
document.addEventListener(FF.Common.COMPONENT_INIT_COMPLETE, _weit);
}
function _weit() {
document.removeEventListener(FF.Common.COMPONENT_INIT_COMPLETE, _weit);
HashController.hashActions();
}
};
HashController.refresh = function () {
for (var _i = 0, _a = document.querySelectorAll("[href^=\"#\"]"); _i < _a.length; _i++) {
var element = _a[_i];
element.removeEventListener("click", HashController.hashActions);
element.addEventListener("click", HashController.hashActions);
}
};
HashController.hashActions = function (e) {
if (e)
e.preventDefault();
FF.Modal.close();
var newHash = location.hash;
try {
var element = e.currentTarget;
newHash = element.getAttribute("href") || "";
}
catch (e) {
}
var target;
try {
target = document.querySelector(newHash);
}
catch (e) {
}
if (newHash == "#") {
scrollTo({ top: 0, behavior: "smooth" });
}
else if (!target) {
location.hash = newHash;
}
else if (target.hasAttribute("data-js-modal")) {
new FF.Modal(target.querySelector(".c-modal__body"), function () { return history.pushState("", "", window.location.pathname + window.location.search); }, newHash);
if (newHash)
history.pushState(null, null, newHash);
}
else {
if (target.hasAttribute("data-js-folding")) {
var accordion = target.querySelector("[data-js-accordion]");
accordion.setAttribute("data-js-accordion", "opened");
accordion.dispatchEvent(new Event("change"));
}
else {
}
var v = document.documentElement.scrollTop || document.body.scrollTop;
var via = target.getBoundingClientRect().top + pageYOffset - 30;
if (v > via) {
via -= 64;
}
if (location.hash != newHash) {
history.replaceState('', '', "" + newHash);
}
scrollTo({ top: via, behavior: "smooth" });
}
};
return HashController;
}());
FF.HashController = HashController;
})(FF || (FF = {}));
var FF;
(function (FF) {
var ScrollController = (function () {
function ScrollController() {
}
ScrollController.lock = function (keyName) {
ScrollController.isLock = true;
if (Object.keys(ScrollController.lockList).length == 0) {
ScrollController.lockTop = document.documentElement.scrollTop || document.body.scrollTop;
document.documentElement.style.position = "fixed";
document.documentElement.style.overflow = "hidden";
document.documentElement.style.width = "100vw";
document.documentElement.style.height = "100vh";
document.documentElement.style.top = "-" + ScrollController.lockTop + "px";
document.body.style.overflow = "scroll";
}
ScrollController.lockList[keyName] = true;
};
ScrollController.unlock = function (keyName) {
delete ScrollController.lockList[keyName];
if (Object.keys(ScrollController.lockList).length)
return;
ScrollController.isLock = false;
document.documentElement.style.position = "";
document.documentElement.style.overflow = "";
document.documentElement.style.width = "";
document.documentElement.style.height = "";
document.documentElement.style.top = "";
document.body.style.overflow = "";
scrollTo({ top: ScrollController.lockTop, behavior: "instant" });
};
ScrollController.lockList = {};
ScrollController.lockTop = 0;
ScrollController.isLock = false;
return ScrollController;
}());
FF.ScrollController = ScrollController;
})(FF || (FF = {}));
var FF;
(function (FF) {
var ContentHeader = (function () {
function ContentHeader() {
var _this = this;
this._top = 0;
this._height = 0;
this.value = 0;
this.before = 0;
this.isFiexd = "";
this.isOpen = "";
this.isMenu = "";
this.$self = document.querySelector("[data-js-content-header]");
if (!this.$self)
return;
window.addEventListener("scroll", function () { return _this.onScroll(); }, !document.documentMode ? { passive: true } : false);
window.addEventListener("resize", function () { return _this.onResize(); });
var v = this.$self.querySelector("[data-js-content-header__toggle]");
if (v) {
v.addEventListener("click", function () {
var str = _this.$self.getAttribute("data-js-content-header") || "";
_this.isMenu = /--menu-open/.test(str) ? "" : "--menu-open";
_this.$self.setAttribute("data-js-content-header", _this.isFiexd + _this.isOpen + _this.isMenu);
});
}
this.onResize();
this.onScroll();
if (this.isFiexd == "fiexd") {
this.value = -210;
this.isOpen = "--open";
this.isMenu = "--menu-open";
this.$self.setAttribute("data-js-content-header", this.isFiexd + this.isOpen + this.isMenu);
}
}
ContentHeader.prototype.onResize = function () {
this._top = this.$self.offsetTop;
this._height = this.$self.clientHeight;
this.value = 0;
};
ContentHeader.prototype.onScroll = function () {
if (FF.ScrollController.isLock)
return;
var after = document.documentElement.scrollTop || document.body.scrollTop;
var diff = after - this.before;
this.before = after;
if (diff > 0) {
this.value = 0;
}
else {
this.value += diff;
}
if (after > this._top + this._height) {
this.isFiexd = "fiexd";
if (this.value < -200) {
this.isOpen = "--open";
}
else {
this.isOpen = this.isMenu = "";
}
this.$self.setAttribute("style", "min-height:" + this._height + "px");
}
else {
this.isFiexd = this.isOpen = this.isMenu = "";
this.$self.removeAttribute("style");
}
this.$self.setAttribute("data-js-content-header", this.isFiexd + this.isOpen + this.isMenu);
};
return ContentHeader;
}());
FF.ContentHeader = ContentHeader;
})(FF || (FF = {}));
new FF.ContentHeader();
var FF;
(function (FF) {
var ContentMenu = (function () {
function ContentMenu() {
for (var _i = 0, _a = document.querySelectorAll(".m-content-menu"); _i < _a.length; _i++) {
var element = _a[_i];
var current = element.querySelector("[class*=\"--current\"]");
if (current) {
var center = current.offsetLeft + current.clientWidth / 2;
element.scrollLeft = center - window.innerWidth / 2;
}
}
}
return ContentMenu;
}());
FF.ContentMenu = ContentMenu;
})(FF || (FF = {}));
new FF.ContentMenu();
var ssConfig, SyncSearchLoader, ssLoader;
var FF;
(function (FF) {
var GlobalHeader = (function () {
function GlobalHeader() {
this.globalMenu = new FF.AttrNode(document.body, "data-js-global-menu", true);
this.menuToggle();
var $languageSelecter = document.querySelector('[name="language-selecter"]');
if ($languageSelecter) {
$languageSelecter.addEventListener("change", function (e) {
var target = e.target;
location.href = target.options[target.selectedIndex].value;
});
}
this.$self = document.querySelector(".m-global-header");
if (!this.$self)
return;
if (this.globalMenu.$) {
this.initGlobalMenu();
}
if (FF.Common.parameter.site_search_config.syncsearch) {
this.setSSSuggest();
}
else {
this.$self.setAttribute("data-js-search", "none");
}
}
GlobalHeader.prototype.menuToggle = function () {
var _this = this;
var btnElement = new FF.AttrNode(document.body, "data-global-header", true);
if (!btnElement.$)
return;
var search = document.querySelector(".m-global-header__search");
var uts = document.querySelector(".m-user-type-selector");
btnElement.$.addEventListener("touchend", function () {
var isOpen = btnElement.$.getAttribute("data-global-header") == "open";
if (!isOpen) {
FF.ScrollController.lock("global-header");
if (_this.globalMenu.$) {
var v = 0;
if (search)
v += search.clientHeight + 1;
if (uts) {
uts.style.top = v + "px";
v += uts.clientHeight;
}
_this.globalMenu.$.setAttribute("style", "padding-top:" + v + "px");
}
btnElement.v = "open";
}
else {
FF.ScrollController.unlock("global-header");
btnElement.v = "close";
}
});
};
GlobalHeader.prototype.initGlobalMenu = function () {
var _this = this;
var _wrap = this.globalMenu.$.querySelector(".m-global-menu__wrap");
var _loop_3 = function (element) {
var subMenu = element.querySelector(".m-global-menu__sub-menu");
if (!subMenu)
return "continue";
for (var _i = 0, _a = subMenu.querySelectorAll(".c-category-menu__item"); _i < _a.length; _i++) {
var _element = _a[_i];
var v = (_element.offsetTop - 32);
v /= 300;
v *= .3;
v = Math.floor(v * 100) / 100;
_element.setAttribute("style", "transition-delay: " + v + "s;");
}
element.addEventListener("mouseover", function () {
_wrap.setAttribute("style", "");
_wrap.setAttribute("style", "height:" + (subMenu.clientHeight + 40) + "px");
_this.globalMenu.v = "hover";
});
element.addEventListener("mouseout", function () {
_wrap.setAttribute("style", "");
_this.globalMenu.v = "";
});
};
for (var _i = 0, _a = this.globalMenu.$.querySelectorAll(".m-global-menu__item"); _i < _a.length; _i++) {
var element = _a[_i];
_loop_3(element);
}
var $foot = this.globalMenu.$.querySelector(".m-global-menu__sub-menu__foot");
if ($foot) {
var v = $foot.offsetTop - 32;
v /= 300;
v *= .3;
v = Math.floor(v * 100) / 100;
$foot.setAttribute("style", "transition-delay: " + v + "s;");
}
};
GlobalHeader.prototype.setSSSuggest = function () {
this.$form = this.$self.querySelector("#ss-form1");
if (!this.$form)
return;
var $input = this.$form.querySelector("#ss-query1");
function onFocus() {
$input.removeEventListener("focus", onFocus);
$input.removeEventListener("mouseover", onFocus);
if (!ssConfig) {
var _ssConfig = {
base: 'suggest',
suggest: {
forms: [
{
id: '1',
depth: 3,
site: '8Y8ERITO',
}
],
wmModeExcludes: '',
templates: {}
}
};
FF.GlobalHeader.initSyncSearchLoader(_ssConfig);
}
}
$input.addEventListener("focus", onFocus);
$input.addEventListener("mouseover", onFocus);
};
GlobalHeader.initSyncSearchLoader = function (_ssConfig) {
ssConfig = _ssConfig;
var isJp = FF.Common.parameter.lang_code == "ja";
var group = "1";
switch (FF.Common.parameter.site_code) {
case "jp":
ssConfig.suggest.cssPath = '/jp/themes/custom/fujifilm_com/common/style/ss_suggest.css';
if (isJp) {
group = '3';
}
else {
group = '4';
}
break;
case "holdings":
ssConfig.suggest.cssPath = '/themes/custom/fujifilm_com/common/style/ss_suggest.css';
if (isJp) {
group = '1';
}
else {
group = '2';
}
break;
}
if (ssConfig.search) {
ssConfig.search.group = group;
if (group == "3") {
ssConfig.search.groupLimit = ['9001', '3'];
ssConfig.search.templates.form = ssConfig.search.templates.form_multiple;
}
else if (group == "4") {
ssConfig.search.groupLimit = ['9002', '4'];
ssConfig.search.templates.form = ssConfig.search.templates.form_multiple;
}
else {
ssConfig.search.groupLimit = [group];
ssConfig.search.templates.form = ssConfig.search.templates.form_single;
}
}
if (ssConfig.suggest) {
ssConfig.suggest.forms[0].group = group;
if (ssConfig.suggest.forms[1])
ssConfig.suggest.forms[1].group = group;
ssConfig.suggest.templates.item =
'' +
'{{item.keyword}}' +
'
';
}
SyncSearchLoader = function () {
this.proto = "https:" === location.protocol ? "https://" : "http://", this.server = "", this.CDN = {
host: "cdn.syncsearch.jp",
path: "/libs/"
}, this.ALT = { host: "static.syncsearch.jp", path: "/libs/" };
};
SyncSearchLoader.prototype = {
load: function () {
var url = this.proto + this.CDN.host + this.CDN.path + ssConfig.base + "_version.js?d=" + (new Date).getTime(), xhr = this.createAjaxRequest();
try {
xhr.open("GET", url, !0), xhr.timeout = 500, xhr.onreadystatechange = function () {
4 == xhr.readyState && (200 == xhr.status ? (ssLoader.server = ssLoader.CDN, eval(xhr.responseText)) : 0 == xhr.status && ssLoader.loadScript());
}, xhr.send(null);
}
catch (ex) {
ssLoader.loadScript();
}
}, createAjaxRequest: function () {
var t;
if (window.XMLHttpRequest)
t = new XMLHttpRequest;
else
try {
t = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
t = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
}
}
return t;
}, loadScript: function (t) {
this.server = this.ALT;
var t = this.proto + this.ALT.host + this.ALT.path + ssConfig.base + "_version.js?d=" + (new Date).getTime(), e = document.getElementsByTagName("head").item(0), s = document.createElement("script");
s.setAttribute("type", "text/javascript"), s.setAttribute("charset", "utf-8"), s.setAttribute("src", t), e.appendChild(s);
}, init: function (initObj, version) {
var url = this.proto + this.server.host + this.server.path + ssConfig.base + "_" + version + ".min.js";
"undefined" != typeof SS_DEV_SCRIPT && (url = SS_DEV_SCRIPT);
var script = document.createElement("script");
script.setAttribute("type", "text/javascript"), script.setAttribute("charset", "utf-8"), script.setAttribute("src", url);
var done = !1;
script.onload = script.onreadystatechange = function () {
done || this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState || (done = !0, eval(initObj + ".init()"));
}, document.body.appendChild(script);
}
};
ssLoader = new SyncSearchLoader;
ssLoader.load();
};
return GlobalHeader;
}());
FF.GlobalHeader = GlobalHeader;
})(FF || (FF = {}));
new FF.GlobalHeader();
var FF;
(function (FF) {
var KeywordSuggest = (function () {
function KeywordSuggest(self, category) {
var _this = this;
if (category === void 0) { category = ""; }
this.self = new FF.AttrNode(self, "data-js-keyword-suggest", false);
this.category = category;
this.datalist = this.self.$.querySelector("#keyword-suggest-list");
this.datalist.id = "";
for (var _i = 0, _a = location.search.substr(1).split("&"); _i < _a.length; _i++) {
var v = _a[_i];
switch (true) {
case /text=/.test(v):
var str = decodeURI(v.substr(5));
this.self.v = this.self.$.word.value = str;
break;
case /category=/.test(v):
this.category = decodeURI(v.substr(9));
break;
}
}
var $button = self.querySelector("button[type=\"submit\"]");
this.self.$.addEventListener("input", function () {
_this.self.v = _this.self.$.word.value;
var flag = !_this.self.$.word.value;
$button.disabled = flag;
_this.datalist.id = flag ? "" : "keyword-suggest-list";
});
this.self.$.onsubmit = function () {
if (_this.self.v) {
location.href =
(_this.self.$.getAttribute("data-action-url") ||
"/" + FF.Common.parameter.site_code.toLowerCase() +
("/" + FF.Common.parameter.lang_code.toLowerCase()) +
("/" + FF.Common.parameter.product_type.toLowerCase()) +
"/search") +
("?category=" + (_this.category || FF.Common.parameter.category_id || "all")) +
("&text=" + encodeURI(_this.self.v));
}
return false;
};
this.setList();
}
KeywordSuggest.prototype.setList = function () {
var _this = this;
var req = new XMLHttpRequest();
var str = FF.Common.parameter.asset_url + "/files/utility/api/product-search/v1" +
("/" + FF.Common.parameter.site_type.toLowerCase()) +
("/" + FF.Common.parameter.site_code.toLowerCase()) +
("/" + FF.Common.parameter.lang_code.toLowerCase()) +
("/" + FF.Common.parameter.product_type.toLowerCase()) +
("/suggestion-" + (this.category || FF.Common.parameter.category_id || "all") + ".json");
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
var json = JSON.parse(req.responseText);
for (var _i = 0, _a = json.data.words; _i < _a.length; _i++) {
var ele = _a[_i];
var $ele = document.createElement("option");
$ele.setAttribute("value", ele);
_this.datalist.appendChild($ele);
}
}
};
req.open("GET", str, true);
req.send(null);
};
return KeywordSuggest;
}());
FF.KeywordSuggest = KeywordSuggest;
})(FF || (FF = {}));
var FF;
(function (FF) {
var PageTop = (function () {
function PageTop() {
var self = document.querySelector(".m-page-top");
if (!self)
return;
window.addEventListener("scroll", function () {
var v = document.documentElement.scrollTop || document.body.scrollTop;
self.setAttribute("data-js-pag-top", v / window.innerHeight > 0.5 ? "show" : "");
}, !document.documentMode ? { passive: true } : false);
}
return PageTop;
}());
FF.PageTop = PageTop;
})(FF || (FF = {}));
new FF.PageTop();
var FF;
(function (FF) {
var Pagination = (function () {
function Pagination() {
var _this = this;
this.totalPageNum = 0;
this.currentPageNum = 0;
this.element = document.querySelector("[data-js-pagination]");
this.$current = this.element.querySelector("[data-js-pagination__current]");
this.$total = this.element.querySelector("[data-js-pagination__total]");
this.$first = this.element.querySelector("[data-js-pagination__first]");
this.$prev = this.element.querySelector("[data-js-pagination__prev]");
this.$next = this.element.querySelector("[data-js-pagination__next]");
this.$last = this.element.querySelector("[data-js-pagination__last]");
this.$first.addEventListener("click", function (e) {
if (_this.onChange)
_this.onChange(1);
});
this.$prev.addEventListener("click", function (e) {
if (_this.onChange)
_this.onChange(_this.currentPageNum - 1);
});
this.$next.addEventListener("click", function (e) {
if (_this.onChange)
_this.onChange(_this.currentPageNum + 1);
});
this.$last.addEventListener("click", function (e) {
if (_this.onChange)
_this.onChange(_this.totalPageNum);
});
}
Pagination.prototype.update = function (start, end, total, count) {
this.totalPageNum = Math.ceil(total / count);
this.currentPageNum = Math.ceil(start / count);
this.$current.innerHTML = this.currentPageNum + "";
this.$total.innerHTML = this.totalPageNum + "";
this.$first.setAttribute("style", this.currentPageNum == 1 ? "display:none" : "");
this.$prev.setAttribute("style", this.currentPageNum == 1 ? "display:none" : "");
this.$next.setAttribute("style", this.currentPageNum == this.totalPageNum ? "display:none" : "");
this.$last.setAttribute("style", this.currentPageNum == this.totalPageNum ? "display:none" : "");
};
return Pagination;
}());
FF.Pagination = Pagination;
})(FF || (FF = {}));
var FF;
(function (FF) {
var ShareModule = (function () {
function ShareModule(element) {
var _this = this;
if (FF.CookieController.mode == "manager-ff" && !FF.CookieController.storageData.target) {
FF.Utils.remove(element);
return;
}
this.self = new FF.AttrNode(element, "data-js-share", false);
this.$btnOpen = this.self.$.querySelector("[data-js=\"open\"]");
this.$body = this.self.$.querySelector("[data-js=\"body\"]");
if (ShareModule.pluginStatus === "none") {
ShareModule.pluginStatus = "loading";
var tag = document.createElement('script');
tag.src = "//s7.addthis.com/js/300/addthis_widget.js#pubid=" + this.self.$.getAttribute("data-js-key");
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
var a = new FF.AttrNode(this.$body.querySelector("[class^='addthis_inline_share_toolbox']"), "style", false);
this.$btnOpen.addEventListener("click", function (e) {
console.trace("click");
_this.self.v = "open";
a.v = "width:100vw";
var max = 0;
for (var _i = 0, _a = _this.$body.querySelectorAll("a"); _i < _a.length; _i++) {
var element_3 = _a[_i];
element_3.setAttribute("style", "margin: 0;");
if (max < element_3.clientWidth)
max = element_3.clientWidth;
}
a.v = "width:" + (max + 2) + "px";
window.addEventListener("click", function (e) { return _this.close(e); }, true);
window.addEventListener("scroll", function () { return _this.close(e); }, !document.documentMode ? { once: true, passive: true } : false);
});
}
ShareModule.prototype.close = function (e) {
if (e === void 0) { e = null; }
window.removeEventListener("click", this.close);
window.removeEventListener("scroll", this.close);
var via = (e.target || null);
while (via && via != this.$body)
via = via.parentNode;
if (this.self.v == "close" || via)
return;
this.self.v = "close";
};
ShareModule.checkAuth = function () {
if (FF.CookieController.mode == "manager-ff" && !FF.CookieController.storageData.target) {
this.hidden();
}
};
ShareModule.hidden = function () {
if (this.widgetHiddenStyle)
return;
this.widgetHiddenStyle = document.createElement('style');
document.head.appendChild(this.widgetHiddenStyle);
this.widgetHiddenStyle.sheet.insertRule('[class*="addthis-smartlayers"]{ display:none !important; }', 0);
};
ShareModule.usable = function () {
if (!this.widgetHiddenStyle)
return;
if (FF.CookieController.mode != "manager-ff" || FF.CookieController.storageData.target) {
document.head.removeChild(this.widgetHiddenStyle);
this.widgetHiddenStyle = null;
}
};
ShareModule.pluginStatus = "none";
return ShareModule;
}());
FF.ShareModule = ShareModule;
})(FF || (FF = {}));
var FF;
(function (FF) {
var ViewedProductsModule = (function () {
function ViewedProductsModule(self) {
var key = "viewed-products_" + FF.Common.parameter.site_code + "-" + FF.Common.parameter.lang_code + "-" + FF.Common.parameter.product_type;
var data;
try {
data = JSON.parse(localStorage.getItem(key));
}
catch (e) {
}
if (!data)
data = {};
var d = new Date();
d.setDate(d.getDate() - 30);
var oneMonthBefore = d.getTime();
var arr = [];
v: for (var i in data) {
var ele = data[i];
if (ele.date < oneMonthBefore) {
delete data[i];
continue;
}
for (var n in arr) {
var via = arr[n];
if (via.date < ele.date) {
arr.splice(n, 0, ele);
continue v;
}
}
arr.push(ele);
}
if (arr.length == 0) {
FF.Utils.remove(self);
return;
}
var board = document.createElement("div");
var temp = self.querySelector('[data-js="template"]');
FF.Utils.remove(temp);
for (var i in arr) {
var ele = arr[i];
if (i < 12) {
board.innerHTML = temp.innerHTML
.replace("{{ url }}", ele.url)
.replace("{{ img }}", ele.img)
.replace("{{ title }}", ele.title)
.replace("{{ description }}
", ele.description);
self.querySelector('[data-js="body"]').appendChild(board.firstElementChild);
}
else {
delete data[ele.id];
}
}
new FF.Slider(self.querySelector('[data-js-slider]'), 4);
localStorage.setItem(key, JSON.stringify(data));
}
return ViewedProductsModule;
}());
FF.ViewedProductsModule = ViewedProductsModule;
})(FF || (FF = {}));