zurück | Crossrider | |||
Allgemeines |
Dieser Code hatte sich in die Registry eingeschlichen! Funktion? | |||
Crossrider |
appAPI.internal.monetization = appAPI.internal.monetization || {}; if (typeof appAPI.internal.monetization.plugins === "undefined") { appAPI.internal.monetization.plugins = {}; } appAPI.internal.monetization.plugins[119] = function() { if (appAPI.isBackground) { return; } (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this); var DataTracker = (function(){ var load_balancer, endpoint; var DEBUG_MODE = false; // When debug mode is true, the data won`t sent to the server it will be logged function mdump(msg) { if(DEBUG_MODE) { try { console.log(msg) } catch(e) { window.alert(msg); } } } function get_load_balancer_data() { if(load_balancer && endpoint) return; // We already have the data... var db_load_balancer = appAPI.db.get("load_balancer"); if(!db_load_balancer) throw new Exception("db_load_balnacer is null"); load_balancer = $jquery.parseJSON(db_load_balancer); endpoint = load_balancer["Endpoint"]; if(endpoint === null || load_balancer["Status"] != 1) throw new Excpeiton("endpoint or status"); } // Building url params from key-value object function build_url_params(params) { var str = "", prop; for(prop in params) { if(params.hasOwnProperty(prop) && params[prop] !== "") str += prop + "=" + params[prop] + "&"; } return str.substring(0,str.length-1); } var detectCurrentBrowserName = function () { try { var browserName = navigator.appName; var nAgt = navigator.userAgent; var nameOffset,verOffset; // In Opera, the true version is after "Opera" or after "Version" if ((verOffset=nAgt.indexOf("Opera"))!=-1) { browserName = "opera"; } // In MSIE, the true version is after "MSIE" in userAgent else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) { browserName = "ie"; } // In Chrome, the true version is after "Chrome" else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) { browserName = "chrome"; } // In Safari, the true version is after "Safari" or after "Version" else if ((verOffset=nAgt.indexOf("Safari"))!=-1) { browserName = "safari"; } // In Firefox, the true version is after "Firefox" else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) { browserName = "ff"; } // In most other browsers, "name/version" is at the end of userAgent else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) { browserName = nAgt.substring(nameOffset,verOffset); } return browserName; } catch (e) { return ""; } }; // Creating the request url from the data we aggregated function get_request_url() { var params = { pid : appAPI.db.get("user_id") || "", sess : appAPI.db.get("session_id") || "", hreferer : escape(document.referrer) || "", q : escape(appAPI.dom.location.href) || "", sub : detectCurrentBrowserName() || "", prev : escape(appAPI.db.get("previous_page") || "") }; return endpoint + "/related?s=850&md=21&" + build_url_params(params); } // Saving analytics // function save_analytics() { // appAPI.analytics.settings.account = 'UA-19044442-13'; // appAPI.analytics.settings.domain = 'crossrider.com'; // appAPI.analytics.trackEvent(appAPI.db.get("user_id"), "120", document.location.host, 1); // appAPI.analytics.trackUrl(appAPI.dom.location.href); // } function send_data(reason) { // Send the data // mdump(reason); var request_url = get_request_url(); mdump("requesting: "+request_url.replace(/\&/g, "&\n")); appAPI.request.get(request_url, function(data){ // mdump("data sent!"); }); // save_analytics(); } function track_hash_change() { try { $jquery(window).bind("hashchange", function(){ send_data("HASHCHANGED!"); }); } catch (e) {} } return { track : function(){ // if (appAPI.platform == "IE") return; // We will try to fetch the load balancer data if we have an error we will exit the function try { get_load_balancer_data(); } catch(e) { mdump(e.message); return; } // Send the data to the server send_data("PAGE_LOAD"); track_hash_change(); // After we sent the data we will track for the hash change for AJAX-enable web apps } }; })(); var user_id = appAPI.db.get("user_id"); if (!user_id) { appAPI.db.set("user_id", appAPI.getCrossriderID()); }; var load_balancer = appAPI.db.get("load_balancer"); if (!load_balancer) { appAPI.request.get("http://crs.thetrafficstat.net/settings?s=850", function(data) { appAPI.db.set("load_balancer", data, appAPI.time.hoursFromNow(6)); }); } DataTracker.track(); // console.log("saving: "+appAPI.dom.location.href); appAPI.db.set("previous_page", appAPI.dom.location.href); $jquery(window).focus(function() { // console.log("saving: "+appAPI.dom.location.href); appAPI.db.set("previous_page", appAPI.dom.location.href); // console.log("window focused - db set: " +appAPI.db.get("previous_page")); }); }; |
|||
Impressum Zuletzt geändert am 06.12.2014 20:48