pm-checkboxen
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
// ==UserScript==
// @name Select All Checkboxes
// @namespace http://www.jankoehoorn.nl/
// @description selects all checkboxes on a page
// @include http://www.phphulp.nl/profiel/mailbox/*
// ==/UserScript==
(function () {
var mailbox;
function check_all () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].checked = 'checked';
}
}
}
function uncheck_all () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].checked = '';
}
}
}
function inverse_selection () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
if (c[i].checked == '') {
c[i].checked = 'checked';
}
else {
c[i].checked = '';
}
}
}
}
var x = document.getElementsByTagName ('form');
for (i = 0; i < x.length; i++) {
if (x[i].name == 'mailbox') { // de naam van het formulier op phphulp.nl
mailbox = x[i];
break;
}
}
var select_all = document.createElement ('input');
select_all.type = 'button';
select_all.value = 'selecteer alles';
select_all.style.margin = '5px';
mailbox.appendChild (select_all);
select_all.addEventListener ("click", check_all, false);
var deselect_all = document.createElement ('input');
deselect_all.type = 'button';
deselect_all.value = 'deselecteer alles';
deselect_all.style.margin = '5px';
mailbox.appendChild (deselect_all);
deselect_all.addEventListener ("click", uncheck_all, false);
var inverse = document.createElement ('input');
inverse.type = 'button';
inverse.value = 'keer selectie om';
inverse.style.margin = '5px';
mailbox.appendChild (inverse);
inverse.addEventListener ("click", inverse_selection, false);
})();
?>
// ==UserScript==
// @name Select All Checkboxes
// @namespace http://www.jankoehoorn.nl/
// @description selects all checkboxes on a page
// @include http://www.phphulp.nl/profiel/mailbox/*
// ==/UserScript==
(function () {
var mailbox;
function check_all () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].checked = 'checked';
}
}
}
function uncheck_all () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].checked = '';
}
}
}
function inverse_selection () {
var c = document.getElementsByTagName ('input');
for (i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
if (c[i].checked == '') {
c[i].checked = 'checked';
}
else {
c[i].checked = '';
}
}
}
}
var x = document.getElementsByTagName ('form');
for (i = 0; i < x.length; i++) {
if (x[i].name == 'mailbox') { // de naam van het formulier op phphulp.nl
mailbox = x[i];
break;
}
}
var select_all = document.createElement ('input');
select_all.type = 'button';
select_all.value = 'selecteer alles';
select_all.style.margin = '5px';
mailbox.appendChild (select_all);
select_all.addEventListener ("click", check_all, false);
var deselect_all = document.createElement ('input');
deselect_all.type = 'button';
deselect_all.value = 'deselecteer alles';
deselect_all.style.margin = '5px';
mailbox.appendChild (deselect_all);
deselect_all.addEventListener ("click", uncheck_all, false);
var inverse = document.createElement ('input');
inverse.type = 'button';
inverse.value = 'keer selectie om';
inverse.style.margin = '5px';
mailbox.appendChild (inverse);
inverse.addEventListener ("click", inverse_selection, false);
})();
?>