Follow up r78003, forgot to make MonoBook use the footericons code.
[lhc/web/wiklou.git] / skins / common / history.js
1 window.historyRadios = function(parent) {
2 var inputs = parent.getElementsByTagName('input');
3 var radios = [];
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];
7 }
8 }
9 return radios;
10 };
11
12 // check selection and tweak visibility/class onclick
13 window.diffcheck = function() {
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');
17 if (!hf) {
18 return true;
19 }
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) {
26 return false;
27 }
28 if (oli) { // it's the second checked radio
29 if (inputs[1].checked) {
30 if ( (typeof oli.className) != 'undefined') {
31 oli.classNameOriginal = oli.className.replace( 'selected', '' );
32 } else {
33 oli.classNameOriginal = '';
34 }
35
36 oli.className = "selected "+oli.classNameOriginal;
37 return false;
38 }
39 } else if (inputs[0].checked) {
40 return false;
41 }
42 if (inputs[0].checked) {
43 dli = lis[i];
44 }
45 if (!oli) {
46 inputs[0].style.visibility = 'hidden';
47 }
48 if (dli) {
49 inputs[1].style.visibility = 'hidden';
50 }
51 if ( (typeof lis[i].className) != 'undefined') {
52 lis[i].classNameOriginal = lis[i].className.replace( 'selected', '' );
53 } else {
54 lis[i].classNameOriginal = '';
55 }
56
57 lis[i].className = "selected "+lis[i].classNameOriginal;
58 oli = lis[i];
59 } else { // no radio is checked in this row
60 if (!oli) {
61 inputs[0].style.visibility = 'hidden';
62 } else {
63 inputs[0].style.visibility = 'visible';
64 }
65 if (dli) {
66 inputs[1].style.visibility = 'hidden';
67 } else {
68 inputs[1].style.visibility = 'visible';
69 }
70 if ( typeof lis[i].classNameOriginal != 'undefined' ) {
71 lis[i].className = lis[i].classNameOriginal;
72 }
73 }
74 }
75 }
76 return true;
77 };