| @@ 961-1052 (lines=92) @@ | ||
| 958 | </form>'; |
|
| 959 | } |
|
| 960 | ||
| 961 | function template_bcd() |
|
| 962 | { |
|
| 963 | global $context, $scripturl; |
|
| 964 | $alt = false; |
|
| 965 | ||
| 966 | echo ' |
|
| 967 | <table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;"> |
|
| 968 | <tr> |
|
| 969 | <th class="windowbg2" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;" colspan="6">BCD Clock</th> |
|
| 970 | </tr> |
|
| 971 | <tr class="windowbg">'; |
|
| 972 | ||
| 973 | foreach ($context['clockicons'] as $t => $v) |
|
| 974 | { |
|
| 975 | echo ' |
|
| 976 | <td style="padding-', $alt ? 'right' : 'left', ': 1.5em;">'; |
|
| 977 | ||
| 978 | foreach ($v as $i) |
|
| 979 | { |
|
| 980 | echo ' |
|
| 981 | <img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '"><br>'; |
|
| 982 | } |
|
| 983 | echo ' |
|
| 984 | </td>'; |
|
| 985 | ||
| 986 | $alt = !$alt; |
|
| 987 | } |
|
| 988 | echo ' |
|
| 989 | </tr> |
|
| 990 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '" style="border-top: 1px solid #ccc; text-align: center;"> |
|
| 991 | <td colspan="6"> |
|
| 992 | <a href="', $scripturl, '?action=clock;rb">Are you hardcore?</a> |
|
| 993 | </td> |
|
| 994 | </tr> |
|
| 995 | </table> |
|
| 996 | ||
| 997 | <script> |
|
| 998 | var icons = new Object();'; |
|
| 999 | ||
| 1000 | foreach ($context['clockicons'] as $t => $v) |
|
| 1001 | { |
|
| 1002 | foreach ($v as $i) |
|
| 1003 | echo ' |
|
| 1004 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
|
| 1005 | } |
|
| 1006 | ||
| 1007 | echo ' |
|
| 1008 | function update() |
|
| 1009 | { |
|
| 1010 | // Get the current time |
|
| 1011 | var time = new Date(); |
|
| 1012 | var hour = time.getHours(); |
|
| 1013 | var min = time.getMinutes(); |
|
| 1014 | var sec = time.getSeconds(); |
|
| 1015 | ||
| 1016 | // Break it up into individual digits |
|
| 1017 | var h1 = parseInt(hour / 10); |
|
| 1018 | var h2 = hour % 10; |
|
| 1019 | var m1 = parseInt(min / 10); |
|
| 1020 | var m2 = min % 10; |
|
| 1021 | var s1 = parseInt(sec / 10); |
|
| 1022 | var s2 = sec % 10; |
|
| 1023 | ||
| 1024 | // For each digit figure out which ones to turn off and which ones to turn on |
|
| 1025 | var turnon = new Array();'; |
|
| 1026 | ||
| 1027 | foreach ($context['clockicons'] as $t => $v) |
|
| 1028 | { |
|
| 1029 | foreach ($v as $i) |
|
| 1030 | echo ' |
|
| 1031 | if (', $t, ' >= ', $i, ') |
|
| 1032 | { |
|
| 1033 | turnon.push("', $t, '_', $i, '"); |
|
| 1034 | ', $t, ' -= ', $i, '; |
|
| 1035 | }'; |
|
| 1036 | } |
|
| 1037 | ||
| 1038 | echo ' |
|
| 1039 | for (var i in icons) |
|
| 1040 | if (!in_array(i, turnon)) |
|
| 1041 | icons[i].src = "', $context['offimg'], '"; |
|
| 1042 | else |
|
| 1043 | icons[i].src = "', $context['onimg'], '"; |
|
| 1044 | ||
| 1045 | window.setTimeout("update();", 500); |
|
| 1046 | } |
|
| 1047 | // Checks for variable in theArray. |
|
| 1048 | function in_array(variable, theArray) |
|
| 1049 | { |
|
| 1050 | for (var i = 0; i < theArray.length; i++) |
|
| 1051 | { |
|
| 1052 | if (theArray[i] == variable) |
|
| 1053 | return true; |
|
| 1054 | } |
|
| 1055 | return false; |
|
| @@ 1062-1149 (lines=88) @@ | ||
| 1059 | </script>'; |
|
| 1060 | } |
|
| 1061 | ||
| 1062 | function template_hms() |
|
| 1063 | { |
|
| 1064 | global $context, $scripturl; |
|
| 1065 | $alt = false; |
|
| 1066 | ||
| 1067 | echo ' |
|
| 1068 | <table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;"> |
|
| 1069 | <tr> |
|
| 1070 | <th class="windowbg2" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;">Binary Clock</th> |
|
| 1071 | </tr>'; |
|
| 1072 | ||
| 1073 | foreach ($context['clockicons'] as $t => $v) |
|
| 1074 | { |
|
| 1075 | echo ' |
|
| 1076 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '"> |
|
| 1077 | <td>'; |
|
| 1078 | foreach ($v as $i) |
|
| 1079 | { |
|
| 1080 | echo ' |
|
| 1081 | <img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">'; |
|
| 1082 | } |
|
| 1083 | echo ' |
|
| 1084 | </td> |
|
| 1085 | </tr>'; |
|
| 1086 | ||
| 1087 | $alt = !$alt; |
|
| 1088 | } |
|
| 1089 | echo ' |
|
| 1090 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '" style="border-top: 1px solid #ccc; text-align: center;"> |
|
| 1091 | <td> |
|
| 1092 | <a href="', $scripturl, '?action=clock">Too tough for you?</a> |
|
| 1093 | </td> |
|
| 1094 | </tr> |
|
| 1095 | </table>'; |
|
| 1096 | ||
| 1097 | echo ' |
|
| 1098 | <script> |
|
| 1099 | var icons = new Object();'; |
|
| 1100 | ||
| 1101 | foreach ($context['clockicons'] as $t => $v) |
|
| 1102 | { |
|
| 1103 | foreach ($v as $i) |
|
| 1104 | echo ' |
|
| 1105 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
|
| 1106 | } |
|
| 1107 | ||
| 1108 | echo ' |
|
| 1109 | function update() |
|
| 1110 | { |
|
| 1111 | // Get the current time |
|
| 1112 | var time = new Date(); |
|
| 1113 | var h = time.getHours(); |
|
| 1114 | var m = time.getMinutes(); |
|
| 1115 | var s = time.getSeconds(); |
|
| 1116 | ||
| 1117 | // For each digit figure out which ones to turn off and which ones to turn on |
|
| 1118 | var turnon = new Array();'; |
|
| 1119 | ||
| 1120 | foreach ($context['clockicons'] as $t => $v) |
|
| 1121 | { |
|
| 1122 | foreach ($v as $i) |
|
| 1123 | echo ' |
|
| 1124 | if (', $t, ' >= ', $i, ') |
|
| 1125 | { |
|
| 1126 | turnon.push("', $t, '_', $i, '"); |
|
| 1127 | ', $t, ' -= ', $i, '; |
|
| 1128 | }'; |
|
| 1129 | } |
|
| 1130 | ||
| 1131 | echo ' |
|
| 1132 | for (var i in icons) |
|
| 1133 | if (!in_array(i, turnon)) |
|
| 1134 | icons[i].src = "', $context['offimg'], '"; |
|
| 1135 | else |
|
| 1136 | icons[i].src = "', $context['onimg'], '"; |
|
| 1137 | ||
| 1138 | window.setTimeout("update();", 500); |
|
| 1139 | } |
|
| 1140 | // Checks for variable in theArray. |
|
| 1141 | function in_array(variable, theArray) |
|
| 1142 | { |
|
| 1143 | for (var i = 0; i < theArray.length; i++) |
|
| 1144 | { |
|
| 1145 | if (theArray[i] == variable) |
|
| 1146 | return true; |
|
| 1147 | } |
|
| 1148 | return false; |
|
| 1149 | } |
|
| 1150 | ||
| 1151 | update(); |
|
| 1152 | </script>'; |
|