can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[ljcom] r10644: LJSUP-9074: Should links open in a new w...

Committer: dpetrov
LJSUP-9074: Should links open in a new window?
U   trunk/htdocs/index.bml.sup
Modified: trunk/htdocs/index.bml.sup
===================================================================
--- trunk/htdocs/index.bml.sup	2011-06-14 03:14:18 UTC (rev 10643)
+++ trunk/htdocs/index.bml.sup	2011-06-14 03:19:53 UTC (rev 10644)
@@ -23,18 +23,26 @@
                 _gaq.push(['_setAccount', 'UA-21183958-7']);
                 _gaq.push(['_setDomainName', 'www.livejournal.com']);
                 _gaq.push(['_trackPageview']);
-                function track_super8( link, event ) {
-                    _gaq.push(["_trackEvent", "super8_branding", "click", link.href]);
-                    setTimeout( 'location="' + link.href + '"', 100);
-                    return false;
+                function track_super8( link, e ) {
+                    _gaq.push(["_trackEvent", "super8", "click", link.href]);
+
+                    // if no new tab
+                    if ( link.target !== '_blank' && !(e.metaKey || e.altKey || e.shiftKey || e.ctrlKey) && e.which === 1 ) {
+                        setTimeout('location="' + link.href + '"', 100);
+                        e.preventDefault();
+                    }
                 }
             </script>
 
             <ul class="branding-links">
-                <li class="branding-link branding-link-1"><a href="http://www.super8film.ru" target="_blank" onclick="return track_super8( this, event )"></a></li>
-                <li class="branding-link branding-link-2"><a href="http://www.super8film.ru" target="_blank" onclick="return track_super8( this, event )"></a></li>
-                <li class="branding-link branding-link-3"><a href="http://www.super8film.ru" target="_blank" onclick="return track_super8( this, event )"></a></li>
+                <li class="branding-link branding-link-1"><a href="http://www.super8film.ru" target="_blank"></a></li>
+                <li class="branding-link branding-link-2"><a href="http://www.super8film.ru" target="_blank"></a></li>
+                <li class="branding-link branding-link-3"><a href="http://www.super8film.ru" target="_blank"></a></li>
             </ul>
+
+            <script type="text/javascript">
+                jQuery( '.branding-link a' ).click( function( e ) { track_super8( this, e ); } );
+            </script>
 SUPER8
 
     }

Tags: can3p, ljcom, sup
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments