/** * * @authors Eric Hsiao * */ storePage = function (_couponData) { //private menbers const YOUTUBE__ID = 'mDD48KKCqYw'; var couponData = []; //private methods function init() { console.log('storePage is init.'); $('.video__close').click(function (e) { e.preventDefault(); TweenMax.to('.video__popout', 0.3, { autoAlpha: 0 }); player.stopVideo(); }); } function updateCoupon(_data) { couponData = _data; console.log('============== updateCoupon =============='); // console.log(userInfo.goodinfo); for (let index = 0; index < couponData.length; index++) { var _coupon; if (couponData[index].lp < 5) { _coupon = new couponItem(index, couponData[index]); } else { var _isLock; if ($.cookie('luckydraw.isVideoUnlock')) { _isLock = false; } else { _isLock = true; } console.log('luckydraw.isVideoUnlock = ' + $.cookie('luckydraw.isVideoUnlock')); //YOUTUBE LINK _coupon = new couponItem(index, $.extend(couponData[index], { lock: _isLock, video: YOUTUBE__ID })); } } } ////////////////////////////////////// function intoPage() { } function leavePage() { } //constructor { $(document).ready(function () { init(); }); } //public return { intoPage: function () { intoPage(); }, leavePage: function () { leavePage(); }, updateCoupon: function (_data) { updateCoupon(_data); } }; }; var storePage = new storePage();