PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 1.6.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v1.6.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / assets / js / ultimate-store-kit-core.js

ultimate-store-kit-core.js in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 1.6.4, at assets/js/ultimate-store-kit-core.js

235 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function ($, elementor) {
2 "use strict";
3 $(document).on("click", ".quick_view", function () {
4 var product_id = $(this).data("id");
5 get_product_details(product_id);
6 });
7
8 //woocommerce gallery
9 $(document).on("click", ".thumbnails a", function (e) {
10 var img_url = $(this).attr("data-href");
11 $(".usk-modal-image-wrapper .images > a").attr("href", img_url);
12 $(".usk-modal-image-wrapper .images > a > img").attr({
13 src: img_url,
14 srcset: img_url,
15 });
16 });
17 $(document).on(
18 "click",
19 ".usk-modal-page .usk-modal-product .images a",
20 function (e) {
21 e.preventDefault();
22 var img_url = $(this).attr("data-href");
23 var img_src = $(this).find("img").attr("srcset");
24 // $('.woocommerce-main-image').find('img').attr('src', img_url);
25 // $('.woocommerce-main-image').find('img').attr('srcset', img_src);
26 $(".woocommerce-main-image").closest("a").attr("href", img_url);
27
28 $(".woocommerce-main-image").find("img").attr({
29 src: img_url,
30 srcset: img_src,
31 });
32
33 $("a.zoom").prettyPhoto({
34 hook: "data-rel",
35 social_tools: false,
36 theme: "pp_woocommerce",
37 horizontal_padding: 20,
38 opacity: 0.8,
39 deeplinking: false,
40 });
41 $("a[data-rel^='prettyPhoto']").prettyPhoto({
42 hook: "data-rel",
43 social_tools: false,
44 theme: "pp_woocommerce",
45 horizontal_padding: 20,
46 opacity: 0.8,
47 deeplinking: false,
48 });
49 }
50 );
51
52 function get_product_details(product_id) {
53 if (product_id !== undefined) {
54 jQuery.ajax({
55 type: "POST",
56 url: ultimate_store_kit_ajax_config.ajaxurl,
57 data: {
58 action: "ultimate_store_kit_wc_product_quick_view_content",
59 product_id: product_id,
60 },
61 success: function (response) {
62 setTimeout(function () {
63 $("#quick-view-id").html(response);
64 }, 1000);
65 },
66 });
67 }
68 }
69
70 $(".elementor-widget-usk-florence-grid").on(
71 "click",
72 ".usk-pagination a",
73 function (b) {
74 b.preventDefault();
75 const requestUrl = $(this).prop("href");
76 $.ajax({
77 url: requestUrl,
78 success: function (d) {
79 var data = $(d).find(".elementor-widget-usk-florence-grid");
80 $(".elementor-widget-usk-florence-grid").html(data);
81 if (window.history.pushState) {
82 window.history.pushState({}, "", requestUrl);
83 }
84 },
85 });
86 }
87 );
88
89 // ========================================
90 // AJAX START
91 // ========================================
92
93 $(".ajax_add_to_wishlist").on("click", function (e) {
94 e.preventDefault();
95 var $this = $(this);
96 var $product_id = $this.data("product_id");
97 $.ajax({
98 url: ultimate_store_kit_ajax_config.ajaxurl,
99 data: {
100 action: "usk_add_to_wishlist",
101 product_id: $product_id,
102 },
103 type: "POST",
104 dataType: "JSON",
105 success: function (response) {
106 if (response.action === "added") {
107 $this.addClass("usk-active").attr("aria-label", response.message);
108 $(".usk-wishlist-button")
109 .find(".usk-wishlist-count")
110 .html(response.count);
111 } else {
112 $this.removeClass("usk-active").attr("aria-label", response.message);
113 $this.attr({
114 href: "javascript:void(0);",
115 });
116 }
117 },
118 error: function (response) {
119 console.log(response);
120 },
121 });
122 });
123 $(".ajax_remove_from_wishlist").on("click", function (e) {
124 e.preventDefault();
125 var $this = $(this);
126 var $product_id = $this.data("product_id");
127 $.ajax({
128 url: ultimate_store_kit_ajax_config.ajaxurl,
129 data: {
130 action: "usk_add_to_wishlist",
131 product_id: $product_id,
132 },
133 type: "POST",
134 dataType: "JSON",
135 success: function (response) {
136 if (response.action == "removed") {
137 $this.closest("tr").remove();
138 $(".usk-wishlist-button")
139 .find(".usk-wishlist-count")
140 .html(response.count);
141 }
142 },
143 error: function (response) {
144 console.log(response);
145 },
146 });
147 });
148
149 $(".ajax_add_to_compare").on("click", function (e) {
150 var $this = $(this);
151 var $product_id = $this.data("product_id");
152 $.ajax({
153 url: ultimate_store_kit_ajax_config.ajaxurl,
154 data: {
155 action: "usk_add_to_compare_products",
156 product_id: $product_id,
157 },
158 type: "POST",
159 dataType: "JSON",
160 success: function (response) {
161 if (response.action === "added") {
162 $(".usk-compare-button")
163 .find(".usk-compare-count")
164 .html(response.count);
165 $this.addClass("usk-active").attr({
166 href: response.url,
167 "aria-label": response.message,
168 });
169 } else {
170 $this.attr({
171 href: "javascript:void(0);",
172 "aria-label": response.message,
173 });
174 }
175 },
176 error: function (response) {
177 console.log(response);
178 },
179 });
180 });
181
182 $(".ajax_add_to_cart").on("click", function (e) {
183 e.preventDefault();
184 var $this = $(this);
185 $this.attr("aria-label", "Added to cart");
186 });
187 // ========================================
188 // AJAX END
189 // ========================================
190 $(document).ready(function () {
191 var loader = `<div class="usk-bouncing-loader"><div></div><div></div><div></div></div>`;
192 var width = $(".product-quick-view").data("modal-width");
193 var height = $(".product-quick-view").data("modal-height");
194 var animation = $(".product-quick-view").data("animation");
195 var close_btn = $(".product-quick-view").data("close-btn");
196 var btn_style = $(".product-quick-view").data("btn-style");
197 // var btn_place = $('.product-quick-view').data('btn-place');
198 var btn_text = $(".product-quick-view").data("btn-text");
199 var modal_bg = $(".product-quick-view").data("modal-bg");
200 var modal_overlay = $(".product-quick-view").data("modal-overlay");
201 $(".product-quick-view").SlickModals({
202 popup_reopenClass: "quick_view",
203 popup_animation: animation,
204 overlay_animation: animation,
205 popup_closeButtonEnable: close_btn,
206 popup_closeButtonStyle: btn_style,
207 popup_closeButtonText: btn_text,
208 popup_closeButtonPlace: "inside",
209 popup_css: {
210 width: width ? width + "px" : "800px",
211 height: height ? height + "px" : "450px",
212 background: modal_bg ? modal_bg : "#fff",
213 "overflow-y": "auto",
214 "animation-duration": "0.7s",
215 },
216 overlay_css: {
217 background: modal_overlay,
218 },
219 mobile_breakpoint: "768px",
220 mobile_position: "center",
221 mobile_css: {
222 width: "300px",
223 padding: "30px",
224 margin: "20px",
225 },
226 callback_afterClose: function () {
227 $("#quick-view-id").html(loader);
228 },
229 callback_beforeOpen: function () {
230 $("#quick-view-id").html(loader);
231 },
232 });
233 });
234 })(jQuery, window.elementorFrontend);
235