Commit aa9cb31b authored by webchick's avatar webchick

Issue #1751430 by oxyc, nod_: Selectors clean-up: taxonomy module.

parent d0ec90ca
......@@ -10,30 +10,33 @@
*/
Drupal.behaviors.termDrag = {
attach: function (context, settings) {
var table = $(context).find('#taxonomy');
var backStep = settings.taxonomy.backStep;
var forwardStep = settings.taxonomy.forwardStep;
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
var rows = table.find('tr').length;
var $table = $('#taxonomy');
var rows = $table.find('tr').length;
// When a row is swapped, keep previous and next page classes set.
tableDrag.row.prototype.onSwap = function (swappedRow) {
table.find('tr.taxonomy-term-preview').removeClass('taxonomy-term-preview');
table.find('tr.taxonomy-term-divider-top').removeClass('taxonomy-term-divider-top');
table.find('tr.taxonomy-term-divider-bottom').removeClass('taxonomy-term-divider-bottom');
$table.find('tr.taxonomy-term-preview').removeClass('taxonomy-term-preview');
$table.find('tr.taxonomy-term-divider-top').removeClass('taxonomy-term-divider-top');
$table.find('tr.taxonomy-term-divider-bottom').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');
var tableBody = $table[0].tBodies[0];
if (backStep) {
for (var n = 0; n < backStep; n++) {
$(tableBody.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');
$(tableBody.rows[backStep - 1]).addClass('taxonomy-term-divider-top');
$(tableBody.rows[backStep]).addClass('taxonomy-term-divider-bottom');
}
if (settings.taxonomy.forwardStep) {
for (var k = rows - settings.taxonomy.forwardStep - 1; k < rows - 1; k++) {
$(table[0].tBodies[0].rows[k]).addClass('taxonomy-term-preview');
if (forwardStep) {
for (var k = rows - forwardStep - 1; k < rows - 1; k++) {
$(tableBody.rows[k]).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');
$(tableBody.rows[rows - forwardStep - 2]).addClass('taxonomy-term-divider-top');
$(tableBody.rows[rows - forwardStep - 1]).addClass('taxonomy-term-divider-bottom');
}
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment