You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/06/27 18:24:13 UTC

svn commit: r1497424 - /incubator/marmotta/site/trunk/content/resources/js/marmotta.js

Author: wikier
Date: Thu Jun 27 16:24:13 2013
New Revision: 1497424

URL: http://svn.apache.org/r1497424
Log:
MARMOTTA-244: reimplemented tracking code

Modified:
    incubator/marmotta/site/trunk/content/resources/js/marmotta.js

Modified: incubator/marmotta/site/trunk/content/resources/js/marmotta.js
URL: http://svn.apache.org/viewvc/incubator/marmotta/site/trunk/content/resources/js/marmotta.js?rev=1497424&r1=1497423&r2=1497424&view=diff
==============================================================================
--- incubator/marmotta/site/trunk/content/resources/js/marmotta.js (original)
+++ incubator/marmotta/site/trunk/content/resources/js/marmotta.js Thu Jun 27 16:24:13 2013
@@ -59,20 +59,13 @@ $(document).ready(function() {
         showHideChangelogs();
 
         var filetypes = /\.(zip|gz)$/i;
-        var baseHref = '';
-        if (jQuery('base').attr('href') != undefined)
-            baseHref = jQuery('base').attr('href');
-        jQuery('a').each(function() {
-            var href = jQuery(this).attr('href');
+        $("a").each(function() {
+            var href = $(this).attr("href");
             if (href && href.match(filetypes)) {
-                jQuery(this).click(function() {
-                    var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;
-                    var filePath = href;
-                    _gaq.push(['_trackEvent', 'Download', 'Click-' + extension, filePath]);
-                    if (jQuery(this).attr('target') != undefined && jQuery(this).attr('target').toLowerCase() != '_blank') {
-                        setTimeout(function() { location.href = baseHref + href; }, 200);
-                        return false;
-                    }
+                $(this).click(function() {
+                    _trackEvent("_trackEvent", "download", $(this).attr("href"));
+                    setTimeout(function() { location.href = $(this).attr("href"); }, 300);
+                    return false;
                 });
             }
         });