From #668104: Make overlay respect other click handlers by casey: these are some cleanups to toolbar.js that were pulled out of a patch for overlay module.

It's just spacing stuff, plus the removal of setting of active classes, which does not seem to be necessary code.

CommentFileSizeAuthor
#2 jscleanup.patch2.63 KBcasey
toolbar.patch2.11 KBjody lynn

Comments

casey’s picture

Status: Needs review » Needs work
@@ -11,19 +11,11 @@
     $('#toolbar', context).once('toolbar', Drupal.admin.toolbar.init);
 
     // Toggling toolbar drawer.
-    $('#toolbar a.toggle', context).once('toolbar-toggle').click(function() {
+    $('#toolbar a.toggle', context).once('toolbar-toggle').click(function(e) {
       Drupal.admin.toolbar.toggle();
-      return false;
-    });
-
-    // Set the most recently clicked item as active.
-    $('#toolbar a').once().click(function() {
-      $('#toolbar a').each(function() {
-        $(this).removeClass('active');
-      });
-      if ($(this).parents('div.toolbar-shortcuts').length) {
-        $(this).addClass('active');
-      }
+      // Allow other scripts to bind their own handlers, but prevent default
+      // action.
+      e.preventDefault();
     });
   }
 };
@@ -48,7 +40,7 @@

Belongs in the other issue.

casey’s picture

Title: Cleanup to toolbar.js » Cleanup javascript
Component: toolbar.module » javascript
Status: Needs work » Needs review
StatusFileSize
new2.63 KB

Lets broaden the scope of this issue; there are a few other javascript files that miss some semicolons. We could easily fix them all here.

casey’s picture

Title: Cleanup javascript » Cleanup javascript-files; missing semicolons + whitespace
casey’s picture

Status: Needs review » Reviewed & tested by the community

no-brainer

jody lynn’s picture

I second that. Casey is very slick with the js!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.