annotate core/modules/taxonomy/taxonomy.js @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 /**
Chris@0 2 * DO NOT EDIT THIS FILE.
Chris@0 3 * See the following change record for more information,
Chris@0 4 * https://www.drupal.org/node/2815083
Chris@0 5 * @preserve
Chris@0 6 **/
Chris@0 7
Chris@0 8 (function ($, Drupal) {
Chris@0 9 Drupal.behaviors.termDrag = {
Chris@0 10 attach: function attach(context, settings) {
Chris@0 11 var backStep = settings.taxonomy.backStep;
Chris@0 12 var forwardStep = settings.taxonomy.forwardStep;
Chris@0 13
Chris@0 14 var tableDrag = Drupal.tableDrag.taxonomy;
Chris@0 15 var $table = $('#taxonomy');
Chris@0 16 var rows = $table.find('tr').length;
Chris@0 17
Chris@0 18 tableDrag.row.prototype.onSwap = function (swappedRow) {
Chris@0 19 $table.find('tr.taxonomy-term-preview').removeClass('taxonomy-term-preview');
Chris@0 20 $table.find('tr.taxonomy-term-divider-top').removeClass('taxonomy-term-divider-top');
Chris@0 21 $table.find('tr.taxonomy-term-divider-bottom').removeClass('taxonomy-term-divider-bottom');
Chris@0 22
Chris@0 23 var tableBody = $table[0].tBodies[0];
Chris@0 24 if (backStep) {
Chris@0 25 for (var n = 0; n < backStep; n++) {
Chris@0 26 $(tableBody.rows[n]).addClass('taxonomy-term-preview');
Chris@0 27 }
Chris@0 28 $(tableBody.rows[backStep - 1]).addClass('taxonomy-term-divider-top');
Chris@0 29 $(tableBody.rows[backStep]).addClass('taxonomy-term-divider-bottom');
Chris@0 30 }
Chris@0 31
Chris@0 32 if (forwardStep) {
Chris@0 33 for (var k = rows - forwardStep - 1; k < rows - 1; k++) {
Chris@0 34 $(tableBody.rows[k]).addClass('taxonomy-term-preview');
Chris@0 35 }
Chris@0 36 $(tableBody.rows[rows - forwardStep - 2]).addClass('taxonomy-term-divider-top');
Chris@0 37 $(tableBody.rows[rows - forwardStep - 1]).addClass('taxonomy-term-divider-bottom');
Chris@0 38 }
Chris@0 39 };
Chris@0 40 }
Chris@0 41 };
Chris@0 42 })(jQuery, Drupal);