PageSourceSearch

https://www.shiseido.com.tw/template/js/common.js

js shiseido.com.tw collected 2026-10-01 14:12:45 UTC 16,704 bytes, 538 lines download raw bytes

vendor: 4,586 bytes, lines 1-119
1/******/ (function(modules) { // webpackBootstrap
2/******/ 	// install a JSONP callback for chunk loading
3/******/ 	function webpackJsonpCallback(data) {
4/******/ 		var chunkIds = data[0];
5/******/ 		var moreModules = data[1];
6/******/ 		var executeModules = data[2];
7/******/
8/******/ 		// add "moreModules" to the modules object,
9/******/ 		// then flag all "chunkIds" as loaded and fire callback
10/******/ 		var moduleId, chunkId, i = 0, resolves = [];
11/******/ 		for(;i < chunkIds.length; i++) {
12/******/ 			chunkId = chunkIds[i];
13/******/ 			if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
14/******/ 				resolves.push(installedChunks[chunkId][0]);
15/******/ 			}
16/******/ 			installedChunks[chunkId] = 0;
17/******/ 		}
18/******/ 		for(moduleId in moreModules) {
19/******/ 			if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
20/******/ 				modules[moduleId] = moreModules[moduleId];
21/******/ 			}
22/******/ 		}
23/******/ 		if(parentJsonpFunction) parentJsonpFunction(data);
24/******/
25/******/ 		while(resolves.length) {
26/******/ 			resolves.shift()();
27/******/ 		}
28/******/
29/******/ 		// add entry modules from loaded chunk to deferred list
30/******/ 		deferredModules.push.apply(deferredModules, executeModules || []);
31/******/
32/******/ 		// run deferred modules when all chunks ready
33/******/ 		return checkDeferredModules();
34/******/ 	};
35/******/ 	function checkDeferredModules() {
36/******/ 		var result;
37/******/ 		for(var i = 0; i < deferredModules.length; i++) {
38/******/ 			var deferredModule = deferredModules[i];
39/******/ 			var fulfilled = true;
40/******/ 			for(var j = 1; j < deferredModule.length; j++) {
41/******/ 				var depId = deferredModule[j];
42/******/ 				if(installedChunks[depId] !== 0) fulfilled = false;
43/******/ 			}
44/******/ 			if(fulfilled) {
45/******/ 				deferredModules.splice(i--, 1);
46/******/ 				result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
47/******/ 			}
48/******/ 		}
49/******/
50/******/ 		return result;
51/******/ 	}
52/******/
53/******/ 	// The module cache
54/******/ 	var installedModules = {};
55/******/
56/******/ 	// object to store loaded and loading chunks
57/******/ 	// undefined = chunk not loaded, null = chunk preloaded/prefetched
58/******/ 	// Promise = chunk loading, 0 = chunk loaded
59/******/ 	var installedChunks = {
60/******/ 		5: 0
61/******/ 	};
62/******/
63/******/ 	var deferredModules = [];
64/******/
65/******/ 	// The require function
66/******/ 	function __webpack_require__(moduleId) {
67/******/
68/******/ 		// Check if module is in cache
69/******/ 		if(installedModules[moduleId]) {
70/******/ 			return installedModules[moduleId].exports;
71/******/ 		}
72/******/ 		// Create a new module (and put it into the cache)
73/******/ 		var module = installedModules[moduleId] = {
74/******/ 			i: moduleId,
75/******/ 			l: false,
76/******/ 			exports: {}
77/******/ 		};
78/******/
79/******/ 		// Execute the module function
80/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
81/******/
82/******/ 		// Flag the module as loaded
83/******/ 		module.l = true;
84/******/
85/******/ 		// Return the exports of the module
86/******/ 		return module.exports;
87/******/ 	}
88/******/
89/******/
90/******/ 	// expose the modules object (__webpack_modules__)
91/******/ 	__webpack_require__.m = modules;
92/******/
93/******/ 	// expose the module cache
94/******/ 	__webpack_require__.c = installedModules;
95/******/
96/******/ 	// define getter function for harmony exports
97/******/ 	__webpack_require__.d = function(exports, name, getter) {
98/******/ 		if(!__webpack_require__.o(exports, name)) {
99/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
100/******/ 		}
101/******/ 	};
102/******/
103/******/ 	// define __esModule on exports
104/******/ 	__webpack_require__.r = function(exports) {
105/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
106/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
107/******/ 		}
108/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
109/******/ 	};
110/******/
111/******/ 	// create a fake namespace object
112/******/ 	// mode & 1: value is a module id, require it
113/******/ 	// mode & 2: merge all properties of value into the ns
114/******/ 	// mode & 4: return value when already ns object
115/******/ 	// mode & 8|1: behave like require
116/******/ 	__webpack_require__.t = function(value, mode) {
117/******/ 		if(mode & 1) value = __webpack_require__(value);
118/******/ 		if(mode & 8) return value;
119/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esMo
119dule) return value;
120/******/ 		var ns = Object.create(null);
121/******/ 		__webpack_require__.r(ns);
122/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
123/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
124/******/ 		return ns;
125/******/ 	};
126/******/
127/******/ 	// getDefaultExport function for compatibility with non-harmony modules
128/******/ 	__webpack_require__.n = function(module) {
129/******/ 		var getter = module && module.__esModule ?
130/******/ 			function getDefault() { return module['default']; } :
131/******/ 			function getModuleExports() { return module; };
132/******/ 		__webpack_require__.d(getter, 'a', getter);
133/******/ 		return getter;
134/******/ 	};
135/******/
136/******/ 	// Object.prototype.hasOwnProperty.call
137/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
138/******/
139/******/ 	// __webpack_public_path__
140/******/ 	__webpack_require__.p = "/";
141/******/
142/******/ 	var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || [];
143/******/ 	var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
144/******/ 	jsonpArray.push = webpackJsonpCallback;
145/******/ 	jsonpArray = jsonpArray.slice();
146/******/ 	for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
147/******/ 	var parentJsonpFunction = oldJsonpFunction;
148/******/
149/******/
150/******/ 	// add entry module to deferred list
151/******/ 	deferredModules.push([0,1,0]);
152/******/ 	// run deferred modules when ready
153/******/ 	return checkDeferredModules();
154/******/ })
155/************************************************************************/
156/******/ ({
157
158/***/ 0:
159/***/ (function(module, exports, __webpack_require__) {
160
161module.exports = __webpack_require__("NbCg");
162
163
164/***/ }),
165
166/***/ "NbCg":
167/***/ (function(module, __webpack_exports__, __webpack_require__) {
168
169"use strict";
170// ESM COMPAT FLAG
171__webpack_require__.r(__webpack_exports__);
172
173// EXTERNAL MODULE: external "jQuery"
174var external_jQuery_ = __webpack_require__("xeH2");
175var external_jQuery_default = /*#__PURE__*/__webpack_require__.n(external_jQuery_);
176
177// EXTERNAL MODULE: ../node_modules/gsap/index.js + 2 modules
178var gsap = __webpack_require__("XOZl");
179
180// EXTERNAL MODULE: ../node_modules/@babel/runtime/helpers/createClass.js
181var createClass = __webpack_require__("NToG");
182var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
183
184// CONCATENATED MODULE: ./footer-canvas.js
185
186// import * as dat from 'dat.gui';
187// 環境變數
188var updateFPS = 30;
189var time = 0;
190var bgColor = 'rgba(0,0,0,0.5)';
191var ww;
192var wh;
193var reqFrame;
194ww = window.innerWidth;
195wh = window.innerHeight;
196
197var getControls = function getControls() {
198  return {
199    startAngle: 0,
200    endAngle: 360,
201    length: ww * 1.5,
202    // 半徑是螢幕寬度
203    top: -(ww * 1.5 - wh) - (window.innerWidth > 576 ? 80 : 20),
204    // 這樣圈圈會在螢幕底部,-80 是為了讓他再高一點
205    amp: 10,
206    freq: 2
207  };
208};
209
210var controls = getControls(); // const gui = new dat.GUI();
211// gui.add(controls, 'startAngle', 0, 360).step(1);
212// gui.add(controls, 'endAngle', 0, 360).step(1);
213// gui.add(controls, 'length', 1, 2 * ww).step(1);
214// gui.add(controls, 'top', -2 * wh, wh).step(1);
215// gui.add(controls, 'amp', 0, 1000).step(1);
216// gui.add(controls, 'freq', 0, 300).step(1);
217
218var footer_canvas_Vec2 = /*#__PURE__*/function () {
219  function Vec2(x, y) {
220    this.x = x;
221    this.y = y;
222  }
223
224  var _proto = Vec2.prototype;
225
226  _proto.set = function set(x, y) {
227    this.x = x;
228    this.y = y;
229  };
230
231  _proto.move = function move(x, y) {
232    this.x += x;
233    this.y += y;
234  };
235
236  _proto.add = function add(v) {
237    return new Vec2(this.x + v.x, this.y + v.y);
238  };
239
240  _proto.sub = function sub(v) {
241    return new Vec2(this.x - v.x, this.y - v.y);
242  };
243
244  _proto.mul = function mul(s) {
245    return new Vec2(this.x * s, this.y * s);
246  };
247
248  _proto.clone = function clone() {
249    return new Vec2(this.x, this.y);
250  };
251
252  _proto.toString = function toString() {
253    return "(" + this.x + ", " + this.y + ")";
254  };
255
256  _proto.equal = function equal(v) {
257    return this.x == v.x && this.y == v.y;
258  };
259
260  createClass_default()(Vec2, [{
261    key: "length",
262    get: function get() {
263      return Math.sqrt(this.x * this.x + this.y * this.y);
264    },
265    set: function set(nv) {
266      var temp = this.unit.mul(nv);
267      this.set(temp.x, temp.y);
268    }
269  }, {
270    key: "angle",
271    get: function get() {
272      return Math.atan2(this.y, this.x);
273    }
274  }, {
275    key: "unit",
276    get: function get() {
277      return this.mul(1 / this.length);
278    }
279  }]);
280
281  return Vec2;
282}();
283
284function update() {
285  time += 1;
286}
287
288var degToPi = Math.PI / 180;
289var points = Array.from({
290  length: controls.endAngle - controls.startAngle
291}).map(function (item, idx) {
292  return {
293    angle: idx + controls.startAngle,
294    // 剛好以 1 度為區隔,所以直接加 idx
295    point: new footer_canvas_Vec2(0, 0)
296  };
297});
298
299function draw(ctx) {
300  // 清空背景
301  ctx.fillStyle = bgColor;
302  ctx.clearRect(0, 0, ww, wh); // 畫圓
303
304  ctx.save();
305  ctx.translate(ww / 2, controls.top);
306  ctx.translate(ww / 14, 0);
307  ctx.rotate(time / 360 * 10);
308  ctx.beginPath();
309  points.forEach(function (_ref) {
310    var angle = _ref.angle,
311        point = _ref.point;
312    ctx.save();
313    var x = controls.length * Math.cos(angle * degToPi) + controls.amp * Math.sin(angle * controls.freq * degToPi);
314    var y = controls.length * Math.sin(angle * degToPi) + controls.amp * Math.sin(angle * controls.freq * degToPi);
315    point = point.add(new footer_canvas_Vec2(x, y));
316    ctx.lineTo(point.x, point.y);
317    ctx.restore();
318  });
319  ctx.closePath();
320  ctx.lineWidth = 1;
321  ctx.strokeStyle = '#C80421';
322  ctx.stroke();
323  ctx.restore();
324  reqFrame = requestAnimationFrame(draw.bind(null, ctx));
325}
326
327function initCanvas(canvas) {
328  if (canvas) {
329    var ctx = canvas.getContext('2d');
330    ww = window.innerWidth;
331    wh = window.innerHeight;
332    canvas.width = ww * window.devicePixelRatio;
333    canvas.height = wh * window.devicePixelRatio;
334    ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
335  }
336}
337var startCanvas = function startCanvas(canvas) {
338  if (canvas) {
339    var ctx = canvas.getContext('2d');
340    draw(ctx);
341    setInterval(function () {
342      update();
343    }, 1000 / updateFPS);
344    window.addEventListener('resize', function () {
345      time = 0;
346      initCanvas(canvas);
347      window.cancelAnimationFrame(reqFrame);
348      controls = getControls();
349      draw(ctx);
350    });
351  }
352};
353// EXTERNAL MODULE: ./utils/smooth-scroll.js
354var smooth_scroll = __webpack_require__("HQpy");
355
356// CONCATENATED MODULE: ./common.js
357
358
359
360 // nav effect start
361
362external_jQuery_default()('.js-hover-nav-sub').mouseenter(function (e) {
363  if (e.target.tagName.toLowerCase() !== 'a') {
364    return;
365  }
366
367  if (window.innerWidth >= 992) {
368    external_jQuery_default()(this).children('.js-nav-sub-box').addClass('is-nav-active');
369  }
370});
371external_jQuery_default()('.js-hover-nav-sub').mouseleave(function () {
372  if (window.innerWidth >= 992) {
373    external_jQuery_default()(this).children('.js-nav-sub-box').removeClass('is-nav-active');
374  }
375});
376external_jQuery_default()('.js-click-nav-sub').click(function (e) {
377  if (window.innerWidth < 992) {
378    if (external_jQuery_default()(this).hasClass('js-click-icon')) {
379      e.preventDefault();
380      external_jQuery_default()(this).parent().siblings().slideToggle('slow');
381      external_jQuery_default()(this).children('.nav-item-mb-icon').toggleClass('is-active');
382      return;
383    }
384
385    e.preventDefault();
386    external_jQuery_default()(this).next().slideToggle('slow');
387    external_jQuery_default()(this).children('.nav-item-mb-icon').toggleClass('is-active');
388  }
389});
390external_jQuery_default()('.js-nav-mb-sub').click(function (e) {
391  e.preventDefault();
392
393  if (window.innerWidth < 992) {
394    external_jQuery_default()(this).next().slideToggle('slow');
395    external_jQuery_default()(this).children('.nav-item-mb-icon').toggleClass('is-active');
396  }
397}); // nav effect end
398// scroll effect
399
400var lastScrollY = null; // let isStartCanvas = false;
401
402external_jQuery_default()(window).scroll(function () {
403  requestAnimationFrame(function () {
404    var scrollY = window.pageYOffset || window.scrollY;
405    var winH = external_jQuery_default()(window).height();
406
407    if (scrollY > 0) {
408      external_jQuery_default()('.header').addClass('is-down');
409    } else {
410      external_jQuery_default()('.header').removeClass('is-down');
411    }
412
413    if (scrollY - lastScrollY < 0 && lastScrollY && scrollY > winH) {
414      external_jQuery_default()('.goback').addClass('is-active');
415    } else {
416      external_jQuery_default()('.goback').removeClass('is-active');
417    }
418
419    lastScrollY = scrollY;
420  });
421}); // search icon
422
423external_jQuery_default()('.js-search').click(function () {
424  external_jQuery_default()('.js-search-box').toggleClass('is-active');
425  external_jQuery_default()('.js-search').toggleClass('is-active');
426}); // mobile nav show
427
428external_jQuery_default()('.js-mobile-btn').click(function () {
429  external_jQuery_default()('.js-nav').addClass('is-mobile-active');
430  external_jQuery_default()('body').css({
431    overflow: 'hidden'
432  });
433}); // mobile nav close
434
435external_jQuery_default()('.js-mobile-btn-close').click(function () {
436  external_jQuery_default()('.js-nav').removeClass('is-mobile-active');
437  external_jQuery_default()('body').css({
438    overflow: 'auto'
439  }); // $('#app').css('display', 'block');
440
441  external_jQuery_default()('.js-click-nav-sub').parents('.js-hover-nav-sub').children('.js-nav-sub-box').slideUp();
442  external_jQuery_default()('.js-click-nav-sub').children('.nav-item-mb-icon').removeClass('is-active');
443  external_jQuery_default()('.js-nav-mb-sub').siblings().slideUp();
444  external_jQuery_default()('.js-nav-mb-sub').children('.nav-item-mb-icon').removeClass('is-active');
445}); // goback
446
447external_jQuery_default()('.js-goback').click(function () {
448  Object(smooth_scroll["a" /* smoothScroll */])(0);
449}); // brand item hover
450
451external_jQuery_default()('.js-brand-hover').hover(function () {
452  external_jQuery_default()(this).toggleClass('is-hover');
453});
454
455function setCookie(cname, cvalue, exdays) {
456  var d = new Date();
457  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
458  var expires = "expires=" + d.toUTCString();
459  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
460}
461
462function getCookie(cname) {
463  var name = cname + "=";
464  var decodedCookie = decodeURIComponent(document.cookie);
465  var ca = decodedCookie.split(';');
466
467  for (var i = 0; i < ca.length; i++) {
468    var c = ca[i];
469
470    while (c.charAt(0) == ' ') {
471      c = c.substring(1);
472    }
473
474    if (c.indexOf(name) == 0) {
475      return c.substring(name.length, c.length);
476    }
477  }
478
479  return '';
480}
481
482var common_pageTitleAnimate = function pageTitleAnimate() {
483  return new Promise(function (resolve) {
484    if (external_jQuery_default()('.page-title').length) {
485      var tl = gsap["a" /* default */].timeline();
486      tl.addLabel('textShow', '0').fromTo('.page-title .js-zh', {
487        opacity: 0,
488        y: -20
489      }, {
490        opacity: 1,
491        y: 0
492      }, 'textShow').fromTo('.page-title .js-en', {
493        opacity: 0,
494        y: 20
495      }, {
496        opacity: 1,
497        y: 0
498      }, 'textShow').to('.page-title .page-title-line', {
499        width: '100%',
500        onComplete: function onComplete() {
501          gsap["a" /* default */].set('.page-title .page-title-line', {
502            width: 'auto'
503          });
504          resolve();
505        }
506      });
507    }
508  });
509};
510
511common_pageTitleAnimate(); // gdpr
512
513external_jQuery_default()('.gdpr-close, .gdpr-agree').click(function () {
514  if (false) {}
515
516  external_jQuery_default()('.gdpr').addClass('d-none');
517});
518
519function showGDPR() {
520  if (false) { var agreeGDPR; }
521}
522
523showGDPR(); // excute footer canvas
524
525var canvas = document.getElementById('canvas');
526initCanvas(canvas);
527startCanvas(canvas);
528
529/***/ }),
530
531/***/ "xeH2":
532/***/ (function(module, exports) {
533
534module.exports = jQuery;
535
536/***/ })
537
538/******/ });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.