1 function historyRadios(parent
) {
2 var inputs
= parent
.getElementsByTagName('input');
4 for (var i
= 0; i
< inputs
.length
; i
++) {
5 if (inputs
[i
].name
== "diff" || inputs
[i
].name
== "oldid") {
6 radios
[radios
.length
] = inputs
[i
];
12 // check selection and tweak visibility/class onclick
13 function diffcheck() {
14 var dli
= false; // the li where the diff radio is checked
15 var oli
= false; // the li where the oldid radio is checked
16 var hf
= document
.getElementById('pagehistory');
20 var lis
= hf
.getElementsByTagName('li');
21 for (var i
=0;i
<lis
.length
;i
++) {
22 var inputs
= historyRadios(lis
[i
]);
23 if (inputs
[1] && inputs
[0]) {
24 if (inputs
[1].checked
|| inputs
[0].checked
) { // this row has a checked radio button
25 if (inputs
[1].checked
&& inputs
[0].checked
&& inputs
[0].value
== inputs
[1].value
) {
28 if (oli
) { // it's the second checked radio
29 if (inputs
[1].checked
) {
30 oli
.className
= "selected";
33 } else if (inputs
[0].checked
) {
36 if (inputs
[0].checked
) {
40 inputs
[0].style
.visibility
= 'hidden';
43 inputs
[1].style
.visibility
= 'hidden';
45 lis
[i
].className
= "selected";
47 } else { // no radio is checked in this row
49 inputs
[0].style
.visibility
= 'hidden';
51 inputs
[0].style
.visibility
= 'visible';
54 inputs
[1].style
.visibility
= 'hidden';
56 inputs
[1].style
.visibility
= 'visible';
58 lis
[i
].className
= "";
66 // attach event handlers to the input elements on history page
67 function histrowinit() {
68 var hf
= document
.getElementById('pagehistory');
72 var lis
= hf
.getElementsByTagName('li');
73 for (var i
= 0; i
< lis
.length
; i
++) {
74 var inputs
= historyRadios(lis
[i
]);
75 if (inputs
[0] && inputs
[1]) {
76 inputs
[0].onclick
= diffcheck
;
77 inputs
[1].onclick
= diffcheck
;
83 hookEvent("load", histrowinit
);