"Open Sourcing" this, perhaps people will find it interesting/useful.

This commit is contained in:
Ryan McGrath 2011-05-11 21:06:42 +09:00
commit 197dcd2ae7
18 changed files with 4339 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
local.properties

26
AndroidManifest.xml Executable file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phonegap.Katanakana" android:versionName="1.2" android:versionCode="2">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".Katanakana"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="2" />
</manifest>

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2009 - 2010 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.

63
README.txt Executable file
View file

@ -0,0 +1,63 @@
Katanakana! (カタナカナ!)
---------------------------------------------------------------------------------------------------------------------------
Katanakana is an Android application built using the **[Phonegap Mobile Framework](http://www.phonegap.com/)** that
aims to teach people one of the Japanese alphabets, Katakana. Katakana is often noted to be one of the more useful
languages to have some sense of if you're visiting Japan, as it's largely used on menus and for words that aren't
of Japanese origin.
It aims to teach through a somewhat algorithmic approach; what this basically entails is a simple formula that watches
for how often a character is incorrectly identified by the user, and will adjust its "resurfacing" time based on the average
amount of seconds it seems to take a person to commit a character to short term memory. This app is built to try and use
short term memory as a jumping off point; **[for more information on the approach used here, consult the initial release article](http://venodesigns.net/2011/03/06/hacking-the-human-brain/)**.
Something to note is that this application was built over the course of roughly 3 hours; it's an initial first shot/attempt
that may or may not be 100% beneficial to people, but with refinement could be quite interesting. Katanakana is released under
an MIT license in the hopes that others might find the approach interesting, and further extend it to the benefit of any party
interested in learning Japanese.
The Version of Katanakana in the Android Market...
---------------------------------------------------------------------------------------------------------------------------
The version of this application is listed on the Android Market, and priced at 99 cents USD. The original author keeps it on
there for the hell of it, but anyone is free to repurpose this and upload it to the market for themselves, just give proper
attribution as the MIT license specifies. :)
**[Katanakana on the Android Market](https://market.android.com/details?id=com.phonegap.Katanakana)**
Questions, Comments?
---------------------------------------------------------------------------------------------------------------------------
Email: **ryan [at] venodesigns _dot_ net**
Twitter: **[@ryanmcgrath](http://twitter.com/ryanmcgrath)**
Web: **[Veno Designs](http://venodesigns.net/)**
Requirements for Compiling
-------------------------------------------
**[Android Development Environment](http://developer.android.com/sdk/index.html)**
**[Ant, if you're using a Terminal]()**
**[Eclipse, if you're a Java-head who uses IDEs](http://www.eclipse.org/)**
Compiling This Yourself (Eclipse)
-------------------------------------------
Eclipse has an Android plugin to facilitate this. I don't use it because
Eclipse and IDEs just get in my way (what this basically means is that I don't even
know where to begin with this). Documentation should be abound, though, as it's an official
Google supported method for Android development.
If you work with this enough, feel free to submit a pull request for this section of the README,
other Eclipse users would surely appreciate it!
Compiling This Yourself (Terminal)
-------------------------------------------
To compile/run on a phone/device in debug mode, run (in the root directory):
ant -v debug install
To compile/store a signed version, **[generate an application keystore](http://developer.android.com/guide/publishing/app-signing.html)** and run:
ant release
It should ask you for a keystore password/etc; if you did the generation step, you should know them. ;)

520
assets/www/index.html Executable file
View file

@ -0,0 +1,520 @@
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Katanakana</title>
<style type="text/css">
html {
height: 100%;
background: -webkit-gradient(linear, left top, left bottom, from(#dedede), to(#f9f9f9));
color: #444;
padding: 0;
margin: 0;
font-family: 'Droid Sans', helvetica, sans-serif;
overflow: hidden;
}
body { padding: 0; margin: 0; height: 100%; }
#header {
position: relative;
width: 100%;
height: 40px;
background: -webkit-gradient(linear, left top, left bottom, from(#3d3d3d), to(#010101));
-webkit-box-shadow: 1px 1px 5px #787878;
}
#header span {
position: absolute;
font-size: 20px;
top: 9px;
left: 10px;
font-weight: bold;
text-shadow: 1px 1px 1px #787878;
color: #f9f9f9;
}
#right, #wrong {
float: right;
padding-top: 12px;
height: 28px;
min-width: 40px;
text-align: center;
color: #f9f9f9;
text-shadow: 1px 1px 1px #121212;
border-left: 1px solid #010101;
}
#right { background: -webkit-gradient(linear, left top, left bottom, from(#6fe78c), to(#169a35)); }
#wrong { background: -webkit-gradient(linear, left top, left bottom, from(#e92222), to(#9f1515)); }
.right { background: -webkit-gradient(linear, left top, left bottom, from(#6fe78c), to(#169a35)) !important; border: 1px solid #169a35 !important; }
.wrong { background: -webkit-gradient(linear, left top, left bottom, from(#e92222), to(#9f1515)) !important; border: 1px solid #9f1515 !important; }
#intro {
padding: 10px;
height: 0; /* Default, gets judged */
text-align: left;
-webkit-transition: opacity .25s linear;
}
#intro h1 {
font-size: 20px;
text-shadow: 1px 1px 1px #b7b7b7;
color: #010101;
padding-bottom: 6px;
margin-bottom: 10px;
border-bottom: 1px solid #c9c9c9;
}
#intro p {
margin: 0 0 15px 0;
font-size: 14px;
line-height: 16px;
text-shadow: 1px 1px 1px #b9b9b9;
}
#game {
height: 0; /* Default, gets judged */
-webkit-transition: opacity .25s linear;
padding: 10px;
position: relative;
text-align: center;
}
#letter, #choices { float: left; }
#letter {
font-weight: bold;
border: 1px solid #b9b9b9;
background: -webkit-gradient(linear, left top, left bottom, from(#fafafa), to(#e7e7e7));
-webkit-border-radius: 6px;
-webkit-box-shadow: 1px 1px 5px #f7f7f7;
-webkit-transition: opacity .25s linear;
margin-bottom: 9px;
letter-spacing: -1px;
}
#choices button, #get_started {
color: #fff;
font-weight: bold;
text-shadow: 1px 1px 3px #121212;
border: 1px solid #1874ca;
-webkit-box-shadow: 1px 1px 5px #787878;
width: 100%;
margin: 0 auto 10px;
padding: 7px 0;
-webkit-border-radius: 6px;
background: -webkit-gradient(linear, left top, left bottom, from(#2792f6), to(#146abb));
}
</style>
</head>
<body>
<div id="header">
<span>Katanakana</span>
<div id="right">0</div>
<div id="wrong">0</div>
</div>
<div id="intro">
<h1>You Can Do This!</h1>
<p>
Learning any of the Japanese alphabets can seem like a daunting task because there's
just so many characters. Thing is, this doesn't <em>have</em> to be difficult!
</p>
<p>
The human brain works in a mysterious fashion, and everybody has their own point at which the brain commits something
to memory. Katanakana watches how you identify characters, and will figure out when your brain has the best chance of
storing the relations you need to read Japanese.
</p>
<p>
Once this is determined, it'll make you re-identify those characters
at the ideal moment, and you'll be good to go!
</p>
<button id="get_started">Get Started Now!</button>
</div>
<div id="game" style="display: none; opacity: 0;">
<div id="letter"></div>
<div id="choices">
<button id="choice_1"></button>
<button id="choice_2"></button>
<button id="choice_3"></button>
<button id="choice_4"></button>
</div>
</div>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.js"></script>
<script type="text/javascript">
Array.prototype.contains = function(v) {
for(var i = 0, x = this.length; i < x; i++) {
if(this[i] === v) return true;
}
return false;
};
Array.prototype.unique = function(blacklist) {
var newArr = [];
for(var i = 0, l = this.length; i < l; i++) {
if(newArr.contains(this[i]) || (typeof blacklist !== 'undefined' && this[i] === blacklist)) this.splice(i, 1);
else newArr.push(this[i]);
}
return this;
};
/* Fisher Yates what up */
Array.prototype.shuffle = function() {
var i = this.length;
if(i === 0) return false;
while(--i) {
var j = Math.floor(Math.random() * (i + 1)),
tmpi = this[i],
tmpj = this[j];
this[i] = tmpj;
this[j] = tmpi;
}
return this;
};
Array.prototype.average = function() {
var avg = 0,
i = this.length;
if(i === 0) return false;
while(--i) {
avg = avg + this[i];
}
return parseInt(avg / this.length, 10);
};
var kat = {
choices: [],
game: null,
letter: null,
right: null,
wrong: null,
rightCount: 0,
wrongCount: 0,
oldFontSize: null,
orientationSwapFontFize: null,
/* Default to two minutes... */
idealLearnTime: 1000*60,
/* Gets constructed in a bit. */
sounds: [],
/* An array of ones that were chosen incorrectly. Circles back to them
* on average every 2 minutes to start.
*/
loopBacks: [],
previousLoopBackTimers: [1000*60*2],
/* Used for lookup of time taken to commit to memory. */
previousLoopBacks: {},
/* This gets set to true after the 4 minute mark, wherein the
* turn functions will take over until loopBacks is empty for each new
* turn.
*/
runloopBacks: false,
/* Stored object from setTimeout, for checking. */
loopBackTimer: null,
katas: {
'ア': 'a <em>(ah)</em>',
'カ': 'ka <em>(kah)</em>',
'サ': 'sa <em>(sah)</em>',
'タ': 'ta <em>(tah)</em>',
'ナ': 'na <em>(nah)</em>',
'ハ': 'ha <em>(hah)</em>',
'マ': 'ma <em>(mah)</em>',
'ヤ': 'ya <em>(yah)</em>',
'ラ': 'ra <em>(rah)</em>',
'ワ': 'wa <em>(wah)</em>',
'ン': 'n',
'ガ': 'ga <em>(gah)</em>',
'ザ': 'za <em>(zah)</em>',
'ダ': 'da <em>(dah)</em>',
'バ': 'ba <em>(bah)</em>',
'パ': 'pa <em>(pah)</em>',
'アァ': 'fa <em>(fah)</em>',
'キャ': 'kya <em>(kyah)</em>',
'シャ': 'sha <em>(shah)</em>',
'チャ': 'cha <em>(chah)</em>',
'ニャ': 'nya <em>(nyah)</em>',
'ヒャ': 'hya <em>(hyah)</em>',
'ミャ': 'mya <em>(myah)</em>',
'リャ': 'rya <em>(ryah)</em>',
'ギャ': 'gya <em>(gyah)</em>',
'ヅャ': 'ja <em>(jah)</em>',
'ビャ': 'bya <em>(byah)</em>',
'ピャ': 'pya <em>(pyah)</em>',
'イ': 'i <em>(ee)</em>',
'キ': 'ki <em>(kee)</em>',
'シ': 'shi <em>(shee)</em>',
'チ': 'chi <em>(chee)</em>',
'ニ': 'ni <em>(nee)</em>',
'ヒ': 'hi <em>(hee)</em>',
'ミ': 'mi <em>(mee)</em>',
'リ': 'ri <em>(ree)</em>',
'ギ': 'gi <em>(gee)</em>',
'ジ': 'ji <em>(jee)</em>',
'ヂ': 'ji <em>(jee)</em>',
'ビ': 'bi <em>(bee)</em>',
'ピ': 'pi <em>(pee)</em>',
'ワィ': 'fi <em>(fee)</em>',
'ウ': 'u <em>(oo)</em>',
'ク': 'ku <em>(koo)</em>',
'ス': 'su <em>(soo)</em>',
'ツ': 'tsu <em>(tsoo)</em>',
'ヌ': 'nu <em>(noo)</em>',
'フ': 'fu <em>(foo)</em>',
'ム': 'mu <em>(moo)</em>',
'ユ': 'yu <em>(yoo)</em>',
'ル': 'ru <em>(roo)</em>',
'グ': 'gu <em>(goo)</em>',
'ズ': 'zu <em>(zoo)</em>',
'ヅ': 'zu <em>(zoo)</em>',
'ブ': 'bu <em>(boo)</em>',
'プ': 'pu <em>(poo)</em>',
'キユ': 'kyu <em>(kyoo)</em>',
'シユ': 'shu <em>(shoo)</em>',
'チユ': 'chu <em>(choo)</em>',
'ニユ': 'nyu <em>(nyoo)</em>',
'ヒユ': 'hyu <em>(hyoo)</em>',
'ミユ': 'myu <em>(myoo)</em>',
'リユ': 'ryu <em>(ryoo)</em>',
'ギユ': 'gyu <em>(gyoo)</em>',
'ジユ': 'ju <em>(joo)</em>',
'ビユ': 'byu <em>(byoo)</em>',
'ピユ': 'pyu <em>(pyoo)</em>',
'エ': 'e <em>(eh)</em>',
'ケ': 'ke <em>(keh)</em>',
'セ': 'se <em>(seh)</em>',
'テ': 'te <em>(teh)</em>',
'ネ': 'ne <em>(neh)</em>',
'ヘ': 'he <em>(heh)</em>',
'メ': 'me <em>(meh)</em>',
'レ': 're <em>(reh)</em>',
'ゲ': 'ge <em>(geh)</em>',
'ゼ': 'ze <em>(zeh)</em>',
'デ': 'de <em>(deh)</em>',
'ベ': 'be <em>(beh)</em>',
'ペ': 'pe <em>(peh)</em>',
'フエ': 'fe <em>(feh)</em>',
'オ': 'o <em>(oh)</em>',
'コ': 'ko <em>(koh)</em>',
'ソ': 'so <em>(soh)</em>',
'ト': 'to <em>(toh)</em>',
'': 'no <em>(noh)</em>',
'ホ': 'ho <em>(hoh)</em>',
'モ': 'mo <em>(moh)</em>',
'ヨ': 'yo <em>(yoh)</em>',
'ロ': 'ro <em>(roh)</em>',
'ヲ': 'o <em>(oh)</em>',
'ゴ': 'go <em>(goh)</em>',
'ゾ': 'zo <em>(zoh)</em>',
'ド': 'do <em>(doh)</em>',
'ボ': 'bo <em>(boh)</em>',
'ポ': 'po <em>(poh)</em>',
'フォ': 'fo <em>(foh)</em>',
'キヨ': 'kyo <em>(kyoh)</em>',
'シヨ': 'sho <em>(shoh)</em>',
'チヨ': 'cho <em>(choh)</em>',
'ニヨ': 'nyo <em>(nyoh)</em>',
'ヒヨ': 'hyo <em>(hyoh)</em>',
'ミヨ': 'myo <em>(myoh)</em>',
'リヨ': 'ryo <em>(ryoh)</em>',
'ギヨ': 'gyo <em>(gyoh)</em>',
'ジヨ': 'jo <em>(joh)</em>',
'ビヨ': 'byo <em>(byoh)</em>',
'ピヨ': 'pyo <em>(pyoh)</em>',
},
/* Yeah custom layout managers because CSS wasn't meant for this. ;P */
resolveLayout: function() {
var w = window.innerWidth,
h = window.innerHeight;
/* Minus 20 to account for left/right automagic padding. */
kat.game.style.width = (w - 20) + 'px';
/* Minus 80 for (40 = header height, 20 pixels total top/bottom automagic padding) */
kat.game.style.height = (h - 80) + 'px';
/* Get the letter nice and into position. */
if(w < h) {
var ideal = w - 22;
kat.letter.style.cssText = "width: " + ideal + "px; height: " + ideal + "px; margin: 0 auto 10px;";
kat.letter.style.fontSize = (kat.letter.innerHTML.length > 1 ? ideal - 150 : ideal - 30) + "px";
kat.choicesNode.style.cssText = 'float: left; clear: left; width: ' + ideal + 'px;';
kat.choices.forEach(function(btn) {
btn.style.cssText = 'padding: 7px 0; font-size: 12px;';
});
} else {
var ideal = h - 60;
kat.letter.style.cssText = "width: " + ideal + "px; height: " + ideal + "px; margin: 0 10px 0 0;";
kat.letter.style.fontSize = (kat.letter.innerHTML.length > 1 ? ideal - 140 : ideal - 130) + "px";
kat.choicesNode.style.cssText = 'float: right; clear: none; width: ' + ((w - 35) - ideal) + 'px;';
kat.choices.forEach(function(btn) {
btn.style.cssText = 'padding: 50px 0; font-size: 40px;';
});
}
},
check: function(e) {
e.preventDefault();
if(e.srcElement.nodeType !== 1) return false;
var ch = kat.letter.innerHTML,
node = e.srcElement.nodeName === 'EM' ? e.srcElement.parentNode : e.srcElement,
possibleOtherNode = null,
answer = node.innerHTML;
if(kat.katas[ch] === answer) {
node.className = 'right';
++kat.rightCount;
kat.right.innerHTML = kat.rightCount;
if(typeof kat.previousLoopBacks[ch] !== 'undefined') {
var diff = +new Date() - kat.previousLoopBacks[ch];
kat.previousLoopBacks[ch] = undefined;
kat.previousLoopBackTimers.push(diff);
kat.idealLearnTime = kat.previousLoopBackTimers.average();
}
} else {
kat.loopBacks.push(ch);
/* If we're in loopBack mode and this is one they already got wrong
* once, then we wanna set the idealLearnTime to be the average of all the previous
* idealLearnTimes (set when they get one they had wrong correct).
*/
if(typeof kat.previousLoopBacks[ch] === 'undefined') {
kat.previousLoopBacks[ch] = +new Date();
}
/* We're gonna come back to this one down the road. */
if(kat.loopBackTimer === null) {
kat.loopBackTimer = setTimeout(function() {
kat.runloopBacks = true;
clearTimeout(kat.loopBackTimer);
kat.loopBackTimer = null;
}, kat.idealLearnTime);
}
++kat.wrongCount;
kat.wrong.innerHTML = kat.wrongCount;
var correct_answer = kat.katas[ch];
for(var choice in kat.choices) {
if(kat.choices[choice].innerHTML === correct_answer) {
possibleOtherNode = kat.choices[choice];
node.className = 'wrong';
possibleOtherNode.className = 'right';
}
}
}
setTimeout(function() {
node.className = '';
if(possibleOtherNode !== null) possibleOtherNode.className = '';
kat.newTurn();
}, 1500);
return false;
},
newTurn: function() {
if(kat.loopBacks.length <= 0) kat.runloopBacks = false;
var kata = kat.sounds[Math.floor(Math.random() * (kat.sounds.length - 1))];
if(kat.runloopBacks) {
var rndm = kat.loopBacks.splice(Math.floor(Math.random() * (kat.loopBacks.length - 1)), 1)[0];
kata = {
ch: rndm,
sound: kat.katas[rndm]
};
}
var answers = [kata.sound],
extraAnswers = [],
choices = [],
lstRndm = null;
for(var i = 0; i < 10; i++) {
extraAnswers.push(kat.sounds[Math.floor(Math.random() * (kat.sounds.length - 1))].sound);
}
answers = answers.concat(extraAnswers.unique(kata.sound).slice(0, 3)).shuffle();
if(kata.ch.length > 1) {
if(kat.oldFontSize === null) {
kat.oldFontSize = parseInt(window.getComputedStyle(kat.letter, '')['font-size']);
kat.letter.style.fontSize = (kat.oldFontSize - 140) + 'px';
}
kat.letter.innerHTML = kata.ch;
} else {
if(kat.oldFontSize !== null) {
kat.letter.style.fontSize = kat.oldFontSize + 'px';
kat.oldFontSize = null;
}
kat.letter.innerHTML = kata.ch;
}
for(var choice in kat.choices) {
choices.push(kat.choices[choice]);
}
for(var i = 0, j = choices.length; i < j; i++) {
choices[i].innerHTML = answers[i];
}
return false;
},
};
document.addEventListener('deviceready', function() {
//document.addEventListener('menuKeyDown', function(e) {
// navigator.notification.alert(device.uuid, function(){}, '', 'Dismiss');
//}, false);
/* Absense of querySelectorAll pre-Android 2.0 makes Ryan sad. ;P */
['choice_1', 'choice_2', 'choice_3', 'choice_4'].forEach(function(choice) {
kat.choices[choice] = document.getElementById(choice);
kat.choices[choice].addEventListener('touchstart', kat.check, false);
});
['intro', 'game', 'letter','right', 'wrong', 'get_started'].forEach(function(nodeName) {
kat[nodeName] = document.getElementById(nodeName);
});
/* Need to go ahead and get a separate Array for the sounds to pull false entries from. */
for(var key in kat.katas) { kat.sounds.push({ch: key, sound: kat.katas[key]}); }
/* When they hit get started, start... */
kat.get_started.addEventListener('touchstart', function(e) {
e.preventDefault();
kat.intro.style.display = 'none';
kat.newTurn();
kat.game.style.display = 'block';
kat.game.style.opacity = 1;
return false;
}, false);
kat.choicesNode = document.getElementById('choices');
kat.resolveLayout();
window.addEventListener('resize', kat.resolveLayout);
}, false);
</script>
</body>
</html>

3498
assets/www/phonegap.0.9.4.js Executable file

File diff suppressed because it is too large Load diff

22
assets/www/zepto.js Normal file
View file

@ -0,0 +1,22 @@
var Zepto=function(){function f(a){return a.filter(function(c){return c!==i&&c!==null})}function h(a){return a.reduce(function(c,d){return c.concat(d)},[])}function n(a){return a.replace(/-+(.)?/g,function(c,d){return d?d.toUpperCase():""})}function j(a,c){this.dom=a||[];this.length=this.dom.length;this.selector=c||""}function b(a,c){if(a==g)return new j;else if(c!==i)return b(c).find(a);else if(typeof a==="function")return b(g).ready(a);else{var d;if(a instanceof j)d=a.dom;else{if(a instanceof Array)d=
f(a);else{if(a instanceof Element||a===window)d=[a];else{if(q.test(a)){e.innerHTML=(""+a).trim();d=l.call(e.childNodes);e.innerHTML="";d=d}else d=o(g,a);d=d}d=d}d=d}return new j(d,a)}}var l=[].slice,k,m,o,q,e,g=window.document,i;if(String.prototype.trim===i)String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")};q=/^\s*<.+>/;e=g.createElement("div");b.extend=function(a,c){for(k in c)a[k]=c[k];return a};b.qsa=o=function(a,c){return l.call(a.querySelectorAll(c))};b.fn={ready:function(a){g.addEventListener("DOMContentLoaded",
a,false);return this},get:function(a){return a===i?this.dom:this.dom[a]},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode.removeChild(this)})},each:function(a){this.dom.forEach(function(c,d){a.call(c,d,c)});return this},filter:function(a){return b(this.dom.filter(function(c){return o(c.parentNode,a).indexOf(c)>=0}))},is:function(a){return this.length>0&&b(this.dom[0]).filter(a).length>0},eq:function(a){return b(this.get(a))},first:function(){return b(this.get(0))},
last:function(){return b(this.get(this.length-1))},find:function(a){var c;c=this.length==1?o(this.get(0),a):h(this.dom.map(function(d){return o(d,a)}));return b(c)},closest:function(a,c){var d=this.dom[0],p=o(c!==i?c:g,a);if(p.length===0)d=null;for(;d&&d!==g&&p.indexOf(d)<0;)d=d.parentNode;return b(d)},parents:function(a){for(var c=[],d=this.get();d.length>0;)d=f(d.map(function(p){if((p=p.parentNode)&&p!==g&&c.indexOf(p)<0){c.push(p);return p}}));c=b(c);return a===i?c:c.filter(a)},parent:function(a){var c,
d=[];this.each(function(){if((c=this.parentNode)&&d.indexOf(c)<0)d.push(c)});d=b(d);return a===i?d:d.filter(a)},pluck:function(a){return this.dom.map(function(c){return c[a]})},show:function(){return this.css("display","block")},hide:function(){return this.css("display","none")},prev:function(){return b(this.pluck("previousElementSibling"))},next:function(){return b(this.pluck("nextElementSibling"))},html:function(a){return a===i?this.length>0?this.dom[0].innerHTML:null:this.each(function(c){this.innerHTML=
typeof a=="function"?a(c,this.innerHTML):a})},text:function(a){return a===i?this.length>0?this.dom[0].innerText:null:this.each(function(){this.innerText=a})},attr:function(a,c){return typeof a=="string"&&c===i?this.length>0&&this.dom[0].nodeName==="INPUT"&&this.dom[0].type==="text"&&a==="value"?this.val():this.length>0?this.dom[0].getAttribute(a)||i:null:this.each(function(d){if(typeof a=="object")for(k in a)this.setAttribute(k,a[k]);else this.setAttribute(a,typeof c=="function"?c(d,this.getAttribute(a)):
c)})},removeAttr:function(a){return this.each(function(){this.removeAttribute(a)})},val:function(a){return a===i?this.length>0?this.dom[0].value:null:this.each(function(){this.value=a})},offset:function(){var a=this.dom[0].getBoundingClientRect();return{left:a.left+g.body.scrollLeft,top:a.top+g.body.scrollTop,width:a.width,height:a.height}},css:function(a,c){if(c===i&&typeof a=="string")return this.dom[0].style[n(a)];m="";for(k in a)m+=k+":"+a[k]+";";if(typeof a=="string")m=a+":"+c;return this.each(function(){this.style.cssText+=
";"+m})},index:function(a){return this.dom.indexOf(b(a).get(0))},hasClass:function(a){return RegExp("(^|\\s)"+a+"(\\s|$)").test(this.dom[0].className)},addClass:function(a){return this.each(function(){!b(this).hasClass(a)&&(this.className+=(this.className?" ":"")+a)})},removeClass:function(a){return this.each(function(){this.className=this.className.replace(RegExp("(^|\\s)"+a+"(\\s|$)")," ").trim()})},toggleClass:function(a,c){return this.each(function(){c!==i&&!c||b(this).hasClass(a)?b(this).removeClass(a):
b(this).addClass(a)})}};["width","height"].forEach(function(a){b.fn[a]=function(){return this.offset()[a]}});var r={append:"beforeEnd",prepend:"afterBegin",before:"beforeBegin",after:"afterEnd"};for(k in r)b.fn[k]=function(a){return function(c){return this.each(function(d,p){if(c instanceof j){dom=c.dom;if(a=="afterBegin"||a=="afterEnd")for(var s=0;s<dom.length;s++)p.insertAdjacentElement(a,dom[dom.length-s-1]);else for(s=0;s<dom.length;s++)p.insertAdjacentElement(a,dom[s])}else p["insertAdjacent"+
(c instanceof Element?"Element":"HTML")](a,c)})}}(r[k]);j.prototype=b.fn;return b}();"$"in window||(window.$=Zepto);
(function(f){function h(e,g,i,r){g=n(g);if(g.ns)var a=RegExp("(?:^| )"+g.ns.replace(" "," .* ?")+"(?: |$)");return(m[e._zid||(e._zid=o++)]||[]).filter(function(c){return c&&(!g.e||c.e==g.e)&&(!g.ns||a.test(c.ns))&&(!i||c.fn==i)&&(!r||c.sel==r)})}function n(e){e=(""+e).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function j(e,g,i,r,a){var c=e._zid||(e._zid=o++),d=m[c]||(m[c]=[]);g.split(/\s/).forEach(function(p){p=f.extend(n(p),{fn:i,sel:r,del:a,i:d.length});d.push(p);e.addEventListener(p.e,
a||i,false)})}function b(e,g,i,r){var a=e._zid||(e._zid=o++);(g||"").split(/\s/).forEach(function(c){h(e,c,i,r).forEach(function(d){delete m[a][d.i];e.removeEventListener(d.e,d.del||d.fn,false)})})}function l(e){var g=f.extend({originalEvent:e},e);q.forEach(function(i){g[i]=function(){return e[i].apply(e,arguments)}});return g}var k=f.qsa,m={},o=1;f.event={add:function(e,g,i){j(e,g,i)},remove:function(e,g,i){b(e,g,i)}};f.fn.bind=function(e,g){return this.each(function(){j(this,e,g)})};f.fn.unbind=
function(e,g){return this.each(function(){b(this,e,g)})};var q=["preventDefault","stopImmediatePropagation","stopPropagation"];f.fn.delegate=function(e,g,i){return this.each(function(r,a){j(a,g,i,e,function(c){for(var d=c.target,p=k(a,e);d&&p.indexOf(d)<0;)d=d.parentNode;d&&d!==a&&d!==document&&i.call(d,f.extend(l(c),{currentTarget:d,liveFired:a}))})})};f.fn.undelegate=function(e,g,i){return this.each(function(){b(this,g,i,e)})};f.fn.live=function(e,g){f(document.body).delegate(this.selector,e,g);
return this};f.fn.die=function(e,g){f(document.body).undelegate(this.selector,e,g);return this};f.fn.trigger=function(e){return this.each(function(){var g=document.createEvent("Events");this.dispatchEvent(g,g.initEvent(e,true,false))})}})(Zepto);
(function(f){function h(j){var b={},l=j.match(/(Android)\s+([\d.]+)/),k=j.match(/(iPhone\sOS)\s([\d_]+)/),m=j.match(/(iPad).*OS\s([\d_]+)/),o=j.match(/(webOS)\/([\d.]+)/);j=j.match(/(BlackBerry).*Version\/([\d.]+)/);if(l){b.android=true;b.version=l[2]}if(k){b.ios=true;b.version=k[2].replace(/_/g,".");b.iphone=true}if(m){b.ios=true;b.version=m[2].replace(/_/g,".");b.ipad=true}if(o){b.webos=true;b.version=o[2]}if(j){b.blackberry=true;b.version=j[2]}return b}f.os=h(navigator.userAgent);f.__detect=h;
var n=navigator.userAgent.match(/WebKit\/([\d.]+)/);f.browser=n?{webkit:true,version:n[1]}:{webkit:false}})(Zepto);(function(f){f.fn.anim=function(h,n,j){var b=[],l,k;for(k in h)if(k==="opacity")l=h[k];else b.push(k+"("+h[k]+")");return this.css({"-webkit-transition":"all "+(n!==undefined?n:0.5)+"s "+(j||""),"-webkit-transform":b.join(" "),opacity:l})}})(Zepto);
(function(f){var h={},n;f(document).ready(function(){f(document.body).bind("touchstart",function(j){var b=Date.now(),l=b-(h.last||b);h.target="tagName"in j.touches[0].target?j.touches[0].target:j.touches[0].target.parentNode;n&&clearTimeout(n);h.x1=j.touches[0].pageX;if(l>0&&l<=250)h.isDoubleTap=true;h.last=b}).bind("touchmove",function(j){h.x2=j.touches[0].pageX}).bind("touchend",function(){if(h.isDoubleTap){f(h.target).trigger("doubleTap");h={}}else if(h.x2>0){Math.abs(h.x1-h.x2)>30&&f(h.target).trigger("swipe")&&
f(h.target).trigger("swipe"+(h.x1-h.x2>0?"Left":"Right"));h.x1=h.x2=h.last=0}else if("last"in h)n=setTimeout(function(){n=null;f(h.target).trigger("tap");h={}},250)}).bind("touchcancel",function(){h={}})});["swipe","swipeLeft","swipeRight","doubleTap","tap"].forEach(function(j){f.fn[j]=function(b){return this.bind(j,b)}})})(Zepto);
(function(f){function h(){}var n=0;f.ajaxJSONP=function(b){var l;l="jsonp"+ ++n;window[l]=b.success;var k=document.createElement("script");f(k).attr({src:b.url.replace(/callback=\?/,"callback="+l)});f("head").append(k)};f.ajax=function(b){b=b||{};if(b.url&&/callback=\?/.test(b.url))return f.ajaxJSONP(b);var l=b.data,k=b.success||h,m=b.error||h,o=j[b.dataType],q=b.contentType,e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status>=200&&e.status<300||e.status==0)if(o=="application/json"){var g,
i=false;try{g=JSON.parse(e.responseText)}catch(r){i=r}i?m(e,"parsererror",i):k(g,"success",e)}else k(e.responseText,"success",e);else m(e,"error")};e.open(b.type||"GET",b.url||window.location,true);o&&e.setRequestHeader("Accept",o);if(l instanceof Object){l=JSON.stringify(l);q=q||"application/json"}q&&e.setRequestHeader("Content-Type",q);e.setRequestHeader("X-Requested-With","XMLHttpRequest");e.send(l)};var j=f.ajax.mimeTypes={json:"application/json",xml:"application/xml",html:"text/html",text:"text/plain"};
f.get=function(b,l){f.ajax({url:b,success:l})};f.post=function(b,l,k,m){if(l instanceof Function){m=m||k;k=l;l=null}f.ajax({type:"POST",url:b,data:l,success:k,dataType:m})};f.getJSON=function(b,l){f.ajax({url:b,success:l,dataType:"json"})};f.fn.load=function(b,l){if(!this.dom.length)return this;var k=this,m=b.split(/\s/),o;if(m.length>1){b=m[0];o=m[1]}f.get(b,function(q){k.html(o?f(document.createElement("div")).html(q).find(o).html():q);l&&l()});return this}})(Zepto);
(function(f){var h=[],n;f.fn.remove=function(){return this.each(function(j){if(j.tagName=="IMG"){h.push(j);j.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";n&&clearTimeout(n);n=setTimeout(function(){h=[]},6E4)}j.parentNode.removeChild(j)})}})(Zepto);

18
build.properties Executable file
View file

@ -0,0 +1,18 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
#key.store=kana-key.keystore
#key.alias=kanalulz

84
build.xml Executable file
View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Katanakana" default="help">
<!-- The local.properties file is created and updated by the 'android'
tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the
default property values used by the Ant rules.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="build.properties" />
<!-- The default.properties file is created and updated by the 'android'
tool, as well as ADT.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<property file="default.properties" />
<!-- Custom Android task to deal with the project target, and import the
proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs" />
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
[This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir}]
<target name="-post-compile">
</target>
-->
<!-- Execute the Android Setup task that will setup some properties
specific to the target, and import the build rules files.
The rules file is imported from
<SDK>/platforms/<target_platform>/ant/ant_rules_r#.xml
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<setup> task.
- customize it to your needs.
- Customize the whole script.
- copy/paste the content of the rules files (minus the top node)
into this file, *after* the <setup> task
- disable the import of the rules by changing the setup task
below to <setup import="false" />.
- customize to your needs.
-->
<setup />
</project>

11
default.properties Executable file
View file

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-4

BIN
libs/phonegap.0.9.4.jar Executable file

Binary file not shown.

36
proguard.cfg Executable file
View file

@ -0,0 +1,36 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

BIN
res/drawable-hdpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
res/drawable-ldpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
res/drawable-mdpi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

11
res/layout/main.xml Executable file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/appView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
</LinearLayout>

5
res/values/strings.xml Executable file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Katanakana</string>
<string name="go">Snap</string>
</resources>

View file

@ -0,0 +1,23 @@
package com.phonegap.Katanakana;
import android.app.Activity;
import android.os.Bundle;
import com.phonegap.*;
public class Katanakana extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
/* By default, the Android Webkit instance shows scrollbars, but our
App should scale enough that the existence of scrollbars should never
NEED to be indicated. This'll kill them by default. Scrolling/panning
around is still totally supported.
*/
super.appView.setVerticalScrollBarEnabled(false);
super.appView.setHorizontalScrollBarEnabled(false);
super.loadUrl("file:///android_asset/www/index.html");
}
}