diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cb6996c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2009 - 2011 Ryan McGrath + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/build.py b/build.py new file mode 100644 index 0000000..7356323 --- /dev/null +++ b/build.py @@ -0,0 +1,65 @@ +#!/usr/bin/python + +""" + Build-script that brings together all the JS files for wii.js and + takes care of minifying it down to a decent size. + + Before you even ask, no, we're not using uglify.js or Closure. Both + of them are simply too aggressive for their own good; while normally this + is an excellent feature to have, the JS engine that the Opera version on the Wii + uses has a really odd set of quirks when you start trying to get smart with code, + and YUI is the only minifier that doesn't appear to totally destroy it all through + obfuscation. We'll forego a few bytes to have the thing working. ;P + + Uglify also requires Node.js. While I *love* Node, I'll wait until it's more readily + available on Windows - there are a large amount of Windows-based programmers that I'm + not keen on keeping out of development. +""" + +import os +from subprocess import call + +currdir = os.getcwd() + +# The names of our JS files (minus the .js) that we want to build into the +# final distribution. +DEPENDENCIES = [ + 'wii', + 'util', + 'console', + 'remote', +] + +# What we're going to end up injecting as our core build, into core.js. +inject_build = '' + +def minify_code(filename, final_filename): + """ + Dips out to Java/YUI compressor and runs the minifier on the specified file, dumping the + output into the specified final_filename. + """ + #cmd = 'java -jar %s/utilities/yuicompressor-2.4.2.jar %s -o %s' % (currdir, filename, final_filename) + call(['java', '-jar', '%s/utilities/yuicompressor-2.4.2.jar' % currdir, filename, '-o', final_filename]) + +# Run through each dependency, read it into "inject build", then do a simple split on the +# contents of core.js and wrap it all up. +for dependency in DEPENDENCIES: + f = open('%s/js/src/%s.js' % (currdir, dependency), 'r') + inject_build += f.read() + f.close() + +# Open core.js, split it on our build spot, wrap junks. +f = open('%s/js/src/core.js' % currdir, 'r') +core = f.read() +f.close() +core = core.split('/*{{inject_build}}*/') + +# Write out a non-minified build. +f = open('%s/js/wii.js' % currdir, 'w') +f.write(core[0]) +f.write(inject_build) +f.write(core[1]) +f.close() + +# Write out a minified build. +minify_code('%s/js/wii.js' % currdir, '%s/js/wii.min.js' % currdir) diff --git a/css/arta.min.css b/css/arta.min.css new file mode 100644 index 0000000..ac3965e --- /dev/null +++ b/css/arta.min.css @@ -0,0 +1 @@ +pre code{display:block;padding:.5em;background:#222}pre .header,pre .profile .header *,pre .ini .title{color:#fff}pre .comment,pre .javadoc,pre .preprocessor,pre .shebang,pre .profile .summary,pre .diff,pre .pi,pre .doctype,pre .xml .tag,pre .template_comment,pre .css .rules,pre .tex .special{color:#444}pre .string,pre .symbol,pre .diff .change,pre .regexp,pre .xml .attribute,pre .xml .value,pre .smalltalk .char,pre .ini .value{color:#fc3}pre .number,pre .addition{color:#0c6}pre .built_in,pre .literal,pre .vhdl .type,pre .go .constant,pre .go .typename,pre .ini .keyword,pre .lua .title,pre .perl .variable,pre .php .variable,pre .mel .variable,pre .django .variable,pre .css .funtion,pre .smalltalk .method,pre .hexcolor,pre .important,pre .flow,pre .inheritance,pre .parser3 .variable{color:#32aaee}pre .keyword,pre .xml .tag .title,pre .css .tag,pre .css .class,pre .css .id,pre .css .pseudo,pre .css .attr_selector,pre .lisp .title,pre .winutils,pre .tex .command{color:#64a}pre .class .title,pre .ruby .constant,pre .vala .constant,pre .parent,pre .deletion,pre .template_tag,pre .css .keyword,pre .javascript .title,pre .objectivec .class .id,pre .smalltalk .class,pre .lisp .keyword,pre .apache .tag,pre .nginx .variable,pre .envvar,pre .bash .variable,pre .go .built_in,pre .vbscript .built_in,pre .lua .built_in,pre .rsl .built_in,pre .tail,pre .avrasm .label,pre .parser3 .title,pre .tex .formula,pre .tex .formula *{color:#b16}pre .yardoctag,pre .phpdoc,pre .profile .header,pre .ini .title,pre .apache .tag,pre .parser3 .title{font-weight:bold}pre .xml .javascript,pre .xml .css,pre .xml .cdata{opacity:.6}pre code,pre .javascript,pre .css,pre .xml,pre .subst,pre .diff .chunk,pre .css .value,pre .css .attribute,pre .lisp .string,pre .lisp .number,pre .tail .params,pre .container,pre .haskell *,pre .erlang *,pre .erlang_repl *{color:#aaa} \ No newline at end of file diff --git a/css/demo.css b/css/demo.css new file mode 100644 index 0000000..0f1d072 --- /dev/null +++ b/css/demo.css @@ -0,0 +1,52 @@ +/** + * Wii Demo CSS + * + * Uses a basic CSS reset, and then some very rudimentary styles to make stuff easy + * on the eyes with the Wii console. + */ + +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, font, img, kbd, q, s, samp, +small, strike, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { +margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } +:focus { outline: 0; } +body { line-height: 1; } +ol, ul { list-style: none; } +table { border-collapse: separate; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +blockquote:before, blockquote:after, q:before, q:after { content: ""; } +blockquote, q { quotes: "" ""; } + +html { + color: #333; + font: normal 22px/26px helvetica, arial, sans-serif; + padding: 0px; + background: #fff; + overflow: hidden !important; +} + +body { overflow: hidden !important; padding: 20px; } + +h1 { background-color: #42a2cc; color: #f9f9f9; font-size: 44px; padding: 10px; } + +a, a:visited { + background-color: #42a2cc; + color: #f9f9f9; + padding: 3px 5px; + text-decoration: none; + display: inline-block; +} + +a:hover { background-color: #147ba8; } + +p { + padding: 10px; + margin-bottom: 10px; +} + +/* "Players". ;) */ +.player { position: absolute; top: 400px; width: 26px; height: 26px; text-align: center; border: 2px solid #010101; padding: 10px; } +.player span { background-color: #f9f9f9; padding: 5px 5px 4px; font-weight: bold; } +#player_1 { background-color: #ef1419; color: #ef1419; left: 500px; } +#player_2 { background-color: #13c32c; color: #13c32c; left: 580px; } +#player_3 { background-color: #e6d01a; color: #e6d01a; left: 660px; } +#player_4 { background-color: #af0bb1; color: #af0bb1; left: 740px; } diff --git a/css/presentation.css b/css/presentation.css new file mode 100644 index 0000000..0639090 --- /dev/null +++ b/css/presentation.css @@ -0,0 +1,69 @@ +/** + * Basic CSS for server sent events demo. + */ + +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, font, img, kbd, q, s, samp, +small, strike, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { +margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } +:focus { outline: 0; } +body { line-height: 1; } +ol, ul { list-style: none; } +table { border-collapse: separate; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +blockquote:before, blockquote:after, q:before, q:after { content: ""; } +blockquote, q { quotes: "" ""; } + +html { + color: #333; + font: normal 22px/26px helvetica, arial, sans-serif; + padding: 0px; + background: #fff; + overflow: hidden !important; +} + +body { + overflow: hidden !important; + padding: 0px; + margin: 0px; +} + +h1 { + background-color: #01acca; + padding: 20px 0; + text-indent: 20px; + color: #fff; + font-weight: bold; + font-size: 1.8em; +} + +h2 { font-size: 1.5em;background-color: #e9e9e9; border-bottom: 1px solid #c9c9c9; margin: 0; padding: 15px; } + +a, a:visited { color: #01acca; font-weight: bold; text-decoration: none; } + +ul { margin: 10px 0 0 45px; list-style-type: disc; } + +li { + font-size: 1.3em; + line-height: 1.3em; + padding: 10px 0; + color: #555; +} + +.slide { + display: none; + border: 1px solid #c9c9c9; + background-color: #f9f9f9; + margin: 30px auto; + padding: 0; +} + +pre { + background: #333; + color: #f9f9f9; + font-size: 18px; + line-height: 22px; + font-family: inconsolata, monospace; + width: 92%; + border-radius: 4px; + padding: 10px; +} diff --git a/images/checker.png b/images/checker.png deleted file mode 100644 index ab14540..0000000 Binary files a/images/checker.png and /dev/null differ diff --git a/index.html b/index.html index ec86ada..1d5759d 100644 --- a/index.html +++ b/index.html @@ -1,287 +1,108 @@ - + -
- - -+ This is a demo page meant to show how easy it is to interact with the Nintendo Wii remotes using Javascript. It's + powered by wii-js, a Javascript library that abstracts the differences + and pain points associated with using the Wii remotes. +
+ ++ This demo is really simple, and works best with all Wii remotes (Wiimotes). Hold a Wiimote horizontal (sideways), and use + the directional pad to move a box floating in the bottom right corner around. Wiimote #1 is red, #2 is green, #3 is yellow, #4 is purple. + Have fun! +
- - - - +A sane, documented, (hopefully) performant event-based library for Wiimote webpage interaction.
- - -