summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/taxonomy/taxonomy.js
diff options
context:
space:
mode:
authorNathan Haug <nate@quicksketch.org>2011-10-30 16:32:37 -0700
committerNathaniel <catch@35733.no-reply.drupal.org>2011-11-01 12:48:40 +0900
commit06fb770bd340e5a18555e0da55a4dd6ba22f76ba (patch)
treee814bc08d51db3af473ae5be565219c0249b7870 /core/modules/taxonomy/taxonomy.js
parent906a6db34707d27120dddd43a23f26f24153255d (diff)
downloaddrupal-06fb770bd340e5a18555e0da55a4dd6ba22f76ba.tar.gz
drupal-06fb770bd340e5a18555e0da55a4dd6ba22f76ba.zip
Issue #22336 by quicksketch, scor, boombatower, and rfay. Move all core Drupal files under a core subdirectory.
Diffstat (limited to 'core/modules/taxonomy/taxonomy.js')
-rw-r--r--core/modules/taxonomy/taxonomy.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/core/modules/taxonomy/taxonomy.js b/core/modules/taxonomy/taxonomy.js
new file mode 100644
index 00000000000..cc9cdf7a61c
--- /dev/null
+++ b/core/modules/taxonomy/taxonomy.js
@@ -0,0 +1,40 @@
+(function ($) {
+
+/**
+ * Move a block in the blocks table from one region to another via select list.
+ *
+ * This behavior is dependent on the tableDrag behavior, since it uses the
+ * objects initialized in that behavior to update the row.
+ */
+Drupal.behaviors.termDrag = {
+ attach: function (context, settings) {
+ 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');
+
+ if (settings.taxonomy.backStep) {
+ for (var n = 0; n < settings.taxonomy.backStep; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[settings.taxonomy.backStep - 1]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[settings.taxonomy.backStep]).addClass('taxonomy-term-divider-bottom');
+ }
+
+ if (settings.taxonomy.forwardStep) {
+ for (var n = rows - settings.taxonomy.forwardStep - 1; n < rows - 1; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 2]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 1]).addClass('taxonomy-term-divider-bottom');
+ }
+ };
+ }
+};
+
+})(jQuery);