File: JavaScripts.h

package info (click to toggle)
postman 2.1-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,248 kB
  • ctags: 3,249
  • sloc: cpp: 33,376; ansic: 2,014; sh: 768; makefile: 300
file content (98 lines) | stat: -rw-r--r-- 3,151 bytes parent folder | download | duplicates (3)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
JavaScripts.h
*/

#ifndef __JAVASCRIPTS_H
#define __JAVASCRIPTS_H

#define DEF_JavaAlertToDisabled \
  "window.setTimeout(\"AlertToDisabled();\",%ld);\n" \
  "function AlertToDisabled()\n" \
  " {\n" \
  " alert(\"%s\")\n" \
  " }\n"

#define DEF_JavaIndexCheck \
  "function putOn()\n" \
  "  {\n" \
  "  for (i = 0; i < document.forms[0].elements.length; i++)\n" \
  "    {\n" \
  "    document.forms[0].elements[i].checked = true;\n" \
  "    }\n" \
  "  }\n" \
  "function putOff()\n" \
  "  {\n" \
  "  for (i = 0; i < document.forms[0].elements.length; i++)\n" \
  "    {\n" \
  "    document.forms[0].elements[i].checked = false;\n" \
  "    }\n" \
  "  }\n"

#define DEF_JavaScriptIDClock \
  "  var browser = navigator.appName;\n" \
  "  var version = parseFloat(navigator.appVersion);\n" \
  "  if ((browser != \"Netscape\") || (version >= 5)) \n" \
  "    {\n" \
  "    document.writeln('<SMALL ID=\"cl\" style=\"position:relative;\"></SMALL>');\n" \
  "    }\n"

#define DEF_JavaScriptClock \
  "function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)\n" \
  "  {\n" \
  "  this[0] = m0;   this[1] = m1; this[2] = m2;   this[3] = m3;\n" \
  "  this[4] = m4;   this[5] = m5; this[6] = m6;   this[7] = m7;\n" \
  "  this[8] = m8;   this[9] = m9; this[10] = m10; this[11] = m11;\n" \
  "  }\n" \
  "  \n" \
  "function showDateTime()\n" \
  "  {\n" \
  "  if (!document.layers && !document.all && !document.getElementById) return;\n" \
  "  \n" \
  "  var today, year, styear, nDays, thisDay, thisMonth, monthDays, hours, minutes, seconds, tv;\n" \
   "  monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);\n" \
  "  today = new Date();\n" \
  "  year = today.getYear(); if (year < 1000) year += 1900;\n" \
  "  styear = year + ''; styear = styear.substring(2,4);\n" \
  "  thisDay = today.getDate();\n" \
  "  if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;\n" \
  "  nDays = monthDays[today.getMonth()];\n" \
  "  thisMonth = today.getMonth() + 1;\n" \
  "  \n" \
  "  hours   = today.getHours();\n" \
  "  minutes = today.getMinutes();\n" \
  "  seconds = today.getSeconds();\n" \
  "  tv = \"\" + hours;\n" \
  "  tv += ((minutes < 10) ? \":0\" : \":\") + minutes;\n" \
  "  //tv += ((seconds < 10) ? \":0\" : \":\") + seconds;\n" \
  "  tv += \"&nbsp;\" + ((thisDay < 10) ? \"0\" : \"\") + thisDay;\n" \
  "  tv += \"/\" + ((thisMonth < 10) ? \"0\" : \"\") + thisMonth;\n" \
  "  tv += \"/\" + styear;\n" \
  "  \n" \
  "  if (document.all)\n" \
  "    {\n" \
  "    document.all.cl.innerHTML = tv;\n" \
  "    }\n" \
  "  else if (document.layers)\n" \
  "    {\n" \
  "    document.layers.cl.document.open();\n" \
  "    document.layers.cl.document.write(tv);\n" \
  "    document.layers.cl.document.close();\n" \
  "    }\n" \
  "  else if (document.getElementById)\n" \
  "    {\n" \
  "    document.getElementById(\"cl\").innerHTML = tv;\n" \
  "    }\n" \
  "  else {}\n" \
  "  \n" \
  "  setTimeout(\"showDateTime()\", 30000);\n" \
  "  }\n" \
  "  \n" \
  "window.onload = showDateTime\n" \
  "\n"

#define DEF_JavaShowMsg \
  "alert(\"%s\")\n"

#endif