PageSourceSearch

https://effort.cz/jscript/DoubleTable.js?ver=262

js effort.cz collected 2026-10-05 23:38:42 UTC 3,769 bytes, 143 lines download raw bytes

1function DoubleTable(id, name, keys)
2{
3	this.data = new Array ();
4	this.id = id;
5	this.name = name;
6	this.keys = keys;
7	this.obj = document.getElementById (this.id);
8			
9	this.ShowRows = function(comboId)
10	{
11		$value = '';
12		//Zde treba setridit polozky this.data podle col1[val]
13		for (var key in this.data)
14		{  
15			if (key == "toJSONString") continue;
16			row = this.data[key];
17			if (row['fixed'] != 1) {oper = this.PrepareOperation (key);}
18				else {oper = '';}
19			this.AddRow (oper, row['col1']['val'], row['col2']['val']);			  		                    		                  
20		}
21		//if (this.data.length == 0)
22	}
23	
24	this.PrepareOperation = function(key)
25	{
26		oper = '';
27		//oper += "<a class='hand' onclick=\"doubleTables['"+this.id+"'].DeleteRow("+key+")\"><img alt='Odstranit' class='dt-ico' src='style/ico/edit16.png' /></a> ";
28		//oper += "<a class='hand' onclick=\"doubleTables['"+this.id+"'].DeleteRow("+key+")\"><img alt='Odstranit' class='dt-ico' src='style/ico/cut16.png' /></a> ";
29		oper += "<a class='hand' onclick=\"doubleTables['"+this.id+"'].DeleteRow("+key+")\">Odstranit</a> ";
30		return oper;	
31	}
32	
33	this.ImportRow = function(key1, value1, key2, value2, fixed)
34	{
35		ar1 = new Array();
36		ar1['key'] = key1;
37		ar1['val'] = value1;
38		
39		ar2 = new Array();
40		ar2['key'] = key2;
41		ar2['val'] = value2;		
42		
43		ar = new Array ();
44		ar['col1'] = ar1;
45		ar['col2'] = ar2;
46		ar['fixed'] = fixed;
47		
48		this.data[this.data.length] = ar;	
49	}	
50	
51	this.Export = function ()
52	{
53		var exp = '';
54		for (var key in this.data)
55		{
56			if (key == "toJSONString") continue;
57			if (exp != '') exp+= '&';			
58			exp += this.ExportRow(key);
59		}
60		return exp;	
61	}
62		
63	this.ExportRow = function (which)
64	{
65		return (this.name + "[]=" + this.data[which]['col1']['key'] + '|' + this.data[which]['col2']['key'] + '|' + this.data[which]['fixed']);	
66	}
67	
68	this.FindKeys = function(key1, key2)
69	{
70		for (var key in this.data)
71		{  			
72			if (key == "toJSONString") continue;			
73			if (this.keys == 2 && (this.data[key]['col1']['key'] == key1) && (this.data[key]['col2']['key'] == key2)) return 1;
74			if (this.keys == 1 && (this.data[key]['col1']['key'] == key1)) return 1;
75		}
76		return 0; 
77	}
78	
79	this.AddItem = function(key1, value1, key2, value2)
80	{
81		if (this.FindKeys (key1, key2) == 1) {alert ('Položka byla přidána dříve / Data already present'); return 0;}	
82		
83		ar1 = new Array();
84		ar1['key'] = key1;
85		ar1['val'] = value1;
86		
87		ar2 = new Array();
88		ar2['key'] = key2;
89		ar2['val'] = value2;		
90		
91		ar = new Array ();
92		ar['col1'] = ar1;
93		ar['col2'] = ar2;
94		ar['fixed'] = false;		
95		
96		this.data[this.data.length] = ar;	
97
98		//this.ClearRows();
99		//this.ShowRows();
100		
101		this.AddRow (this.PrepareOperation (this.data.length - 1), value1, value2);
102		return 1;	
103	}
104	
105	this.AddRow = function(cell, cell1, cell2)
106	{
107		var tBody = this.obj.getElementsByTagName('tbody')[0];
108		var newTR = document.createElement('tr');
109		var newTD1 = document.createElement('td');
110		var newTD2 = document.createElement('td');
111		var newTD3 = document.createElement('td');
112		newTD1.innerHTML = cell;
113		newTD1.clasName = "ajaxtableleft";
114		newTD2.innerHTML = cell1;
115		newTD3.innerHTML = cell2;
116		newTR.appendChild (newTD1);
117		newTR.appendChild (newTD2);
118		newTR.appendChild (newTD3);
119		tBody.appendChild (newTR);
120	}
121
122	this.DeleteRow = function (which)
123	{
124		this.data.splice (which, 1); 
125
126		this.ClearRows();
127		this.ShowRows();						
128	}
129	
130	this.ClearRows = function ()
131	{
132		var tBody = this.obj.getElementsByTagName('tbody')[0];
133
134		var pocet = tBody.rows.length;
135		for (i = 1; i < pocet; i++)		
136		{
137			tBody.deleteRow (1);
138		}		
139	}	
140	
141	this.ShowRows();
142} 	
143	

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.