PageSourceSearch

https://trunghocduytan.com/media/distribution/click-tracker.js

js trunghocduytan.com collected 2026-09-27 05:41:43 UTC 3,781 bytes, 117 lines download raw bytes

1// Copyright (C) 2005-2008 Ilya S. Lyubinskiy. All rights reserved.
2// Technical support: http://www.php-development.ru/
3//
4// YOU MAY NOT
5// (1) Remove or modify this copyright notice.
6// (2) Re-distribute this code or any part of it.
7//     Instead, you may link to the homepage of this code:
8//     http://www.php-development.ru/php-scripts/click-tracker.php
9// (3) Use this code as a part of another product.
10//
11// YOU MAY
12// (1) Use this code on your website.
13//
14// NO WARRANTY
15// This code is provided "as is" without warranty of any kind.
16// You expressly acknowledge and agree that use of this code is at your own risk.
17
18
19// ***** Aux *******************************************************************
20
21// ***** clicktracker_inarray  *****
22
23function clicktracker_inarray (arr, val)
24{
25  for (var i in arr) if (arr[i] == val) return true;
26  return false;
27}
28
29// ***** clicktracker_innertxt *****
30
31function clicktracker_innertxt(str)
32{
33  str = str.replace(/<[^>]*>/g, ' ');
34  str = str.replace(  /&amp;/g, '&');
35  str = str.replace( /&nbsp;/g, ' ');
36  str = str.replace(   /^\s+/g,  '');
37  str = str.replace(   /\s+$/g,  '');
38  return str;
39}
40
41
42// ***** URL *******************************************************************
43
44var clicktracker_re_scheme = "^\\w+://";
45var clicktracker_re_folder = "((?:-|\\w|\\.)*)";
46var clicktracker_re_domain = clicktracker_re_scheme+       clicktracker_re_folder;
47var clicktracker_re_urlall = clicktracker_re_domain+"(?:/"+clicktracker_re_folder+')*';
48
49// ***** clicktracker_domain *****
50
51function clicktracker_domain(url)
52{
53  var reg   = new RegExp(clicktracker_re_domain);
54  var match = reg.exec(url);
55  if (!match) return "";
56  match = match[match.length-1];
57  return match;
58}
59
60// ***** clicktracker_extension *****
61
62function clicktracker_extension(url)
63{
64  var reg   = new RegExp(clicktracker_re_urlall);
65  var match = reg.exec(url);
66  if (!match) return "";
67  match = match[match.length-1].split(".");
68  return (match.length >= 2) ? match[match.length-1] : "";
69}
70
71
72// ***** Track *****************************************************************
73
74// ***** clicktracker_aux *****
75
76function clicktracker_aux(url, title)
77{
78  var img = new Image();
79  img.src = clicktracker_url+"?url="+url+"&title="+title+"&rand="+Math.random();
80}
81
82// ***** clicktracker *****
83
84function clicktracker(e)
85{
86  var ie  = navigator.appName == "Microsoft Internet Explorer";
87  var src = ie ? window.event.srcElement : e.target;
88  var tag =  (src.tagName.toLowerCase() != "a") ? src.parentNode : src;
89
90  if (!tag || tag.tagName.toLowerCase() != "a") return;
91
92  domain    = clicktracker_domain   (tag.href);
93  extension = clicktracker_extension(tag.href);
94
95  if ( clicktracker_inarray(clicktracker_domains, domain) &&
96      !clicktracker_inarray(clicktracker_extensions, extension)) return;
97
98  var url   = tag.href;
99  var title = '';
100
101  if (!title) if (tag.tagName.toLowerCase() ==   "a") title = clicktracker_innertxt(tag.innerHTML);
102  if (!title) if (tag.tagName.toLowerCase() ==   "a") title = clicktracker_innertxt(tag.title);
103  if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innertxt(src.alt);
104  if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innertxt("Image");
105  url   = escape(url  .substr(0, 150));
106  title = escape(title.substr(0, 150));
107
108  if (url && title) setTimeout("clicktracker_aux('"+url+"', '"+title+"')", 10);
109  return;
110}
111
112
113// ***** Attach Events *********************************************************
114
115if (navigator.appName == "Microsoft Internet Explorer")
116     document.attachEvent   ('onclick', clicktracker);
117else document.addEventListener('click', clicktracker, false);

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.