Jump without "Go" Button

Rob T - June 15, 2008 - 22:25
Project:Jump
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:marcp
Status:needs review
Description

I want the Jump to occur without the "Go" button.

What would be the best way to modify this module to allow for that ability?

#1

marcp - June 17, 2008 - 14:05
Status:active» won't fix

You probably should do this with a little bit of jQuery magic that hides the Go button and attaches whatever handler it is that deals with the enter key being pressed in a text field.

This functionality won't make it into Jump, so you'll need a separate javascript file that you either include in your theme or via some custom module.

#2

Rob T - June 19, 2008 - 13:43

Thanks for the advice. It's definitely something I want to have.

I've been looking at this Views example, which utilizes that jQuery magic you mention to create a similar function (Drupal 5.x): http://drupal.org/node/186211

This might be a little heavy for me... especially if I want to have more than one Jump menu on a page... I'm sure I'll hack at it eventually. If anything promising develops, I'll post back.

BTW: it stinks that a "won't fix" assignment to the issue removes it from the queue. While I may or may not be able come up with a solution, I've found that quite often, solutions for little feature requests like this come about as a semi-collective community effort (ie. someone else sees the post, gives a hack at it, and posts back with their workaround or solution).

If feature request posts are hidden from public view, such a result is practically impossible.

#3

marcp - June 20, 2008 - 18:00
Status:won't fix» postponed (maintainer needs more info)

How about active (needs more info)?

Community - please post your solutions here. Never say never -- a nice solution, preferrably one that would be turned off by default and require an admin to turn it on, would have a good chance of getting in.

#4

Rob T - June 24, 2008 - 03:26

Thanks for bringing the request back. Your general framework suggestion is solid, though I'd take a working template override as well.

#5

brenes - July 21, 2008 - 19:43

Any development on this question? If there is a solution to it I would like to know how its working.
Best regards

#6

Rob T - July 22, 2008 - 22:55

I realize that this isn't what you're looking for, but I ended up making some old-school jump menus for my needs, placing similar code like this into a block (with my unfiltered HTML input format). I'd still love to have the menus automated via Drupal and Jump Menu, but the "Go" button seemed awkward for my needs.

<style language="text\css">
<!--
.mainNavDropdown { font-size: .875em; width: 129; border: 1px solid #808080 }
-->
</style>
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <form method="post" name="sForm1">
      <tr>
        <td>
          <select class="mainNavDropdown" name="dropdownbox" onchange="document.location=document.sForm1.dropdownbox[document.sForm1.dropdownbox.selectedIndex].value;">
          <option value="">-- Menu Title --</option>
<option value="/page1">Page 1</option>
<option value="/page2">Page 2</option>
<option value="/page3">Page 3</option>
          </select>
         </td>
       </tr>
   </form>
</table>

#7

brenes - July 23, 2008 - 15:23

Yeah thats not exactly what I am looking for. I already implemented the needed function with a php-snippet, but its alway a hassle to set it up. I think the plugin without the go button would be a bit more handy. If you are intrested youll find the snippet (only for taxonomy) here: http://drupal.org/node/91924

#8

Rob T - July 24, 2008 - 00:21

Thanks for that link. I'll have to try it out. In my case, I have Pathauto creating custom taxonomy paths, and then I have a 301 redirect in my htaccess file leading to my preferred landing spot for those taxonomy links. So I'm wondering how that snippet will function in my current setup.

I agree with you that this module with an option to scrap the go button would be sweet. I just haven't had the time to try a solution that incorporates the recommended jQuery magic that was suggested by marcp.

#9

Rob_Feature - August 18, 2008 - 21:19

Hey Guys...
Quickmenu module does this by default...(jumps without a button). It will work with any menu, which means to do taxonomy, you'd have to install taxonomy menu.module as well. I just did this setup on my latest site, and it worked like a charm.

Hope that helps.

#10

JaredAM - September 15, 2008 - 04:33

I think this would be a great thing to add, however, I do not believe in eliminating the current functionality since some people might have js disabled.

I wanted to try and add this functionality, so I borrowed the code from Rob T above and added it to the code of the module:

(line 51)

  $form['#submit'] = array('jump_quickly_form_submit' => 1);
  $form['#theme'] = 'jump_quickly_form';
  $form['#attributes']['class'] = 'jump-quickly';
  $form['#attributes']['name'] = 'jumpquickly';
  $form['jump_goto'] = array(
    '#type' => 'select',
    '#default_value' => '0',
    '#options' => $options,
    '#attributes'=> array('onchange' => "document.location=document.jumpquickly.jump_goto[document.jumpquickly.jump_goto.selectedIndex].value;")
  );

I noticed that js didn't like "jump-quickly" as the name so I had to name it "jumpquickly". However, since I'm not a js guru, I'm not sure how you would pass in the form id number. I do think it's a good idea to allow more than one jump menu per page!

I dunno, there's probably a more elegant way to make this work.

Also, if you're using a relative path, it does some goofy stuff. For example if your link is "user/" . $user->uid and you're on a user page, the link you'll be directed to will be "user/user/uid".

#11

momper - November 26, 2008 - 22:44

i do not know the module and didn't read everything here ...

but maybe this helps: http://drupal.org/node/313790

#12

lerhonew - April 1, 2009 - 18:07

@Rob_Feature #9

Hmm, maybe I'm doing something wrong...but I didn't get a select list with this module just a ul. Am I wrong to think you were referring to a standard form select list? Thanks Rob.
P.S. Your podcast rocks!

#13

evoltech - September 10, 2009 - 11:53

I have started writing a patch that will be submitted tomorrow that will:

"This patch adds a configurable setting for adding a js file that will turn a jump module select list into a "javascripty" style jumper. If users have js disabled they will still the standard form. This patch depends on the patch from #344054: Jump blocks use delta for id w/ colon"

#14

evoltech - September 10, 2009 - 11:53
Status:postponed (maintainer needs more info)» needs review

This patch includes the patch for #344054: Jump blocks use delta for id w/ colon.

AttachmentSize
jump-270924.patch 3.34 KB

#15

evoltech - September 11, 2009 - 22:16

This patch now requires hand massaging to apply against the new version of HEAD. Would you like me to re-roll this against HEAD after you commit #284985: Jump menu should default to showing the active page?

#16

marcp - September 15, 2009 - 19:45

Yeah, let's do these one at a time so that the commit messages will show clear messages for each issue. So, let's take care of #284985: Jump menu should default to showing the active page first and get it committed before re-rolling this one.

#17

aaron - September 25, 2009 - 22:43

subscribe

#18

evoltech - September 29, 2009 - 23:46

This patch is against head. It includes a new test case to make sure that the js is included when configured to and not included when not configured to. The hook_uninstall has been updated to delete the variable that stores this configuration and some coder recommended fixes have been made to journal.test.

AttachmentSize
jump-270924.3.patch 8.73 KB

#19

marcp - September 30, 2009 - 03:37

After a quick look, I think the Javascript needs to target the form.jump-quickly since it's possible for the form to appear someplace other than in a block (for instance, it could appear in a View's header or footer if those are set to PHP and jump_quickly() is called from there).

