entity_taxonomy-1.0.2/entity_taxonomy.js

entity_taxonomy.js
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

(function ($, Drupal) {
  Drupal.behaviors.termDrag = {
    attach: function attach(context, settings) {
      var backStep = settings.entity_taxonomy.backStep;
      var forwardStep = settings.entity_taxonomy.forwardStep;
      var tableDrag = Drupal.tableDrag.entity_taxonomy;
      var $table = $('#entity_taxonomy');
      var rows = $table.find('tr').length;

      tableDrag.row.prototype.onSwap = function (swappedRow) {
        $table.find('tr.entity_taxonomy-term-preview').removeClass('entity_taxonomy-term-preview');
        $table.find('tr.entity_taxonomy-term-divider-top').removeClass('entity_taxonomy-term-divider-top');
        $table.find('tr.entity_taxonomy-term-divider-bottom').removeClass('entity_taxonomy-term-divider-bottom');
        var tableBody = $table[0].tBodies[0];

        if (backStep) {
          for (var n = 0; n < backStep; n++) {
            $(tableBody.rows[n]).addClass('entity_taxonomy-term-preview');
          }

          $(tableBody.rows[backStep - 1]).addClass('entity_taxonomy-term-divider-top');
          $(tableBody.rows[backStep]).addClass('entity_taxonomy-term-divider-bottom');
        }

        if (forwardStep) {
          for (var k = rows - forwardStep - 1; k < rows - 1; k++) {
            $(tableBody.rows[k]).addClass('entity_taxonomy-term-preview');
          }

          $(tableBody.rows[rows - forwardStep - 2]).addClass('entity_taxonomy-term-divider-top');
          $(tableBody.rows[rows - forwardStep - 1]).addClass('entity_taxonomy-term-divider-bottom');
        }
      };
    }
  };
})(jQuery, Drupal);

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc