PageSourceSearch

https://www.ipdt.org/wp-content/plugins/woocommerce-tm-extra-produ…/compatibility/assets/js/cp-quickview.js

js ipdt.org collected 2026-09-26 16:14:48 UTC 3,263 bytes, 110 lines download raw bytes

1( function( window, document, $ ) {
2	'use strict';
3
4	var TMEPOJS;
5	var tcAPI;
6
7	// document ready
8	$( function() {
9		TMEPOJS = window.TMEPOJS || null;
10		tcAPI = $.tcAPI ? $.tcAPI() : null;
11
12		if ( ! TMEPOJS || ! tcAPI ) {
13			return;
14		}
15
16		// Sober theme quickview fix
17		$( 'body' ).on( 'sober_quickview_opened', function() {
18			var product_id;
19			var epo_id;
20			var tmLazyloadContainer;
21
22			tmLazyloadContainer = $( '#quick-view-modal' );
23			$.tcepo.tmLazyloadContainer( tmLazyloadContainer );
24
25			product_id = tmLazyloadContainer.find( tcAPI.epoSelector ).attr( 'data-product-id' );
26			epo_id = tmLazyloadContainer.find( tcAPI.epoSelector ).attr( 'data-epo-id' );
27
28			$.tcepo.tm_init_epo( tmLazyloadContainer, true, product_id, epo_id );
29			$( window ).trigger( 'tmlazy' );
30			$( window ).trigger( 'tm_epo_loaded_quickview' );
31			if ( $.jMaskGlobals ) {
32				tmLazyloadContainer.find( $.jMaskGlobals.maskElements ).toArray().forEach( function( t ) {
33					t = $( t );
34
35					if ( t.attr( 'data-mask' ) ) {
36						t.mask( t.attr( 'data-mask' ) );
37					}
38				} );
39			}
40		} );
41		if ( window.ctEvents ) {
42			window.ctEvents.on( 'blocksy:frontend:init', function() {
43				// quickview plugins
44				var qv_container = TMEPOJS.quickview_array || 'null';
45				var fromaddons = TMEPOJS.quickview_container || 'null';
46				var added = {};
47				var selectors;
48				var container;
49				var product_id;
50				var epo_id;
51				var noProductCheck;
52				var time = 1;
53				var key = 'blocsky_get_woo_quick_view';
54				var tmLazyloadContainer;
55
56				$( '.tm-formepo-normal' ).remove();
57				$( '.tm-formepo' ).remove();
58
59				qv_container = $.epoAPI.util.parseJSON( qv_container );
60
61				fromaddons = $.epoAPI.util.parseJSON( fromaddons );
62
63				for ( selectors in fromaddons ) {
64					if ( Object.prototype.hasOwnProperty.call( fromaddons, selectors ) ) {
65						added[ fromaddons[ selectors ][ 0 ] ] = $( fromaddons[ selectors ][ 1 ] );
66					}
67				}
68
69				$.extend( qv_container, added );
70
71				noProductCheck = false;
72				container = $( qv_container[ key ] );
73
74				if ( container.find( '.product' ).length === 0 && container.is( '.product' ) ) {
75					noProductCheck = true;
76				}
77
78				if ( container.length && ( container.find( '.product' ).length > 0 || noProductCheck ) ) {
79					container.removeClass( 'tc-init' );
80
81					tmLazyloadContainer = container;
82					$.tcepo.tmLazyloadContainer( tmLazyloadContainer );
83
84					setTimeout( function() {
85						product_id = tmLazyloadContainer.find( tcAPI.epoSelector ).attr( 'data-product-id' );
86						epo_id = tmLazyloadContainer.find( tcAPI.epoSelector ).attr( 'data-epo-id' );
87						if ( key === 'woodmart_quick_shop' ) {
88							container.addClass( 'has-options' );
89						}
90
91						// Reset element cache
92						tcAPI.getElementFromFieldCache = [];
93						$.tcepo.tm_init_epo( tmLazyloadContainer, true, product_id, epo_id );
94						$( window ).trigger( 'tmlazy' );
95						$( window ).trigger( 'tm_epo_loaded_quickview' );
96						if ( $.jMaskGlobals ) {
97							tmLazyloadContainer.find( $.jMaskGlobals.maskElements ).toArray().forEach( function( t ) {
98								t = $( t );
99
100								if ( t.attr( 'data-mask' ) ) {
101									t.mask( t.attr( 'data-mask' ) );
102								}
103							} );
104						}
105					}, time );
106				}
107			} );
108		}
109	} );
110}( window, document, window.jQuery ) );

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.