save-status-assets-11801fdee82d0c61262c.js 1.6 KB

1
  1. (()=>{var t={42948:(t,e,a)=>{"use strict";a.r(e)}},e={};function a(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,a),i.exports}a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a(42948),function(t,e){function a(e,a){e.data("url",a.updateSaveStatusUrl),e.data("requiresTallerBox",a.requiresTallerBox);var o=e.find("a");o.toggleClass("saved",a.isSaved),t.each(o,(function(){var e=t(this);e.parents().hasClass("gallery-portal-top")?e.attr("data-webm-clickvalue",a.isSaved?"unsave-item":"save-item"):e.attr("data-webm-clickvalue",a.isSaved?"unsave-item-nav":"save-item-nav")}))}function o(o){var n=o.data("url");t.get(n).done((function(n){a(o,n),o.click((function(n){n.stopPropagation(),function(e){t.post(e.data("url"),{requestUrl:window.location.href}).done((function(o){if(o.updateSaveStatusUrl)a(e,o);else{var n={html:o};e.data("requiresTallerBox")&&(n.height=360),t.colorbox(n)}})).fail((function(t){console.log("ROBOT: Could not save the item")}))}(o);var i=t(this).find("a");e.optimizelyUtil&&e.optimizelyUtil.track(i.attr(i.hasClass("saved")?"data-opm-event-unsave":"data-opm-event-save"))}))})).fail((function(t){console.log("ROBOT: Do not know if this item is saved")}))}t((function(){t("#save_item_components").children().each((function(){var e=t(this);t(e.data("target")).append(e)}));var a=t(".section-saved-status");o(a),t(e).on("EnquirySaveCar",(function(){setTimeout((function(){o(t(a))}),1499)}))}))}(jQuery,window)})();