Skip to content

Commit

Permalink
Nothing to see here
Browse files Browse the repository at this point in the history
  • Loading branch information
live627 committed Sep 12, 2024
1 parent be32fda commit a3062df
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 262 deletions.
2 changes: 2 additions & 0 deletions Sources/Actions/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ public function clock(): void
$bcd = !isset($_REQUEST['rb']) && !isset($_REQUEST['omfg']) && !isset($_REQUEST['time']);

Theme::loadTemplate('Calendar');
Theme::loadCSSFile('calendar.css', ['force_current' => false, 'validate' => true], 'smf_calendar');
Theme::loadJavaScriptFile('calendar.js', ['defer' => true], 'smf_calendar');

if ($bcd) {
Utils::$context['sub_template'] = 'bcd';
Expand Down
292 changes: 47 additions & 245 deletions Themes/default/Calendar.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -903,323 +903,125 @@ function template_event_post()
*/
function template_bcd()
{
$alt = false;

echo '
<table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;">
<tr>
<th class="windowbg" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;" colspan="6">BCD Clock</th>
</tr>
<tr class="windowbg">';
<div class="cat_bar">
<h3 class="catbg">BCD Clock</h3>
</div>
<div class="roundframe noup">
<ul id="geek-clock" class="bcd">';

foreach (Utils::$context['clockicons'] as $t => $v)
{
echo '
<td style="padding-', $alt ? 'right' : 'left', ': 1.5em;">';
<ul>';

foreach ($v as $i)
echo '
<img src="', Utils::$context['offimg'], '" alt="" id="', $t, '_', $i, '"><br>';
<li data-e="', $t, '" data-v="', $i, '">';

echo '
</td>';

$alt = !$alt;
}
echo '
</tr>
<tr class="windowbg" style="border-top: 1px solid #ccc; text-align: center;">
<td colspan="6">
<a href="', Config::$scripturl, '?action=clock;rb">Are you hardcore?</a>
</td>
</tr>
</table>
<script>
var icons = new Object();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
</ul>';
}

echo '
function update()
{
// Get the current time
var time = new Date();
var hour = time.getHours();
var min = time.getMinutes();
var sec = time.getSeconds();
// Break it up into individual digits
var h1 = parseInt(hour / 10);
var h2 = hour % 10;
var m1 = parseInt(min / 10);
var m2 = min % 10;
var s1 = parseInt(sec / 10);
var s2 = sec % 10;
// For each digit figure out which ones to turn off and which ones to turn on
var turnon = new Array();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
if (', $t, ' >= ', $i, ')
{
turnon.push("', $t, '_', $i, '");
', $t, ' -= ', $i, ';
}';
}

echo '
for (var i in icons)
if (!in_array(i, turnon))
icons[i].src = "', Utils::$context['offimg'], '";
else
icons[i].src = "', Utils::$context['onimg'], '";
window.setTimeout(update, 500);
}
// Checks for variable in theArray.
function in_array(variable, theArray)
{
for (var i = 0; i < theArray.length; i++)
{
if (theArray[i] == variable)
return true;
}
return false;
}
update();
</script>';
</ul>
<div class="centertext">
<a href="', Config::$scripturl, '?action=clock;rb" class="button">Are you hardcore?</a>
</div>
</div>';
}

/**
* Displays the hours, minutes and seconds for our clock
*/
function template_hms()
{
$alt = false;

echo '
<table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;">
<tr>
<th class="windowbg" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;">Binary Clock</th>
</tr>';
<div class="cat_bar">
<h3 class="catbg">Binary Clock</h3>
</div>
<div class="roundframe noup">
<ul id="geek-clock" class="hms">';

foreach (Utils::$context['clockicons'] as $t => $v)
{
echo '
<tr class="windowbg">
<td>';
<ul>';

foreach ($v as $i)
echo '
<img src="', Utils::$context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">';
<li data-e="', $t, '" data-v="', $i, '">';

echo '
</td>
</tr>';

$alt = !$alt;
</ul>';
}
echo '
<tr class="windowbg" style="border-top: 1px solid #ccc; text-align: center;">
<td>
<a href="', Config::$scripturl, '?action=clock">Too tough for you?</a>
</td>
</tr>
</table>';

echo '
<script>
var icons = new Object();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
}

