PageSourceSearch

https://www.euyansang.com.sg/on/demandware.static/Sites-EYS-Site/-/en_SG/v1790229921292/js/custom.js

js euyansang.com.sg collected 2026-09-24 10:47:14 UTC 17,416 bytes, 471 lines download raw bytes

vendor: 4,291 bytes, lines 1-114
1/******/ (function(modules) { // webpackBootstrap
2/******/ 	// The module cache
3/******/ 	var installedModules = {};
4/******/
5/******/ 	// The require function
6/******/ 	function __webpack_require__(moduleId) {
7/******/
8/******/ 		// Check if module is in cache
9/******/ 		if(installedModules[moduleId]) {
10/******/ 			return installedModules[moduleId].exports;
11/******/ 		}
12/******/ 		// Create a new module (and put it into the cache)
13/******/ 		var module = installedModules[moduleId] = {
14/******/ 			i: moduleId,
15/******/ 			l: false,
16/******/ 			exports: {}
17/******/ 		};
18/******/
19/******/ 		// Execute the module function
20/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ 		// Flag the module as loaded
23/******/ 		module.l = true;
24/******/
25/******/ 		// Return the exports of the module
26/******/ 		return module.exports;
27/******/ 	}
28/******/
29/******/
30/******/ 	// expose the modules object (__webpack_modules__)
31/******/ 	__webpack_require__.m = modules;
32/******/
33/******/ 	// expose the module cache
34/******/ 	__webpack_require__.c = installedModules;
35/******/
36/******/ 	// define getter function for harmony exports
37/******/ 	__webpack_require__.d = function(exports, name, getter) {
38/******/ 		if(!__webpack_require__.o(exports, name)) {
39/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
40/******/ 		}
41/******/ 	};
42/******/
43/******/ 	// define __esModule on exports
44/******/ 	__webpack_require__.r = function(exports) {
45/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47/******/ 		}
48/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
49/******/ 	};
50/******/
51/******/ 	// create a fake namespace object
52/******/ 	// mode & 1: value is a module id, require it
53/******/ 	// mode & 2: merge all properties of value into the ns
54/******/ 	// mode & 4: return value when already ns object
55/******/ 	// mode & 8|1: behave like require
56/******/ 	__webpack_require__.t = function(value, mode) {
57/******/ 		if(mode & 1) value = __webpack_require__(value);
58/******/ 		if(mode & 8) return value;
59/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60/******/ 		var ns = Object.create(null);
61/******/ 		__webpack_require__.r(ns);
62/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64/******/ 		return ns;
65/******/ 	};
66/******/
67/******/ 	// getDefaultExport function for compatibility with non-harmony modules
68/******/ 	__webpack_require__.n = function(module) {
69/******/ 		var getter = module && module.__esModule ?
70/******/ 			function getDefault() { return module['default']; } :
71/******/ 			function getModuleExports() { return module; };
72/******/ 		__webpack_require__.d(getter, 'a', getter);
73/******/ 		return getter;
74/******/ 	};
75/******/
76/******/ 	// Object.prototype.hasOwnProperty.call
77/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78/******/
79/******/ 	// __webpack_public_path__
80/******/ 	__webpack_require__.p = "";
81/******/
82/******/
83/******/ 	// Load entry module and return exports
84/******/ 	return __webpack_require__(__webpack_require__.s = 259);
85/******/ })
86/************************************************************************/
87/******/ ({
88
89/***/ 259:
90/***/ (function(module, exports) {
91
92/* eslint-disable no-sequences */
93/* eslint-disable no-unused-expressions */
94/* eslint-disable no-undef */
95
96var isDesktop = function (element) {
97    return $(element).parents('.menu-toggleable-left').css('position') !== 'fixed';
98};
99
100$(function () {
101    if ($('.datepicker').length > 0) {
102        $('.datepicker').datepicker({
103            autoclose: true,
104            todayHighlight: false,
105            startDate: '-100y',
106            endDate: '-1y'
107        });
108    }
109});
110
111//Function to get newsletter cookie
112function getCookie(cname) {
113    let name = cname + "=";
114    let decodedCookie = decodeURIComponent(document.cookie);
115    let ca = decodedCookie.split(';');
116    for(let i = 0; i <ca.length; i++) {
117      let c = ca[i];
118      while (c.charAt(0) == ' ') {
119        c = c.substring(1);
120      }
121      if (c.indexOf(name) == 0) {
122        return c.substring(name.length, c.length);
123      }
124    }
125    return "";
126  }
127// eslint-disable-next-line no-undef
128
129// TO Do : This links will be dynamic from Custom Preferences
130
131// eslint-disable-next-line no-undef
132$(document).ready(function () {
133    // eslint-disable-next-line no-undef
134    $('#openInApp').on('click', function () {
135        if (window.navigator.userAgent.indexOf('iPhone') !== -1) {
136            // eslint-disable-next-line no-undef
137            $('a').attr('href', 'https://apps.apple.com/my/app/eu-yan-sang-malaysia/id1489912037');
138        } else {
139            // eslint-disable-next-line no-undef
140            $('a').attr('href', 'https://play.google.com/store/apps/details?id=my.com.euyansang');
141        }
142    });
143
144    // eslint-disable-next-line no-undef
145    $('.icon-slim-close-btn').on('click', function () {
146        // eslint-disable-next-line no-undef
147        $('.header-downloadapp').hide();
148        return false;
149    });
150
151    // eslint-disable-next-line no-undef
152    $('.search-icon-mobile').on('click', function () {
153        // eslint-disable-next-line no-undef
154        $('.search-mobile').toggleClass('d-none');
155    });
156
157    // append L2 categories in Life style banner
158    var workSubLinks = $('#lifestyleSubNavigation').html();
159    $('#work-sublinks').append(workSubLinks);
160
161
162    // eslint-disable-next-line no-undef
163    if ($(window).width() < 768) {
164        // eslint-disable-next-line no-undef
165        // Sidebar Dropdown - Mobile version
166        $('#maincontent').off('click').on('click', '.article-nav-mob', function (e) {
167            e.preventDefault();
168            var offset = $('.article-nav-mob').position();
169            height = $('.article-nav-mob').outerHeight(),
170                xPos = offset.left,
171                yPos = offset.top;
172
173            $('.article-nav-mob').toggleClass('cate-expanded');
174
175            // eslint-disable-next-line quote-props
176            if ($('#maincontent').find('.category-level-default')) {
177                $('.category-level-default').css({ 'top': yPos + height + 14 });
178                $('.category-level-default').toggle();
179            }
180            $('.category-level-1').css({ 'top': yPos + height + 14 });
181            $('.category-level-1').toggle();
182            return false;
183        });
184
185        $('#maincontent').on('click', '.expandable', function (e) {
186            $(this).find('.category-level').toggle();
187        });
188    }
189
190    // Mobile Menu - Remove Link from TOP Category
191    $('.dropdown:not(.disabled) [data-toggle="dropdown"]').on('click', function (e) {
192        if (!isDesktop(this)) {
193            $('.top-category .nav-link').attr('href','javascript:void(0)');
194        }
195    });
196    //for tile UI after adding promotions
197    var TimeIntervalProductTiles = setInterval(() => {
198        var maxTileHeight = 0;
199        $('.pdp-horizontal-carousel .product-eys-tile').each(function () {
200            if (maxTileHeight < $(this).find('.eys-tile-content').height()) {
201                maxTileHeight = $(this).find('.eys-tile-content').height();
202            }
203        });
204        $('.experience-custom_components-slickSlider .product-listing .slick-track .slick-slide .component-product-tile .product-tile-body').each(function () {
205            if (maxTileHeight < $(this).find('.tile-content').height()) {
206                maxTileHeight = $(this).find('.tile-content').height();
207            }
208        });
209
210        $('.eys-product-grid .plp-product-grid .product-tiles .product .product-eys-tile .eys-tile-body .product-main-col').each(function () {
211            if (maxTileHeight < $(this).find('.eys-tile-content').height()) {
212                maxTileHeight = $(this).find('.eys-tile-content').height();
213            }
214        });
215
216        if (maxTileHeight > 0) {
217            $('.eys-tile-content').css('height', maxTileHeight);
218            $('.experience-custom_components-slickSlider .product-listing .slick-track .slick-slide .component-product-tile .product-tile-body .tile-content').css('height', maxTileHeight);
219            clearInterval(TimeIntervalProductTiles);
220        }
221    }, 1000);
222    if (TimeIntervalProductTiles) {
223        setTimeout(function () {
224            clearInterval(TimeIntervalProductTiles);
225        }, 3500);
226    }
227    // Copy to clipboard voucher code
228    $(document).on('click', '.copy-voucher',function (e) {
229        var voucherCode = $(this).text();
230        var copyText = document.createElement("input");
231        copyText.setAttribute("value", voucherCode);
232        document.body.appendChild(copyText);
233        copyText.select();
234        copyText.setSelectionRange(0, 99999); // For mobile devices
235
236        // Copy the text inside the text field
237        navigator.clipboard.writeText(copyText.value);
238        document.body.removeChild(copyText);
239    });
240});
241// eslint-disable-next-line no-undef
242$(window).scroll(function () {
243    // eslint-disable-next-line no-undef
244    if ($(window).width() < 768) {
245        // eslint-disable-next-line no-undef
246        var sticky = $('header').offset().top;
247        if (window.pageYOffset > sticky) {
248            $('.header-mobile').addClass('header-fix');
249            $('.header-downloadapp').hide();
250            $('.header-banner-promo').hide();
251        } else {
252            $('.header-mobile').removeClass('header-fix');
253            $('.header-downloadapp').show();
254            $('.header-banner-promo').show();
255        }
256    }
257});
258
259$(window).on('load', function() {
260    var width = $(window).width();
261    var checkCookie = getCookie($('#newsletterCookieName').val())
262    if (checkCookie!='') {
263        $('#newsletter-popup').modal('hide');
264    } else {
265        $('#newsletter-popup').modal('show');
266    }
267
268    $('#splash-popup').modal('show');
269
270    var checkStickyCookie = getCookie( $('#newsletterStickyCookieName').val())
271    if (checkStickyCookie!='' && width < 768) {
272        $('.fixed-footer-email-signup').attr("style", "display:none;")
273    } else {
274        $('.fixed-footer-email-signup').attr("style", "display:block;")
275    }
276
277    // Set cookie on newsletter popup close
278    $('.newsletter-popup-close').click(function () {
279        var d = new Date();
280        var expires = $('#newsletterCookieMaxAge').val();
281        var newsletterCookieName = $('#newsletterCookieName').val();
282        d.setTime(d.getTime()+expires*1000);
283        expires = "expires="+d.toUTCString();
284        document.cookie = newsletterCookieName+' =1;' + expires + '; path=/';
285
286        return true;
287    });
288
289    // Set cookie on newsletter sticky popup close
290    $('.newsletter-sticky-popup-close').click(function () {
291        $('.fixed-footer-email-signup').hide();
292        var d = new Date();
293        var expires = $('#newsletterCookieMaxAge').val();
294        var newsletterStickyCookieName = $('#newsletterStickyCookieName').val();
295        d.setTime(d.getTime()+expires*1000);
296        expires = "expires="+d.toUTCString();
297        document.cookie = newsletterStickyCookieName+' =1;' + expires + '; path=/';
298
299        return true;
300    });
301
302    /**
303 * Display the returned message.
304 * @param {string} data - data returned from the server's ajax call
305 * @param {Object} button - button that was clicked for contact us sign-up
306 */
307function displayMessage(data, button) {
308    $.spinner().stop();
309    var status;
310    if (data.success) {
311        status = 'alert-success';
312    } else {
313        status = 'alert-danger';
314    }
315
316    if ($('.contact-us-signup-message').length === 0) {
317        $('body').append(
318            '<div class="contact-us-signup-message"></div>'
319        );
320    }
321    $('.contact-us-signup-message')
322        .append('<div class="contact-us-signup-alert text-center ' + status + '" role="alert">' + data.msg + '</div>');
323
324    setTimeout(function () {
325        $('.contact-us-signup-message').remove();
326        button.removeAttr('disabled');
327    }, 3000);
328}
329
330    // This form gets the file uploads with all other fields of the form as well as validates the recaptcha
331    $('form.contact-us-sg').submit(function (e) {
332        e.preventDefault();
333        var form = $(this);
334        var button = $('.subscribe-contact-us');
335        var url = form.attr('action');
336        var formData = new FormData(form[0]);
337
338        $.spinner().start();
339        button.attr('disabled', true);
340        $.ajax({
341            url: url,
342            type: 'post',
343            dataType: 'json',
344            data: formData,
345            contentType: false,
346            processData: false,
347            success: function (data) {
348                displayMessage(data, button);
349                if (data.success) {
350                    $('.contact-us-sg').trigger('reset');
351                    $('#contact-attachment').val(''); // Clear the file input
352                    $('#selected-file-name').empty(); // Clear the div content
353                }
354            },
355            error: function (err) {
356                displayMessage(err, button);
357            }
358        });
359    });
360});
361
362/**
363 * add a new button for add to cart on pdp after scrolling up of one button.
364 */
365 var width = $(window).width();
366 if($(".add-to-cart-fixed").length && width < 768) {
367    var buttonTop = $('.add-to-cart-fixed').offset().top + 300;       // get initial position of the element
368    $(window).scroll(function() {
369
370        var currentScroll = $(window).scrollTop();
371        if (currentScroll > buttonTop) {
372            $('.add-to-cart-sticky').removeClass('d-none')
373            .addClass('d-block');
374        } else {
375        $('.add-to-cart-sticky').removeClass('d-block')
376        .addClass('d-none');
377        }
378    });
379 }
380
381$(document).ready(function () {
382    // for making first description tab active on pdp
383    $('.product-detail-bottom #myTab').find(".nav-item .nav-link:first").addClass('active show');
384    $('.product-detail-bottom #myTabContent').find(".tab-pane:first").addClass('active show');
385});
386
387$("#loginSignup").click(function(){
388    $(".login-register-dropdown-menu").toggle();
389});
390
391$(document).on('click', function (event) {
392    if (!$(event.target).closest('.navbar-header').length) {
393        var element = $(".login-register-dropdown-menu");
394        if($(element).is(":visible")){
395            element.toggle();
396        }
397    }
398});
399
400$(document).ready(function(){
401    if($('#homepage').length>0){
402        $('link[rel="icon"]').prependTo('head');
403    }
404});
405
406$(document).on('click', '.bv_button_buttonFull#AAQ', function () {
407    $('#product-tab-5').click();
408})
409
410$(document).ready(function () {
411    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
412      jQuery("#product-reviews .card-body").html(jQuery("#rating-tab .description-and-detail"));
413      jQuery("#product-reviews .description-and-detail .row").removeClass( "collapsible-xs" );
414    }
415  });
416/****Chat Bot UI JS Start*/
417$(document).ready(function() {
418    const $chatbotContainer = $('#chatbotContainer');
419    const $minimizeBtn = $('#minimizeBtn');
420    const $closeBtnHeader = $('.closeBtnHeader');
421    const $minimizeIcon = $('#minimizeIcon');
422    const $closeBtnIcon = $('#closeBtnIcon');
423
424    $minimizeBtn.on('click', function() {
425        if (!$chatbotContainer.hasClass('visible')) {
426            $("#chatbotIframe").attr("src", "https://copilotstudio.microsoft.com/environments/0eb2c929-7038-eccc-9485-61c171ef7393/bots/crf26_chatEyss/webchat?__version__=2");
427            $chatbotContainer.addClass('visible');
428            $minimizeIcon.addClass('hide');
429            $closeBtnIcon.removeClass('hide');
430        } else {
431            $chatbotContainer.removeClass('visible');
432            $("#chatbotIframe").attr("src", ' ');
433            $closeBtnIcon.addClass('hide');
434            $minimizeIcon.removeClass('hide');
435        }
436    });
437
438    $closeBtnHeader.on('click', function() {
439        $chatbotContainer.removeClass('visible');
440        $("#chatbotIframe").attr("src", ' ');
441        $closeBtnIcon.addClass('hide');
442        $minimizeIcon.removeClass('hide');
443    });
444});
445/****Chat Bot UI JS End*/
446
447$('.checkout-btn').on('click', function(e) {
448    e.preventDefault();
449    var href = $(this).attr('href');
450    var url = $(this).data('check-fraud');
451    $.ajax({
452        url: url,
453        method: 'GET',
454        success: function(response){
455            if (response.error) {
456                var tempDiv = document.createElement('div');
457                tempDiv.innerHTML = response.errorMessage;
458                var plainTextMessage = tempDiv.textContent || tempDiv.innerText;
459                alert(plainTextMessage);
460            } else {
461                window.location.href = href;
462            }
463        }
464    })
465});
466
467
468
469/***/ })
470
471/******/ });

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.