PageSourceSearch

https://fulltextsearch.org/wp-content/plugins/slicewp/assets/js/script-trk.js?ver=1.1.32

js fulltextsearch.org collected 2026-09-25 21:04:57 UTC 3,296 bytes, 181 lines download raw bytes

1var slicewp_register_visit = function() {
2
3	if ( typeof slicewp === 'undefined' ) {
4		return false;
5	}
6
7	var cookie_aff = get_cookie( 'slicewp_aff' );
8	var aff;
9
10	if ( slicewp.affiliate_credit == 'first' && cookie_aff ) {
11		return false;
12	}
13
14	if ( slicewp.post_affiliate_id ) {
15	
16		aff = slicewp.post_affiliate_id;
17
18		if ( cookie_aff && cookie_aff == aff ) {
19			return false;
20		}
21
22	} else {
23
24		aff = get_query_arg( slicewp.affiliate_keyword );
25		aff = ( aff != '' ? aff : get_query_arg_pretty( slicewp.affiliate_keyword ) );
26
27		if ( aff == '' ) {
28			return false;
29		}
30	
31		if ( slicewp.affiliate_credit == 'last' && cookie_aff && cookie_aff == aff ) {
32			return false;
33		}
34
35	}
36
37
38	var data = new FormData();
39
40	data.append( 'action', 'slicewp_register_visit' );
41	data.append( 'aff', aff );
42	data.append( 'landing_url', document.URL );
43	data.append( 'referrer_url', document.referrer );
44
45	var request = new XMLHttpRequest();
46
47	request.open( 'POST', slicewp_ajaxurl, true );
48
49	request.onload = function () {
50
51        if ( this.status >= 200 && this.status < 400 ) {
52            
53			var response = JSON.parse( this.response );
54
55			if ( response.success > 0 ) {
56
57				set_cookie( 'slicewp_aff', response.affiliate_id );
58				set_cookie( 'slicewp_visit', response.visit_id );
59
60			} else {
61
62				// For debugging purposes.
63				console.log( response );
64
65			}
66
67        }
68
69    };
70
71	request.send( data );
72
73
74	/**
75	 * Returns the value of the query argument requested from the current URL, if present.
76	 *
77	 * @param string arg
78	 *
79	 * @return string
80	 *
81	 */
82	function get_query_arg( arg ) {
83
84		var query = window.location.search.slice(1);
85		var parts = query.split('&');
86		var obj   = {};
87
88		parts.map( function( part ) {
89
90			part = part.split('=');
91
92			obj[part[0]] = part[1];
93
94		});
95
96		return ( typeof obj[arg] != 'undefined' ? obj[arg] : '' );
97
98	}
99
100
101	/**
102	 * Returns the value of the query argument requested from the current prettified URL, if present.
103	 *
104	 * @param string arg
105	 *
106	 * @return string
107	 *
108	 */
109	function get_query_arg_pretty( arg ) {
110
111		var path  = window.location.pathname;
112		var parts = path.split( '/' );
113		var val   = '';
114
115		for ( var i = 0; i < parts.length; i++ ) {
116
117			if ( parts[i] == arg ) {
118				val = parts[i+1];
119				break;
120			}
121
122		}
123
124		return val;
125
126	}
127
128
129	/**
130	 * Set a cookie.
131	 *
132	 * @param string name
133	 * @param string value
134	 *
135	 */
136	function set_cookie( name, value ) {
137
138	    var d = new Date();
139	    d.setTime( d.getTime() + ( slicewp.cookie_duration * 24 * 60 * 60 * 1000 ) );
140	    var expires = "expires=" + d.toUTCString();
141
142	    document.cookie = name + "=" + value + "; " + expires + "; " + "path=/;";
143
144	}
145
146
147	/**
148	 * Get a cookie.
149	 *
150	 * @param string name
151	 *
152	 * @return string
153	 *
154	 */
155	function get_cookie( name ) {
156
157	    var name = name + "=";
158	    var ca 	 = document.cookie.split(';');
159
160	    for ( var i=0; i<ca.length; i++ ) {
161	        var c = ca[i];
162	        while ( c.charAt(0)==' ' ) c = c.substring(1);
163	        if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
164	    }
165
166	    return false;
167
168	}
169
170}
171
172
173if ( document.readyState === "complete" || ( document.readyState !== "loading" && ! document.documentElement.doScroll ) ) {
174
175	slicewp_register_visit();
176
177} else {
178
179  document.addEventListener( "DOMContentLoaded", slicewp_register_visit );
180
181}

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.