summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-24 10:19:38 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-24 10:19:38 +0000
commit308f84919500a0aed7d457322402b31efe41e47b (patch)
treecaf481e5581319a279108e30eec5d1c7d5e915d1 /misc
parent92bd43b3ecfee9af69214c2a3751600a8dcb659e (diff)
downloadbrdo-308f84919500a0aed7d457322402b31efe41e47b.tar.gz
brdo-308f84919500a0aed7d457322402b31efe41e47b.tar.bz2
- Patch #741726 by sun: move filter module's vertical tabs extensions into vertical-tabs.js.
Diffstat (limited to 'misc')
-rw-r--r--misc/vertical-tabs.js47
1 files changed, 45 insertions, 2 deletions
diff --git a/misc/vertical-tabs.js b/misc/vertical-tabs.js
index ba43c8f88..127df5420 100644
--- a/misc/vertical-tabs.js
+++ b/misc/vertical-tabs.js
@@ -80,7 +80,9 @@ Drupal.verticalTab = function (settings) {
};
Drupal.verticalTab.prototype = {
- // Displays the tab's content pane.
+ /**
+ * Displays the tab's content pane.
+ */
focus: function () {
this.fieldset
.siblings('fieldset.vertical-tabs-pane')
@@ -96,9 +98,50 @@ Drupal.verticalTab.prototype = {
this.item.addClass('selected');
},
- // Updates the tab's summary.
+ /**
+ * Updates the tab's summary.
+ */
updateSummary: function () {
this.summary.html(this.fieldset.getSummary());
+ },
+
+ /**
+ * Shows a vertical tab pane.
+ */
+ tabShow: function () {
+ // Display the tab.
+ this.item.show();
+ // Update .first marker for items. We need recurse from parent to retain the
+ // actual DOM element order as jQuery implements sortOrder, but not as public
+ // method.
+ this.item.parent().children('.vertical-tab-button').removeClass('first')
+ .filter(':visible:first').addClass('first');
+ // Display the fieldset.
+ this.fieldset.removeClass('vertical-tab-hidden').show();
+ // Focus this tab.
+ this.focus();
+ return this;
+ },
+
+ /**
+ * Hides a vertical tab pane.
+ */
+ tabHide: function () {
+ // Hide this tab.
+ this.item.hide();
+ // Update .first marker for items. We need recurse from parent to retain the
+ // actual DOM element order as jQuery implements sortOrder, but not as public
+ // method.
+ this.item.parent().children('.vertical-tab-button').removeClass('first')
+ .filter(':visible:first').addClass('first');
+ // Hide the fieldset.
+ this.fieldset.addClass('vertical-tab-hidden').hide();
+ // Focus the first visible tab (if there is one).
+ var $firstTab = this.fieldset.siblings('.vertical-tabs-pane:not(.vertical-tab-hidden):first');
+ if ($firstTab.length) {
+ $firstTab.data('verticalTab').focus();
+ }
+ return this;
}
};