Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 161a13ff773e13130e10b4d923a1beaef0bb285a @koyachi committed Feb 21, 2011
1 .gitignore
@@ -0,0 +1 @@
+conf/common.js
8 conf/common.sample.js
@@ -0,0 +1,8 @@
+exports.conf = {
+ host: 'localhost',
+ port: 3000,
+ twitter: {
+ consumer: '',
+ consumer_secret: '',
+ }
+};
179 server.js
@@ -0,0 +1,179 @@
+var express = require('express')
+ , OAuth = require('oauth').OAuth
+ , conf = require('node-config')
+ , mime = require('mime')
+ , app = express.createServer();
+
+mime.define({
+ 'text/cache-manifest': ['manifest']
+});
+
+conf.initConfig(function(err){
+ if (err) throw err;
+
+ var callbackUrl = ['http://', conf.host, ':', conf.port, '/login'].join('');
+ var oauth = new OAuth("http://twitter.com/oauth/request_token",
+ "http://twitter.com/oauth/access_token",
+ conf.twitter.consumer,
+ conf.twitter.consumer_secret,
+ "1.0A",
+ callbackUrl,
+ "HMAC-SHA1");
+
+ function postToTwitter(req, res, text) {
+ console.log("[postToTwitter]");
+ console.log(JSON.stringify(req.session));
+ if (req.session.oauth && req.session.oauth.oauth_token_secret) {
+ console.log(' oatuh');
+ var oauth_access_token = req.session.oauth.oauth_access_token;
+ var oauth_access_token_secret = req.session.oauth.oauth_access_token_secret;
+ console.log(' ' + oauth_access_token + ':' + oauth_access_token_secret);
+ oauth.post("http://api.twitter.com/1/statuses/update.json",
+ oauth_access_token, oauth_access_token_secret,
+ {"status":text}, function(error, data){
+ console.log(' getProtectedResource handler');
+ if (error) {
+ console.log(' error:' + JSON.stringify(error));
+ res.send(error);
+ } else {
+ console.log(' ok');
+ res.send('ok');
+ }
+ });
+ } else {
+ res.redirect('/signin/twitter');
+ }
+ }
+
+ var message = {
+ 'basic_batari': 'バタリ',
+ 'basic_gabari': 'ガバリ',
+ 'basic_furoha': 'フロハ',
+ 'basic_furoa': 'フロア',
+// '': '',
+ };
+
+ app.configure(function(){
+ [express.staticProvider(__dirname + '/static'),
+ express.cookieDecoder(),
+ express.bodyDecoder(),
+ express.session({
+ secret: 'ooojiiichankeitai2',
+ })
+ ].forEach(function(m){
+ app.use(m);
+ });
+ app.set('view engine', 'haml');
+ app.set('views', __dirname + '/views');
+ });
+
+ app.get('/', function(req, res){
+ res.render('index');
+ });
+
+ app.get('/login', function(req, res){
+ console.log('/login');
+ var oauth_token = req.query.oauth_token;
+ var oauth_verifier = req.query.oauth_verifier;
+ console.log('o_token = ' + oauth_token);
+ console.log('o_verifier = ' + oauth_verifier);
+ console.log(JSON.stringify(req.session));
+ if (oauth_token && oauth_verifier && req.session.oauth) {
+ console.log('authenticateDDD');
+ oauth.getOAuthAccessToken(oauth_token,
+ null,
+ oauth_verifier,
+ function(error, oauth_access_token, oauth_access_token_secret, results) {
+ console.log(' getOauthAccessToken');
+ if (error) {
+ console.log(' error');
+ res.send(error, 500);
+ } else {
+ console.log(' ok');
+ req.session.user = results.screen_name;
+ req.session.oauth.oauth_access_token = oauth_access_token;
+ req.session.oauth.oauth_access_token_secret = oauth_access_token_secret;
+ req.session.oauth.access_token_results = results;
+ res.redirect('/ojiichankeitai2');
+ }
+ });
+ } else {
+ console.log('authenticate');
+ oauth.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){
+ if (error) {
+ res.send(error, 500);
+ } else {
+ req.session.oauth = {
+ oauth_token: oauth_token,
+ oauth_token_secret: oauth_token_secret,
+ request_token_results: results
+ };
+ res.redirect('https://api.twitter.com/oauth/authorize?oauth_token=' + oauth_token);
+ }
+ });
+ }
+ });
+ app.get('/logout', function(req, res){
+ req.session.destroy(function(){
+ res.redirect('/');
+ });
+ });
+
+ app.get('/ojiichankeitai2', function(req, res){
+ var token = '';
+ var token_secret = '';
+ var access_token = '';
+ var access_token_secret = '';
+ if (req.session.oauth &&
+ req.session.oauth.oauth_token &&
+ req.session.oauth.oauth_token_secret &&
+ req.session.oauth.oauth_access_token &&
+ req.session.oauth.oauth_access_token_secret) {
+ token = req.session.oauth.oauth_token;
+ token_secret = req.session.oauth.oauth_token_secret;
+ access_token = req.session.oauth.oauth_access_token;
+ access_token_secret = req.session.oauth.oauth_access_token_secret;
+ }
+ res.render('ojiichankeitai2', {
+ locals: {
+ user: req.session.user,
+ oauth_token: token,
+ oauth_token_secret: token_secret,
+ oauth_access_token: access_token,
+ oauth_access_token_secret: access_token_secret
+ }
+ });
+ });
+
+ app.post('/post_to_twitter', function(req, res){
+ console.log('/post_to_twitter');
+ console.log(JSON.stringify(req.params));
+ console.log(JSON.stringify(req.session));
+ console.log(JSON.stringify(req.body));
+ var msg_id = req.body.msg_id;
+ if (message[msg_id]) {
+ if (req.body.oauth_token &&
+ req.body.oauth_token_secret &&
+ req.body.oauth_access_token &&
+ req.body.oauth_access_token_secret) {
+ if (!req.session.oauth) {
+ req.session.oauth = {};
+ }
+ req.session.oauth.oauth_token = req.body.oauth_token;
+ req.session.oauth.oauth_token_secret = req.body.oauth_token_secret;
+ req.session.oauth.oauth_access_token = req.body.oauth_access_token;
+ req.session.oauth.oauth_access_token_secret = req.body.oauth_access_token_secret;
+ console.log(' OAUTH TOKEN FROM REQUEST.PARAMS');
+ }
+ console.log('Post to Twitter: ' + message[msg_id]);
+ postToTwitter(req, res, message[msg_id]);
+ res.send(message[msg_id]);
+ } else {
+ res.redirect('/');
+ }
+ });
+
+ app.listen(conf.port);
+ console.log('Server running at http"//' + conf.host + ':' + conf.port + '/');
+});
+
36 static/cache.manifest
@@ -0,0 +1,36 @@
+CACHE MANIFEST
+
+NETWORK:
+http://arena.no.de/
+http://localhost:3000/
+
+CACHE:
+#scripts
+js/underscore-min.js
+js/init.js
+js/client.js
+
+#css
+css/ojiichankeitai2.css
+
+#images
+image/anim_touch_001.png
+image/anim_touch_002.png
+image/anim_touch_003.png
+image/anim_touch_004.png
+image/anim_touch_transparent.png
+image/button_batari_off.png
+image/button_batari_on.png
+image/button_furoa_off.png
+image/button_furoa_on.png
+image/button_furoha_off.png
+image/button_furoha_on.png
+image/button_gabari_off.png
+image/button_gabari_on.png
+image/main.png
+image/screen_blank.png
+image/screen_ng.png
+image/screen_ok1.png
+image/screen_ok2.png
+image/screen_post1.png
+image/screen_post2.png
22 static/css/ojiichankeitai2.css
@@ -0,0 +1,22 @@
+#keitaibody {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ padding:0;
+ margin: 0;
+ width: 100%;
+ height: 100%;
+ background-image: url("/image/main.png");
+ background-size: 100% 100%;
+}
+#_batari {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ padding:0;
+ margin: 0;
+ width: 50%;
+ height: 50%;
+ background-image: url("/image/button_batari_on.png");
+ background-size: 100% 100%;
+}
BIN static/image/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/Default_booting.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/anim_touch_001.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/anim_touch_002.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/anim_touch_003.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/anim_touch_004.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/anim_touch_transparent.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_batari_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_batari_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_furoa_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_furoa_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_furoha_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_furoha_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_gabari_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/button_gabari_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/main.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_ng.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_ok1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_ok2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_post1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN static/image/screen_post2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
219 static/js/client.js
@@ -0,0 +1,219 @@
+var OAuth = {
+ oauth_token: '',
+ oauth_token_secret: '',
+ oauth_access_token: '',
+ oauth_access_token_secret: ''
+};
+function setupOAuth() {
+ var cacheToken = localStorage.getItem('oauth_token');
+ var cacheTokenSecret = localStorage.getItem('oauth_token_secret');
+ var cacheAccessToken = localStorage.getItem('oauth_access_token');
+ var cacheAccessTokenSecret = localStorage.getItem('oauth_access_token_secret');
+ if (cacheToken && cacheTokenSecret && cacheAccessToken && cacheAccessTokenSecret) {
+ OAuth.oauth_token = cacheToken;
+ OAuth.oauth_token_secret = cacheTokenSecret;
+ OAuth.oauth_access_token = cacheAccessToken;
+ OAuth.oauth_access_token_secret = cacheAccessTokenSecret;
+ }
+ else {
+ var elmForm = document.getElementById('oauth');
+ for (var i=0; i < elmForm.length; i++) {
+ var elm = elmForm.elements[i];
+ if (elm.value && elm.value.length > 0) {
+ OAuth[elm.name] = elm.value;
+ }
+ }
+ if (OAuth.oauth_token.length > 0 &&
+ OAuth.oauth_token_secret.length > 0 &&
+ OAuth.oauth_access_token.length > 0 &&
+ OAuth.oauth_access_token_secret.length > 0)
+ {
+ localStorage.setItem('oauth_token', OAuth.oauth_token);
+ localStorage.setItem('oauth_token_secret', OAuth.oauth_token_secret);
+ localStorage.setItem('oauth_access_token', OAuth.oauth_access_token);
+ localStorage.setItem('oauth_access_token_secret', OAuth.oauth_access_token_secret);
+ }
+ }
+}
+
+function startAnimation(animationImages, e){
+ if (!this.t) {
+ var self = this;
+ var elm = document.getElementById(self.elmId);
+ if (self.fixPosition) self.fixPosition(e);
+ var count = 0;
+ self.animationCount = 0;
+ self.t = setInterval(function(){
+ var image = animationImages[count];
+ elm.src = "/image/" + image + ".png";
+ count++;
+ self.animationCount++;
+ if (count >= animationImages.length) count = 0;
+ if (self.animationStopCount && self.animationCount > self.animationStopCount) {
+ self.stopAnimation();
+ }
+ }, self.animationTick);
+ }
+};
+function stopAnimation(e){
+ if (this.t) {
+ clearInterval(this.t);
+ this.t = null;
+ document.getElementById(this.elmId).src = this.normalImage;
+ this.animationCount = 0;
+ }
+}
+
+var Screen = {
+ status: '',
+ wFactor: 1,
+ hFactor: 1,
+ t: null,
+ elmId: 'screen',
+ normalImage: '/image/screen_blank.png',
+ animationCount: 0,
+ animationTick: 500
+};
+Screen.startSendingAnimation = _.bind(startAnimation, Screen, ['screen_post1', 'screen_post2']);
+Screen.startOkAnimation = _.bind(startAnimation, Screen, ['screen_ok1', 'screen_ok2']);
+Screen.stopAnimation = _.bind(stopAnimation, Screen, null);
+
+var Touch = {
+ status: '',
+ t: null,
+ elmId: 'touch',
+ normalImage: "/image/anim_touch_transparent.png",
+ animationStopCount: 4,
+ animationCount: 0,
+ animationTick: 100,
+ fixPosition: function(e){
+ console.log(e.clientX + ':' + e.clientY);
+ var elm = document.getElementById("touch");
+ elm.style.left = e.clientX - images.touch.w * Screen.wFactor / 2;
+ elm.style.top = e.clientY - images.touch.h * Screen.hFactor / 2;
+ }
+};
+Touch.startAnimation = _.bind(startAnimation, Touch, ['anim_touch_001', 'anim_touch_002', 'anim_touch_003', 'anim_touch_004']);
+Touch.stopAnimation = _.bind(stopAnimation, Touch, null);
+
+var buttonUrl = function(label, status){
+ return "button_" + label + "_" + status + ".png";
+}
+var images = {
+ screen: {
+ url: function(label, status){ return "screen_" + status + ".png" },
+ x: 42,
+ y: 46,
+ w: 301,
+ h: 218,
+ },
+ touch: {
+ url: function(label, status){ return "anim_touch_" + status + ".png" },
+ x: 0,
+ y: 0,
+ w: 150,
+ h: 150
+ },
+ batari: {
+ msg_id: 'basic_batari',
+ url: buttonUrl,
+ x: 81,
+ y: 292,
+ w: 147,
+ h: 152
+ },
+ gabari: {
+ msg_id: 'basic_gabari',
+ url: buttonUrl,
+ x: 98,
+ y: 443,
+ w: 106,
+ h: 111
+ },
+ furoha: {
+ msg_id: 'basic_furoha',
+ url: buttonUrl,
+ x: 228,
+ y: 292,
+ w: 133,
+ h: 143
+ },
+ furoa: {
+ msg_id: 'basic_furoa',
+ url: buttonUrl,
+ x: 238,
+ y: 438,
+ w: 156,
+ h: 129
+ }
+};
+
+function buttonClicked(text){
+ var url = '/post_to_twitter';
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', url, true);
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xhr.onreadystatechange = function(){
+ if (xhr.readyState === 4) {
+ var data = xhr.responseText;
+ Screen.stopAnimation();
+ Screen.startOkAnimation();
+ setTimeout(function(){
+ Screen.stopAnimation();
+ }, 4000);
+ window.alert('done');
+ }
+ }
+ xhr.send([
+ 'msg_id=' + text,
+ 'oauth_token=' + OAuth.oauth_token,
+ 'oauth_token_secret=' + OAuth.oauth_token_secret,
+ 'oauth_access_token=' + OAuth.oauth_access_token,
+ 'oauth_access_token_secret=' + OAuth.oauth_access_token_secret,
+ ].join('&'));
+ Screen.startSendingAnimation();
+}
+document.onclick = function(){
+// タッチアニメーションはスクリーン全体に対して実行
+ Touch.startAnimation(window.event);
+}
+
+function imageHtml(label, imageStatus) {
+ var image = images[label];
+ var x = image.x * Screen.wFactor;
+ var y = image.y * Screen.hFactor;
+ var w = image.w * Screen.wFactor;
+ var h = image.h * Screen.hFactor;
+ var clickHandler = (image.msg_id) ? 'onclick="javascript:buttonClicked(\'' + image.msg_id + '\')" ' : '';
+ var html = [
+ '<img id="' + label + '" ',
+ clickHandler,
+ 'src="/image/' + image.url(label, imageStatus) + '"',
+ 'style="position:absolute; padding:0; margin:0; left:'+x+'px; top:'+y+'px; width:'+w+'px; height:'+h+'px" ',
+ ' />'
+ ].join('');
+ return html;
+}
+
+function setup(){
+ var bodyOriginalWidth = 438;
+ var bodyOriginalHeight = 600;
+ var width = document.width;
+ var height = document.height;
+ Screen.wFactor = width / bodyOriginalWidth;
+ Screen.hFactor = height / bodyOriginalHeight;
+ var html = imageHtml('screen', 'blank');
+ html += [
+ 'batari',
+ 'gabari',
+ 'furoha',
+ 'furoa',
+ ].map(function(label){ return imageHtml(label, 'off') }).join('');
+ html += imageHtml('touch', 'transparent');
+ var elmTarget = document.getElementById('keitaibody');
+ elmTarget.innerHTML = html;
+ setupOAuth();
+}
+//function resize(){} PC向けやる気あるなら実装する
+
+window.onload = setup;
8 static/js/init.js
@@ -0,0 +1,8 @@
+function clearCache(){
+ var keys = ['oauth_token', 'oauth_token_secret', 'oauth_access_token', 'oauth_access_token_secret'];
+ keys.forEach(function(k){
+ localStorage.removeItem(k);
+ });
+}
+
+clearCache();
25 static/js/underscore-min.js
@@ -0,0 +1,25 @@
+// Underscore.js 1.1.4
+// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+(function(){var q=this,C=q._,m={},j=Array.prototype,n=Object.prototype,i=j.slice,D=j.unshift,E=n.toString,o=n.hasOwnProperty,s=j.forEach,t=j.map,u=j.reduce,v=j.reduceRight,w=j.filter,x=j.every,y=j.some,p=j.indexOf,z=j.lastIndexOf;n=Array.isArray;var F=Object.keys,c=function(a){return new l(a)};if(typeof module!=="undefined"&&module.exports){module.exports=c;c._=c}else q._=c;c.VERSION="1.1.4";var k=c.each=c.forEach=function(a,b,d){if(a!=null)if(s&&a.forEach===s)a.forEach(b,d);else if(c.isNumber(a.length))for(var e=
+0,f=a.length;e<f;e++){if(b.call(d,a[e],e,a)===m)break}else for(e in a)if(o.call(a,e))if(b.call(d,a[e],e,a)===m)break};c.map=function(a,b,d){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(b,d);k(a,function(f,g,h){e[e.length]=b.call(d,f,g,h)});return e};c.reduce=c.foldl=c.inject=function(a,b,d,e){var f=d!==void 0;if(a==null)a=[];if(u&&a.reduce===u){if(e)b=c.bind(b,e);return f?a.reduce(b,d):a.reduce(b)}k(a,function(g,h,G){if(!f&&h===0){d=g;f=true}else d=b.call(e,d,g,h,G)});if(!f)throw new TypeError("Reduce of empty array with no initial value");
+return d};c.reduceRight=c.foldr=function(a,b,d,e){if(a==null)a=[];if(v&&a.reduceRight===v){if(e)b=c.bind(b,e);return d!==void 0?a.reduceRight(b,d):a.reduceRight(b)}a=(c.isArray(a)?a.slice():c.toArray(a)).reverse();return c.reduce(a,b,d,e)};c.find=c.detect=function(a,b,d){var e;A(a,function(f,g,h){if(b.call(d,f,g,h)){e=f;return true}});return e};c.filter=c.select=function(a,b,d){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(b,d);k(a,function(f,g,h){if(b.call(d,f,g,h))e[e.length]=
+f});return e};c.reject=function(a,b,d){var e=[];if(a==null)return e;k(a,function(f,g,h){b.call(d,f,g,h)||(e[e.length]=f)});return e};c.every=c.all=function(a,b,d){b=b||c.identity;var e=true;if(a==null)return e;if(x&&a.every===x)return a.every(b,d);k(a,function(f,g,h){if(!(e=e&&b.call(d,f,g,h)))return m});return e};var A=c.some=c.any=function(a,b,d){b=b||c.identity;var e=false;if(a==null)return e;if(y&&a.some===y)return a.some(b,d);k(a,function(f,g,h){if(e=b.call(d,f,g,h))return m});return e};c.include=
+c.contains=function(a,b){var d=false;if(a==null)return d;if(p&&a.indexOf===p)return a.indexOf(b)!=-1;A(a,function(e){if(d=e===b)return true});return d};c.invoke=function(a,b){var d=i.call(arguments,2);return c.map(a,function(e){return(b?e[b]:e).apply(e,d)})};c.pluck=function(a,b){return c.map(a,function(d){return d[b]})};c.max=function(a,b,d){if(!b&&c.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};k(a,function(f,g,h){g=b?b.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});
+return e.value};c.min=function(a,b,d){if(!b&&c.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};k(a,function(f,g,h){g=b?b.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};c.sortBy=function(a,b,d){return c.pluck(c.map(a,function(e,f,g){return{value:e,criteria:b.call(d,e,f,g)}}).sort(function(e,f){var g=e.criteria,h=f.criteria;return g<h?-1:g>h?1:0}),"value")};c.sortedIndex=function(a,b,d){d=d||c.identity;for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(b)?
+e=g+1:f=g}return e};c.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(c.isArray(a))return a;if(c.isArguments(a))return i.call(a);return c.values(a)};c.size=function(a){return c.toArray(a).length};c.first=c.head=function(a,b,d){return b&&!d?i.call(a,0,b):a[0]};c.rest=c.tail=function(a,b,d){return i.call(a,c.isUndefined(b)||d?1:b)};c.last=function(a){return a[a.length-1]};c.compact=function(a){return c.filter(a,function(b){return!!b})};c.flatten=function(a){return c.reduce(a,function(b,
+d){if(c.isArray(d))return b.concat(c.flatten(d));b[b.length]=d;return b},[])};c.without=function(a){var b=i.call(arguments,1);return c.filter(a,function(d){return!c.include(b,d)})};c.uniq=c.unique=function(a,b){return c.reduce(a,function(d,e,f){if(0==f||(b===true?c.last(d)!=e:!c.include(d,e)))d[d.length]=e;return d},[])};c.intersect=function(a){var b=i.call(arguments,1);return c.filter(c.uniq(a),function(d){return c.every(b,function(e){return c.indexOf(e,d)>=0})})};c.zip=function(){for(var a=i.call(arguments),
+b=c.max(c.pluck(a,"length")),d=Array(b),e=0;e<b;e++)d[e]=c.pluck(a,""+e);return d};c.indexOf=function(a,b,d){if(a==null)return-1;if(d){d=c.sortedIndex(a,b);return a[d]===b?d:-1}if(p&&a.indexOf===p)return a.indexOf(b);d=0;for(var e=a.length;d<e;d++)if(a[d]===b)return d;return-1};c.lastIndexOf=function(a,b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};c.range=function(a,b,d){var e=i.call(arguments),f=e.length<=1;a=f?0:e[0];
+b=f?e[0]:e[1];d=e[2]||1;e=Math.max(Math.ceil((b-a)/d),0);f=0;for(var g=Array(e);f<e;){g[f++]=a;a+=d}return g};c.bind=function(a,b){var d=i.call(arguments,2);return function(){return a.apply(b||{},d.concat(i.call(arguments)))}};c.bindAll=function(a){var b=i.call(arguments,1);if(b.length==0)b=c.functions(a);k(b,function(d){a[d]=c.bind(a[d],a)});return a};c.memoize=function(a,b){var d={};b=b||c.identity;return function(){var e=b.apply(this,arguments);return e in d?d[e]:d[e]=a.apply(this,arguments)}};
+c.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};c.defer=function(a){return c.delay.apply(c,[a,1].concat(i.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};c.throttle=function(a,b){return B(a,b,false)};c.debounce=function(a,b){return B(a,b,true)};c.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments));return b.apply(this,
+d)}};c.compose=function(){var a=i.call(arguments);return function(){for(var b=i.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};c.keys=F||function(a){if(c.isArray(a))return c.range(0,a.length);var b=[],d;for(d in a)if(o.call(a,d))b[b.length]=d;return b};c.values=function(a){return c.map(a,c.identity)};c.functions=c.methods=function(a){return c.filter(c.keys(a),function(b){return c.isFunction(a[b])}).sort()};c.extend=function(a){k(i.call(arguments,1),function(b){for(var d in b)a[d]=
+b[d]});return a};c.clone=function(a){return c.isArray(a)?a.slice():c.extend({},a)};c.tap=function(a,b){b(a);return a};c.isEqual=function(a,b){if(a===b)return true;var d=typeof a;if(d!=typeof b)return false;if(a==b)return true;if(!a&&b||a&&!b)return false;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual)return a.isEqual(b);if(c.isDate(a)&&c.isDate(b))return a.getTime()===b.getTime();if(c.isNaN(a)&&c.isNaN(b))return false;if(c.isRegExp(a)&&c.isRegExp(b))return a.source===b.source&&a.global===
+b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(d!=="object")return false;if(a.length&&a.length!==b.length)return false;d=c.keys(a);var e=c.keys(b);if(d.length!=e.length)return false;for(var f in a)if(!(f in b)||!c.isEqual(a[f],b[f]))return false;return true};c.isEmpty=function(a){if(c.isArray(a)||c.isString(a))return a.length===0;for(var b in a)if(o.call(a,b))return false;return true};c.isElement=function(a){return!!(a&&a.nodeType==1)};c.isArray=n||function(a){return E.call(a)===
+"[object Array]"};c.isArguments=function(a){return!!(a&&o.call(a,"callee"))};c.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};c.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};c.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};c.isNaN=function(a){return a!==a};c.isBoolean=function(a){return a===true||a===false};c.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};c.isRegExp=function(a){return!!(a&&a.test&&a.exec&&(a.ignoreCase||
+a.ignoreCase===false))};c.isNull=function(a){return a===null};c.isUndefined=function(a){return a===void 0};c.noConflict=function(){q._=C;return this};c.identity=function(a){return a};c.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};c.mixin=function(a){k(c.functions(a),function(b){H(b,c[b]=a[b])})};var I=0;c.uniqueId=function(a){var b=I++;return a?a+b:b};c.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};c.template=function(a,b){var d=c.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+
+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(e,f){return"',"+f.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(e,f){return"');"+f.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return b?d(b):d};var l=function(a){this._wrapped=a};c.prototype=l.prototype;var r=function(a,b){return b?c(a).chain():a},H=function(a,b){l.prototype[a]=function(){var d=
+i.call(arguments);D.call(d,this._wrapped);return r(b.apply(c,d),this._chain)}};c.mixin(c);k(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=j[a];l.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});k(["concat","join","slice"],function(a){var b=j[a];l.prototype[a]=function(){return r(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}})();
11 views/index.haml
@@ -0,0 +1,11 @@
+%h1 hello, this is ojiichankeitai2.
+%a{href: "/login"}
+ %img{src: "/image/button_gabari_off.png", alt: "login twitter"}
+
+%hr
+%h2 アプリっぽく起動するには
+アイホンのサファリでアクセスして携帯画面でたらサファリの下のバー真ん中の飛び出るボタンみたいの押して'ホーム画面に追加'するとアプリっぽく起動できるようになります。
+
+%h2 やめたい
+twitterのwebからおじいちゃん携帯にオッス許可しないようにするとアイホン奪われて勝手にフロハされないようにできます。
+
9 views/layout.haml
@@ -0,0 +1,9 @@
+%html{manifest: "cache.manifest"}
+ %head
+ %title おじいちゃん携帯2
+ %meta{name: "viewport", content: "width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no"}
+ %meta{name: "apple-mobile-web-app-capable", content: "yes"}
+ %link{rel: "apple-touch-icon", href: "/image/button_gabari_off.png"}
+ %link{href: "/css/ojiichankeitai2.css", rel: "stylesheet", type: "text/css"}
+ %script{src: "/js/underscore-min.js"}
+ %body = body
9 views/ojiichankeitai2.haml
@@ -0,0 +1,9 @@
+%h1 ojiichankeitai2
+%p = user
+%div{id: "keitaibody"}
+%form{id: "oauth"}
+ %input{type: "hidden", name: "oauth_token", value: oauth_token}
+ %input{type: "hidden", name: "oauth_token_secret", value: oauth_token_secret}
+ %input{type: "hidden", name: "oauth_access_token", value: oauth_access_token}
+ %input{type: "hidden", name: "oauth_access_token_secret", value: oauth_access_token_secret}
+%script{src: "/js/client.js"}
13 views/ojiichankeitai2.haml.org
@@ -0,0 +1,13 @@
+%h1 ojiichankeitai2
+%p = user
+%div{id: "keitaibody"}
+ %_div
+ %span{id: "batari", onclick: "javacript:postText('basic_batari')"}
+ batari
+ %span{id: "gabari", onclick: "javacript:postText('basic_gabari')"}
+ gabari
+ %span{id: "furoha", onclick: "javacript:postText('basic_furoha')"}
+ furoha
+ %span{id: "furoa", onclick: "javacript:postText('basic_furoa')"}
+ furoa
+%script{src: "/js/client.js"}

0 comments on commit 161a13f

Please sign in to comment.
Something went wrong with that request. Please try again.