#20

evoltech - September 30, 2009 - 19:07

@marcp as per your suggestion the js now targets form.jump-quickly.

AttachmentSize
jump-270924.4.patch 8.74 KB

#21

marcp - October 6, 2009 - 22:34
Status:needs review» needs work

@evoltech - thanks for the patch. I sent you some tweaks to get this working for items that are full URLs. This is still not working on IE and Safari, though.

#22

evoltech - October 8, 2009 - 05:26

Don't believe the myth of cross platform compatibility with jQuery. I am sure anyone that has not used it is already skeptical, but I have had so much "luck" with it just working across different browsers that I stopped even testing other browsers.

The problem lied with IE and Safari not liking to bind click handlers on option elements. I fixed this by watching the whole jump-quickly form for a 'change' event then pulling out the selected option.

Good call with looking for offsite urls, I didn't even think of that case. I took it a bit furthur and changed the logic to check for any link with a :// prefix.

I updated the test cases to reflect the location and new name of the js file.

AttachmentSize
jump-270924.5.patch 8.94 KB

#23

marcp - October 8, 2009 - 14:19

@evoltech - I haven't tried it yet, but from looking at the patch the drupal_add_js() looks like it might need to be moved. I'm pretty sure it belongs at the beginning of jump_quickly_form() so that it makes it in there even when the jump_quickly() API call is made from some custom code in another module or a view header/footer, or custom block, etc.

#24

evoltech - October 8, 2009 - 18:07

oops, I incorrectly copied that section of code from the patch you gave me. Re-rolled.

AttachmentSize
jump-270924.6.patch 8.92 KB

#25

marcp - October 9, 2009 - 18:33
Assigned to:Anonymous» marcp
Status:needs work» needs review

Thanks, evoltech - I'm looking this over. If anyone else in this thread is interested, please try out the patch in #24. One thing that will change before it gets committed is the line in jump.js that says:

    window.location.replace(dest);

will say:

    window.location = dest;

I played with the replace for a while and didn't like the way I couldn't use my browser's back button. So far I've tested on IE, Safari, FF on Windows and FF on Mac.

#26

evoltech - October 9, 2009 - 19:54

I confirmed that the JS change you made in #25 works in FF. Just noticed though that if an off site link is the top menu, not selected, is clicked that it doesn't work. I am not seeing an obvious solution to this right off the bat. I was able to get this to work correctly with native js (like in this example). But then there is the issue of getting all of the id's that the jump-quickly form uses, easy with jQuery, but there seems to be problems mixing jQuery selectors and native js selectors. I also tried binding other events to the select element wiith varying results, none really satisfactory. I am at a bit of a standstill.

#27

jrao - October 22, 2009 - 10:36

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.