summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.js
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-10-29 10:01:28 +0000
committerDries Buytaert <dries@buytaert.net>2008-10-29 10:01:28 +0000
commit5371104a2d10889c532bb5d345fa6d71c0a897d1 (patch)
treebbef382cea55823195e0cb7469074b743913bc74 /modules/taxonomy/taxonomy.js
parent068febde425f4521d61f863ffaca76da65916449 (diff)
downloadbrdo-5371104a2d10889c532bb5d345fa6d71c0a897d1.tar.gz
brdo-5371104a2d10889c532bb5d345fa6d71c0a897d1.tar.bz2
- Patch #316225 by sun et al: allow behaviors to detach from AHAH/AJAX.
Diffstat (limited to 'modules/taxonomy/taxonomy.js')
-rw-r--r--modules/taxonomy/taxonomy.js46
1 files changed, 24 insertions, 22 deletions
diff --git a/modules/taxonomy/taxonomy.js b/modules/taxonomy/taxonomy.js
index 0631ebd99..bbf1f5c47 100644
--- a/modules/taxonomy/taxonomy.js
+++ b/modules/taxonomy/taxonomy.js
@@ -6,31 +6,33 @@
* This behavior is dependent on the tableDrag behavior, since it uses the
* objects initialized in that behavior to update the row.
*/
-Drupal.behaviors.termDrag = function(context) {
- var table = $('#taxonomy', context);
- var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
- var rows = $('tr', table).size();
+Drupal.behaviors.termDrag = {
+ attach: function(context) {
+ var table = $('#taxonomy', context);
+ var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
+ var rows = $('tr', table).size();
- // When a row is swapped, keep previous and next page classes set.
- tableDrag.row.prototype.onSwap = function(swappedRow) {
- $('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
- $('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
- $('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
+ // When a row is swapped, keep previous and next page classes set.
+ tableDrag.row.prototype.onSwap = function(swappedRow) {
+ $('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
+ $('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
+ $('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
- if (Drupal.settings.taxonomy.backPeddle) {
- for (var n = 0; n < Drupal.settings.taxonomy.backPeddle; n++) {
- $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ if (Drupal.settings.taxonomy.backPeddle) {
+ for (var n = 0; n < Drupal.settings.taxonomy.backPeddle; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
}
- $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
- $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
- }
- if (Drupal.settings.taxonomy.forwardPeddle) {
- for (var n = rows - Drupal.settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
- $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ if (Drupal.settings.taxonomy.forwardPeddle) {
+ for (var n = rows - Drupal.settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
}
- $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
- $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
- }
- };
+ };
+ }
};