Chris@0: /** Chris@0: * DO NOT EDIT THIS FILE. Chris@0: * See the following change record for more information, Chris@0: * https://www.drupal.org/node/2815083 Chris@0: * @preserve Chris@0: **/ Chris@0: Chris@0: (function ($, Drupal) { Chris@0: Drupal.behaviors.termDrag = { Chris@0: attach: function attach(context, settings) { Chris@0: var backStep = settings.taxonomy.backStep; Chris@0: var forwardStep = settings.taxonomy.forwardStep; Chris@0: Chris@0: var tableDrag = Drupal.tableDrag.taxonomy; Chris@0: var $table = $('#taxonomy'); Chris@0: var rows = $table.find('tr').length; Chris@0: Chris@0: tableDrag.row.prototype.onSwap = function (swappedRow) { Chris@0: $table.find('tr.taxonomy-term-preview').removeClass('taxonomy-term-preview'); Chris@0: $table.find('tr.taxonomy-term-divider-top').removeClass('taxonomy-term-divider-top'); Chris@0: $table.find('tr.taxonomy-term-divider-bottom').removeClass('taxonomy-term-divider-bottom'); Chris@0: Chris@0: var tableBody = $table[0].tBodies[0]; Chris@0: if (backStep) { Chris@0: for (var n = 0; n < backStep; n++) { Chris@0: $(tableBody.rows[n]).addClass('taxonomy-term-preview'); Chris@0: } Chris@0: $(tableBody.rows[backStep - 1]).addClass('taxonomy-term-divider-top'); Chris@0: $(tableBody.rows[backStep]).addClass('taxonomy-term-divider-bottom'); Chris@0: } Chris@0: Chris@0: if (forwardStep) { Chris@0: for (var k = rows - forwardStep - 1; k < rows - 1; k++) { Chris@0: $(tableBody.rows[k]).addClass('taxonomy-term-preview'); Chris@0: } Chris@0: $(tableBody.rows[rows - forwardStep - 2]).addClass('taxonomy-term-divider-top'); Chris@0: $(tableBody.rows[rows - forwardStep - 1]).addClass('taxonomy-term-divider-bottom'); Chris@0: } Chris@0: }; Chris@0: } Chris@0: }; Chris@0: })(jQuery, Drupal);