(view source code of atticnumerals.hta as plain text)
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Attic Numerals Converter</title>
<meta http-equiv="x-ua-compatible" content="ie=9" />
<script type="text/javascript">
window.resizeTo( 480, 540 ); // resize HTA
window.moveTo( ( window.screen.width - 480 ) / 2, ( window.screen.height - 540 ) / 2 ); // center HTA on screen
html {
height: 100%;
width: 100%;
}
body
{
background-color: #108010;
color: black;
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#40F0C0',EndColorStr='#108010');
font-family: arial, sans-serif;
font-size: 12pt;
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
a {
color: darkgray;
}
input[type=text] {
background-color: white;
border: 1px solid silver;
color: black;
height: 20px;
text-align: right;
width: 210px;
}
th {
text-align: left;
}
.Button {
border-radius: 8px;
font-weight: bold;
height: 22px;
width: 147px;
}
.Center {
margin-left: auto;
margin-right: auto;
text-align: center;
}
.Input {
background-color: white;
border: 1px solid silver;
color: black;
height: 22px;
text-align: right;
width: 212px;
}
.Right {
text-align: right;
}
Dim gvaAttic, gviDecimal, gviAttic, gvsAttic
Dim imgAttic0050, imgAttic0500, imgAttic5000
Sub window_onload
document.getElementById( "AppName" ).innerHTML = AtticNumerals.applicationname
document.getElementById( "AppVersion" ).innerHTML = AtticNumerals.version
document.title = AtticNumerals.applicationname & " " & AtticNumerals.version
gviDecimal = 0
gviAttic = 0
' Use embedded images for Attic Numerals 50, 500 and 5000
CreateImageSources
document.getElementById( "Attic0050Src" ).src = imgAttic0050
document.getElementById( "Attic0500Src" ).src = imgAttic0500
document.getElementById( "Attic5000Src" ).src = imgAttic5000
' The order in which the items are added determines the order of the calculations, so start with the highest number
Set gvaAttic = CreateObject( "Scripting.Dictionary" )
gvaAttic.Item( 10000 ) = "<span title=""10000"">Μ</span>"
gvaAttic.Item( 5000 ) = "<img src=""" & imgAttic5000 & """ width=""18"" height=""18"" alt=""5000"" />"
gvaAttic.Item( 1000 ) = "<span title=""1000"">Χ</span>"
gvaAttic.Item( 500 ) = "<img src=""" & imgAttic0500 & """ width=""18"" height=""18"" alt=""500"" />"
gvaAttic.Item( 100 ) = "<span title=""100"">Η</span>"
gvaAttic.Item( 50 ) = "<img src=""" & imgAttic0050 & """ width=""18"" height=""18"" alt=""50"" />"
gvaAttic.Item( 10 ) = "<span title=""10"">Δ</span>"
gvaAttic.Item( 5 ) = "<span title=""5"">Π</span>"
gvaAttic.Item( 1 ) = "<span title=""1"">Ι</span>"
End Sub
Sub Add1( )
gviDecimal = gviDecimal + 1
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add10( )
gviDecimal = gviDecimal + 10
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add100( )
gviDecimal = gviDecimal + 100
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add1000( )
gviDecimal = gviDecimal + 1000
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add10000( )
gviDecimal = gviDecimal + 10000
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add5( )
gviDecimal = gviDecimal + 5
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add50( )
gviDecimal = gviDecimal + 50
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add500( )
gviDecimal = gviDecimal + 500
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Sub Add5000( )
gviDecimal = gviDecimal + 5000
document.getElementById( "Decimal" ).value = gviDecimal
ShowAttic
End Sub
Function AddAtticDigit( intSize )
Dim intThisDigit, strThisDigit
strThisDigit = ""
If gviAttic < intSize Then
strThisDigit = ""
Else
intThisDigit = Int( gviAttic / intSize )
gviAttic = gviAttic Mod ( intThisDigit * intSize )
For i = 1 To intThisDigit
strThisDigit = strThisDigit & gvaAttic.Item( intSize )
Next
End If
AddAtticDigit = strThisDigit
End Function
Sub CenterWindow( )
window.moveTo CInt( ( window.screen.width - document.body.offsetWidth ) / 2 ), CInt( ( window.screen.height - document.body.offsetHeight ) / 2 )
End Sub
Sub Clear( )
document.getElementById( "Decimal" ).value = ""
document.getElementById( "Attic" ).innerHTML = ""
End Sub
Sub CreateImageSources( )
' Embedded images for Attic Numerals 50, 500 and 5000
imgAttic0050 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH2gkIEDkgnhnRdQAAAJZJREFUOI3t0KEKAkEUheFPEYsKi8lqMgu+gVhsVh/IKvgKaheTYPER9jVsm8wGDQs7OoMsaPBvc5j738Pl12gEsgM6CbOzmKjAtPRuY4IV5rjhgl5sUxHINthj8eZPVNTFCRmOr0TNBPES2+fwFaOUNqFtZ487wRjrUKNWRDpEH7tSNvi0UYisLlGFlGP/RVXyuuTf5Q6xnRXu4tnD1AAAAABJRU5ErkJggg=="
imgAttic0500 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH2gkIEDkgnhnRdQAAAI5JREFUOI3t0LEJAkEURdGjmImIBjYgWIEt2IE1bDtWY2ZgA0aGNmAiiLGLJht8PrjsLgsaeGEY3mP+ZWb4NQYpL3CpVh1LzOpEc9ywDt0KD1xDd8QkDo6SqKz2U+g2OKeulMiiT4ylp3QVFdiGnL+ksWiHfcj3fGDYUNSaKV5dBnu70V/UXvTEoS/5d3kDD6QQnuVMCtgAAAAASUVORK5CYII="
imgAttic5000 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH2gkIEDkgnhnRdQAAAJlJREFUOI3t0D0OAWEUheEHEZUIEhvQWAALEIl12ILFKO2ARq2htQRqncQCJBTzFTIZ30z8hMJJbnFP8Z5zL7+mUmrvYB8mpi6aMVALJ/TvvCHaWGCCHWaox5IauKa8CjYYYBW8c07jTBCMcUDvEaicRw6qhoCskMKNathKTlu+0miKueTJR4yebVRIRX/0B30AdMH6XfDv6gbFThh4peNQfAAAAABJRU5ErkJggg=="
End Sub
Sub ShowAttic( )
Dim intKey, strVal
gviDecimal = 0
On Error Resume Next
gviDecimal = CLng( document.getElementById( "Decimal" ).value )
On Error Goto 0
gviAttic = gviDecimal
gvsAttic = ""
For Each intKey In gvaAttic.Keys
strVal = AddAtticDigit( intKey )
gvsAttic = gvsAttic & strVal
Next
document.getElementById( "Attic" ).innerHTML = gvsAttic
End Sub
</script>
<body onresize="vbscript:window.setTimeout('CenterWindow()',250,'VBScript')">
<div style="height: 25px;"></div>
<div style="height: 480px; margin: auto; width: 400px;">
<table style="height: 320px; width: 400px;">
<tr title="Enter a decimal number">
<th>Decimal</th>
<th> </th>
<th colspan="5"><input type="text" id="Decimal" onchange="vbscript:ShowAttic( )" onkeyup="vbscript:ShowAttic( )" /></th>
</tr>
<tr title="Use the buttons to enter an Attic numeral">
<th>Attic Numerals</th>
<th> </th>
<th colspan="5"><div class="Input" id="Attic"></div></th>
</tr>
<tr>
<th colspan="7"> </th>
</tr>
<tr>
<th colspan="7">Attic Input:</th>
</tr>
<tr>
<th><input type="button" class="Button" value="Add 1" onclick="vbscript:Add1( )" /></th>
<th> </th>
<th>Ι</th>
<th> </th>
<th><input type="button" class="Button" value="Add 5" onclick="vbscript:Add5( )" /></th>
<th> </th>
<th>Π</th>
</tr>
<tr>
<th><input type="button" class="Button" value="Add 10" onclick="vbscript:Add10( )" /></th>
<th> </th>
<th>Δ</th>
<th> </th>
<th><input type="button" class="Button" value="Add 50" onclick="vbscript:Add50( )" /></th>
<th> </th>
<th><img id="Attic0050Src" width="18" height="18" alt="50" /></th>
</tr>
<tr>
<th><input type="button" class="Button" value="Add 100" onclick="vbscript:Add100( )" /></th>
<th> </th>
<th>Η</th>
<th> </th>
<th><input type="button" class="Button" value="Add 500" onclick="vbscript:Add500( )" /></th>
<th> </th>
<th><img id="Attic0500Src" width="18" height="18" alt="500" /></th>
</tr>
<tr>
<th><input type="button" class="Button" value="Add 1000" onclick="vbscript:Add1000( )" /></th>
<th> </th>
<th>Χ</th>
<th> </th>
<th><input type="button" class="Button" value="Add 5000" onclick="vbscript:Add5000( )" /></th>
<th> </th>
<th><img id="Attic5000Src" width="18" height="18" alt="5000" /></th>
</tr>
<tr>
<th><input type="button" class="Button" value="Add 10000" onclick="vbscript:Add10000( )" /></th>
<th> </th>
<th>Μ</th>
<th> </th>
<th><input type="button" class="Button" value="Clear" onclick="vbscript:Clear( )" /></th>
<th> </th>
<th> </th>
</tr>
</table>
<div style="height: 25px;"></div>
<p class="Center"><span id="AppName">Application</span>, Version <span id="AppVersion">0.00</span><br />
© 2018, Rob van der Woude<br />
<a href="http://www.robvanderwoude.com/attics.php">www.robvanderwoude.com</a></p>
<p class="Center">More info on <a href="http://en.wikipedia.org/wiki/Attic_numerals">Attic numerals</a> at <a href="http://en.wikipedia.org/wiki/Attic_numerals">WikiPedia</font></a></p>
</div>
</body>
</html>
page last modified: 2024-04-16; loaded in 0.0135 seconds