PageSourceSearch

https://dulist.hr/wp-content/plugins/wpadcenter/public/js/wpadcenter-public.js

js dulist.hr collected 2026-10-02 11:35:43 UTC 2,270 bytes, 92 lines download raw bytes

1/**
2 * Javascript file for public section.
3 *
4 * @since 1.0.0
5 *
6 * @package
7 */
8
9( function( $ ) {
10	'use strict';
11
12	/**
13	 * All of the code for your public-facing JavaScript source
14	 * should reside in this file.
15	 *
16	 * Note: It has been assumed you will write jQuery code here, so the
17	 * $ function reference has been prepared for usage within the scope
18	 * of this function.
19	 *
20	 * This enables you to define handlers, for when the DOM is ready:
21	 *
22	 * $(function() {
23	 *
24	 * });
25	 *
26	 * When the window is loaded:
27	 *
28	 * $( window ).load(function() {
29	 *
30	 * });
31	 *
32	 * ...and/or other possibilities.
33	 *
34	 * Ideally, it is not considered best practise to attach more than a
35	 * single DOM-ready or window-load handler for a particular page.
36	 * Although scripts in the WordPress core, Plugins and Themes may be
37	 * practising this, we should strive to set a better example in our own work.
38	 */
39	/*global jQuery, ajax_url*/
40	$( document ).ready( function() {
41		//track clicks on ads rendered without iframe.
42		$( document ).on(	'click', '#wpadcenter_ad', function() {
43			var boundAdClick = onAdClick.bind( this );
44			boundAdClick();
45		} );
46
47		var onAdClick = function() {
48			var ad_id = $( this ).data( 'value' );
49			var placement_id = $( this ).data( 'placement' );
50			var request = {
51				action: 'set_clicks',
52				ad_id: ad_id,
53				placement_id: placement_id,
54				security: ajax_url.security,
55				async: false,
56			};
57			$.ajax( {
58				url: ajax_url.url,
59				dataType: 'json',
60				type: 'POST',
61				data: request,
62				async: false,
63				success: function( response ) {
64					if ( /(^|;)\s*wpadcenter_hide_ads=/.test( document.cookie ) ) {
65						$( '.wpadcenter-ad-container' ).hide();
66						$( '.wpadcenter-adgroup' ).hide();
67					}
68				},
69				error: function() {
70
71				},
72			} );
73		};
74
75		//track clicks on ads rendered within iframe.
76		setTimeout( function() {
77			window.addEventListener( 'blur', function() {
78				window.setTimeout( function() {
79					if ( document.activeElement instanceof HTMLIFrameElement ) {
80						var ad = document.activeElement.closest( '#wpadcenter_ad' );
81						if ( ad ) {
82							var boundAdClick = onAdClick.bind( ad );
83							boundAdClick();
84							window.focus();
85						}
86					}
87				}, 0 );
88			} );
89		}, 1000 );
90	} );
91}( jQuery ) );
92

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.