mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-08 02:40 am

[dw-nonfree] Fix Tropospherical Red to work with jQuery pages.

[commit: http://hg.dwscoalition.org/dw-nonfree/rev/4c48f66466b9]

Fix Tropospherical Red to work with jQuery pages.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/bml/scheme/tropo-red.look
  • htdocs/js/tropo/nav-jquery.js
--------------------------------------------------------------------------------
diff -r 03bd63c51413 -r 4c48f66466b9 cgi-bin/bml/scheme/tropo-red.look
--- a/cgi-bin/bml/scheme/tropo-red.look	Sun Mar 08 02:32:47 2009 +0000
+++ b/cgi-bin/bml/scheme/tropo-red.look	Sun Mar 08 02:40:43 2009 +0000
@@ -41,7 +41,11 @@ head<=
         LJ::need_res( "stc/lj_base-app.css" );
         LJ::need_res( "stc/tropo/reset.css" );
         LJ::need_res( "stc/tropo/red.css" );
-        LJ::need_res( "js/tropo/nav.js" );
+
+        # we support both old style and new style pages; only one of these will get
+        # loaded ...
+        LJ::need_res( {group=>'jquery'}, "js/tropo/nav-jquery.js" );
+        LJ::need_res( {group=>'default'}, "js/tropo/nav.js" );
     _code?>
     <?_code LJ::res_includes(); _code?>
 
diff -r 03bd63c51413 -r 4c48f66466b9 htdocs/js/tropo/nav-jquery.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/js/tropo/nav-jquery.js	Sun Mar 08 02:40:43 2009 +0000
@@ -0,0 +1,36 @@
+/*
+    js/tropo/nav-jquery.js
+
+    Tropospherical Navigation JavaScript
+
+    Authors:
+        Mark Smith <mark@dreamwidth.org>
+
+    Copyright (c) 2009 by Dreamwidth Studios, LLC.
+
+    This program is NOT free software or open-source; you can use it as an
+    example of how to implement your own site-specific extensions to the
+    Dreamwidth Studios open-source code, but you cannot use it on your site
+    or redistribute it, with or without modifications.
+*/
+
+DW.whenPageLoaded( function() {
+
+    // used below
+    var hideNavs = function() {
+        $( '.topnav' ).removeClass( 'hover' );
+        $( '.subnav' ).removeClass( 'hover' );
+    };
+
+    // add event listeners to the top nav items
+    $( '.topnav' )
+
+        .mouseover( function() {
+            hideNavs();
+            $( this ).addClass( 'hover' );
+        } )
+
+        .mouseout( function() {
+            hideNavs();
+        } );
+} );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org