-
-
Save Bluebie/65409 to your computer and use it in GitHub Desktop.
weird thing elliott's doing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
Number.extend({ | |
ones: ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], | |
teens: ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'], | |
tens: ['zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'], | |
megas: ['none', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', | |
'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', | |
'decillion', 'undecillion', 'duodecillion', 'tredecillion', | |
'quattuordecillion', 'quindecillion', 'sexdecillion', 'septendecillion', | |
'octodecillion', 'novemdecillion', 'vigintillion'] | |
}); | |
var trio = function(places) { | |
var strings = []; | |
if (places[1] == 1) { | |
strings.push(Number.teens[places[0]].toString()); | |
} else if (typeof places[1] != "undefined" && places[1] > 0) { | |
if (places[0] == 0) { | |
var s = Number.tens[places[1]].toString(); | |
} else { | |
var s = Number.tens[places[1]].toString() + '-' + Number.ones[places[0]].toString(); | |
}; | |
strings.push(s); | |
} else if (places[0] > 0) { | |
strings.push(Number.ones[places[0]].toString()); | |
}; | |
if (typeof places[2] != "undefined" && places[2] > 0) { | |
strings.push("hundred", Number.ones[places[2]].toString()) | |
}; | |
return strings; | |
} | |
Number.implement({ | |
numerals: function(number) { | |
var places = number.toString(10).split('').map(function(e){ return parseInt(e) }).reverse(); | |
var name = []; | |
parseInt((places.length + 2) / 3).times(function(j){ | |
var strings = trio(places.slice(j*3, (j*3) + 3)) | |
if(strings.length > 0 && j > 0) | |
name.push(Number.megas[j]); | |
name = name.concat(strings); | |
}); | |
if(name.length <= 0) | |
name.push(Number.ones[0]); | |
return name.reverse().join(" ");; | |
} | |
}); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// evil global | |
var include = function(path) { | |
var includeElement = document.createElement('script'); | |
includeElement.setAttribute('language', 'javascript'); | |
includeElement.setAttribute('type', 'text/javascript'); | |
includeElement.setAttribute('src', path); | |
document.getElementsByTagName('head')[0].appendChild(includeElement); | |
return true; | |
}; | |
window.addEvent('domready', function() { | |
include("js/C.js"); | |
include("js/english_numerals.js"); | |
include("js/main.js"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet href="css/main.css" type="text/css" media="screen"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<title>This is new thought.</title> | |
<script type="text/javascript" charset="utf-8" | |
src="js/vendor/mootools-1.2.1-core-jm.js"></script> | |
<script type="text/javascript" charset="utf-8" | |
src="js/includes.js"></script> | |
</head> | |
<body> | |
<div id="article"> | |
<p>1999, in fact. Forty years after he crammed her whole life on a very high rate of speed. Dinos And Noah Just Makes Sense — I love this. Oekaki Is An Advance In Guestbookin — It’s like a ghost. I went to a commercial touting sugar as the monofin speed is that much larger.</p> | |
</div> | |
<ol id="articles"> | |
<li>Something</li> | |
<li>Nothing</li> | |
<li>What?</li> | |
<li>Really?</li> | |
<li>Belief</li> | |
<li>Pain</li> | |
<li>Design</li> | |
<li>Sheepdog</li> | |
<li>Storage</li> | |
<li>Nerf</li> | |
<li>Bottle</li> | |
</ol> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEvent('domready', function() { | |
$$('#articles > li').each(function(el,i){ | |
el.setStyle('list-style-type', 'none') | |
el.set('text', english_numerals(i)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment