1 |
85ad3d82
|
Assos Assos
|
(function ($) {
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
Drupal.behaviors.simpleTestMenuCollapse = {
|
7 |
|
|
attach: function (context, settings) {
|
8 |
|
|
var timeout = null;
|
9 |
|
|
|
10 |
|
|
$('div.simpletest-image').once('simpletest-image', function () {
|
11 |
|
|
var $this = $(this);
|
12 |
|
|
var direction = settings.simpleTest[this.id].imageDirection;
|
13 |
|
|
$this.html(settings.simpleTest.images[direction]);
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
$this.click(function () {
|
17 |
|
|
var trs = $this.closest('tbody').children('.' + settings.simpleTest[this.id].testClass);
|
18 |
|
|
var direction = settings.simpleTest[this.id].imageDirection;
|
19 |
|
|
var row = direction ? trs.length - 1 : 0;
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
if (timeout) {
|
23 |
|
|
clearTimeout(timeout);
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
function rowToggle() {
|
30 |
|
|
if (direction) {
|
31 |
|
|
if (row >= 0) {
|
32 |
|
|
$(trs[row]).hide();
|
33 |
|
|
row--;
|
34 |
|
|
timeout = setTimeout(rowToggle, 20);
|
35 |
|
|
}
|
36 |
|
|
}
|
37 |
|
|
else {
|
38 |
|
|
if (row < trs.length) {
|
39 |
|
|
$(trs[row]).removeClass('js-hide').show();
|
40 |
|
|
row++;
|
41 |
|
|
timeout = setTimeout(rowToggle, 20);
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
rowToggle();
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
$this.html(settings.simpleTest.images[(direction ? 0 : 1)]);
|
51 |
|
|
settings.simpleTest[this.id].imageDirection = !direction;
|
52 |
|
|
|
53 |
|
|
});
|
54 |
|
|
});
|
55 |
|
|
}
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
Drupal.behaviors.simpleTestSelectAll = {
|
63 |
|
|
attach: function (context, settings) {
|
64 |
|
|
$('td.simpletest-select-all').once('simpletest-select-all', function () {
|
65 |
|
|
var testCheckboxes = settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
|
66 |
|
|
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
var updateGroupCheckbox = function () {
|
71 |
|
|
var checkedTests = 0;
|
72 |
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
73 |
|
|
$('#' + testCheckboxes[i]).each(function () {
|
74 |
|
|
if (($(this).attr('checked'))) {
|
75 |
|
|
checkedTests++;
|
76 |
|
|
}
|
77 |
|
|
});
|
78 |
|
|
}
|
79 |
|
|
$(groupCheckbox).attr('checked', (checkedTests == testCheckboxes.length));
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
groupCheckbox.change(function () {
|
84 |
|
|
var checked = !!($(this).attr('checked'));
|
85 |
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
86 |
|
|
$('#' + testCheckboxes[i]).attr('checked', checked);
|
87 |
|
|
}
|
88 |
|
|
});
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
92 |
|
|
$('#' + testCheckboxes[i]).change(function () {
|
93 |
|
|
updateGroupCheckbox();
|
94 |
|
|
});
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
updateGroupCheckbox();
|
99 |
|
|
$(this).append(groupCheckbox);
|
100 |
|
|
});
|
101 |
|
|
}
|
102 |
|
|
};
|
103 |
|
|
|
104 |
|
|
})(jQuery); |