Skip to content

Commit 1abb3cc

Browse files
committed
Funnyface.js: Indentation
1 parent 158848f commit 1abb3cc

File tree

1 file changed

+99
-100
lines changed
  • labs/architecture-examples/o_O/js

1 file changed

+99
-100
lines changed

labs/architecture-examples/o_O/js/app.js

Lines changed: 99 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,68 @@
22
(function( window ) {
33
'use strict';
44

5-
// represents a single todo item
6-
var Todo = o_O.model.extend({
7-
title: '',
8-
completed: false
9-
},
10-
{
11-
initialize: function() {
12-
this.editing = o_O( false );
13-
},
14-
15-
startEditing: function() {
16-
this.editing( true );
17-
var self = this;
18-
setTimeout(function() {
19-
$( self.el ).parent().find('input.edit').select();
20-
}, 0);
5+
// represents a single todo item
6+
var Todo = o_O.model.extend({
7+
title: '',
8+
completed: false
219
},
10+
{
11+
initialize: function() {
12+
this.editing = o_O( false );
13+
},
14+
15+
startEditing: function() {
16+
this.editing( true );
17+
var self = this;
18+
setTimeout(function() {
19+
$( self.el ).parent().find('input.edit').select();
20+
}, 0);
21+
},
22+
23+
stopEditing: function() {
24+
var text = $.trim( this.title() );
25+
26+
if ( text ) {
27+
this.title( text );
28+
} else {
29+
this.remove();
30+
}
2231

23-
stopEditing: function() {
24-
var text = $.trim( this.title() );
25-
26-
if ( text ) {
27-
this.title( text );
28-
} else {
29-
this.remove();
30-
}
31-
32-
this.editing( false );
33-
},
32+
this.editing( false );
33+
},
3434

35-
remove: function() {
36-
todoapp.todos.remove( this );
37-
},
35+
remove: function() {
36+
todoapp.todos.remove( this );
37+
},
3838

39-
visible: function() {
40-
var filter = todoapp.filter(),
41-
completed = this.completed();
39+
visible: function() {
40+
var filter = todoapp.filter(),
41+
completed = this.completed();
4242

43-
return filter === '' ||
44-
( filter === 'completed' && completed ) ||
45-
( filter === 'active' && !completed );
46-
},
43+
return filter === '' ||
44+
( filter === 'completed' && completed ) ||
45+
( filter === 'active' && !completed );
46+
},
4747

48-
klass: function() {
49-
if ( this.editing() ) {
50-
return 'editing';
51-
}
52-
if ( this.completed() ) {
53-
return 'completed';
54-
} else {
55-
return '';
48+
klass: function() {
49+
if ( this.editing() ) {
50+
return 'editing';
51+
}
52+
if ( this.completed() ) {
53+
return 'completed';
54+
} else {
55+
return '';
56+
}
5657
}
5758
}
58-
}
59-
);
60-
61-
// main application
62-
var TodoApp = o_O.model.extend({
63-
current: '',
64-
completedCount: 0,
65-
filter: ''
66-
}, {
59+
);
60+
61+
// main application
62+
var TodoApp = o_O.model.extend({
63+
current: '',
64+
completedCount: 0,
65+
filter: ''
66+
}, {
6767
initialize: function() {
6868
var self = this;
6969

@@ -123,59 +123,58 @@ var TodoApp = o_O.model.extend({
123123
pluralize: function( word, count ) {
124124
return word + ( count === 1 ? '' : 's' );
125125
}
126-
}
127-
);
126+
});
128127

129-
function main() {
130-
// load todos
131-
var i, l,
132-
todos = [];
128+
function main() {
129+
// load todos
130+
var i, l,
131+
todos = [];
133132

134-
try {
135-
todos = JSON.parse( localStorage['todos-o_O'] );
136-
} catch( e ) {}
133+
try {
134+
todos = JSON.parse( localStorage['todos-o_O'] );
135+
} catch( e ) {}
137136

138-
// create models
139-
for( i = 0, l = todos.length; i < l; i++ ) {
140-
todos[ i ] = Todo.create( todos[ i ] );
137+
// create models
138+
for( i = 0, l = todos.length; i < l; i++ ) {
139+
todos[ i ] = Todo.create( todos[ i ] );
140+
}
141+
142+
// create app
143+
window.todoapp = TodoApp({
144+
todos: todos
145+
});
146+
147+
// bind to DOM element
148+
todoapp.bind('#todoapp');
149+
150+
// setup Routing
151+
o_O.router()
152+
.add('*filter', function( filter ) {
153+
todoapp.filter( filter );
154+
155+
$('#filters a')
156+
.removeClass('selected')
157+
.filter( '[href="#/' + filter + '"]' )
158+
.addClass('selected');
159+
})
160+
.start();
141161
}
142162

143-
// create app
144-
window.todoapp = TodoApp({
145-
todos: todos
146-
});
163+
// a custom binding to handle the enter key
164+
o_O.bindings.enterKey = function( func, $el ) {
165+
var ENTER_KEY = 13,
166+
context = this;
147167

148-
// bind to DOM element
149-
todoapp.bind('#todoapp');
150-
151-
// setup Routing
152-
o_O.router()
153-
.add('*filter', function( filter ) {
154-
todoapp.filter( filter );
155-
156-
$('#filters a')
157-
.removeClass('selected')
158-
.filter( '[href="#/' + filter + '"]' )
159-
.addClass('selected');
160-
})
161-
.start();
162-
}
163-
164-
// a custom binding to handle the enter key
165-
o_O.bindings.enterKey = function( func, $el ) {
166-
var ENTER_KEY = 13,
167-
context = this;
168-
169-
$el.keyup(function( e ) {
170-
if ( e.which === ENTER_KEY ) {
171-
func.call( context );
172-
}
173-
});
174-
};
168+
$el.keyup(function( e ) {
169+
if ( e.which === ENTER_KEY ) {
170+
func.call( context );
171+
}
172+
});
173+
};
175174

176-
o_O.bindingTypes.enterKey = 'outbound';
175+
o_O.bindingTypes.enterKey = 'outbound';
177176

178-
// kick it off
179-
main();
177+
// kick it off
178+
main();
180179

181180
})( window );

0 commit comments

Comments
 (0)