echo '
function update()
{
// Get the current time
var time = new Date();
var h = time.getHours();
var m = time.getMinutes();
var s = time.getSeconds();
// For each digit figure out which ones to turn off and which ones to turn on
var turnon = new Array();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
if (', $t, ' >= ', $i, ')
{
turnon.push("', $t, '_', $i, '");
', $t, ' -= ', $i, ';
}';
}

echo '
for (var i in icons)
if (!in_array(i, turnon))
icons[i].src = "', Utils::$context['offimg'], '";
else
icons[i].src = "', Utils::$context['onimg'], '";
window.setTimeout(update, 500);
}
// Checks for variable in theArray.
function in_array(variable, theArray)
{
for (var i = 0; i < theArray.length; i++)
{
if (theArray[i] == variable)
return true;
}
return false;
}
update();
</script>';
</ul>
<div class="centertext">
<a href="', Config::$scripturl, '?action=clock" class="button">Too tough for you?</a>
</div>
</div>';
}

/**
* Displays a binary clock
*/
function template_omfg()
{
$alt = false;

echo '
<table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;">
<tr>
<th class="windowbg" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;">OMFG Binary Clock</th>
</tr>';
<div class="cat_bar">
<h3 class="catbg">OMFG Binary Clock</h3>
</div>
<div class="roundframe noup">
<ul id="geek-clock" class="omfg">';

foreach (Utils::$context['clockicons'] as $t => $v)
{
echo '
<tr class="windowbg">
<td>';
<ul>';

foreach ($v as $i)
echo '
<img src="', Utils::$context['offimg'], '" alt="" id="', $t, '_', $i, '" style="padding: 2px;">';
<li data-e="', $t, '" data-v="', $i, '">';

echo '
</td>
</tr>';

$alt = !$alt;
</ul>';
}

echo '
</table>
<script>
var icons = new Object();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
icons[\'', $t, '_', $i, '\'] = document.getElementById(\'', $t, '_', $i, '\');';
}

echo '
function update()
{
// Get the current time
var time = new Date();
var month = time.getMonth() + 1;
var day = time.getDate();
var year = time.getFullYear();
year = year % 100;
var hour = time.getHours();
var min = time.getMinutes();
var sec = time.getSeconds();
// For each digit figure out which ones to turn off and which ones to turn on
var turnon = new Array();';

foreach (Utils::$context['clockicons'] as $t => $v)
{
foreach ($v as $i)
echo '
if (', $t, ' >= ', $i, ')
{
turnon.push("', $t, '_', $i, '");
', $t, ' -= ', $i, ';
}';
}

echo '
for (var i in icons)
if (!in_array(i, turnon))
icons[i].src = "', Utils::$context['offimg'], '";
else
icons[i].src = "', Utils::$context['onimg'], '";
window.setTimeout(update, 500);
}
// Checks for variable in theArray.
function in_array(variable, theArray)
{
for (var i = 0; i < theArray.length; i++)
{
if (theArray[i] == variable)
return true;
}
return false;
}
update();
</script>';
</ul>
</div>';
}

/**
* Displays the time
*/
function template_thetime()
{
$alt = false;

echo '
<table class="table_grid" style="margin: 0 auto 0 auto; border: 1px solid #ccc;">
<tr>
<th class="windowbg" style="font-weight: bold; text-align: center; border-bottom: 1px solid #ccc;">The time you requested</th>
</tr>';
<div class="cat_bar">
<h3 class="catbg">OMFG Binary Clock</h3>
</div>
<div class="roundframe noup">
<ul id="geek-time">';

foreach (Utils::$context['clockicons'] as $v)
foreach (Utils::$context['clockicons'] as $t => $v)
{
echo '
<tr class="windowbg">
<td>';
<ul>';

foreach ($v as $i)
echo '
<img src="', $i ? Utils::$context['onimg'] : Utils::$context['offimg'], '" alt="" style="padding: 2px;">';
<li', $i ? ' style="background: currentColor"' : '', '>';

echo '
</td>
</tr>';

$alt = !$alt;
</ul>';
}

echo '
</table>';
</ul>
</div>';
}

?>
Loading

0 comments on commit a3062df

Please sign in to comment.