· 6 years ago · Mar 23, 2020, 01:44 PM
1! function(self_name) {
2 var viglink, $;
3 $ = {
4 each: function(a, b) {
5 var c, d;
6 for (c = 0, d = a.length; c < d; c++) b(a[c], c)
7 },
8 extend: function(a) {
9 var b, c, d, e, f = arguments.length;
10 for (a = a || {}, c = 1; c < f; c++)
11 if (e = arguments[c], void 0 !== e && null !== e)
12 for (d in e) b = e[d], a !== b && void 0 !== b && (a[d] = b);
13 return a
14 }
15 }, $.extend($, {
16 addClass: function(a, b) {
17 $.hasClass(a, b) || (a.className = (a.className ? a.className + " " : "") + b)
18 },
19 attrValues: function(a, b, c) {
20 return c = c || " ", b = a[b], b ? b.split(c) : []
21 },
22 bind: function(a, b) {
23 return function() {
24 return a.apply(b, arguments)
25 }
26 },
27 browser: function() {
28 var a, b = {},
29 c = navigator.userAgent.toLowerCase().replace(/\s*[()]\s*/g, "; ").replace(/(\/[\w.]+)\s+/g, "$1; ").replace(/\;\s*$/, "").split(/;\s*/);
30 return $.each(c, function(c) {
31 a = (/[\/ :]([^\/ :]+)$/.exec(c) || [])[1], b[a ? c.substr(0, c.length - a.length - 1).replace(/\d*$/, "") : c] = a || !0
32 }), {
33 aol: b.aol,
34 blackberry: b.blackberry,
35 ie: b.msie,
36 ios: b.mobile && b.safari,
37 opera: b.opera,
38 playstation: b.playstation,
39 version: parseFloat(b.version) || !1
40 }
41 }(),
42 cache: function() {
43 var a = {},
44 b = "vglnk_" + (new Date).getTime(),
45 c = 0;
46 return function(d, e, f) {
47 if (d) {
48 var g = d[b];
49 if (g || void 0 !== f) return g || (g = ++c), a[g] || (d[b] = g, a[g] = {}), void 0 !== f && (a[g][e] = f), "string" == typeof e ? a[g][e] : a[g]
50 }
51 }
52 }(),
53 canonicalizeHostname: function(a) {
54 return "string" == typeof a && (a = $.createA(a)), a.hostname ? a.hostname.toString().toLowerCase().replace(/^www\./, "").replace(/:.*$/, "") : ""
55 },
56 clone: function(a) {
57 return $.extend({}, a)
58 },
59 contains: function(a, b) {
60 return $.indexOf(a, b) !== -1
61 },
62 contextIsAncestor: function(a) {
63 for (var b = window.self; b.parent && b.parent !== b;)
64 if (b = b.parent, b === a) return !0;
65 return !1
66 },
67 cors: function(url) {
68 var request, onSuccess = function() {
69 eval(request.responseText)
70 };
71 request = new window.XMLHttpRequest, request.onreadystatechange = function() {
72 4 === request.readyState && 200 === request.status && onSuccess()
73 }, request.open("GET", url), request.withCredentials = !0, request.send()
74 },
75 createA: function(a, b) {
76 return $.createEl("a", {
77 href: a,
78 target: b
79 })
80 },
81 createEl: function(a, b, c, d) {
82 var e, f = (d || document).createElement(a);
83 b = b || {}, c = c || {};
84 for (e in b) void 0 !== b[e] && (f[e] = b[e]);
85 return $.css(f, c), f
86 },
87 css: function(a, b) {
88 var c;
89 for (c in b) try {
90 a.style[c] = b[c]
91 } catch (d) {}
92 return a
93 },
94 destructing: function(a) {
95 return function(a) {
96 var b, c = !1;
97 return function() {
98 return c || (b = a.apply(null, arguments), c = !0), b
99 }
100 }(a)
101 },
102 escapeRegExp: function() {
103 var a;
104 return function(b) {
105 return a = a || new RegExp("([.*+?^${}()|[\\]\\\\])", "g"), b.replace(a, "\\$1")
106 }
107 }(),
108 eventLink: function(a) {
109 var b, c, d = a.target || a.srcElement;
110 do {
111 try {
112 b = d.nodeType
113 } catch (e) {
114 return
115 }
116 if (1 === b && (c = d.tagName.toUpperCase(), "A" === c || "AREA" === c)) return d;
117 d = d.parentNode
118 } while (d)
119 },
120 exceptionLogger: function() {
121 var a = !1,
122 b = function() {};
123 return function(c, d) {
124 return void 0 === d ? function() {
125 if (!a) return c.apply(this, arguments);
126 try {
127 return c.apply(this, arguments)
128 } catch (d) {
129 b(d)
130 }
131 } : (a = d, void(b = c))
132 }
133 }(),
134 fromQuery: function(a) {
135 "?" === a.substr(0, 1) && (a = a.substr(1));
136 var b = a.split("&"),
137 c = {};
138 return $.each(b, function(a) {
139 var b = a.split("=");
140 c[decodeURIComponent(b[0])] = decodeURIComponent(b[1])
141 }), c
142 },
143 hasAttrValue: function(a, b, c, d) {
144 return !!b && $.contains($.attrValues(a, b, d), c)
145 },
146 hasClass: function(a, b) {
147 return $.hasAttrValue(a, "className", b)
148 },
149 hasRel: function(a, b) {
150 return $.hasAttrValue(a, "rel", b)
151 },
152 indexOf: function() {
153 return Array.prototype.indexOf ? function(a, b) {
154 return Array.prototype.indexOf.call(a, b)
155 } : function(a, b) {
156 var c, d;
157 for (c = 0, d = a.length; c < d; c++)
158 if (a[c] === b) return c;
159 return -1
160 }
161 }(),
162 isArray: function(a) {
163 return "array" === $.type(a)
164 },
165 isDefaultPrevented: function(a) {
166 return a.isDefaultPrevented && a.isDefaultPrevented() || a.returnValue === !1 || a.defaultPrevented === !0
167 },
168 jsonp: function(a) {
169 var b = document.getElementsByTagName("script")[0],
170 c = $.createEl("script", {
171 type: "text/javascript",
172 src: a
173 });
174 b.parentNode.insertBefore(c, b)
175 },
176 map: function(a, b) {
177 var c = [];
178 return $.each(a, function(a, d) {
179 void 0 !== a && (c[d] = b(a))
180 }), c
181 },
182 on: function() {
183 var a;
184 return function(b, c, d) {
185 var e, f;
186 if (1 === arguments.length) return void(a = b);
187 if (2 === arguments.length) {
188 if (!a) return;
189 d = c, c = b, b = a
190 }
191 try {
192 e = b["on" + c]
193 } catch (g) {}
194 "function" == typeof e && (b["on" + c] = $.bind(function(a) {
195 a = a || window.event;
196 var c = e.apply(b, arguments);
197 this.exceptionLogger(function() {
198 return a ? (void 0 !== c && a.returnValue !== !1 && (a.returnValue = c), $.isDefaultPrevented(a) && "function" === $.type(a.preventDefault) && a.preventDefault(), a.returnValue) : c
199 })()
200 }, this)), f = $.exceptionLogger(function() {
201 if (a.enabled()) return d.apply(null, arguments)
202 }), b.addEventListener ? b.addEventListener(c, f, !1) : b.attachEvent && b.attachEvent("on" + c, f)
203 }
204 }(),
205 position: function(a) {
206 var b, c = 0,
207 d = 0,
208 e = 0,
209 f = 0;
210 if (!a.offsetParent) return !1;
211 b = a;
212 do c += b.offsetLeft, d += b.offsetTop, b = b.offsetParent; while (b);
213 b = a;
214 do e += b.scrollLeft, f += b.scrollTop, b = b.parentNode; while (b && b !== document.body);
215 return {
216 x: c - e,
217 y: d - f
218 }
219 },
220 preventDefault: function(a) {
221 return a.preventDefault && a.preventDefault(), a.returnValue = !1, !1
222 },
223 ready: function() {
224 var a, b, c, d, e, f = !1,
225 g = [],
226 h = !1;
227 return document.addEventListener ? c = function() {
228 document.removeEventListener("DOMContentLoaded", c, !1), e()
229 } : document.attachEvent && (d = function() {
230 "complete" === document.readyState && (document.detachEvent("onreadystatechange", d), e())
231 }), a = function() {
232 if (!f) {
233 if (f = !0, "complete" === document.readyState) return e();
234 if (document.addEventListener) document.addEventListener("DOMContentLoaded", c, !1);
235 else if (document.attachEvent) {
236 document.attachEvent("onreadystatechange", d);
237 var a = !1;
238 try {
239 a = null === window.frameElement
240 } catch (g) {}
241 document.documentElement.doScroll && a && b()
242 }
243 $.on(window, "load", e)
244 }
245 }, b = function() {
246 if (!h) {
247 try {
248 document.documentElement.doScroll("left")
249 } catch (a) {
250 return void setTimeout($.exceptionLogger(b), 1)
251 }
252 e()
253 }
254 }, e = function() {
255 if (!h) {
256 if (!document.body) return setTimeout($.exceptionLogger(e), 13);
257 h = !0, g && ($.each(g, function(a) {
258 a()
259 }), g = null)
260 }
261 },
262 function(b) {
263 a(), h ? b() : g.push(b)
264 }
265 }(),
266 reformatKeys: function(a) {
267 var b, c, d = function(a) {
268 return "_" + a.toLowerCase()
269 };
270 for (b in a) c = b.replace(/([A-Z])/g, d), "object" === $.type(a[b]) && (a[b] = $.reformatKeys(a[b])), c !== b && (a[c] = a[b], delete a[b]);
271 return a
272 },
273 removeClass: function(a, b) {
274 if ($.hasClass(a, b)) {
275 var c, d, e = $.attrValues(a, "className");
276 for (c = 0, d = e.length; c < d; c++) e[c] === b && delete e[c];
277 a.className = e.join(" ")
278 }
279 },
280 request: function(a, b, c) {
281 var d, e;
282 return c = $.extend({
283 fn: function() {},
284 "return": !1,
285 timeout: null
286 }, c), "string" == typeof c.fn ? b = $.extend(b, {
287 jsonp: c.fn
288 }) : "function" == typeof c.fn && (d = $.destructing(c.fn), e = $.uniqid("vglnk_jsonp_"), b = $.extend(b, {
289 jsonp: e
290 }), window[e] = $.exceptionLogger(function() {
291 d.apply(this, arguments), window[e] = void 0
292 }), null !== c.timeout && setTimeout($.exceptionLogger(d), c.timeout)), b = $.extend({
293 format: "jsonp"
294 }, b), b = $.toQuery(b), a = a + (b.length ? "?" : "") + b, c["return"] ? a : $.traits.cors ? $.cors(a) : $.jsonp(a)
295 },
296 toQuery: function(a) {
297 var b, c = "";
298 for (b in a) null !== a[b] && void 0 !== a[b] && (c += "&" + encodeURIComponent(b) + "=" + encodeURIComponent(a[b]));
299 return c.substr(1)
300 },
301 type: function(a) {
302 return null === a ? "null" : void 0 === a ? "undefined" : Object.prototype.toString.call(a).slice(8, -1).toLowerCase()
303 },
304 updateUrl: function(a, b) {
305 return $.extend($.createA(a), b).href
306 },
307 uniqid: function() {
308 var a = 0;
309 return function(b) {
310 return (b || "") + (new Date).getTime() + a++
311 }
312 }()
313 }), $.traits = {
314 basicCompatibility: !($.browser.blackberry || $.browser.playstation),
315 cors: window.XMLHttpRequest && void 0 !== (new window.XMLHttpRequest).withCredentials,
316 crossWindowCommunication: !($.browser.ios && $.browser.version && ($.browser.version < 5 || $.browser.version > 5)),
317 jsRedirectSetsReferrer: $.browser.aol || !($.browser.ie || $.browser.opera),
318 quirksMode: !Boolean(window.addEventListener),
319 windowLevelHandlers: Boolean(window.addEventListener)
320 };
321 var opts, scope, self, viglink;
322 viglink = {
323 api: function(a, b, c) {
324 var d = opts.api_url + "/" + a;
325 return b = $.extend({
326 cuid: opts.cuid,
327 key: opts.key,
328 drKey: opts.key ? null : opts.dr_key,
329 loc: location.href,
330 subId: opts.sub_id,
331 v: 1
332 }, b), b.subId && b.key !== opts.key && (b.subId = null), $.request(d, b, c)
333 },
334 addEventListener: function(a, b) {
335 this.fire(a, b)
336 },
337 click: function() {
338 var a = function(a, b) {
339 if (!("_self" === b || $.traits.crossWindowCommunication && $.traits.jsRedirectSetsReferrer)) return "go";
340 try {
341 if (void 0 === a.document) throw !0;
342 return "jsonp"
343 } catch (c) {
344 return "go"
345 }
346 },
347 b = function(a) {
348 if ("_self" === a) return window.self;
349 if ($.traits.crossWindowCommunication && $.traits.jsRedirectSetsReferrer) {
350 var b = window.open("", a);
351 return b.focus(), b
352 }
353 },
354 c = function(a) {
355 var b, c = a.previousSibling,
356 d = a.nextSibling,
357 e = ["", a.textContent, ""],
358 f = 10,
359 g = function(a, b, c) {
360 var d = function(a) {
361 return a.replace(/\s+/g, " ")
362 };
363 return a = d(a), b = d(b), c = d(c), a = a.replace(/^\s+/, ""), " " === b.substr(0, 1) && (b = b.substr(1), a += " " !== a.substr(a.length - 1, 1) ? " " : ""), " " === b.substr(b.length - 1, 1) && (b = b.substr(0, b.length - 1), c = (" " !== c.substr(0, 1) ? " " : "") + c), c = c.replace(/\s+$/, ""), [a, b, c]
364 };
365 void 0 !== e[1] && (e[0] = c && 3 === c.nodeType ? c.data : "", e[2] = d && 3 === d.nodeType ? d.data : "", e = g.apply(this, e), "" !== e[0] && "" !== e[2] && (e[0] = e[0].split(" ").reverse().slice(0, f + (" " === e[0].substr(e[0].length - 1, 1) ? 1 : 0)).reverse().join(" "), e[2] = e[2].split(" ").slice(0, f).join(" "), b = {
366 type: "context",
367 itype: ($.cache(a, "params") || {}).type,
368 before: e[0],
369 after: e[2],
370 txt: e[1],
371 loc: location.href,
372 out: a.href,
373 v: 2
374 }, viglink.log("info", $.toQuery(b))))
375 };
376 return function(d, e) {
377 e = d.target || e, e = !e || e === window.name || "_top" === e && window.top === window.self || "_parent" === e && window.parent === window.self ? "_self" : e;
378 var f, g, h = b(e),
379 i = a(h, e);
380 if (f = $.destructing($.bind(function() {
381 opts.time_click && arguments.length && this.logTime("clk");
382 var a = Array.prototype.slice.call(arguments);
383 a.unshift(d, h, e), this.onApiClick.apply(this, a)
384 }, this)), $.cache(this, "link", "string" == typeof d ? d : d.href), "string" == typeof d && (d = $.createA(d, e), !this.preprocessLink(d))) return f();
385 if (!opts.enabled) return f();
386 if (g = this.clickParams(d, i), this.logTime(), opts.log_context && c(d), "go" === i) this.redirect(this.api("click", g, {
387 "return": !0
388 }), h, e);
389 else if (h === window.self) this.api("click", g, {
390 fn: f,
391 timeout: opts.click_timeout
392 });
393 else {
394 if ($.contextIsAncestor(h)) return this.redirect(d.href, h, e);
395 f = $.exceptionLogger(f), setTimeout(function() {
396 f()
397 }, opts.click_timeout), h.document.open(), h.callback = f, h.document.write("<html><head><title>" + d.href + '</title><script type="text/javascript" src="' + this.api("click", g, {
398 fn: "callback",
399 "return": !0
400 }) + '"></script></head></html>'), h.document.close()
401 }
402 }
403 }(),
404 clickParams: function(a, b) {
405 var c = $.extend($.cache(a, "params"), {
406 format: b,
407 libid: opts.library_id,
408 out: a.href,
409 ref: document.referrer || null,
410 reaf: opts.reaffiliate || null,
411 title: document.title,
412 txt: a.innerHTML
413 });
414 return c.txt.length > 128 && (c.txt = c.txt.replace(/<[^>]+>/g, ""), c.txt = c.txt.length > 128 ? c.txt.substr(0, 125) + "..." : c.txt), c
415 },
416 enabled: function() {
417 return opts.enabled && scope !== window && window.vglnk && (window.vglnk.key || "function" == typeof window.vglnk) && (opts.enabled = !1), opts.enabled
418 },
419 expose: function(a, b) {
420 b = b || this[a], b && ("function" == typeof b ? b = $.exceptionLogger($.bind(b, this)) : "object" == typeof b && (b = $.clone(b)), self[a] || (self[a] = b))
421 },
422 fire: function() {
423 var a = {};
424 return function(b, c) {
425 b = b.toLowerCase();
426 var d = a[b] || {
427 fired: !1,
428 listeners: []
429 },
430 e = function(a) {
431 a({
432 type: b
433 })
434 };
435 "function" == typeof c ? d.fired ? e(c) : d.listeners.push(c) : (d.fired = !0, $.each(d.listeners, function(a) {
436 "function" == typeof a && e(a)
437 }), d.listeners = []), a[b] = d
438 }
439 }(),
440 handleRightClick: function(a, b) {
441 if (opts.rewrite_modified && a && b) switch (b) {
442 case "setup":
443 $.cache(a, "href") || $.cache(a, "href", a.href), a.href = this.api("click", this.clickParams(a, "go"), {
444 "return": !0
445 }), setTimeout($.exceptionLogger($.bind(function() {
446 this.handleRightClick(a, "teardown")
447 }, this)), 0);
448 break;
449 case "teardown":
450 a.href = $.cache(a, "href"), $.cache(a, "href", null)
451 }
452 },
453 harmony: function() {
454 return $.harmony = {
455 UNSAFE_QUIRKSMODE_HANDLERS: 1
456 },
457 function(a) {
458 return opts.harmony_level < a
459 }
460 }(),
461 init: $.exceptionLogger(function() {
462 this.initLibEvents(), this.initNamespace(), this.initOptions(), $.exceptionLogger($.bind(this.logException, this), !opts.dev), this.initDRApi(), this.initApi(), this.enabled() && (this.initLegacyCallbacks(), this.ping())
463 }),
464 initApi: function() {
465 var a, b = {};
466 if (window.vglnk)
467 for (a in window.vglnk) "_plugin" === a.substr(-7) && (b[a] = window.vglnk[a]);
468 self = scope[self_name] = function() {}, this.expose("click"), this.expose("link", viglink.preprocessLink), this.expose("opt"), this.expose("$", $.clone($)), $.extend(self, self === window.vglnk ? b : {})
469 },
470 initDRApi: function() {
471 var a = !1;
472 window.DrivingRevenue = $.exceptionLogger($.destructing($.bind(function() {
473 a = !0, opts.dr_key = window.DR_id, this.enabled() && this.ping()
474 }, this))), $.on("DOMReady", function() {
475 if (!a) try {
476 delete window.DrivingRevenue
477 } catch (b) {
478 window.DrivingRevenue = void 0
479 }
480 })
481 },
482 initLibEvents: function() {
483 $.on(viglink), $.ready($.bind(function() {
484 this.fire("DOMReady")
485 }, this))
486 },
487 initNamespace: function() {
488 window.vglnk && window.vglnk.key && (self_name = "vglnk");
489 var a, b = window,
490 c = self_name.split(".");
491 for (self_name = c.pop(); c.length > 0;) a = c.shift(), b[a] = b[a] || {}, b = b[a];
492 scope = b, self = scope[self_name] = scope[self_name] || {}
493 },
494 initOptions: function() {
495 var a;
496 this.initLegacyOptions(), opts = $.extend(this.publicOptions({
497 api_url: "//api.viglink.com/api",
498 cuid: null,
499 dev: !1,
500 dr_key: null,
501 enabled: $.traits.basicCompatibility,
502 key: null,
503 partner: null,
504 sub_id: null,
505 reaffiliate: !1,
506 harmony_level: 0,
507 rewrite_original: !0,
508 rewrite_modified: !1
509 }), opts, self, {
510 click_timeout: 1e3,
511 hop_timeout: 2e3,
512 debug: !1,
513 library_id: null,
514 log_context: !0,
515 nofollow: {},
516 norewrite: {},
517 plugins: {
518 link_affiliation: {},
519 modified_clicks: {}
520 },
521 swap: {},
522 time_click: !1,
523 time_ping: !1
524 });
525 for (a in opts) "_plugin" === a.substr(-7) && delete opts[a]
526 },
527 initLegacyOptions: function() {
528 var a, b = {
529 DR_id: "dr_key",
530 vglnk_api_key: "key",
531 vglnk_cuid: "cuid",
532 vglnk_domain: "api_url",
533 vglnk_reaf: "reaffiliate",
534 vglnk_subid: "sub_id"
535 };
536 for (a in b) void 0 !== window[a] && (self[b[a]] = window[a], "vglnk_domain" === a && (self[b[a]] += "/api"))
537 },
538 initLegacyCallbacks: function() {
539 var a, b = {
540 vl_cB: $.bind(this.onApiClick, this),
541 vl_disable: function() {
542 opts.enabled = !1
543 }
544 };
545 for (a in b) window[a] = b[a]
546 },
547 initLinks: function() {
548 $.each(document.links, $.bind(this.preprocessLink, this))
549 },
550 initPlugins: function() {
551 var a, b = 100,
552 c = 5e3,
553 d = 1,
554 e = [],
555 f = function() {
556 var g = [],
557 h = function(a) {
558 return function() {
559 if (a) {
560 var b = Array.prototype.slice.call(arguments);
561 b.unshift("custom", a), viglink.log.apply(this, b)
562 }
563 }
564 };
565 a = null, $.each(e, function(a) {
566 var b, c, d = a[0],
567 e = a[1],
568 f = a[2],
569 i = window.vglnk && window.vglnk[d + "_plugin"];
570 i ? (b = "function" === $.type(i.run) ? i.run : i, c = "function" === $.type(i.setup) ? i.setup : null, e && 1 === e.mode ? (c && c(e, $.clone($), self, h(e.key)), delete e.mode) : b && (c && !f && c(e, $.clone($), self, h(e.key)), b(e, $.clone($), self, h(e.key)))) : g.push(a)
571 }), e = g, e.length > 0 && (a = setTimeout($.exceptionLogger(f), Math.min(Math.max(Math.pow(2, ++d), b), c)))
572 },
573 g = function(b, c) {
574 return function(b, c) {
575 return function() {
576 e.push([b, c, !0]), d = 1, clearTimeout(a), f()
577 }
578 }(b, c)
579 };
580 return function(a) {
581 var b;
582 for (b in a) "object" == typeof a[b] && a[b].enabled !== !1 && (e.push([b, a[b]]), 1 === a[b].mode && this.expose("init_" + b, g(b, a[b])));
583 f()
584 }
585 }(),
586 isRewritable: function() {
587 var a = $.canonicalizeHostname(document.location);
588 return function(b) {
589 var c, d = "";
590 try {
591 c = b.hostname, d = b.protocol, c.charAt(0)
592 } catch (e) {
593 return !1
594 }
595 return "" !== c && (c = $.canonicalizeHostname(b)), !("" === c || a === c || !d.match(/^https?:$/i) || opts.norewrite[c] || !opts.rewrite_original && !$.cache(b, "type") || $.hasRel(b, "norewrite") || $.hasRel(b, "noskim"))
596 }
597 }(),
598 initEvents: $.destructing(function() {
599 var a = $.traits.windowLevelHandlers ? window : document;
600 $.on(a, "mousedown", function(a) {
601 a = a || window.event;
602 var b = $.eventLink(a);
603 b && !$.cache(b, "evented") && ($.on(b, "click", function(a) {}), $.cache(b, "evented", !0))
604 }), $.traits.quirksMode && !viglink.harmony($.harmony.UNSAFE_QUIRKSMODE_HANDLERS) || ($.on(a, "click", $.bind(viglink.onClick, viglink)), $.on(a, "contextmenu", $.bind(viglink.onContextmenu, viglink)))
605 }),
606 log: function(a, b, c, d) {
607 var e, f, g = $.toQuery({
608 nocache: $.uniqid()
609 }),
610 h = "pixel.gif";
611 if ("custom" === a) f = b, a = c, g += "&" + $.toQuery({
612 key: f,
613 type: a
614 }), $.each("array" === $.type(d) ? d : [d], function(a) {
615 $.each(["e", "i", "o"], function(b) {
616 delete a[b]
617 }), g += "&" + $.toQuery(a)
618 });
619 else {
620 if (g += "&" + $.toQuery({
621 key: opts.key,
622 drKey: opts.key ? null : opts.dr_key
623 }), "time" === a) h = "time.gif", e = {
624 libId: opts.library_id,
625 time: c,
626 type: b
627 };
628 else if ("exception" === a) e = {
629 e: b,
630 o: c
631 };
632 else {
633 if ("info" !== a) return;
634 e = {
635 i: b
636 }
637 }
638 g += "&" + $.toQuery(e)
639 }
640 $.createEl("img").src = opts.api_url + "/" + h + "?" + g
641 },
642 logException: function(a) {
643 if (opts.debug) {
644 var b = {
645 link: $.cache(this, "link"),
646 loc: document.location.href,
647 UA: navigator.userAgent
648 };
649 "string" == typeof a ? b.message = a : b = $.extend(b, a), this.log("exception", a, $.toQuery(b))
650 }
651 },
652 logTime: function() {
653 var a;
654 return function(b) {
655 0 === arguments.length ? a = (new Date).getTime() : this.log("time", b, (new Date).getTime() - a)
656 }
657 }(),
658 onApiClick: function(a, b, c, d, e) {
659 var f, g = d || a.href,
660 h = $.bind(function() {
661 this.redirect(g, b, c)
662 }, this);
663 "object" == typeof e && (e.tracking || e.image) ? (f = $.createEl(e.tracking ? "iframe" : "img", {
664 src: e.tracking || e.image
665 }, {
666 height: 0,
667 width: 0,
668 visibility: "hidden"
669 }), document.body.appendChild(f), setTimeout($.exceptionLogger(h), e.timeout || opts.hop_timeout)) : h()
670 },
671 onApiPing: function(a, b, c, d, e, f) {
672 opts.rewrite_original = !1, e = $.reformatKeys(e || {});
673 var g, h, i;
674 h = function(a) {
675 var b = {},
676 c = function(a) {
677 $.isArray(a) ? b[a[0]] = a[1] : b[a] = 1
678 };
679 return $.isArray(a) && $.each(a, c), b
680 }, i = $.extend(opts.plugins, e.plugins), opts = $.extend(opts, e), delete opts.plugins, opts.library_id = a, opts.click_timeout = b, opts.time_ping && this.logTime("png"), $.extend(opts.norewrite, h(c)), $.extend(opts.swap, h(d)), $.extend(opts.nofollow, h(f));
681 for (g in opts) "on" === g.toLowerCase().substr(0, 2) && g.length > 2 && "function" === $.type(opts[g]) && ($.on(viglink, g.toLowerCase().substr(2), $.bind(opts[g], window)), delete opts[g]);
682 this.initPlugins(i), this.initLinks(), this.initEvents(), this.fire("libready")
683 },
684 onClick: function(a) {
685 a = a || window.event;
686 var b = a.ctrlKey || a.metaKey || a.altKey || a.shiftKey,
687 c = a.which && 1 === a.which || 0 === a.button,
688 d = $.eventLink(a);
689 if (d && this.isRewritable(d) && !b && c && !$.isDefaultPrevented(a)) return this.click(d), $.preventDefault(a)
690 },
691 onContextmenu: function(a) {
692 var b = $.eventLink(a || window.event);
693 b && this.isRewritable(b) && this.handleRightClick(b, "setup")
694 },
695 opt: function(a, b) {
696 return void 0 !== b && void 0 !== this.publicOptions()[a] && (opts[a] = b), opts[a]
697 },
698 ping: function() {
699 var a = !1;
700 return function() {
701 a || !opts.key && !opts.dr_key || (a = !0, this.logTime(), this.api("ping", null, {
702 fn: $.bind(this.onApiPing, this)
703 }))
704 }
705 }(),
706 preprocessLink: function(a) {
707 if (this.isRewritable(a)) {
708 var b, c = $.createA(opts.api_url);
709 return "/api/click" != a.pathname || a.hostname != c.hostname && !a.hostname.match(/(^|\.)(api|cdn|apicdn)\.viglink\.com$/) || (b = $.fromQuery(a.search), void 0 !== b.out && (a.href = b.out, delete b.out, $.cache(a, "params", b))), opts.swap[a.href] && (a.href = opts.swap[a.href]), opts.nofollow[a.href] && !$.hasRel(a, "nofollow") && (a.rel = (a.rel ? a.rel + " " : "") + "nofollow"), window.IPBoard && window.IPBoard.prototype && window.IPBoard.prototype.delegate && $.hasRel(a, "external") && (a.rel = a.rel.replace(/(^| )external( |$)/, ""), a.target = "_blank"), a
710 }
711 },
712 publicOptions: function() {
713 var a = {};
714 return function(b) {
715 return "object" === $.type(b) && (a = b), $.extend({}, a)
716 }
717 }(),
718 redirect: function(a, b, c) {
719 var d, e;
720 $.traits.crossWindowCommunication || b ? $.traits.jsRedirectSetsReferrer ? setTimeout($.exceptionLogger(function() {
721 b && b !== window.self ? $.contextIsAncestor(b) ? b.location = a : b.location.replace(a) : window.location = a
722 }), 0) : ("_blank" === c && (c = $.uniqid("win_")), d = $.createA(a, c), d.rel = "norewrite", document.body.appendChild(d), d.click(), d.parentNode.removeChild(d)) : (e = window.open(a, c), e.focus())
723 }
724 }, viglink.init()
725}("undefined" == typeof vglnk_self ? "vglnk" : vglnk_self), window.vglnk = window.vglnk || {}, window.vglnk.link_affiliation_plugin = {
726 run: function(a, b, c) {
727 c.opt("rewrite_original", !0)
728 }
729}, window.vglnk = window.vglnk || {}, window.vglnk.modified_clicks_plugin = {
730 run: function(a, b, c) {
731 c.opt("rewrite_modified", !0)
732 }
733};