summaryrefslogtreecommitdiff
path: root/htroot/js/html.js
blob: ef79dca3e347e25c39bb53708a9ccaaafdca9402 (plain)
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
/*    
* Copyright (C) 2006 - 2008 Alexander Schier, Michael Hamann, David Wieditz
*         
* This file is part of YaCy.
* 
* YaCy is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
* 
* YaCy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with YaCy.  If not, see <http://www.gnu.org/licenses/>.
*/

function createCol(content){
	col=document.createElement("td");
	text=document.createTextNode(content);
	col.appendChild(text);
	return col;
}

function clearTable(table, numSkip){
	if(numSkip==null){
		numSkip=0;
	}
	row=getFirstChild(getFirstChild(table, "tbody"), "tr");
	//skip numSkip rows
	for(i=0;i<numSkip;i++){
		row=getNextSibling(row, "tr");
	}
    while(row != null){ //delete old entries
        getFirstChild(table, "tbody").removeChild(row);
   		row=getFirstChild(getFirstChild(table, "tbody"), "tr");
		//skip numSkip rows
		for(i=0;i<numSkip;i++){
			row=getNextSibling(row, "tr");
		}
    }
}

function createLinkCol(url, linktext){
	col=document.createElement("td");
	link=document.createElement("a");
	link.setAttribute("href", url);
	link.setAttribute("target", "_blank");
	text=document.createTextNode(linktext);
	link.appendChild(text);
	col.appendChild(link);
	return col;
}

function radioValue(inputs) {
  for (var i=0; i<inputs.length; i++) if (inputs[i].checked) return inputs[i].value;
  return false;
}

function hide(id) {
	document.getElementById(id).style.display = "none";
}

function show(id) {
	document.getElementById(id).style.display = "inline";
}