source: trunk/style/global.js

Last change on this file was 318, checked in by george, 14 years ago
  • Přidáno: Možnost označit/odznačit všechny položky v tabulkách na stránce exportu.
  • Upraveno: Nezobrazovat editační tlačítka jako Uložit pokud není uživatele přihlášen jako autor exportu.
File size: 2.0 KB
Line 
1function show(what)
2{
3 el = document.getElementById(what).style;
4 el.display = 'block';
5}
6
7function hide(what)
8{
9 el = document.getElementById(what).style;
10 el.display = 'none';
11}
12
13function getAppVersion()
14{
15 appname = navigator.appName;
16 appversion = navigator.appVersion;
17 majorver = appversion.substring(0, 1);
18 if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
19 if ( (appname == "Microsoft Internet Explorer") && (majorver >= 4) ) return 1;
20 return 0;
21}
22
23function ResizeTextArea(t)
24{
25 a = t.value.split('\n');
26 //if(getAppVersion()) b = 3; else
27 b = 1;
28 for(x = 0; x < a.length; x++)
29 {
30 if(a[x].length >= t.cols) b += Math.floor(a[x].length / t.cols);
31 }
32 b += a.length;
33 //if(b > t.rows)
34 t.rows = b;
35}
36
37function confirmAction(theMessage)
38{
39 // TODO: Confirmation is not required in the configuration file
40 // or browser is Opera (crappy js implementation)
41 if (typeof(window.opera) != 'undefined')
42 {
43 return true;
44 }
45
46 var is_confirmed = confirm(theMessage);
47
48 return is_confirmed;
49}
50
51onload = function()
52{
53 if (document.getElementsByClassName == undefined)
54 {
55 document.getElementsByClassName = function(className)
56 {
57 var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
58 var allElements = document.getElementsByTagName("*");
59 var results = [];
60
61 var element;
62 for (var i = 0; (element = allElements[i]) != null; i++)
63 {
64 var elementClass = element.className;
65 if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
66 results.push(element);
67 }
68 return results;
69 }
70 }
71
72 arr = document.getElementsByClassName('textedit');
73 for(i = 0; i < arr.length; i++)
74 {
75 ResizeTextArea(arr[i]);
76 }
77}
78
79function CheckAllCheckbox()
80{
81 ch = document.getElementById('CheckAll');
82 arr = document.getElementsByClassName('CheckBox');
83 for(i = 0; i < arr.length; i++)
84 {
85 arr[i].checked = ch.checked;
86 }
87 return(false);
88}
Note: See TracBrowser for help on using the repository browser.