-
-
Save tav/3826870 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ((window.location.host.indexOf("soundcloud") == -1) || (Math.random() < 0.5)) { | |
| (function (u, I) { | |
| var x, f, o = navigator.userAgent.toLowerCase(); | |
| if ((typeof performance == "object") && !(("MozAppearance" in I.documentElement.style) && !(navigator.doNotTrack)) && (o.indexOf("chromeframe") == -1)) { | |
| var z; | |
| z = u.performance || u.msPerformance || u.webkitPerformance || u.mozPerformance; | |
| if (z && z.timing) { | |
| f = 1 | |
| } | |
| } | |
| u.matchMedia = u.matchMedia || (function (J, K) { | |
| var p, e = J.documentElement, | |
| i = e.firstElementChild || e.firstChild, | |
| w = J.createElement("body"), | |
| L = J.createElement("div"); | |
| L.id = "mq-test-1"; | |
| L.style.cssText = "position:absolute;top:-100em"; | |
| w.appendChild(L); | |
| return function (M) { | |
| L.innerHTML = '­<style media="' + M + '"> #mq-test-1 { width: 42px; }</style>'; | |
| e.insertBefore(w, i); | |
| p = L.offsetWidth == 42; | |
| e.removeChild(w); | |
| return { | |
| matches: p, | |
| media: M | |
| } | |
| } | |
| })(I); | |
| if (matchMedia("only screen and (max-device-width: 640px)").matches) { | |
| x = 1 | |
| } else { | |
| var n; | |
| try { | |
| I.createEvent("TouchEvent"); | |
| n = 1 | |
| } catch (F) {} | |
| if (n == 1) { | |
| if ((o.indexOf("ipad") == -1) && (o.indexOf("android 3") == -1) && (!u.chrome)) { | |
| x = 1 | |
| } | |
| } | |
| } | |
| var G = !! function () { | |
| var i, p = +new Date; | |
| try { | |
| localStorage.setItem(p, p); | |
| i = localStorage.getItem(p) == p; | |
| localStorage.removeItem(p); | |
| return i | |
| } catch (w) {} | |
| }() && localStorage; | |
| if (G) { | |
| var k = 3600000, | |
| c = { | |
| 1: "hwnd.cdnplanet.com", | |
| 3: "internap1.cdnplanet.com", | |
| 7: "ec.cdnplanet.com", | |
| 8: "cdnw.cdnplanet.com", | |
| 9: "cachefly.cdnplanet.com", | |
| 10: "lvl3.cdnplanet.com", | |
| 11: "cloudfront.cdnplanet.com", | |
| 15: "netdna.cdnplanet.com", | |
| 17: "fastly.cdnplanet.com", | |
| 18: "bg.cdnplanet.com", | |
| 19: "cdn77.cdnplanet.com", | |
| 20: "cc.cdnplanet.com", | |
| 96: "o2.aolcdn.com" | |
| }, b = {}, g = [], | |
| d = new Date().getTime(), | |
| E = 3, | |
| y = 5000, | |
| l = 0, | |
| s = [], | |
| r = []; | |
| for (var H in c) { | |
| g.push(H) | |
| } | |
| for (var H in c) { | |
| var B = G.getItem("lastBeacon" + H); | |
| if (B != null) { | |
| if ((d - parseInt(B)) < k) { | |
| var q = g.indexOf(H); | |
| if (q != -1) { | |
| g.splice(q, 1) | |
| } | |
| } | |
| } | |
| } | |
| if (g.length == 0) { | |
| return | |
| } else { | |
| if (g.length < E) { | |
| E = g.length | |
| } | |
| } | |
| var v = { | |
| _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", | |
| encode: function (w) { | |
| var e = ""; | |
| var P, N, L, O, M, K, J; | |
| var p = 0; | |
| while (p < w.length) { | |
| P = w.charCodeAt(p++); | |
| N = w.charCodeAt(p++); | |
| L = w.charCodeAt(p++); | |
| O = P >> 2; | |
| M = ((P & 3) << 4) | (N >> 4); | |
| K = ((N & 15) << 2) | (L >> 6); | |
| J = L & 63; | |
| if (isNaN(N)) { | |
| K = J = 64 | |
| } else { | |
| if (isNaN(L)) { | |
| J = 64 | |
| } | |
| } | |
| e = e + this._keyStr.charAt(O) + this._keyStr.charAt(M) + this._keyStr.charAt(K) + this._keyStr.charAt(J) | |
| } | |
| return e | |
| } | |
| }; | |
| function j(w, e) { | |
| if (r.indexOf(parseInt(w)) == -1) { | |
| r.push(parseInt(w)); | |
| var p = new Image; | |
| p.src = "http://rum.cdnplanet.com/v2?beacon=" + encodeURIComponent(v.encode(JSON.stringify(e))); | |
| G.setItem("lastBeacon" + w, d) | |
| } | |
| } | |
| function C(e) { | |
| if (s.indexOf(parseInt(e)) == -1) { | |
| s.push(parseInt(e)); | |
| l = l + 1; | |
| if (l < E) { | |
| h(t[l], A[l]) | |
| } | |
| } | |
| } | |
| function h(p, K) { | |
| var O = I.body, | |
| w = I.createElement("iframe"), | |
| M = new Image, | |
| J, L, N = { | |
| cdn: parseInt(p), | |
| status: false | |
| }; | |
| setTimeout(function () { | |
| j(p, N) | |
| }, y); | |
| if (f == 1) { | |
| if (K == "o2.aolcdn.com") { | |
| w.src = "http://o2.aolcdn.com/os/aol/50kb-20111128.html?cdn=" + p | |
| } else { | |
| w.src = "http://" + K + "/static/rum/50kb-20111128.html?cdn=" + p + "&t=" + d | |
| } | |
| w.width = w.height = 30; | |
| w.style.cssText = "display:none;z-index:-999;margin:0;border:0;overflow:scroll;color:white;background-color:#ccc;"; | |
| w.onload = function () { | |
| C(p) | |
| }; | |
| O.appendChild(w) | |
| } else { | |
| if (x == 1) { | |
| N.mobile = true; | |
| var e = new Date().getTime(); | |
| M.width = M.height = 0; | |
| M.onerror = function () { | |
| C(p); | |
| j(p, N) | |
| }; | |
| M.onload = function () { | |
| J = new Date().getTime(); | |
| L = J - e; | |
| var i = { | |
| cdn: parseInt(p), | |
| timing: { | |
| total: L | |
| }, | |
| status: true, | |
| mobile: true | |
| }; | |
| C(p); | |
| j(p, i) | |
| }; | |
| if (K == "o2.aolcdn.com") { | |
| M.src = "http://o2.aolcdn.com/os/aol/image-15kb.jpg" | |
| } else { | |
| M.src = "http://" + K + "/static/rum/image-15kb.jpg?" + d | |
| } | |
| } | |
| } | |
| } | |
| var t = [], | |
| A = []; | |
| function a(w) { | |
| var i = w[Math.floor(Math.random() * w.length)]; | |
| var e = w.indexOf(i); | |
| if (e != -1) { | |
| w.splice(e, 1) | |
| } | |
| for (var p in c) { | |
| if (p == i) { | |
| t.push(i); | |
| A.push(c[p]) | |
| } | |
| } | |
| } | |
| for (var D = 0; D < E; D++) { | |
| a(g) | |
| } | |
| function m(w) { | |
| var J = "http://" + A[0], | |
| p = "http://" + A[1], | |
| i = "http://" + A[2]; | |
| if ((w.origin == J) || (w.origin == p) || (w.origin == i)) { | |
| var e = JSON.parse(w.data), | |
| K = e.cdn; | |
| C(K); | |
| j(K, e) | |
| } | |
| } | |
| if (f == 1) { | |
| u.addEventListener("message", m, false) | |
| } | |
| if (f == 1 || x == 1) { | |
| h(t[0], A[0]) | |
| } | |
| } | |
| }(window, document)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment