Some troubles with add-ons?

Ask for help about NoScript, no registration needed to post
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Some troubles with add-ons?

Post by Thrawn »

Code: Select all

 /**
  * Returns true if a group_id OR a group name matches the group_id OR the group_name of the person
  * @public
  * @function
  * @param int person_id Id of the person to check
  * @param object groups Object containing the groups to check.
  * @returns bool true if a group_id OR a group name matches the group_id OR the group_name of the person
  */
function isPersonInGroup(person_id, groups) {
   "use strict";
   var i, j, person_groups;
   if (groups !== null && typeof (groups) !== "undefined") {
      if (persons && persons[person_id]) {
         person_groups = persons[person_id].groups;
         for (i = 0; i < groups.length; i += 1) {
            for (j = 0; j < person_groups.length; j += 1) {
               if (groups[i].group_id === person_groups[j].group_id) {
                  return true;
               }
               if (groups[i].group_name === person_groups[j].group_name) {
                  return true;
               }
            }
         }
      }
   }
   return false;
}

//===================================================================
// UCTWinScriptlets: tracklet/components/GoogleInstantTracker.js
//===================================================================

/*jsl:option explicit*/
/*jsl:declare CustomEventHelper*/
/*jsl:declare Base64*/
/*jsl:declare json_encode */
/*jsl:declare base64_json_encode */
/*jsl:declare parseURL*/
/*jsl:declare GacelaNavigateService*/
/*jsl:declare _private*/
/*jsl:declare GacelaEventService*/
/*jsl:declare Components*/
/*jsl:declare GacelaStorageService*/

//=============================================================================
// Google Instant Patch and Firefox Location Listener
// The patch detects Google Instant Update and PI Events
// For Firefox an additional Location Listener is needed to safely detect PIs
//=============================================================================

/*global Components, GacelaEventService, parseURL, GacelaNavigateService, Base64, JSON, CustomEventHelper, GacelaStorageService, _private, base64_json_encode*/
/**
* Google Instant Patch and Firefox Location Listener.
* The patch detects Google Instant Update and PI Events.
* For Firefox an additional Location Listener is needed to safely detect PIs.
* @class Additional Location Listener for Firefox, to safely detect PIs.
* @author Team Dev
* @public
* @param object browser Browser object
* @param object locationHashChangeHandler Function which handles the locationHashChangeEvent
*/
function CFirefoxLocationListener(browser, locationHashChangeHandler)
{
    this.browser = browser;
    this.locationHashChangeHandler = locationHashChangeHandler;
    this.browser.addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
}

CFirefoxLocationListener.prototype = {
    /**
    * Does nothing
    * @private
    * @function
    * @param {?} aSubject Subject
    * @param {?} aTopic Topic
    * @param {?} aData Data
    */
    observe : function(aSubject, aTopic, aData) {
    },

    // Destructor - Frees all resources, removes event listeners,
    /**
    * Destructor - Frees all resources, removes event listeners
    * @private
    * @function
    */
    remove : function() {
        this.browser.removeProgressListener(this);
        this.browser = null;
    },

    /**
    * @private
    * @property string locationHash Stores the locationHash
    */
    locationHash: "",

    /**
    * onLocationChange
    * @private
    * @function
    * @param object webProgress <i>unused</i>
    * @param object request <i>unused</i>
    * @param object location Location object
    */
    onLocationChange: function(webProgress, request, location) {
        var tmp, pos, loc = location.asciiSpec;
        pos = loc.indexOf("#");
        if (pos !== -1) {
            tmp = loc.substring(pos);
            if (tmp !== this.locationHash) {
                this.locationHash = tmp;
                if (this.locationHashChangeHandler) {
                    this.locationHashChangeHandler(location.asciiSpec);
                }
            }
        } else if (this.locationHash !== "") {
            this.locationHash = "";
            this.locationHashChangeHandler(location.asciiSpec);
        }
    },

    /**
    * Does nothing
    * @private
    * @function
    * @param object webProgress <i>unused</i>
    * @param object request <i>unused</i>
    * @param object location <i>unused</i>
    */
    onStateChange: function(webProgress, request, stateFlags, status) {
    },

    // Not used, since we only receive NOTIFY_LOCATION Notifications
    /**
    * Does nothing
    * @deprecated
    * @private
    * @function
    * @param object webProgress <i>unused</i>
    * @param object request <i>unused</i>
    * @param object location <i>unused</i>
    */
    onStatusChange: function(webProgress, request, status, message) {
    },

    // Not used, since we only receive NOTIFY_LOCATION Notifications
    /**
    * Does nothing
    * @deprecated
    * @private
    * @function
    * @param object webProgress <i>unused</i>
    * @param object request <i>unused</i>
    * @param object location <i>unused</i>
    */
    onSecurityChange: function(webProgress, request, state) {
    },

    /**
    * Does nothing
    * @private
    * @function
    * @param object webProgress <i>unused</i>
    * @param object request <i>unused</i>
    * @param object curSelfProgress <i>unused</i>
    * @param object maxSelfProgress <i>unused</i>
    * @param object curTotalProgress <i>unused</i>
    * @param object maxTotalProgress <i>unused</i>
    */
    onProgressChange: function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {
    },

    /**
    * Returns class instance if parameter equals WebProgressListener, Supports or SupportsWeakReference Interface
    * @private
    * @function
    * @param object iid Interface object   
    * @returns object CFirefoxLocationListener
    * @throws {Components.results.NS_ERROR_NO_INTERFACE} If parameter iid doesn't equals any of the mentioned interfaces
    */
    QueryInterface: function(iid) {
        if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
                iid.equals(Components.interfaces.nsISupports) ||
                iid.equals(Components.interfaces.nsISupportsWeakReference)) {
            return this;
        }
        throw Components.results.NS_ERROR_NO_INTERFACE;
    }
};

/**
* Tracks google instant search queries
* @class Tracks google instant search queries
* @author Team Dev
* @public
* @param object config GoogleInstantTracker configuration
* @dependency tracklet Helper 15
* @dependency tracklet GfKBase 15
* @dependency tracklet CustomEventHelper 15
* @dependency tracklet GlobalConfiguration 127
*/
function GoogleInstantTracker(config)
{
    /**
    * @private
    * @property object Trackconfig
    */
    this.trackconfig = {};

      /**
      * Returns true if a group_id OR a group name matches the group_id OR the group_name of the person
      * @private
      * @function
      * @param object groups Object containing the groups to check.
      * @returns bool true if a group_id OR a group name matches the group_id OR the group_name of the person
      */
    this.isPersonInGroup = function(groups) {
        var userIndex = GacelaStorageService.get("CurrentAuthenticatedUser");
        var i, j, person_groups;
        if (groups !== null && typeof (groups) !== "undefined") {
            if (this.persons && this.persons[userIndex]) {
                person_groups = this.persons[userIndex].groups;
                for (i = 0; i < groups.length; i += 1) {
                    for (j = 0; j < person_groups.length; j += 1) {
                        if (groups[i].group_id === person_groups[j].group_id) {
                            return true;
                        }
                        if (groups[i].group_name === person_groups[j].group_name) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    };
   
    /**
    * Prepares an event object and dispatches an GacelaEvent
    * @private
    * @function
    * @param string evtName Name of the event to dispatch
    * @param event e Event object
    */
    this.dispatchGoogleInstantEvent = function(evtName, e) {
        var evt = {};
        if (typeof (e.document) === "undefined") {
            // this is FF
            evt.document = e.target.ownerDocument;
            evt.url = e.target.getAttribute("url");
            evt.mainframe = e.target.getAttribute("mainframe") === "true";
            evt.newcontent = e.target.getAttribute("newcontent");
            evt.targetid = e.target.getAttribute("targetid");
        } else {
            // this is IE
            evt.document = e.document;
            evt.url = e.url;
            evt.mainframe = e.mainframe;
            evt.newcontent = e.newcontent;
            evt.targetid = e.targetid;
        }
        GacelaEventService.dispatchEvent(evtName, evt);
    };

    /**
    * Checks if a given Document belongs to a Google page
    * @private
    * @function
    * @param object doc Document of the page to check
    * @returns bool True if the Document belongs to a google page, otherwise false
    */
    this.isGooglePage = function(doc) {
        if (!doc || !doc.location || !doc.location.href || !this.trackconfig || !doc.location.href.match(this.trackconfig.googleurlregexp)) {
            return false;
        }
        return true;
    };

    /**
    * Does the GoogleInstant tracking
    * @private
    * @function
    * @param event e DocumentComplete event object
    */
    this.onDocumentComplete = function(e, config) {
        try {
            //check actionlist
            if (config !== null && typeof(config) !== "undefined") {
                //check group_name
                for (var i = 0; i < config.length; i += 1) {
                    if (this.isPersonInGroup(config[i].active_groups)) {
                        this.trackconfig = config[i].settings;
                        if (this.trackconfig) {
                            if (this.trackconfig.track_document_complete) {
                                this.TrackEvents(e);
                            }
                        }
                    }
                }
            }
        } catch (ex) {
            Logger.log("ERROR", "Error in GoogleInstantTracker.onDocumentComplete(): " + ex.messsage);
        }

        var giUpdate_evtName, giPI_evtName, head, newScript, marker, self, cnt;
        // only inject google instant patch if there is a document and if it belongs to a google page
        if (typeof (e.document) === "undefined" || e.document === null || this.isGooglePage(e.document) === false) {
            return;
        }
        giUpdate_evtName = "onclick";
        giPI_evtName = "ondblclick";

        if (e.document.getElementById("tracked_by_gacela") === null) {
            head = e.document.getElementsByTagName("head")[0];
            newScript = e.document.createElement("script");
            newScript.type = "text/javascript";
            newScript.text =
                'function notifyTracklet(doc, evtName, targetid, newcontent) {' +
                'var gacelaDiv, evtName, evt;' +
                'gacelaDiv = document.getElementById("tracked_by_gacela");' +
                'if(typeof(gacelaDiv) === "undefined" || gacelaDiv === null) {' +
                'gacelaDiv = parent.document.getElementById("tracked_by_gacela");' +
                '}' +
                'if (typeof(doc.createEvent) === "function") {' +
                'gacelaDiv.setAttribute("url", self.location.href);' +
                'gacelaDiv.setAttribute("mainframe", self.location === top.location);' +
                'gacelaDiv.setAttribute("targetid", targetid);' +
                'gacelaDiv.setAttribute("newcontent", newcontent);' +
                'evt = doc.createEvent("Events");' +
                'evt.initEvent(evtName, true, true);' +
                'gacelaDiv.dispatchEvent(evt);' +
                '} else if (typeof(gacelaDiv.fireEvent) !== "undefined") {' +
                'evt = doc.createEventObject();' +
                'evt.document = doc;' +
                'evt.url = self.location.href;' +
                'evt.mainframe = (self.location === top.location);' +
                'evt.targetid = targetid;' +
                'evt.newcontent = newcontent;' +
                'gacelaDiv.fireEvent(evtName, evt);' +
                '}' +
                '}' +

                // override google.j.p() method to detect updates performed by google instant search
                'window.setTimeout(function() {' +
                'if (typeof(google) === "object" && typeof(google.j) === "object" && typeof(google.j.p) === "function") {' +
                'google.j.real_p = google.j.p;' +
                'google.j.p = function(one, targetId, newContent, four, five) {' +
                'if(targetId === "search") {' +
                'notifyTracklet(document, "' + giUpdate_evtName + '", targetId, newContent);' +
                '}' +
                'return google.j.real_p(one, targetId, newContent, four, five);' +
                '};' +
                '}' +
                '}, 500);' +

                // register onhaschange on nonIE Browsers (chrome)
                'if ((typeof(window.addEventListener) === "function") || (typeof(window.addEventListener) === "object")) {' +
                'window.addEventListener("hashchange", function() {' +
                'notifyTracklet(document, "' + giPI_evtName + '");' +
                '});' +
                '} ' +
                // register to onhashchange for detecting PI for google instant search
                'else if(typeof(window.attachEvent) !== "undefined") {' +
                'window.attachEvent ("onhashchange", function() {' +
                'notifyTracklet(document, "' + giPI_evtName + '");' +
                '});' +
                '}';

            // add a marker to page, because ie fires multiple documentComplete events and we don't want to
            // add the script multiple times.
            marker = e.document.createElement("div");
            marker.style.display = "none";
            marker.id = "tracked_by_gacela";
            self = this;
            if ((typeof (marker.addEventListener) === "function") || (typeof (marker.addEventListener) === "object")) {
                marker.addEventListener(giUpdate_evtName, function(ev) {
                    self.dispatchGoogleInstantEvent("GacelaGoogleInstantUpdate", ev);
                }, false);
                marker.addEventListener(giPI_evtName, function(ev) {
                    self.dispatchGoogleInstantEvent("GacelaGoogleInstantPI", ev);
                }, false);
            } else {
                marker.attachEvent(giUpdate_evtName, function(ev) {
                    self.dispatchGoogleInstantEvent("GacelaGoogleInstantUpdate", ev);
                });
                marker.attachEvent(giPI_evtName, function(ev) {
                    self.dispatchGoogleInstantEvent("GacelaGoogleInstantPI", ev);
                });
            }

            cnt = 0;
            while (e.document.body === null && cnt < 50000) {
                cnt = cnt + 1;
            }

            try {
                e.document.body.appendChild(marker);
                head.appendChild(newScript);
            } catch (ex) {
                Logger.log("ERROR", "Error in GoogleInstantTracker.onDocumentComplete(): " + ex.messsage);
            }
        }
    };

    this.onGoogleInstantUpdate = function(e, config) {
        try {
            //check actionlist
            if (config !== null && typeof(config) !== "undefined") {
                //check group_name
                for (var i = 0; i < config.length; i += 1) {
                    if (this.isPersonInGroup(config[i].active_groups)) {
                        this.trackconfig = config[i].settings;
                        if (this.trackconfig) {
                            if (this.trackconfig.track_instant_updates) {
                                this.TrackEvents(e);
                            }
                        }
                    }
                }
            }
        } catch (ex) {
            Logger.log("ERROR", "Error in GoogleInstantTracker.onGoogleInstantUpdate(): " + ex.message);
        }
    };
   
    this.onGoogleInstantPI = function(e, config) {
        try {
            //check actionlist
            if (config !== null && typeof(config) !== "undefined") {
                //check group_name
                for (var i = 0; i < config.length; i += 1) {
                    if (this.isPersonInGroup(config[i].active_groups)) {
                        this.trackconfig = config[i].settings;
                        if (this.trackconfig) {
                            if (this.trackconfig.track_instant_pi) {
                                this.TrackEvents(e);
                            }
                        }
                    }
                }
            }
        } catch (ex) {
            Logger.log("ERROR", "Error in GoogleInstantTracker.onGoogleInstantPI(): " + ex.message);
        }
    };
   
    // Parses URL, adds the ability to parse and decode parameters on top of the usual "parseURL" function
    /**
    * Parses URL, adds the ability to parse and decode parameters on top of the usual "parseURL" function
    * @private
    * @function
    * @param string url URL to parse
    * @returns string parsed URL
    */   
    this.parseURL = function(url) {
        var purl, parts, params, anchorparts, anchorpartindex, ps, i;
        purl = parseURL(String(url));
        if (!purl.query && !purl.anchor) {
            return purl;
        }
        purl.params = {};
        if (purl.query) {
            parts = purl.query.split("&");
            for (i = 0; i < parts.length; i += 1) {
                params = parts[i].split("=");
                if (params.length < 2) {
                    continue;
                }
                purl.params[params[0]] = decodeURIComponent(params[1].replace(/\+/g, " "));
            }
        }
        purl.anchorparams = {};

        if (purl.anchor) {
            anchorparts = purl.anchor.split("&");
            for (anchorpartindex = 0; anchorpartindex < anchorparts.length; anchorpartindex += 1) {
                ps = anchorparts[anchorpartindex].split("=");
                if (ps.length < 2) {
                    continue;
                }
                purl.anchorparams[ps[0]] = decodeURIComponent(ps[1].replace(/\+/g, " "));
            }
        }
        return purl;
    };

    // Extracts google search term from given URL
    /**
    * Extracts google search term from given URL
    * @private
    * @function
    * @param string url URL
    * @returns string Google search term
    */   
    this.getGoogleSearchTermFromURL = function(url) {
        var purl = this.parseURL(url);
        if (!this.trackconfig || !purl.host || !purl.host.match(this.trackconfig.googleurlregexp)) {
            return false;
        }
        if (purl.anchorparams && purl.anchorparams.q) {
            return purl.anchorparams.q;
        }
        if (purl.params && purl.params.q) {
            return purl.params.q;
        }
        return "";
    };

    /**
    * Extracts google search term from document or browser search field
    * @private
    * @function
    * @param object doc Document
    * @param bool useSearchField If the searchField is used
    * @returns string Google search term
    */   
    this.getGoogleSearchTerm = function(doc, useSearchField) {
        var searchterm, elem, inputfields, i, inputfield;
        searchterm = "";
        if (useSearchField) {
            try {
                elem = doc.getElementById("grey");
                if (typeof (elem.value) !== "undefined") {
                    searchterm = elem.value;
                    searchterm = searchterm.replace(/<[^>]*>/g, "");
                } else {
                    // in IE the element with id="grey" is not a input but a div. so instead of elem.value
                    // we use elem.innerHTML
                    searchterm = elem.innerHTML;
                    searchterm = searchterm.replace(/ /g, " ");
                }
            } catch (ex) {}
            if (typeof (searchterm) === "undefined" || searchterm === "") {
                try {
                    inputfields = doc.getElementsByTagName("input");
                    if (inputfields !== null) {
                        for (i = 0; i < inputfields.length; i += 1) {
                            inputfield = inputfields[i];
                            if (inputfield.name === "q") {
                                searchterm = inputfield.value;
                                break;
                            }
                        }
                    }

                } catch (ex2) { }
            }
        }
        if (typeof (searchterm) === "undefined" || searchterm === "") {
            searchterm = this.getGoogleSearchTermFromURL(doc.location.href);
        }
        return searchterm;
    };

    /**
    * Function which handles the tracking
    * @private
    * @function
    * @param event e Event object
    */   
    this.TrackEvents = function(e) {
        //track google content
        if (e.mainframe) {
            var doc, docurl, googleContent, content, type;
            doc = GacelaNavigateService.getCurrentDocument();
            docurl = doc.location.href;
            if (((docurl.indexOf("https://") === -1) || GlobalConfiguration.isHttpsExceptionPage(doc, this.trackconfig)) && this.isGooglePage(doc)) {
                googleContent = {
                    "assockey": docurl,
                    "searchterm": this.getGoogleSearchTerm(doc, e.type === "GacelaGoogleInstantPI"),
                    "htmlcontent": GacelaNavigateService.getInnerHTML(doc)
                };
                content = base64_json_encode(googleContent);
                type = "unknown";
                switch (e.type) {
                case "GacelaDocumentComplete":
                    type = "google-content-document-complete";
                    break;
                case "GacelaGoogleInstantUpdate":
                    type = "google-content-serp-update";
                    break;
                case "GacelaGoogleInstantPI":
                    type = "google-content-serp-pi";
                    break;
                default:
                    break;
                }

                CustomEventHelper.sendCustomevent(e, Base64.encode(docurl), type, googleContent);
            }
        }
    };

    /**
    * Initializes the CFirefoxLocationListener and dispatches GacelaGoogleInstantPI event
    * @private
    * @function   
    * @see CFirefoxLocationListener
    */   
  this.initFirefoxLocationListener = function() {
        var self, evt;
        if (GacelaStorageService.getStatic("BrowserType") === "FF") {
         var versionstring = GacelaStorageService.getStatic("BrowserVersion");
         if (versionstring) {
            var vparts = versionstring.split(/\./);
            if (vparts && vparts.length>0) {
               var ffVersion = parseInt(vparts[0],10);
               // This fix isn't neccessary anymore since Firefox 6
               if (ffVersion<6) {
                  self = this;
                  this.firefoxlocationlistener = new CFirefoxLocationListener(_private.browser, function(location) {
                     if (!self.trackconfig || !location || !location.match(self.trackconfig.googleurlregexp)) {
                        return;
                     }
                     evt = {};
                     evt.document = GacelaNavigateService.getCurrentDocument();
                     evt.url = evt.document.location.href;
                     evt.mainframe = true;
                     GacelaEventService.dispatchEvent("GacelaGoogleInstantPI", evt);
                  });
               } 
            }
         }
        }
    };

    //--- add event handlers
    var self = this;
    GacelaEventService.addListener('GacelaNewWindow', function(e) {
        self.initFirefoxLocationListener();
    });
    GacelaEventService.addListener('GacelaDocumentComplete', function(e) {
        self.onDocumentComplete(e, config);
    });
    GacelaEventService.addListener('GacelaGoogleInstantUpdate', function(e) {
        self.onGoogleInstantUpdate(e, config);
    });
    GacelaEventService.addListener('GacelaGoogleInstantPI', function(e) {
        self.onGoogleInstantPI(e, config);
    });

    this.persons = persons;
    this.config = config;
}

//===================================================================
// UCTWinScriptlets: tracklet/components/WWSCookieTracker.js
//===================================================================
/**
* The WWSCookieTracker Performs requests to the WWS system, on every frameload.
* With these Requests the cookies can be tracklet via the WWS system.
* To configure the Component initialize it with a config value.
* On the UserChanged Event the active_groups of the config is evaluated,
* and the component is enabled.
* @class Performs requests to WWS-System on every frameload
* @author Team Dev
* @public
* @dependency tracklet Helper 15
* @dependency tracklet GfKBase 15
*/
function WWSCookieTracker(config){

  this.tracklist = [];
  this.initialized = false;

  /**
  * Sends a request containing the cookies of the current page to the configured URL.
  * @private
  * @function
  * @param event e The document complete event object
  */
  this.OnDocumentComplete = function(e) {
    try {
      for(var i = 0;i < this.tracklist.length; i++){
        if (e.url.match(this.tracklist[i].regex)) {
          BlindSend(this.tracklist[i].target, "hhid="+GacelaStorageService.getStatic('GacelaPanelId')+"&uid="+GacelaStorageService.get(e.eid.browsersessionid + '.authentication')+"&eid="+GacelaTrackingService.eventIDToString(e.eid)+"&url="+encodeURIComponent(e.url));
        }
      }
    }
    catch (err) {
      Logger.log("ERROR", "Error in WWSCookieTracker::OnDocumentComplete: " + err);
    }
  };

  //Init function
   /**
  * Initializes this component, is triggered by the UserChanged event. Binds the OnDocumentComplete method to the GacelaDocumentComplete event.
  * @private
  * @param event e The UserChanged event
  * @param object config The config object from the configuration
  */
  this.OnUserChange = function(e, config){
    try{
      //check actionlist
      if(config !== null && typeof(config) !== "undefined"){
        //check group_name
        for(var i = 0 ; i < config.length ; i++){
          if(isPersonInGroup(e.user_id, config[i].active_groups)){
            this.tracklist = config[i].settings;
         if (!this.initialized) {
            this.initialized = true;
            var self = this;
            GacelaEventService.addListener('GacelaDocumentComplete', function(e){self.OnDocumentComplete(e);});
         }
          }
        }
      }
    }
    catch (e){
      Logger.log("ERROR", "Error in WWSCookieTracker::OnUserChange: " + e);
    }
  };

  //Register init function
  var self = this;
  GacelaEventService.addListener('UserChanged', function(e){self.OnUserChange(e, config);});
}

//========================================================================

//===================================================================
// UCTWinScriptlets: tracklet/components/PageCookieTracker.js
//===================================================================

/**
* The PageCookieTracker Performs requests to the given url, on every frameload.
* With these Requests the cookie of the current Page is sent as cookie parameter.
* To configure the Component initialize it with a config value.
* On the UserChanged Event the active_groups of the config is evaluated,
* and the component is enabled.
* @class Sends cookie of current page to configured URL
* @author Team Dev
* @public
* @dependency tracklet GfKBase 15
* @dependency tracklet Helper 15
*/
function PageCookieTracker(config){

  this.tracklist = [];
  this.initialized = false;

   /**
  * Sends a request containing the cookies of the current page to the configured URL.
  * @private
  * @function
  * @param event e The document complete event object
  */
  this.OnDocumentComplete = function(e) {
    try {
      for(var i = 0;i < this.tracklist.length; i++){
        if (e.url.match(this.tracklist[i].regex)) {
          BlindSend(this.tracklist[i].target, 'hhid='+GacelaStorageService.getStatic('GacelaPanelId')+'&uid='+GacelaStorageService.get(e.eid.browsersessionid + '.authentication')+'&cookies='+escape(e.document.cookie)+'&url='+escape(e.url));
        }
      }
    }
    catch (err) {
      Logger.log("ERROR", "Error in PageCookieTracker::OnDocumentComplete: " + err);
    }
  };

  //Init function
   /**
  * Initializes this component, is triggered by the UserChanged event. Binds the OnDocumentComplete method to the GacelaDocumentComplete event.
  * @private
  * @function
  * @param event e The UserChanged event
  * @param object config The config object from the configuration
  */
  this.OnUserChange = function(e, config){
    try{
      //check actionlist
      if(config !== null && typeof(config) !== "undefined"){
        //check group_name
        for(var i = 0 ; i < config.length ; i++){
          if(isPersonInGroup(e.user_id, config[i].active_groups)){
            this.tracklist = config[i].settings;
         if (!this.initialized) {
            this.initialized = true;
            var self = this;
            GacelaEventService.addListener('GacelaDocumentComplete', function(e){self.OnDocumentComplete(e);});
         }
          }
        }
      }
    }
    catch (e){
      Logger.log("ERROR", "Error in PageCookieTracker::OnUserChange: " + e);
    }
  };

  //Register init function
  var self = this;
  GacelaEventService.addListener('UserChanged', function(e){self.OnUserChange(e, config);});
}

//=======================================================================


//===================================================================
// UCTWinScriptlets: tracklet/components/Fixes.js
//===================================================================

//======================
// Patch to fix missing beforenavigate events in Firefox
//======================

//check if is an IE8 and Gacela Version less than 2.1

/**
* Patch to fix missing beforenavigate events in Firefox. Checks if is an IE8 and Gacela Version less than 2.1
* @function
* @returns boolean Returns false if  the GacelaExtensionVersion is bigger than 2.1. Also returns false if the GacelaExtensionVersion is smaller or equal 2.1 but MSIE major version is smaller than 8, or browser is firefox. <br />
* Only returns true if the Browser is MSIE with a major version bigger than 7 and a GacelaExtensionVersion smaller or equal 2.1.
*/
function hasIE8Bug() {
  var extver = GacelaStorageService.getStatic('GacelaExtensionVersion');
  var extverparts = extver.split(".");
  if(extverparts[0] == 2 && extverparts[1]>=1) {
    return false; // Version bigger than 2.1 installed
  }
  if (extverparts[0]>2){
    return false; // Version bigger than 2.x installed
  }
  var ver = GacelaStorageService.getStatic("BrowserVersion");
  var mainver = ver;
  if (typeof(ver)=="string") {
    var vparts = ver.split(".");
    mainver = parseInt(vparts[0], 10);
  }
  if ((GacelaStorageService.getStatic("BrowserType")!="FF") && (mainver>7)) {
    return true;
  }
  return false;
}
//========================================================================

//===================================================================
// UCTWinScriptlets: tracklet/components/DomainCookieTracker.js
//===================================================================

/*jsl:declare Base64*/
/*jsl:declare json_encode */
/*jsl:declare base64_json_encode */

/** 
* The DomainCookieTracker inserts an iframe into pages matching the
* targetdomainregex. Results are sent as Customevents with the configured
* customeventname.
* To configure the Component initialize it with a config value.
* On the UserChanged Event the active_groups of the config is evaluated,
* and the component is enabled.
* @class Inserts iFrames into configured pages and reports results as Customevents
* @author Team Dev
* @public
* @property object config The configuration object for DomainCookieTracker
* @dependency tracklet Helper 15
* @dependency tracklet GfKBase 15
*/
function DomainCookieTracker(config){

  this.settings = [];
  this.initialized = false;
   
  /**
  * Creates a CustomEvent containing cookies. On a GacelaDocumentComplete event, this method is called. <br />
  * @private
  * @function
  * @param event e The document complete event object
  */
  this.OnDocumentComplete = function(e) {
    try {
      var purl = parseURL(e.url);
      var domain = purl.domain;
      var doc = e.document;
      for(var i = 0;i<this.settings.length;i++){
       if(domain){
         if (domain.match(this.settings[i].alldomainregex)) {
           var eid = GacelaTrackingService.eventIDToString(e.eid);
           var ts = e.timestamp;
           var cevent = {
            cookies : e.document.cookie,
            url : "" + (e.url),
            mainframe : e.mainframe,
            eid : eid,
            timestamp : ts,
            tags : GacelaTrackingService.trackingTags
           };
           var content = base64_json_encode(cevent);
           var entry = '<customevent eid="'+eid+'" timestamp="'+ts+'" type="' + this.settings[i].customeventname + '" key="'+domain+'" >'+content+'</customevent>';
           GacelaTrackingService.logData(entry);
         }

         // Create hidden IFrame to track doubleclick cookies.
         if (e.mainframe && domain.match(this.settings[i].targetdomainregex)) {
           var iframe = doc.createElement("iframe");
           iframe.setAttribute("src", this.settings[i].iframesrc);
           iframe.setAttribute("width", "0");
           iframe.setAttribute("heigth", "0");
           iframe.style.display = "none";
           doc.body.appendChild(iframe);
           iframe.src = this.settings[i].iframesrc;
         }
      }
      }
    }
    catch (err) {
      Logger.log("ERROR", "Error: Exception in  DomainCookieTracker::OnDocumentComplete. Message: " + err);
    }
  };

  /**
  * Assigns the GacelaDocumentComplete event to the OnDocumentComplete method.
  * @private
  * @function
  * @param object setting The setting object from the configuration.
  */
  this.Init = function(setting){
   this.settings = setting;
   if (!this.initialized) {
      this.initialized = true;
      var self = this;
      GacelaEventService.addListener('GacelaDocumentComplete', function(e){self.OnDocumentComplete(e);});
   }
  };

  /**
  * Initializes this component, is triggered by the UserChanged event.
  * @private
  * @param event e The UserChanged event
  * @param object config The config object from the configuration
  */
  this.OnUserChange = function(e, config){
    try{
      //check actionlist
      if(config !== null && typeof(config) !== "undefined"){
        //check group_name
        for(var i = 0 ; i < config.length ; i++){
          if(isPersonInGroup(e.user_id, config[i].active_groups)){
            this.Init(config[i].settings);
          }
        }
      }
    }
    catch (e){
      Logger.log("ERROR", "Error in DomainCookieTracker::OnUserChange: " + e);
    }
  };

  //Register init function
  var self = this;
  GacelaEventService.addListener('UserChanged', function(e){self.OnUserChange(e, config);});
}

//========================================================================

//===================================================================
// UCTWinScriptlets: tracklet/components/GoogleSERPRefererTracking.js
//===================================================================

/*

Google Search Engine Results Page Referrer Tracking Component

Tracks Navigation Events on Google Search Result Pages, and writes custom events of the type "google-reflink" in the
clicked-on pages with some information about the click, especially whether it was a natural search result, or a paid link.

The google-reflink custom event contains a base64 encoded JSON Object (this is standard) with the following properties:

href - the href attribute value of the link that was clicked on on the Google SERP
tagid - the id attribute of the link element that was clicked
clicktype - either "organic", "adword" or "other" - specifies the type of the link that has been clicked on
greenlink - (if present) - the "green" visible target domain/link below the adwords text (for example hotel.com or something like that)
assockey - the url of the Google SERP Page (same as google_url, see below)
timestamp - the timestamp of the click that led to the navigation
google_url - the url of the Google SERP Page
google_eid - the event ID of the click on the Google SERP Page (allows to uniquely identify that pageload)

Initialization Code (to be placed into extended_tracklet.js)

--

var googleSerpReferrerTrackingConstants = { 
"googleurlregexp" : /(\.|^)google\.(com|de)/i,  // Regex which determines, which pages are considered to be google pages
"awIDpattern" : "^(pa[1-3]1)|(an[1-8]1)$" , // Regex pattern for Adword-IDs
    "referrer_max_timediff" : 30000                  // Maximum time stamp difference between click and doc complete event, to associate them
};

var googleSERPReferrerTracking = new GoogleSERPReferrerTracking(false, googleSerpReferrerTrackingConstants);

--

As on mouse button up events SERP links are manipulated by Google, changing them into indirect links, the original link must be
reconstructed at our click events. Later, when a document has been loaded, the URL of that document is compared with the original link.
Original links cannot be fetched from "green texts" on the results page, as they do not always contain URLs. Therefore original links
are copied from the url=... parameter of the manipulated link.
The algorithm may use up to 10 "slots" for tracking: When more than one link is clicked during a short time interval (then usually click
with ctrl key to open in new tab), several slots may be active until the linked documents have been loaded.

*/

/*global GacelaStorageService, GacelaNavigateService, GacelaEventService, GacelaTrackingService, Base64, base64_json_encode, json_encode*/
/**
* Tracks Navigation Events on Google Search Result Pages, and writes custom events of the type "google-reflink" in the
* clicked-on pages with some information about the click, especially whether it was a natural search result, or a paid link.
* @class Tracks Navigation Events on Google Search Result Pages.
* @author Team Dev
* @public
* @param bool register_all True if all pages should be tracked, false if the pattern from the constants should be used.
* @param object constants Object containing configuration options
* @dependency tracklet Helper 15
* @dependency tracklet GlobalConfiguration
*/
function GoogleSERPReferrerTracking(register_all, constants)
{
    // Construction
    var self = this;
    this.constants = constants;

    // Mouseclick-Event IE
    var awIDpattern = this.constants.awIDpattern;

    /**
    * Checks if a given Document belongs to a Google page
    * @private
    * @function
    * @param object doc Document of the page to check
    * @returns bool True if the Document belongs to a google page, otherwise false
    */
    this.isGooglePage = function (doc) {
        var result = false;
        if (doc && doc.location && doc.location.href) {
            result = doc.location.href.search(this.constants.googleurlregexp) >= 0;
        }
        return result;
    };
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Some troubles with add-ons?

Post by Thrawn »

Code: Select all


        /**
        * Extracts the green text (which often -- but not always! -- is an URL) from a <b>cite</b> element
        * @private
        * @function
        * @param object elem HTML element
        * @returns string The extracted URL or empty string in case of failure
        */
        this.getGreenLink = function (elem) {
            var result = "";
            if (elem !== null && elem != 'undefined') {
                var pp = elem.parentNode.parentNode;
                try {
                    if (pp.getElementsByTagName('cite')[0] !== null & pp.getElementsByTagName('cite')[0] != 'undefined') {
                        result = this.removeTagsFromURL(pp.getElementsByTagName('cite')[0].innerHTML).replace(/\/\s\-\s/, "");
                    }
                } catch (ex) {
                }
            }
            return result;
        };

        /**
        * Removes HTML Tags '<' and '>' from given string
        * @private
        * @function
        * @param string url String
        * @returns string The input string without html tags
        */
        this.removeTagsFromURL = function (url) {
            url = url.replace(/<[^>]*>/g, "");
            return url;
        };

        /**
        * Claim stored referrer for this pageload
        * @private
        * @function
        * @param int compareTimestamp Timestamp to compare to
        * @param event event Event object
        */
        this.claimStoredReferrer = function(compareTimestamp, event) {
            this.claimedEvent = null;
            var doc = GacelaNavigateService.getCurrentDocument();
            var href = ((doc && doc.location && doc.location.href) ? doc.location.href : "");
            for (var i = 0; i <= 9; i++) {
                var ts = GacelaStorageService.get("GoogleSERPReferrerTimestamp" + i);
                ts = ((ts && ts.length) ? parseInt(ts, 10) : null);
                if (ts) {
                    var tdiff = Math.abs(ts - compareTimestamp);
                    if (tdiff > this.constants.referrer_max_timediff) {
                        // stale entry -> delete it
                        GacelaStorageService.set("GoogleSERPReferrerTimestamp" + i, "");
                        GacelaStorageService.set("GoogleSERPReferrer" + i, "");
                        continue;
                    }
                    var r = GacelaStorageService.get("GoogleSERPReferrer" + i);
                    var parts = r.split('~');
                    if (parts.length == 4) {
                        var reqTarget = "";
                        var json = Base64.decode(parts[2]);
                        eval("reqTarget=" + json + ";");
                        if (reqTarget.href == href) {
                            this.claimedEvent = { "content" : parts[2], "key" : parts[3], "timediff" : tdiff, "pageurl" : href };
                            this.claimedOnEventId = event.eid;
                            this.claimedOnTimestamp = new Date().getTime();
                            this.claimedIndex = i;
                            break;
                        }
                    }
                }
            }
        };

        /**
        * Checks the claimed stored referrer
        * @private
        * @function
        * @param int compareTimestamp Timestamp to compare to
        * @param event event Event object
        */
        this.checkStoredReferrer = function (compareTimestamp, event) {
            this.claimStoredReferrer(compareTimestamp, event);
            if (this.claimedOnEventId &&
                this.claimedOnEventId.userid == event.eid.userid &&
                this.claimedOnEventId.browsersessionid == event.eid.browsersessionid &&
                this.claimedOnEventId.windowid == event.eid.windowid &&
                this.claimedOnEventId.pageimpressionid == event.eid.pageimpressionid)
            {
                GacelaEventService.dispatchEvent("WriteGoogleReflinkCustomEvent", this.claimedEvent);
                this.claimedOnEventId = null;
                this.claimedEvent = null;
                this.claimedOnTimestamp = null;
                GacelaStorageService.set("GoogleSERPReferrer" + this.claimedIndex, "");
                GacelaStorageService.set("GoogleSERPReferrerTimestamp" + this.claimedIndex, "");
                this.claimedIndex = -1;
            }
        };

        /**
        * While a user is clicking on a search result link, Google manipulates the href attribute, so
        * that the link becomes an indirect link with via a google address. The manipulation happens
        * the mouse button down event handler of the <a> element.
        * This function extracts the original href from a manipulated href.
        * @private
        * @function
        * @param string href Manipulated link
        * @returns string Original link
        */
        this.getOriginalHREF = function(href) {
            var result = href;
            var i1 = href.indexOf("&url=");
            if (i1 >= 0) {
                i1 += 5;
                var i2 = href.indexOf("&", i1);
                result = unescape(href.substring(i1, i2));
            }
            return result;
        };
       
        /**
        * Creates CustomEvents for google referrer links
        * @private
        * @function
        * @param event e WriteGoogleReflinkCustomEvent event object
        */
        this.onWriteGoogleReflinkCustomEvent = function (e) {
            try {
                var eid = GacelaTrackingService.eventIDToString(e.eid);
                var ts = e.timestamp;
                var jsonObj = "";
                eval("jsonObj=" + Base64.decode(e.content) + ";");
                jsonObj["timediff"] = e.timediff;
                var jsonString = JSON.stringify(jsonObj);
                var content = Base64.encode(jsonString);
                var entry = '<customevent eid="' + eid + '" timestamp="' + ts + '" type="google-reflink" key="' + GacelaTrackingService.makeAttributeValid(e.key) + '">' + content + '</customevent>';
                GacelaTrackingService.logData(entry);
            } catch (ex) {
            }
        };

        /**
        * On GacelaDocumentComplete event checks the stored referrer and emulates a mouse click event for Microsoft Internet Explorer
        * @private
        * @function
        * @param event e GacelaDocumentComplete event object
        */
        this.onDocumentComplete = function (e) {
            if (e.mainframe) {
                this.checkStoredReferrer(this.beforeNavigateTimestamp ? this.beforeNavigateTimestamp : e.timestamp, e);

                // In IE we emulate a kind of GacelaMouseClickEvent, so that we can get the target
                if (GacelaStorageService.getStatic("BrowserType") == "MSIE") {
                    var doc = GacelaNavigateService.getCurrentDocument();
                    if (doc && doc.location && doc.location.href && this.isGooglePage(doc)) {
                        doc.attachEvent('onclick', function (e) {
                            GacelaEventService.dispatchEvent("MSIEGacelaMouseClick", { "target" : e.srcElement });
                        });
                    }
                }
            }
        };

        /**
        * Handles all click events and generates the logging data
        * Is called on GacelaClickEvent (non-IE) or on MSIEGacelaClickEvent (IE only)
        * @private
        * @function
        * @param event e GacelaClickEvent or MSIEGacelaClickEvent event object
        */
        this.onClick = function(e) {
            try {
                var doc = GacelaNavigateService.getCurrentDocument();
                var docurl = doc.location.href;
                if (((docurl.indexOf("https://") == -1) || GlobalConfiguration.isHttpsExceptionPage(doc, this.constants)) && this.isGooglePage(doc)) {
                    var eid = GacelaTrackingService.eventIDToString(e.eid);
                    var ts = e.timestamp;
                    // browseruebergreifendes target-Object
                    var target = e.target;
                    // Suchbegriffe in den Suchergebnissen werden mittels <b> oder <em> gehighlighted, daher auch Eltern-Element ueberpruefen.
                    if (target.nodeName == "A" || target.nodeName == "a" || target.parentNode.nodeName == "A" || target.parentNode.nodeName == "a") {
                        if (target.nodeName != "A" & target.nodeName != "a") {
                            target = target.parentNode;
                        }
                        var registerThis = register_all;
                        if (!registerThis) {
                            // AdWords
                            if (target.id.match(this.constants.awIDpattern)) {
                                registerThis = true;
                            } else {
                                // Suchergebnis-Link identifizieren: im DOM hochgehen bis #res erreicht, sonst Abbruch bei body
                                var p = target.parentNode;
                                while (p !== null && typeof (p) != 'undefined' && p.tagName != "BODY" && p.tagName != "body") {
                                    if (p.id == "res") {
                                        registerThis = true;
                                        break;
                                    }
                                    p = p.parentNode;
                                }
                            }
                        }
                        if (registerThis) {
                            var reqTarget = {};
                            reqTarget.tagid = target.id;
                            reqTarget.assockey = docurl;
                            reqTarget.href = target.getAttribute("href");
                            if (!reqTarget.href) {
                                reqTarget.href = "";
                            }
                           
                            // extract original href from manipulated href
                            reqTarget.href = this.getOriginalHREF(reqTarget.href);

                            // position eines Organics bestimmen (Position des uebergeordneten li-Items in der ol#rso oder aus der JS-Funktion in onmouseover-Attribut als Wert fuer "res")
                            var onmousedown = target.getAttribute("onmousedown");
                            reqTarget.orgposition = 0;

                            if (onmousedown !== null && typeof(onmousedown) != 'undefined') {
                                // In IE onmousedown is sometimes empty, i.e. getAttribute() returns an empty string. (Eventually caused by different delivering server.)
                                // However, the position can be extracted from "cd" parameter of the href attribute.
                                if (onmousedown !== "") {
                                    try {
                                        reqTarget.orgposition = onmousedown.substr(onmousedown.indexOf(",'res',") + 7).match(/\'[0-9]+\'/).toString().replace(/\'/g, "");
                                    } catch (ex1) {
                                    }
                                } else {
                                    var strpos = reqTarget.href.search(/(\&)|(\?)cd\=/i);
                                    if (strpos != -1) {
                                        strpos += 4;
                                        try {
                                            reqTarget.orgposition = reqTarget.href.substr(strpos).match(/[0-9]+/)[0];
                                        } catch (ex2) {
                                        }
                                    }
                                }
                            }
                            // organic vs. adword
                            if (target.id.match(this.constants.awIDpattern)) {
                                reqTarget.clicktype = "adword";
                            } else if (reqTarget.orgposition > 0) {
                                reqTarget.clicktype = "organic";
                            } else {
                                reqTarget.clicktype = "other";
                            }
                            // green text (inside a <cite> element => cite.innerHTML)
                            // Note that this is not always an URL, but sometimes a row of links which is a kind of path
                            reqTarget.greenlink = this.getGreenLink(target);
                            reqTarget.timestamp = ts;
                            reqTarget.google_url = docurl;
                            reqTarget.google_event_eid = eid;
                            var json = JSON.stringify(reqTarget);
                            var content = Base64.encode(json);
                            var value = String(ts) + "~" + eid + "~" + content + "~" + Base64.encode(docurl);
                            // find free slot
                            for (var i = 0; i <= 9; i++) {
                                var t = GacelaStorageService.get("GoogleSERPReferrerTimestamp" + i, value);
                                if (!t || !t.length) {
                                    break;
                                }
                            }
                            GacelaStorageService.set("GoogleSERPReferrer" + i, value);
                            GacelaStorageService.set("GoogleSERPReferrerTimestamp" + i, String(ts));
                        }
                    }
                }
            } catch (ex) {
            }
        };

        var clickEvtName = (GacelaStorageService.getStatic("BrowserType") == "MSIE" ? 'MSIEGacelaMouseClick' : 'GacelaMouseClick');
        GacelaEventService.addListener(clickEvtName, function(e) {
            self.onClick(e);
        });
        GacelaEventService.addListener('GacelaDocumentComplete', function(e) {
            self.onDocumentComplete(e);
        });
        GacelaEventService.addListener('WriteGoogleReflinkCustomEvent', function(e) {
            self.onWriteGoogleReflinkCustomEvent(e);
        });
    }

    //===================================================================
    // UCTWinScriptlets: tracklet/helper/Logger.js
    //===================================================================

    /*jsl:option explicit*/

    /*global GacelaStorageService, BlindSend*/
    /**
    * Provides a function to create an entry in the messagelog. Determines necessary informations and makes a HTTP-Request to the <b>receive_logdata.php</b> of the backend.
    * @class Provides a function to create an entry in the messagelog.
    * @author Team Dev
    * @apiVersion 1
    */
    var Logger = {

       /** @constant */
       logLevelTrace : "TRACE",
       /** @constant */
       logLevelInfo : "INFO",
       /** @constant */
       logLevelWarning : "WARNING",
       /** @constant */
       logLevelError : "ERROR",

       /**
       * Creates a semicolon separated string with additional informations for the MessageLog.   
       * @function
       * @returns string Addon informations
       */
       getAddonInfo : function () {
          var addonInfo = GacelaStorageService.getStatic("GacelaUserId");
          addonInfo += ";" + GacelaStorageService.getStatic("GacelaExtensionVersion");
          addonInfo += ";" + GacelaStorageService.getStatic("GacelaPanelId");
          addonInfo += ";" + GacelaStorageService.getStatic("GacelaInstallId");
          addonInfo += ";" + GacelaStorageService.getStatic('WinVersion');
          addonInfo += ";" + GacelaStorageService.getStatic('BrowserType');
          addonInfo += ";" + GacelaStorageService.getStatic('BrowserVersion');
          addonInfo += ";" + GacelaStorageService.getStatic('GacelaUpdateletVersion');
          addonInfo += ";" + GacelaStorageService.getStatic('GacelaTrackletVersion');
          addonInfo += ";" + GacelaStorageService.getStatic('GacelaSniffletVersion');
          return addonInfo;
       },
       
       /**
       * Sends a request to receive_logdata.php. Only the logLevel and the error message have to be provided, <br />
       * the additional required informations will be automatically fetched.
       * @function
       * @param string logLevel The log level. Will be converted to uppercase
       * @param string errorMessage The message you want to send to the backend
       * @requires Helper
       */
       log : function (logLevel, errorMessage) {
          var date, logMessage, messageTargetBaseUrl, formattedGetParameter;
          date = new Date();
          logMessage =  date.getTime();
          logMessage += "\t" + date.toLocaleString();
          logMessage += "\t" + logLevel.toUpperCase();
          logMessage += "\t" + this.getAddonInfo();
          logMessage += "\t\t" + errorMessage + "\n";
          messageTargetBaseUrl = GacelaStorageService.get("GacelaLogmessageTargetUrl");
          if (!messageTargetBaseUrl || messageTargetBaseUrl.length < 10 || messageTargetBaseUrl === '@GacelaLogmessageTargetUrl@') {
             messageTargetBaseUrl = GacelaStorageService.getStatic('BaseUrl') + "/receive_logdata.php";
          }
          formattedGetParameter = "format=simple";
          formattedGetParameter += "&uid=" + encodeURIComponent(GacelaStorageService.get("GacelaUserId"));
          formattedGetParameter += "&data=" + encodeURIComponent(logMessage);
          formattedGetParameter += "&send_tstamp=" + new Date().getTime();
          BlindSend(messageTargetBaseUrl, formattedGetParameter);
          return;
       }
    };

    //===================================================================
    // UCTWinScriptlets: tracklet/components/ViewTimeMeasurement.js
    //===================================================================

    /*jsl:option explicit*/
    /*global BlindSend, JSON */

    /**
    * The View Time Measurement component is a configurable tracklet component,
    * which allows measuring how long certain display ads are visible to a user.
    * https://jira.nurago.com/browse/PD0793-2306
    */
    function ViewTimeMeasurement(config)
    {
       
       this.finishedPID = -1;
       
       // in IE it is not possible to re-dispatch an event from within the GacelaPageLeave Event Handler, and get an event which has the same page id,
       // This is a hack-ish workaround:
       this.patchIETrackingService = function() {
          if (GacelaStorageService.getStatic("BrowserType")!="MSIE") return;

          var viewTimeSelf = this;
          // Save original event handler from GacelaTRackingService.
          GacelaTrackingService._original_onPageLeave = GacelaTrackingService.onPageLeave;
          
          // Inject some wrapper code. Remember: This is called in the context of GacelaTrackingService, therefore "this" refers to GacelaTrackingService.
          // to refer to the "ViewTimeService" this, refer to viewTimeSelf defined above
          GacelaTrackingService.onPageLeave = function(event) {
             try {
                
                var id = event.eid;
                // Since PageLeave can be guaranteed to be the last event for a given page, it should be safe to "synthesize" 2 events from one to get unique event ids.
                //  at least on IE
                var event1 = {  "userid" : id.userid,
                            "browsersessionid" : id.browsersessionid,
                            "windowid" : id.windowid,
                            "pageimpressionid" : id.pageimpressionid,
                            "eventid" : id.eventid
                            };
                            
                viewTimeSelf.cleanup(config, event1, false, this.use_last_pidata);
                event.eid.pageimpressionid = id.pageimpressionid+1;
                    return this._original_onPageLeave(event);
             } catch(E) {
                Logger.log("ERROR", "Exception in ViewTimeMeasurement IE Hack: "+E.message);
                    // Do the safe thing to not lose data
                    return this._original_onPageLeave(event);
             }
          };
       };
       
       this.patchIETrackingService();
       
       /**
         * Returns true if the passed node is an ad (in terms of configuration).
         */
        this.isAd = function(node, config)
        {   
            var match = false;
            for (var i = 0; !match && (i < config.patterns.length); i += 3) {
                // Examples:
                // "img", "src", new RegExp("adserv\.quality-channel\.de.*")
                // "", "id", "4711"
                var tag = config.patterns[i].toUpperCase();
                if (!tag || node.nodeName.toUpperCase() == tag) {
                    var attrname = config.patterns[i + 1];
                    var val = config.patterns[i + 2];
                    if (val instanceof RegExp) {
                        match = val.test(node[attrname]);
                    } else {
                        match = (node[attrname] == val);
                    }
                }
            }
            return match;
        };

        /**
         * Initializes ad states for a node, when it is an ad.
         */
        this.checkForAd = function(node, config)
        {
            var bAd = this.isAd(node, config);
            if (bAd) {
                var found = false;
                for (var i = 0; i < this.ads.length; i++) {
                    if (this.ads[i].node === node) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    var ad = new Object();
                    ad.node = node;
                    ad.creationTime = this.time;
                    for (var cp = 0; cp < config.percentages.length; cp++) {
                        var configPerc = config.percentages[cp];
                        // initialize stopwatch as "stopped"
                        ad["start" + configPerc] = null;      // time since last start - not started yet
                        ad["stop" + configPerc] = this.time;  // time since last stop == creation time
                        ad["time" + configPerc] = 0;
                        ad["visibilityCount" + configPerc] = 0;
                        ad["history" + configPerc] = [];
                    }
                    ad.key = node.nodeName;
                    if (node.id) {
                        ad.key += " " + node.id;
                    }
                    this.ads.push(ad);
                }
            }
            return bAd;
        };

        /**
         * Performs a depth first tree traversal rooted at the given rootNode.  This
         * node and all of its child nodes will have checkForAd() called on it.
         */
        this.dfsCheckForAd = function(rootNode, config)
        {
          
            var numChildren = rootNode.childNodes.length;
            if (!this.checkForAd(rootNode, config)) {
                for (var i = 0; i < numChildren; i++) {
                    var childNode = rootNode.childNodes[i];
                    this.dfsCheckForAd(childNode, config);
                }
            }
          
        };
       
        /**
         * Called while the current document is active.
         * Checks all ads for changes in all (percentage related) visibility states.
         * Starts or stops stopwatches on related visibility state changes.
         */
        this.update = function(config, event)
        {
          if (event.eid.pageimpressionid<=this.finishedPID) return; // No updates for pages which we've already cleaned up
            var window = GacelaNavigateService.getCurrentWindow();
            var document = GacelaNavigateService.getCurrentDocument();
          
            this.time = new Date().getTime();
            if (this.windowActive) {
                this.dfsCheckForAd(document, config);
            }
           
            for (var i = 0; i < this.ads.length; i++) {
                var percVisible = (this.windowActive ? this.getPercetageVisible(this.ads[i].node) : 0);
                //addToLogFile("update()  percVisible:" + percVisible);
                for (var cp = 0; cp < config.percentages.length; cp++) {
                    var configPerc = config.percentages[cp];
                    if (this.ads[i]["start" + configPerc] === null) {
                        if (percVisible >= configPerc) {
                            // ad has become visible -> start stopwatch
                            //addToLogFile("update()  start " + i + " (" + configPerc + "%)");
                            var tInvisible = this.time - this.ads[i]["stop" + configPerc];  // time since last stop
                            this.ads[i]["history" + configPerc].push(tInvisible);
                            this.ads[i]["start" + configPerc] = this.time;
                            this.ads[i]["stop" + configPerc] = null;
                            this.ads[i]["visibilityCount" + configPerc]++;
                        }
                    } else {
                        if (percVisible < configPerc) {
                            // ad has become invisible -> stop stopwatch
                            //addToLogFile("update()  stop " + i + " (" + configPerc + "%)");
                            var tVisible = this.time - this.ads[i]["start" + configPerc];  // time since last start
                            this.ads[i]["history" + configPerc].push(tVisible);
                            this.ads[i]["time" + configPerc] += tVisible;
                            this.ads[i]["start" + configPerc] = null;
                            this.ads[i]["stop" + configPerc] = this.time;
                        }
                    }
                }
            }
        };

        /**
         * Called when the current document has been closed.
         * Checks all ads for changes in all (percentage related) visibility states.
         * Starts or stops stopwatches on related visibility state changes.
         */
        this.cleanup = function(config, eventid, doDispatch, use_last_pidata)
        {
          this.finishedPID = eventid.pageimpressionid;
            //addToLogFile("cleanup()");
            this.time = new Date().getTime();
            try {
                for (var i = 0; i < this.ads.length; i++) {
                    var instanceTime = this.time - this.ads[i].creationTime;
                    var ce = {
                        "key": this.ads[i].key,
                        "cedata": {
                            "instanceTime": instanceTime
                        }
                    };
               
                    for (var cp = 0; cp < config.percentages.length; cp++) {
                        var configPerc = config.percentages[cp];
                        if (this.ads[i]["start" + configPerc] !== null) {
                            //addToLogFile("cleanup()  stop " + i + " (" + configPerc + "%)");
                            var tVisible = this.time - this.ads[i]["start" + configPerc];
                            this.ads[i]["history" + configPerc].push(tVisible);
                            this.ads[i]["time" + configPerc] += tVisible;
                            this.ads[i]["start" + configPerc] = null;
                        } else {
                            var tInvisible = this.time - this.ads[i]["stop" + configPerc];
                            this.ads[i]["history" + configPerc].push(tInvisible);
                        }

                        ce.cedata["vt" + configPerc] = {
                            "tt": this.ads[i]["time" + configPerc],
                            "visCount": this.ads[i]["visibilityCount" + configPerc],
                            "history": this.ads[i]["history" + configPerc]
                        };
                    }
                   
                    ce.cedata.info = GacelaStorageService.getStatic("GacelaUserId") + ";" +
                                     GacelaStorageService.getStatic("GacelaExtensionVersion") + ";" +
                                     GacelaStorageService.getStatic("GacelaPanelId") + ";" +
                                     GacelaStorageService.getStatic("GacelaInstallId") + ";" +
                                     GacelaStorageService.getStatic("WinVersion") + ";" +
                                     GacelaStorageService.getStatic("BrowserType") + ";" +
                                     GacelaStorageService.getStatic("BrowserVersion");
                    ce.use_last_pidata = (use_last_pidata) ? true : false;
                    //addToLogFile("CE: " + JSON.stringify(ce));
                if (doDispatch) {
                   GacelaEventService.dispatchEvent("WriteViewTimeMeasurementCustomEvent", ce);
                } else {
                   // Part of hack solution for IE
                   ce.eid = eventid;
                   this.onWriteViewTimeMeasurementCustomEvent(ce);
                }
                }
            } catch (ex) {
             //addToLogFile("EXCEPTION in ViewTimeMeasurement.cleanup(): " + ex.message);
            }
           
            // dispose all ads
            this.ads = [];
        };

        /**
         * Returns size of current viewport (== visible range within browser window)
         * @return object (props: x,y)
         */
        this.getViewportSize = function()
        {
            var window = GacelaNavigateService.getCurrentWindow();
            //var window = this.getWindow();
           
            var size = {x: 0, y: 0};
            // use window.top to grant functionality in frame structures
            if (typeof(window.innerWidth) == 'number') {
                //Non-IE
                size.x = window.innerWidth;
                size.y = window.innerHeight;
            } else if (window.document.documentElement && (window.document.documentElement.clientWidth || window.document.documentElement.clientHeight)) {
                //IE 6+ in 'standards compliant mode'
                size.x = window.document.documentElement.clientWidth;
                size.y = window.document.documentElement.clientHeight;
            } else if (window.document.body && (window.document.body.clientWidth || window.document.body.clientHeight)) {
                //IE 4 compatible
                size.x = window.document.body.clientWidth;
                size.y = window.document.body.clientHeight;
            }
           
            //addToLogFile("getViewportSize()  size:" + JSON.stringify(size));
           
            return size;
        };

        /**
         * Returns the current scroll position (offset).
         */
        this.getScrollPos = function()
        {
            var window = GacelaNavigateService.getCurrentWindow();
            var document = GacelaNavigateService.getCurrentDocument();
            var pos = {x: 0, y: 0};
            if (typeof(window.pageYOffset) == 'number') {
                pos.y = window.pageYOffset;
                pos.x = window.pageXOffset;
            } else if (document.body) {
                // DOM compliant
                pos.y = document.body.scrollTop;
                pos.x = document.body.scrollLeft;
            } else if (document.documentElement) {
                // IE6 standards compliant mode
                pos.y = document.documentElement.scrollTop;
                pos.x = document.documentElement.scrollLeft;
            }
            return pos;
        };
       
        /**
         * Returns the total document size.
         * @return object (props: x,y)
         */
        this.getDocumentSize = function()
        {
            var doc = GacelaNavigateService.getCurrentDocument();
            //var doc = this.getDocument();
           
            var w1 = Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth);
            var w2 = Math.max(doc.body.offsetWidth, doc.documentElement.offsetWidth);
            var w3 = Math.max(doc.body.clientWidth, doc.documentElement.clientWidth);
            var h1 = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight);
            var h2 = Math.max(doc.body.offsetHeight, doc.documentElement.offsetHeight);
            var h3 = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight);
            var size = {
                x: Math.max(w1, w2, w3),
                y: Math.max(h1, h2, h3)
            };

            //addToLogFile("getDocumentSize()  size:" + JSON.stringify(size));

            return size;
        };

        /**
         * Returns the position coordinates of a node.
         */
        this.getNodePos = function(node)
        {
            var pos = {x: 0, y: 0};
            if (node && node.offsetParent) {
                do {
                    pos.x += node.offsetLeft;
                    pos.y += node.offsetTop;
                    node = node.offsetParent;
                } while (node);
            }
            return pos;
        };

        /**
         * Returns the total area of a node.
         */
        this.getNodeSize = function(node)
        {
            var size = {x: 0, y: 0};
            try {
                size.y = node.offsetHeight;
                size.x = node.offsetWidth;
            } catch (ex) {
                //addToLogFile("EXCEPTION in ViewTimeMeasurement.getNodeSize(): " + ex.message);
            }
            return size;
        };
       
        /**
         * Returns the area of the visible part of a node.
         */
        this.getAdDimensionsVisible = function(node)
        {
            var size = {x: 0, y: 0};
            try {
                var adPos = this.getNodePos(node);
                var adSize = this.getNodeSize(node);
                var scrollPosition = this.getScrollPos();
                var viewport = this.getViewportSize();
                var currentRangeHeight = viewport.y + scrollPosition.y; // viewport height + scroll pos top
                var currentRangeWidth = viewport.x + scrollPosition.x; // viewport width + scroll pos left
                var adSpaceToViewportRight = currentRangeWidth - adPos.x - adSize.x;
                var adSpaceToViewportLeft = adPos.x - scrollPosition.x;
                var adSpaceToViewportBottom = currentRangeHeight - adPos.y - adSize.y;
                var adSpaceToViewportTop = adPos.y - scrollPosition.y;
                size.x = Math.max(0, viewport.x - ((adSpaceToViewportRight > 0) ? adSpaceToViewportRight : 0) - ((adSpaceToViewportLeft > 0) ? adSpaceToViewportLeft : 0));
                size.y = Math.max(0, viewport.y - ((adSpaceToViewportTop > 0) ? adSpaceToViewportTop : 0) - ((adSpaceToViewportBottom > 0) ? adSpaceToViewportBottom : 0));
            } catch (ex) {
                //addToLogFile("EXCEPTION in ViewTimeMeasurement.getAdDimensionsVisible(): " + ex.message);
            }
            return size;
        };
       
        /**
         * Returns the amount of visibility in percent.
         */
        this.getPercetageVisible = function(node)
        {
            var adDimensions = this.getNodeSize(node);
            var adDimensionsVisible = this.getAdDimensionsVisible(node);
            var adArea = adDimensions.x * adDimensions.y;
            var adAreaVisible = adDimensionsVisible.x * adDimensionsVisible.y;
            return adAreaVisible / adArea * 100;
        };
       
        /**
         * Initializes this component, is triggered by the UserChanged event.
         * Starts the tracking, if the current user is in a configured group.
         * @private
         * @param event e The UserChanged event         
         */
        this.onUserChange = function(e, config)
        {
            //addToLogFile("onUserChange(" + e.eid.userid + ", " + e.eid.windowid + ")");
        };

        /**
         * Called on GacelaNewWindow event.
         * ...
         * @private
         * @param event e NewWindow object.
         */
        this.onNewWindow = function(e, config)
        {
            //addToLogFile("onNewWindow(" + e.eid.userid + ", " + e.eid.windowid + ")");
        };   

        /**
         * Called on GacelaBeforeNavigate event.
         * ...
         * @private
         * @param event e BeforeNavigate object.
         */
        this.onBeforeNavigate = function(e, config)
        {
            //addToLogFile("onBeforeNavigate(" + e.eid.userid + ", " + e.eid.windowid + ", " + e.url + ")");
        };   

        /**
         * Called on GacelaNavigateComplete event.
         * ...
         * @private
         * @param event e NavigateComplete object.
         */
        this.onNavigateComplete = function(e, config)
        {
            //addToLogFile("onNavigateComplete(" + e.eid.userid + ", " + e.eid.windowid + ", " + e.url + ")");
        };   

        /**
         * Called when the window visibility changes.
         * ...
         * @private
         * @param event evt
         */
        this.onDocFocusChange = function(evt, config)
        {
            try {
                var window = GacelaNavigateService.getCurrentWindow();
                var document = GacelaNavigateService.getCurrentDocument();
                var body = document.body;
                evt = evt || window.event;
                if (evt.type == "focus" || evt.type == "focusin") {
                    this.windowActive = true;
                } else if (evt.type == "blur" || evt.type == "focusout") {
                    this.windowActive = false;
                } else if (typeof document.hidden !== "undefined") {
                    this.windowActive = document.visibilityState == 'visible';
                } else if (typeof document.mozHidden !== "undefined") {
                    this.windowActive = document.mozVisibilityState == 'visible';
                } else if (typeof document.msHidden !== "undefined") {
                    this.windowActive = document.msVisibilityState == 'visible';
                } else if (typeof document.webkitHidden !== "undefined") {
                    this.windowActive = document.webkitVisibilityState == 'visible';
                }
                //addToLogFile("onDocFocusChange() evt.type:" + evt.type + " this.windowActive:" + this.windowActive);
                this.update(config, evt);
            } catch (ex) {
                //addToLogFile("EXCEPTION in ViewTimeMeasurement.onDocFocusChange(): " + ex.message);
            }
        };
       
        /**
         * Called on GacelaDocumentComplete event.
         * ...
         * @private
         * @param event evt DocumentComplete object.
         */
        this.onDocComplete = function(evt, config)
        {
            //addToLogFile("onDocComplete(" + evt.eid.userid + ", " + evt.eid.windowid + ", " + evt.url + ") adcount:" + this.ads.length);
            var document = GacelaNavigateService.getCurrentDocument();
            this.windowActive = true;  //todo
           
            var vis = {
                hidden: "visibilitychange",
                mozHidden: "mozvisibilitychange",
                webkitHidden: "webkitvisibilitychange",
                msHidden: "msvisibilitychange",
                oHidden: "ovisibilitychange" /* not currently supported */
            };             
            var change;
            for (var hidden in vis) {
                if (vis.hasOwnProperty(hidden) && hidden in document) {
                    change = vis[hidden];
                    break;
                }
            }
            var self = this;
            if (change) {
                document.addEventListener(change, function(e) {
                    self.onDocFocusChange(e, config);
                });
            } else {
                document.onfocusin = document.onfocusout = function(e) {
                    self.onDocFocusChange(e, config);
                };
            }

            this.update(config, evt);
        };

        /**
         * Called on GacelaPageHide event.
         * @private
         * @param event e GacelaPageHide event object.
         */
        this.onPageHide = function(e, config)
        {
          //addToLogFile("onPageHide(" + e.eid.userid + ", " + e.eid.windowid + ", " + e.url + ")");   
       };

        /**
         * Called on GacelaPageLeave event.
         * @private
         * @param event e GacelaPageLeave event object.
         */
        this.onPageLeave = function(e, config)
        {
          //addToLogFile("onPageLeave(" + e.eid.userid + ", " + e.eid.windowid + ", " + e.url + ")");
          if (GacelaStorageService.getStatic("BrowserType")!="MSIE") {
             this.cleanup(config, e.eid, true, false);
          }
        };
       
        /**
         * Called on GacelaWindowClose event.
         * @private
         * @param event e GacelaWindowClose event object.
         */
        this.onWindowClose = function(e, config)
        {
            //addToLogFile("onWindowClose(" + e.eid.userid + ", " + e.eid.windowid + ", " + e.url + ")");
        };
       
        /**
         * Called on GacelaWindowActivated event.
         * @private
         * @param event e WindowActivated event object.
         */
        this.onWindowActivated = function(e, config)
        {
            //addToLogFile("onWindowActivated(" + e.eid.userid + ", " + e.eid.windowid /*+ ", " + e.url*/ + ") adcount:" + this.ads.length);
            this.windowActive = true;
            this.update(config, e);
        };

        /**
         * Called on GacelaWindowDeactivated event.
         * @private
         * @param event e WindowDeactivated event object.
         */
        this.onWindowDeactivated = function(e, config)
        {
            //addToLogFile("onWindowDeactivated(" + e.eid.userid + ", " + e.eid.windowid /*+ ", " + e.url*/ + ") adcount:" + this.ads.length);
            this.windowActive = false;
            this.update(config, e);
        };
       
        /**
         * Called on GacelaScroll event.
         * Updates all ad status data.
         * @private
         * @param event evt GacelaScroll event object.
         */
        this.onScroll = function(evt, config)
        {
            this.update(config, evt);
        };

       
        /**
         * Called on WriteViewTimeMeasurementCustomEvent event.
         * ...
         * @private
         * @param event evt ViewTimeMeasurementEvent object.
         */
        this.onWriteViewTimeMeasurementCustomEvent = function(evt)
        {
            try {
             var key = JSON.stringify(evt.key);
             if (!evt.use_last_pidata) {
                GacelaTrackingService.sendCustomevent(evt, key, "ViewTimeMeasurement", evt.cedata);
             } else {
                if (GacelaTrackingService.sendCustomeventLastPI) {
                   GacelaTrackingService.sendCustomeventLastPI(evt, key, "ViewTimeMeasurement", evt.cedata);
                }
             }
                addToLogFile("Wrote CE with key: " + key);
            } catch (ex) {
             //addToLogFile("EXCEPTION in ViewTimeMeasurement.onWriteViewTimeMeasurementCustomEvent(): " + ex.message);
            }
        };

        var self = this;
        GacelaEventService.addListener('UserChanged', function(e) {
            self.onUserChange(e, config);
        });
        GacelaEventService.addListener('GacelaNewWindow', function(e) {
            self.onNewWindow(e, config);
        });
        GacelaEventService.addListener('GacelaBeforeNavigate', function(e) {
            self.onBeforeNavigate(e, config);
        });
        GacelaEventService.addListener('GacelaNavigateComplete', function(e) {
            self.onNavigateComplete(e, config);
        });
        GacelaEventService.addListener('GacelaDocumentComplete', function(e) {
            self.onDocComplete(e, config);
        });
        GacelaEventService.addListener('GacelaPageHide', function(e) {
            self.onPageHide(e, config);
        });
        GacelaEventService.addListener('GacelaPageLeave', function(e) {
            self.onPageLeave(e, config);
        });
        GacelaEventService.addListener('GacelaWindowClose', function(e) {
            self.onWindowClose(e, config);
        });
        GacelaEventService.addListener('GacelaWindowActivated', function(e) {
            self.onWindowActivated(e, config);
        });
        GacelaEventService.addListener('GacelaWindowDeactivated', function(e) {
            self.onWindowDeactivated(e, config);
        });
        GacelaEventService.addListener('GacelaScroll', function(e) {
            self.onScroll(e, config);
        });
        GacelaEventService.addListener('WriteViewTimeMeasurementCustomEvent', function (e) {
            self.onWriteViewTimeMeasurementCustomEvent(e);
        });

        this.config = config;
        this.ads = [];
        //addToLogFile("ViewTimeMeasurement - Initialized"); 
    }
    //===================================================================
    // UCTWinScriptlets: tracklet/components/GlobalConfiguration.js
    //===================================================================

    /**
    * This component aggregates global, cross-component configuration values and related functions.
    *
    * @name GlobalConfiguration
    * @author Team Dev
    * @public
    */
    var GlobalConfiguration = {
        config: {},

        /**
        * Checks whether https tracking is allowed for a given document. This is usually configured by this.config.httpsExceptionRegexp,
        * in special cases overridden by localConfig.httpsExceptionRegexp.
        * Note that soon any google page will to use https automatically.
        * @private
        * @function
        * @param object doc Document of the page to check
        * @returns bool true if https tracking is allowed for the passed document, otherwise false
        */
        isHttpsExceptionPage: function(doc, localConfig) {
            var result = false;
            if (doc && doc.location && doc.location.href) {
                if (localConfig && localConfig.httpsExceptionRegexp) {
                    result = doc.location.href.search(localConfig.httpsExceptionRegexp) >= 0;
                } else if (this.config.httpsExceptionRegexp) {
                    result = doc.location.href.search(this.config.httpsExceptionRegexp) >= 0;
                }
            }
            return result;
        }
    };

    //===================================================================
    // UCTWinScriptlets: tracklet/components/ChromeFixes.js
    //===================================================================

    /**
    *  Does nothing if executed on Firefox or IE <br />
    * On Chrome, it provides a fix for the fact that in Chrome, every component which relies on "UserChanged" Events to initialize itself for a given user, <br />
    * will fail to "stay initialized" on new pageloads, since on Chrome, the Tracklet gets completely re-evaluated for each pageload. <br />
    * Usage:<br />
    *  Place the following on the last line of the tracklet configuration (extended_tracklet.js):<br />
    * <font color='red'>IMPORTANT: IT MUST BE THE LAST STATEMENT IN THE CONFIGURATION !</font>
    * @class Provides a fix for the fact that in Chrome, every component which relies on "UserChanged" Events to initialize itself for a given user
    * @author Team Dev
    */
    function CChromeFixes() {
       this.installed = false;
       this.initializedUser = false;
       this.install();
       this.initUser();
    }

    CChromeFixes.prototype = {
       
       installed : false,
       initializedUser : false,   
       
       /**
       * Checks if the current browser is Google Chrome. If it is, it registers {@link CChromeFixes#event:onUserChange} to the UserChanged event.
       * @function
       */
       install : function() {
          if (this.installed) {
             return;
          }
          if (GacelaStorageService.getStatic("BrowserType")=="Chrome") {
             this.installed = true;
             GacelaEventService.addListener('UserChanged', bind(this.onUserChange, this));
          }
       },

       /**
       * Initializes the current user and fires a UserChanged event.
       * @function
       * @returns boolean Describes if the user has been initialized
       */
       initUser : function() {
          if (!this.installed) {
             return false;
          }
          if (this.initializedUser) {
             return false;
          }
          var uid = GacelaLocalModel.get("ChromeFixes.user_id");
          if (uid) {
             this.initializedUser = true;
             GacelaEventService.dispatchEvent('UserChanged', { "user_id" : uid });
          }
          return true;
       },

       /**
       *   Sets the user id
       *   @function
       *   @param event e A userChanged event
       *   @event UserChanged
       */
       onUserChange : function(e) {
          GacelaLocalModel.set("ChromeFixes.user_id", e.user_id);   
          this.initializedUser = true;
       }

    };

    eval(GacelaStorageService.getTracklet('extended_tracklet.js'));
    Local Tracklet URL=file://C:/Program%20Files%20(x86)/GfK%20Internet-Monitor//extended_tracklet.js
    20 March 2013 19:50:50: Tab0 got Focus
    onPageHide
    args[url]=http://localhost:9768/deliver/dialogs/UserSelectionDialog.html?allow_concurrent_logins=false&ask_for_guest_socio=false&ts=1363809051038&LastAuthenticatedUser=undefined#NoLastSelection;1:Chrissy%20Pang;96:Household%20member%20under%2016;99:Guest
    args[id]=Authentication
    args[GacelaTab]=[object Object]

Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Some troubles with add-ons?

Post by Thrawn »

No actual ABE messages there, but I do notice at least one reference to localhost:9768, which is likely to cause ABE problems.
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0
Post Reply