PageSourceSearch

https://www.klondyke.co.uk/shop/js/kgkrunch_custom.js?v=1.3

js klondyke.co.uk collected 2026-10-02 13:03:23 UTC 7,673 bytes, 173 lines download raw bytes

1jQuery(document).ready(function() {
2	if (jQuery(window).width() < 749) {
3		jQuery('.widgettitle').siblings().css("display", "none");
4		jQuery('.widgettitle').click(function() {
5			jQuery(this).siblings().toggle();
6		});
7	}
8	
9});
10// jQuery(document).ready(function() {
11// 	var td = jQuery(".kg_mobile .kgkg td");          
12// td.each(function(i){                        
13//     if (i % 3 == 0) {                      
14//         td.slice(i, i+3).wrapAll('<tr/>')    
15//     }
16// }).parent('tr').unwrap(); 
17
18// });
19
20
21jQuery( document ).ready(function() {
22	 jQuery(document.body).on('click', '.wishlist-icon', (function() 
23	 {
24		var current_block = jQuery(this);
25		var kg_product_stkcode = jQuery(this).attr('stkcode');
26		var kg_image ;
27		var kg_cart_button ;
28		if(jQuery(this).hasClass('product-view'))
29		{
30			//var kg_product_name = jQuery.trim(jQuery(this).parent().parent().find('.entry-title').html());
31			var kg_product_name = jQuery.trim(jQuery(this).parent().parent().parent().find('.title.title-left h1').html());
32			var kg_price = jQuery.trim(jQuery(current_block).parent().parent().parent().find('.price').html());
33			var kg_image = jQuery(this).attr('kg_product_image');
34			var kg_product_link = jQuery("link[rel='canonical']").attr("href");
35			var kg_cart_button = jQuery.trim(jQuery(current_block).parent().parent().parent().find('.kg_cart_button').html());
36		}
37		else
38		{
39			console.log( jQuery(this).parent().parent().parent().parent().parent().find('.product-title').text());
40			var kg_product_name = jQuery(this).parent().parent().parent().parent().parent().find('.product-title').text();
41			var kg_price = jQuery.trim(jQuery(this).parent().parent().parent().parent().parent().find('.price').html());
42			var kg_image = jQuery(this).parent().parent().parent().parent().parent().find('img').attr('src');
43			var kg_product_link = jQuery(this).parent().parent().parent().parent().parent().find('.product-content-image').attr('href');
44			//var kg_cart_button = jQuery.trim(jQuery(this).parent().parent().parent().find('.kg_cart_button').html().replace(/Item Added/g, "Add to Basket"));
45			var kg_cart_button = jQuery.trim(jQuery(this).parent().parent().parent().parent().parent().find('.kg_cart_button').html());
46			//var n_occurence = 2
47			//kg_cart_button = kg_cart_button;
48		}
49		
50		var product_data = {};
51		product_data["kg_product_stkcode"]  = kg_product_stkcode;
52		product_data["kg_product_name"] 	= kg_product_name;
53		product_data["kg_price"] 			= kg_price;
54		product_data["kg_image"] 			= kg_image;
55		product_data["kg_product_link"] 	= kg_product_link;
56		product_data["kg_cart_button"] 		= kg_cart_button;
57
58		jQuery.ajax({
59			url: '/wp-content/wishlist.php',
60			method: 'POST',
61			data: {
62				'action_type': 'add',
63				'product_data': product_data
64			},
65			dataType: 'json',
66			success: function(response){
67				jQuery.magnificPopup.open({
68					items: { src: '<div class="quick-view-popup add-to-success-popup mfp-with-anim"><div class="doubled-border">Thank you. This item has now been added to your wishlist</div><a href="/shop/static/wishlist.html" title="Comparable Products" class="kg_popup_wishlist_btn btn gray big icon-right c-button">My Wishlist</a></div>' },
69					type: 'inline',
70					removalDelay: 300, //delay removal by X to allow out-animation
71					callbacks: {
72						beforeOpen: function() {
73							this.st.mainClass = 'my-mfp-slide-bottom';
74						},
75						open: function() {
76							/*setTimeout(function(){
77								jQuery.magnificPopup.close();
78							},2000); // 10000 == 10seconds*/
79						}
80					}
81				}, 0);
82			}
83		});
84
85	}));
86			
87	jQuery(document.body).on('click', '.compare-icon', (function() 
88	{
89		var current_block = jQuery(this);
90		var kg_product_stkcode = jQuery(this).attr('stkcode');
91		var kg_image ;
92		var kg_cart_button ;
93
94		if(jQuery(this).hasClass('product-view'))
95		{
96			//var kg_product_name = jQuery.trim(jQuery(this).parent().parent().find('.entry-title').html());
97			var kg_product_name = jQuery.trim(jQuery(this).parent().parent().parent().find('.title.title-left h1').html());
98			var kg_price = jQuery.trim(jQuery(current_block).parent().parent().parent().find('.price').html());
99			var kg_image = jQuery(this).attr('kg_product_image');
100			var kg_product_link = jQuery("link[rel='canonical']").attr("href");
101			var kg_stock_availability = jQuery.trim(jQuery(current_block).parent().parent().parent().find('.stock-availability').text());
102			//var kg_description = jQuery.trim(jQuery(current_block).parent().parent().find('.short-description').html());
103			var kg_description = jQuery.trim(jQuery(current_block).parent().parent().parent().parent().parent().parent().find('.short-description').html());
104			var kg_cart_button = jQuery.trim(jQuery(current_block).parent().parent().parent().find('.kg_cart_button').html());
105
106		}
107		else
108		{
109			var kg_product_name = jQuery(this).parent().parent().parent().parent().find('.product-details .product-title').text();
110			var kg_price = jQuery.trim(jQuery(this).parent().parent().parent().parent().find('.product-details .price').html());
111			var kg_image = jQuery(this).parent().parent().parent().parent().find('img').attr('src');
112			var kg_product_link = jQuery(this).parent().parent().parent().parent().find('.product-content-image').attr('href');
113			var kg_stock_availability = jQuery.trim(jQuery(this).parent().parent().parent().parent().find('.product-details .stock-availability').text());
114			var kg_description = jQuery.trim(jQuery(this).parent().parent().parent().parent().find('.product-details .kg_product_description').html());
115			//var kg_cart_button = jQuery.trim(jQuery(this).parent().parent().parent().find('.kg_cart_button').html().replace(/Item Added/g, "Add to Basket"));
116			var kg_cart_button = jQuery.trim(jQuery(this).parent().parent().parent().parent().find('.kg_cart_button').html());
117		}
118		
119		var product_data = {};
120		product_data["kg_product_stkcode"] = kg_product_stkcode;
121		product_data["kg_product_name"] 	= kg_product_name;
122		product_data["kg_price"] 			= kg_price;
123		product_data["kg_image"] 			= kg_image;
124		product_data["kg_product_link"] 	= kg_product_link;
125		product_data["kg_stock_availability"] 	= kg_stock_availability;
126		product_data["kg_description"] 	= kg_description;
127		product_data["kg_cart_button"] 		= kg_cart_button;
128
129
130		jQuery.ajax({
131			url: '/wp-content/compare.php',   
132			method: 'POST',
133			data: {
134				'action_type': 'add',
135				'product_data': product_data
136			},
137			dataType: 'json',
138			success: function(response){
139				
140				jQuery.magnificPopup.open({
141					items: { src: '<div class="quick-view-popup add-to-success-popup mfp-with-anim"><div class="doubled-border">Thank you. This item has now been added to your compare list</div><a href="/shop/static/compare.html" title="Compare Items" class="kg_popup_compare_btn btn gray big icon-right c-button">Compare Items</a></div>' },
142					type: 'inline',
143					removalDelay: 300, //delay removal by X to allow out-animation
144					callbacks: {
145						beforeOpen: function() {
146							this.st.mainClass = 'my-mfp-slide-bottom';
147						},
148						open: function() {
149							/*setTimeout(function(){
150								jQuery.magnificPopup.close();
151							},2000); // 10000 == 10seconds*/
152						}
153					}
154				}, 0);
155			}
156		});
157
158	}));
159			
160	//set_active_wishlist();
161	//set_active_compare();
162});
163
164function set_active_wishlist()
165{
166	jQuery(".wishlist-icon").each(function() {
167    	var kg_product_stkcode = jQuery(this).attr('stkcode');
168		if(jQuery.cookie('wishlist_'+kg_product_stkcode))
169		{ 
170			jQuery(this).toggleClass('active');	
171		}
172	});
173}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.