| @@ 915-1006 (lines=92) @@ | ||
| 912 | </form>'; |
|
| 913 | } |
|
| 914 | ||
| 915 | function template_bcd() |
|
| 916 | { |
|
| 917 | global $context, $scripturl; |
|
| 918 | $alt = false; |
|
| 919 | echo ' |
|
| 920 | <table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;"> |
|
| 921 | <tr> |
|
| 922 | <th class="windowbg2" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;" colspan="6">BCD Clock</th> |
|
| 923 | </tr> |
|
| 924 | <tr class="windowbg">'; |
|
| 925 | foreach ($context['clockicons'] as $t => $v) |
|
| 926 | { |
|
| 927 | echo '<td style="padding-', $alt ? 'right' : 'left', ': 1.5em;">'; |
|
| 928 | foreach ($v as $i) |
|
| 929 | { |
|
| 930 | echo '<img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '"><br>'; |
|
| 931 | } |
|
| 932 | echo '</td>'; |
|
| 933 | $alt = !$alt; |
|
| 934 | } |
|
| 935 | echo '</tr> |
|
| 936 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '" style="border-top: 1px solid #ccc; text-align: center;"> |
|
| 937 | <td colspan="6"> |
|
| 938 | <a href="', $scripturl, '?action=clock;rb">Are you hardcore?</a> |
|
| 939 | </td> |
|
| 940 | </tr> |
|
| 941 | </table> |
|
| 942 | ||
| 943 | <script> |
|
| 944 | var icons = new Object();'; |
|
| 945 | ||
| 946 | foreach ($context['clockicons'] as $t => $v) |
|
| 947 | { |
|
| 948 | foreach ($v as $i) |
|
| 949 | echo ' |
|
| 950 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
|
| 951 | } |
|
| 952 | ||
| 953 | echo ' |
|
| 954 | function update() |
|
| 955 | { |
|
| 956 | // Get the current time |
|
| 957 | var time = new Date(); |
|
| 958 | var hour = time.getHours(); |
|
| 959 | var min = time.getMinutes(); |
|
| 960 | var sec = time.getSeconds(); |
|
| 961 | ||
| 962 | // Break it up into individual digits |
|
| 963 | var h1 = parseInt(hour / 10); |
|
| 964 | var h2 = hour % 10; |
|
| 965 | var m1 = parseInt(min / 10); |
|
| 966 | var m2 = min % 10; |
|
| 967 | var s1 = parseInt(sec / 10); |
|
| 968 | var s2 = sec % 10; |
|
| 969 | ||
| 970 | // For each digit figure out which ones to turn off and which ones to turn on |
|
| 971 | var turnon = new Array();'; |
|
| 972 | ||
| 973 | foreach ($context['clockicons'] as $t => $v) |
|
| 974 | { |
|
| 975 | foreach ($v as $i) |
|
| 976 | echo ' |
|
| 977 | if (', $t, ' >= ', $i, ') |
|
| 978 | { |
|
| 979 | turnon.push("', $t, '_', $i, '"); |
|
| 980 | ', $t, ' -= ', $i, '; |
|
| 981 | }'; |
|
| 982 | } |
|
| 983 | ||
| 984 | echo ' |
|
| 985 | for (var i in icons) |
|
| 986 | if (!in_array(i, turnon)) |
|
| 987 | icons[i].src = "', $context['offimg'], '"; |
|
| 988 | else |
|
| 989 | icons[i].src = "', $context['onimg'], '"; |
|
| 990 | ||
| 991 | window.setTimeout("update();", 500); |
|
| 992 | } |
|
| 993 | // Checks for variable in theArray. |
|
| 994 | function in_array(variable, theArray) |
|
| 995 | { |
|
| 996 | for (var i = 0; i < theArray.length; i++) |
|
| 997 | { |
|
| 998 | if (theArray[i] == variable) |
|
| 999 | return true; |
|
| 1000 | } |
|
| 1001 | return false; |
|
| 1002 | } |
|
| 1003 | ||
| 1004 | update(); |
|
| 1005 | </script>'; |
|
| 1006 | } |
|
| 1007 | ||
| 1008 | function template_hms() |
|
| 1009 | { |
|
| @@ 1008-1095 (lines=88) @@ | ||
| 1005 | </script>'; |
|
| 1006 | } |
|
| 1007 | ||
| 1008 | function template_hms() |
|
| 1009 | { |
|
| 1010 | global $context, $scripturl; |
|
| 1011 | $alt = false; |
|
| 1012 | echo ' |
|
| 1013 | <table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;"> |
|
| 1014 | <tr> |
|
| 1015 | <th class="windowbg2" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;">Binary Clock</th> |
|
| 1016 | </tr>'; |
|
| 1017 | foreach ($context['clockicons'] as $t => $v) |
|
| 1018 | { |
|
| 1019 | echo ' |
|
| 1020 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '"> |
|
| 1021 | <td>'; |
|
| 1022 | foreach ($v as $i) |
|
| 1023 | { |
|
| 1024 | echo '<img src="', $context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">'; |
|
| 1025 | } |
|
| 1026 | echo '</td> |
|
| 1027 | </tr> |
|
| 1028 | '; |
|
| 1029 | $alt = !$alt; |
|
| 1030 | } |
|
| 1031 | echo '</tr> |
|
| 1032 | <tr class="', $alt ? 'windowbg2' : 'windowbg', '" style="border-top: 1px solid #ccc; text-align: center;"> |
|
| 1033 | <td> |
|
| 1034 | <a href="', $scripturl, '?action=clock">Too tough for you?</a> |
|
| 1035 | </td> |
|
| 1036 | </tr> |
|
| 1037 | </table>'; |
|
| 1038 | ||
| 1039 | echo ' |
|
| 1040 | <script> |
|
| 1041 | var icons = new Object();'; |
|
| 1042 | ||
| 1043 | foreach ($context['clockicons'] as $t => $v) |
|
| 1044 | { |
|
| 1045 | foreach ($v as $i) |
|
| 1046 | echo ' |
|
| 1047 | icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');'; |
|
| 1048 | } |
|
| 1049 | ||
| 1050 | echo ' |
|
| 1051 | function update() |
|
| 1052 | { |
|
| 1053 | // Get the current time |
|
| 1054 | var time = new Date(); |
|
| 1055 | var h = time.getHours(); |
|
| 1056 | var m = time.getMinutes(); |
|
| 1057 | var s = time.getSeconds(); |
|
| 1058 | ||
| 1059 | // For each digit figure out which ones to turn off and which ones to turn on |
|
| 1060 | var turnon = new Array();'; |
|
| 1061 | ||
| 1062 | foreach ($context['clockicons'] as $t => $v) |
|
| 1063 | { |
|
| 1064 | foreach ($v as $i) |
|
| 1065 | echo ' |
|
| 1066 | if (', $t, ' >= ', $i, ') |
|
| 1067 | { |
|
| 1068 | turnon.push("', $t, '_', $i, '"); |
|
| 1069 | ', $t, ' -= ', $i, '; |
|
| 1070 | }'; |
|
| 1071 | } |
|
| 1072 | ||
| 1073 | echo ' |
|
| 1074 | for (var i in icons) |
|
| 1075 | if (!in_array(i, turnon)) |
|
| 1076 | icons[i].src = "', $context['offimg'], '"; |
|
| 1077 | else |
|
| 1078 | icons[i].src = "', $context['onimg'], '"; |
|
| 1079 | ||
| 1080 | window.setTimeout("update();", 500); |
|
| 1081 | } |
|
| 1082 | // Checks for variable in theArray. |
|
| 1083 | function in_array(variable, theArray) |
|
| 1084 | { |
|
| 1085 | for (var i = 0; i < theArray.length; i++) |
|
| 1086 | { |
|
| 1087 | if (theArray[i] == variable) |
|
| 1088 | return true; |
|
| 1089 | } |
|
| 1090 | return false; |
|
| 1091 | } |
|
| 1092 | ||
| 1093 | update(); |
|
| 1094 | </script>'; |
|
| 1095 | } |
|
| 1096 | ||
| 1097 | function template_omfg() |
|
| 1098 | { |
|