PageSourceSearch

https://scilearnix.com/wp-content/plugins/copy-the-code/classes/elementor/widgets/coupon/script.js?ver=4.1.1

js scilearnix.com collected 2026-10-04 22:29:39 UTC 1,903 bytes, 91 lines download raw bytes

1(function ($) {
2	const CTCCoupon = {
3
4		/**
5		 * Init
6		 */
7		init: function () {
8			this._bind();
9		},
10
11		/**
12		 * Binds events
13		 */
14		_bind: function () {
15			$( document ).on( 'click', '.ctc-coupon-toggle-link', this.toggleDetails );
16			$( document ).on( 'click', '.ctc-coupon-link', this.handleClick );
17		},
18
19		/**
20		 * Handle click
21		 */
22		handleClick: function (event) {
23			event.preventDefault()
24
25			const self   = $( this )
26			const parent = self.parents( '.ctc-coupon' )
27			if ( parent.hasClass( 'ctc-coupon-clicked' ) ) {
28				return
29			}
30
31			const href       = self.attr( 'href' )
32			const target     = self.attr( 'target' )
33			const couponCode = parent.find( '.ctc-coupon-code' ).text().trim() || ''
34			console.log( couponCode )
35
36			parent.addClass( 'ctc-coupon-clicked' )
37
38			CTCWP.copy( couponCode )
39
40			window.open( href, target )
41		},
42
43		/**
44		 * Handle click
45		 */
46		oldHandleClick: function (event) {
47			event.preventDefault();
48
49			const self   = $( this )
50			const href   = self.data( 'href' )
51			const target = self.data( 'target' )
52			const btn    = self.find( '.ctc-coupon-button' )
53
54			// Clicked then open the link
55			if ( ! self.hasClass( 'ctc-coupon-link-clicked' ) ) {
56				window.open( href, target )
57
58				self.addClass( 'ctc-coupon-link-clicked' )
59				btn.text( 'Copy Code' )
60			}
61
62			if ( self.hasClass( 'ctc-coupon-link-clicked' ) ) {
63				self.addClass( 'ctc-coupon-link-copied' )
64				btn.text( 'Copied' )
65			}
66		},
67
68		/**
69		 * Toggle Details
70		 */
71		toggleDetails: function (event) {
72			event.preventDefault();
73
74			const self    = $( this )
75			const coupon  = self.parents( '.ctc-coupon' )
76			const details = coupon.find( '.ctc-toggle-details' )
77
78			details.slideToggle( 'fast' )
79		}
80	};
81
82	/**
83	 * Initialization
84	 */
85	$(
86		function () {
87			CTCCoupon.init();
88		}
89	);
90
91})( 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.