Mercurial > hg > rr-repo
comparison sites/all/modules/ctools/js/jump-menu.js @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ff03f76ab3fe |
---|---|
1 | |
2 (function($) { | |
3 Drupal.behaviors.CToolsJumpMenu = { | |
4 attach: function(context) { | |
5 $('.ctools-jump-menu-hide') | |
6 .once('ctools-jump-menu') | |
7 .hide(); | |
8 | |
9 $('.ctools-jump-menu-change') | |
10 .once('ctools-jump-menu') | |
11 .change(function() { | |
12 var loc = $(this).val(); | |
13 var urlArray = loc.split('::'); | |
14 if (urlArray[1]) { | |
15 location.href = urlArray[1]; | |
16 } | |
17 else { | |
18 location.href = loc; | |
19 } | |
20 return false; | |
21 }); | |
22 | |
23 $('.ctools-jump-menu-button') | |
24 .once('ctools-jump-menu') | |
25 .click(function() { | |
26 // Instead of submitting the form, just perform the redirect. | |
27 | |
28 // Find our sibling value. | |
29 var $select = $(this).parents('form').find('.ctools-jump-menu-select'); | |
30 var loc = $select.val(); | |
31 var urlArray = loc.split('::'); | |
32 if (urlArray[1]) { | |
33 location.href = urlArray[1]; | |
34 } | |
35 else { | |
36 location.href = loc; | |
37 } | |
38 return false; | |
39 }); | |
40 } | |
41 } | |
42 })(jQuery); |