\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '
';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\n if(jQuery('body.luxury').length > 0){\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off-luxury.svg');\n }else{\n var star_off = jQuery(\"#star-off img\");\n star_off.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-off.svg');\n var star_on = jQuery(\"#star-on img\");\n star_on.attr('src', 'https://www.nykaa.com/skin/frontend/nykaa/theme202/images/star-on.svg');\n }\n \n function funTagGTM_Garnier()\n {\n if(jQuery('#hdnGTM_Garnier').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-TX3ZS4');\n jQuery('#hdnGTM_Garnier').val(1);\n }\n }\n\n function funTagGTM_LP()\n {\n if(jQuery('#hdnGTM_LP').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-5HSSFS');\n jQuery('#hdnGTM_LP').val(1);\n }\n }\n\n function funTagGTM_MNY()\n {\n if(jQuery('#hdnGTM_MNY').val()==0){\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-52JDQS');\n jQuery('#hdnGTM_MNY').val(1);\n }\n }\n\n function ajaxLoadings() {\n var over = '';\n over += 'Loading ....';\n over += '
';\n jQuery(over).appendTo('body');\n setTimeout(function(){\n window.location='/checkoutmobile' ;\n }, 1000);\n }\n\n function ajaxWishlist(action, id, parentId, type) {\n var url = jQuery('#' + parentId + ' a').attr('data-url');\n url = url.replace(\"wishlist/index\", \"advancedwishlist/index\");\n url += 'isAjax/1/';\n ajaxLoading();\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (data.error == 1) {\n lightbox(null, '/customer/account/signupformpopup', 1);\n } else {\n if (action == 'remove') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Removed from wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishremoved');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishremoved');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('added');\n jQuery('#' + parentId + ' a').addClass('add');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"add\", \"' + id + '\", \"' + parentId + '\");');\n }\n if (action == 'add') {\n jQuery('#wishlist_msg_' + id).show();\n jQuery('#wishlist_msg_' + id).text('Added to wishlist');\n jQuery('#wishlist_msg_' + id).addClass('wishadded');\n setTimeout(function () {\n jQuery('#wishlist_msg_' + id).hide();\n jQuery('#wishlist_msg_' + id).text('');\n jQuery('#wishlist_msg_' + id).removeClass('wishadded');\n }, 2000);\n jQuery('#' + parentId + ' a').removeClass('add');\n jQuery('#' + parentId + ' a').addClass('added');\n jQuery('#' + parentId + ' a').attr('onclick', 'ajaxWishlist(\"remove\", \"' + id + '\", \"' + parentId + '\");');\n }\n jQuery('#' + parentId + ' a').attr('data-url', data.href);\n if (jQuery('.block-wishlist').length) {\n jQuery('.block-wishlist').replaceWith(data.sidebar);\n } else {\n if (jQuery('.col-right').length) {\n jQuery('.col-right').prepend(data.sidebar);\n }\n }\n if (type == 'customer') {\n ajaxRemoveWishlist(action, id, parentId);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n function showOptions(url, id, flag) {\n if (jQuery('#product_view_' + id).is(':hidden')) {\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product_view_' + id).show();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, null);\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n\n jQuery('#product-opt-' + id + ' img.discount-tag').hide();\n jQuery('#product-opt-' + id + ' .org_add').hide();\n jQuery('#product-opt-' + id + ' .discount_offer_tag_label').hide();\n jQuery('#wishlist-id-' + id + '').hide();\n jQuery('#product-opt-' + id).prepend(data);\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n alert('AJAX Failure!');\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function setMobileLocationAjax(url, id,wishlist,trackparam,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\nbreak;\n}\n}\nurl = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\nvar qty = jQuery('.product_block_' + id + ' .qty').val();\nif (window.location.protocol !== 'http:') {\nurl = url.replace(\"http:\", \"https:\");\n}\najaxLoading();\ntry {\njQuery.ajax({\nurl: url,\ndataType: 'json',\nbeforeSend: function () {\npace.on();\n},\nsuccess: function (data) {\ncloseAjaxLoading();\nif(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\nif(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\nvar image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n}else{\nvar image_pro_src = jQuery('.product_cart_front_'+id).find('.product-image img').attr('src');\n}\nlightbox(null,'/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n}\nsetMobileAjaxData(data, id, false);\nsetGamoogaPixel(id,url,trackparam);\nif(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\nrediMessage(element);\n},\ncomplete: function () {\npace.off();\npace.init();\n}\n});\n} catch (e) {\n}\n}\n\n function setLocationAjax(url, id,trackparam,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n url += 'isAjax/1';\n if( wishlist.wishlist == 1 ){ url += '?wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n url += '?customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '?listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n setAjaxData(data, false, id);\n if (data.status == 'ERROR') {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n if(trackparam==\"prod_customer+also+viewed\" || trackparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(element).closest('.n_prod_block').find('.product-image img').attr('src');\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }else{\n jQuery('#product_view_alert_' + id + ' div').html(data.message);\n jQuery('#product_view_alert_' + id).show();\n jQuery('.tagoffer'+id).addClass('tag-offer-veg-hide');\n }\n } else {\n\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (trackparam.search(\"catg_people\") >= 0)){}\n else{\n if(window.location.href.indexOf('n=beautyservices') > -1){\n\n }else{\n jQuery('.listing-page-widget').hide(1000);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }\n\n }\n\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n setGamoogaPixel(id,url,trackparam);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n if((window.location.href.indexOf('n=beautyservices') > 0 || jQuery('#beautyservices_gc').val() == 1)&&(jQuery(window).width() > 480)){\n showCart();\n }\n }\n });\n } catch (e) {\n }\n }\n\n function setMobilebundleLocationAjax(url, id,button,wid,wishlist,element,trackparam) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n if(url.indexOf('?') < 0){ url += '?';}\n url += '&isAjax=1&check_param='+button+'&wid='+wid;\n\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (trackparam) {\n case 'prod_people also bought':\n case 'catg_people also bought':\n url += '?customeralsoboughtm=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '?recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '?cavmobile=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(button==\"wishlist\"){\n window.location.href= '/checkoutmobile';\n }\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str1 = jQuery(\"#old-price-\"+id).html();\n if(str1 == \"\")\n {\n str = jQuery(\"#old-price-\"+id).val();\n ppriceid = str.replace(\"Rs. \", \"\");\n }else\n {\n str =str1;\n ppriceid = str;\n }\n\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(jQuery(\"body\").hasClass('catalog-product-view') ){\n recommendedWidgetOnClick();\n }\n setBundlePixel(id,url,button,ppriceid,trackparam);\n setMobileBundleAjaxData(data, id, false,button);\n if(jQuery(\"#checkout_mobile_config\").val() == 'yes') {document.location.href='/checkoutmobile';}\n rediMessage(element);\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function setbundleLocationAjax(url, id,tparam,wid,wishlist,element) {\n if (typeof(wishlist)==='undefined') wishlist = 0;\n var pincodesource = jQuery(\"#pincodesource\").val();\n if(url.indexOf('?') < 0){\n url += '?';\n }\n url += '&isAjax=1&check_param='+tparam+'&wid='+wid;\n if(pincodesource ==\"\" || pincodesource === undefined){\n }else{\n url +=\"&pincodesource=\"+pincodesource;\n }\n if( wishlist.wishlist == 1 ){ url += '&wishlist=1'; }\n else{\n switch (tparam) {\n case 'prod_people also bought':\n url += '&customeralsobought=yes';\n break;\n case 'catg_people also bought':\n url += '&listcustomerbought=yes';\n break;\n case 'prod_recentlyviewed':\n case 'catg_recentlyviewed':\n url += '&recentview=yes';\n break;\n case 'prod_customer+also+viewed':\n case 'prod_customer also viewed':\n url += '&cavdesktop=yes';\n break;\ndefault:\n break;\n }\n }\n url = url.replace(\"checkout/cart\", \"ajaxaddcart/index\");\n var qty = jQuery('.product_block_' + id + ' .qty').val();\n ajaxLoading();\n try {\n jQuery.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if(tparam==\"wishlist\"){\n ajaxRemoveWishlist('', '0', '');\n }\n if(data.message !=\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\"){\n setAjaxData(data, false, id);\n }else if(data.message==\"This is a Nykaa PRO exclusive product. Please join PRO to avail this product.\" && data.status == 'ERROR'){\n if(wishlist){\n var image_pro_src = jQuery(\"#product-opt-\"+id).find('.product-image img').attr('src');\n }else if(tparam==\"prod_customer+also+viewed\" || tparam==\"prod_customer also viewed\"){\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.left-img-second img').attr(\"src\");\n }else{\n var image_pro_src = jQuery(\".addtocart_product_front_\"+id).find('.product-image img').attr('src');\n if(typeof image_pro_src === \"undefined\"){\n image_pro_src = jQuery(\".product-image img\").attr('src');\n }\n }\n lightbox(null, '/bulkbuyer/index/shownykaapropopup/imgsrc/'+btoa(image_pro_src)+'/prod_name/'+btoa(data.prod_name), 1);\n }\n if(data.status != 'ERROR'){\n\n\n if(jQuery(\"body\").hasClass('catalog-category-view')||jQuery(\"body\").hasClass('solr-result-index')){\n if((jQuery(element).parents('.listing-page-widget').length) || (tparam.search(\"catg_people\") >= 0)){}\n else{\n jQuery('.listing-page-widget').hide(1500);\n var widget_element = jQuery(element).closest('.n_prod_block').nextAll('.listing-page-widget').first();\n if(widget_element.length){}\n else{\n var widget_element = jQuery(element).closest('.bestseller-slider').nextAll('.listing-page-widget').first();\n }\n widget_element.animate({height:'0px'},1000,function(){recommendedWidgetOnClickList(element,id)});\n }\n }else if(jQuery(\"body\").hasClass('catalog-product-view') ){\n if((jQuery(element).closest('li.widget-sliderbox').length == 0)&&(jQuery(element).closest('#cbar_widget01').length == 0)){\n console.log(\"recommendedWidgetOnClick\");\n recommendedWidgetOnClick();\n }else{\n console.log(\"Not recommendedWidgetOnClick\");\n }\n }\n Unbxd.track(\"click\",{\"pid\": +id ,\"prank\":\"\"});\n Unbxd.track(\"addToCart\", {\"pid\": id});\n if(window.amo_tag_params==undefined)\n {\n window.amo_tag_params = {\n ut1 : data.itemids,\n ut2 : data.category,\n ut3 : data.brand,\n };\n }\n else{\n window.amo_tag_params['ut1'] = data.itemids;\n window.amo_tag_params['ut2'] = data.category;\n window.amo_tag_params['ut3'] = data.brand;\n window.amo_tag_params['flag'] = 'yes';\n }\n console.log(\"---------\"+window.amo_tag_params['ut1']);\n console.log(\"---------\"+window.amo_tag_params['ut2']);\n console.log(\"---------\"+window.amo_tag_params['ut3']);\n\n var ga_name = jQuery('#product-opt-'+id+' .ga_product_name').val();\n var ga_price = jQuery('#product-opt-'+id+' .ga_product_price').val();\n var ga_price = parseInt(ga_price);\n var cat_hn = jQuery('#product-opt-'+id).parents('.home-bestseller').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var cat_wn = jQuery('#product-opt-'+id).parents('.product_widget_slider_home').eq(0).find('.nykaa-choice a').text().replace(/'/g,\"\");\n var ppriceid = jQuery(\"#bundleviewprice_\"+id).val();\n if(ppriceid == undefined){\n var str = jQuery(\"#old-price-\"+id).html();\n if(typeof str != 'undefined'){\n ppriceid = str.replace(\"Rs. \", \"\");\n }\n }\n setBundlePixel(id,url,'',ppriceid,tparam);\n if(cat_hn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/hp/'+cat_hn,ga_price);\n } else if (cat_wn) {\n ga('send', 'event', 'Add to Cart',ga_name, 'post/category/'+cat_wn,ga_price);\n } else {\n ga('send', 'event', 'Add to Cart',ga_name, 'post',ga_price);\n }\n } else {\n ga('send', 'event', 'Checkout Error', 'Add to Cart', data.message);\n }\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n } catch (e) {\n }\n }\n\n function showMobileOptions(url, id, flag, obj) {\n var objId = jQuery(obj).parent().parent();\n if (jQuery(objId).find('#product_view_' + id).is(':hidden') && false) {\n\n jQuery(objId).find('img.discount-tag').hide();\n jQuery(objId).find('#product_view_' + id).show();\n jQuery(objId).find('.org_add').hide();\n jQuery(objId).find('.discount_offer_tag_label').hide();\n jQuery(objId).find('.nykaa-tags').hide();\n jQuery('.wishlist-id-' + id + '').hide();\n jQuery(objId).css({border: 'none'});\n } else {\n if (flag == 'notify') {\n url += 'outofstock/1';\n } else if (flag) {\n url += 'WishId/' + flag;\n }\n jQuery('#ajax_loader' + id).show();\n ajaxLoading();\n url += '?eq=mobile';\n jQuery.ajax({\n type: 'GET',\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n closeAjaxLoading();\n if (flag == 'notify') {\n lightbox(data, null, 2);\n jQuery('#lightbox').css('position', 'fixed');\n return;\n } else {\n jQuery('#ajax_loader' + id).hide();\n lightbox(data, null, 2);\n jQuery('#lightbox #closelb').remove();\n jQuery('body #lightbox').css('width', '300px !important');\n jQuery('body #lightbox').css('height', '300px !important');\n jQuery('#lightbox').css('position', 'fixed');\n jQuery(\"#shade-scrollbar .demooo\").mCustomScrollbar({\n live: true,\n liveSelector: '#shade-scrollbar .demooo',\n autoDraggerLength: true,\n advanced: {\n updateOnContentResize: true,\n updateOnImageLoad: false\n }\n });\n }\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n }\n\n function getNotifyForm(id) {\n jQuery('#outofstockSubscriptionOnCategory .product_subscr_id').val(id);\n lightbox(jQuery('#outofstockSubscriptionOnCategory').html(), null, null);\n }\n\n function outofstockSubscriptionOnCategory() {\n var validate = validateSubscrEmail(jQuery('#lightbox #subscription_email').val());\n if (!validate) {\n return false;\n }\n var p_id = jQuery('#lightbox .product_subscr_id').val();\n ga('send','event','Notify Me',p_id,'Category Page');\n var url = '/ajaxaddcart/index/outofStockSubscription/';\n var req_data = 'subscription_email=' + jQuery('#lightbox #subscription_email').val();\n req_data += '&product=' + jQuery('#lightbox .product_subscr_id').val();\n req_data += '&isAjax=1';\n if (!jQuery('#lightbox .product_subscr_id').val()) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('Please Select Shade.');\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n return;\n }\n jQuery.ajax({\n type: 'POST',\n data: req_data,\n dataType: \"json\",\n url: url,\n beforeSend: function () {\n pace.on();\n },\n success: function (data) {\n if (data.error) {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('error-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n } else {\n try\n {\n _taq.events.push(['notifyme',{'product_id':data.product_id ,'email':data.email ,'device':\"desktop\" , 'product_name':data.product_name ,'Associated_categories':data.associated_categories, 'Associated_brand':data.associated_brand , 'MRP':data.mrp , 'selling_price':data.selling_price }]);\n }catch(err){}\n jQuery('#lightbox #subscription_email').val('');\n jQuery('#lightbox #ajax_msg_blck .aj_msg').addClass('success-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text(data.message);\n setTimeout(function () {\n jQuery('#lightbox #ajax_msg_blck .aj_msg').removeClass('successf-msg');\n jQuery('#lightbox #ajax_msg_blck .aj_msg ul li span').text('');\n jQuery('#lightbox #ajax_msg_blck').hide('slow');\n }, 3000);\n }\n jQuery('#lightbox #ajax_msg_blck').show('slow');\n },\n error: function () {\n },\n complete: function () {\n pace.off();\n pace.init();\n }\n });\n }\n\n\r\n jQuery(document).ready(function(e) {\r\n jQuery('.product_list_ul').slick({\r\n slidesToShow: 3,\r\n dots:false,\r\n slide: 'li',\r\n arrows:true,\r\n responsive: [\r\n {\r\n breakpoint: 1024,\r\n settings: {\r\n arrows: true,\r\n centerMode: true,\r\n centerPadding: '0px',\r\n slidesToShow: 3\r\n }\r\n },\r\n {\r\n breakpoint: 480,\r\n settings: {\r\n arrows: true,\r\n centerMode: true,\r\n centerPadding: '0px',\r\n slidesToShow: 2\r\n }\r\n },\r\n {\r\n breakpoint: 320,\r\n settings: {\r\n arrows: true,\r\n centerMode: true,\r\n centerPadding: '0px',\r\n slidesToShow: 2\r\n }\r\n }\r\n ]\r\n\r\n });\r\n jQuery('.slider').slick({\r\n slidesToShow: 1,autoplay:true,\r\n dots:true,\r\n slide: 'li',\r\n arrows:false,\r\n });\r\n\r\n\t \r\n\r\n });\r\n function JSGET(param) { var vars = {}; window.location.href.replace( location.hash, '' ).replace( /[?&]+([^=&]+)=?([^&]*)?/gi, /* regexp */function( m, key, value ) { /* callback */vars[key] = value !== undefined ? value : ''; } ); if ( param ) return vars[param] ? vars[param] : null; return vars; } if(window.datalayer == undefined){ window.datalayer = {}; } window.datalayer['pageName'] = 'Responsive:cheryls-brand-store'; window.datalayer['dataeVar91'] = 'Brand Page'; if(JSGET('intcmp')){ window.datalayer['dataeVar34'] = 'Internal Campaigns'; window.datalayer['dataeVar35'] = 'Internal Campaigns : '+JSGET('intcmp'); }else{ window.datalayer['dataeVar34'] = 'Brand Page'; window.datalayer['dataeVar35'] = 'Brand Page:cheryls-brand-store'; } if(window.DTM_tag_params == undefined){ window.DTM_tag_params = {}; } window.DTM_tag_params['dtm_pagetype'] = 'cmspage';