1
|
(function ($) {
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
Drupal.behaviors.termDrag = {
|
10
|
attach: function (context, settings) {
|
11
|
var table = $('#taxonomy', context);
|
12
|
var tableDrag = Drupal.tableDrag.taxonomy;
|
13
|
var rows = $('tr', table).length;
|
14
|
|
15
|
|
16
|
tableDrag.row.prototype.onSwap = function (swappedRow) {
|
17
|
$('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
|
18
|
$('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
|
19
|
$('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
|
20
|
|
21
|
if (settings.taxonomy.backStep) {
|
22
|
for (var n = 0; n < settings.taxonomy.backStep; n++) {
|
23
|
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
24
|
}
|
25
|
$(table[0].tBodies[0].rows[settings.taxonomy.backStep - 1]).addClass('taxonomy-term-divider-top');
|
26
|
$(table[0].tBodies[0].rows[settings.taxonomy.backStep]).addClass('taxonomy-term-divider-bottom');
|
27
|
}
|
28
|
|
29
|
if (settings.taxonomy.forwardStep) {
|
30
|
for (var n = rows - settings.taxonomy.forwardStep - 1; n < rows - 1; n++) {
|
31
|
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
32
|
}
|
33
|
$(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 2]).addClass('taxonomy-term-divider-top');
|
34
|
$(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 1]).addClass('taxonomy-term-divider-bottom');
|
35
|
}
|
36
|
};
|
37
|
}
|
38
|
};
|
39
|
|
40
|
})(jQuery);
|