Skip to content

Commit 3d71ff0

Browse files
committed
Fixed crlf issue
1 parent 9e536a3 commit 3d71ff0

File tree

11 files changed

+1128
-1128
lines changed

11 files changed

+1128
-1128
lines changed

architecture-examples/closure/css/todos.css

Lines changed: 399 additions & 399 deletions
Large diffs are not rendered by default.
Lines changed: 142 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,143 @@
1-
goog.require('goog.array');
2-
goog.require('goog.events.EventType');
3-
goog.require('goog.events.KeyCodes');
4-
goog.require('goog.ui.Component');
5-
goog.require('goog.ui.Control');
6-
7-
goog.require('todomvc.model.ToDoItem');
8-
goog.require('todomvc.view');
9-
goog.require('todomvc.view.ClearCompletedControlRenderer');
10-
goog.require('todomvc.view.ItemCountControlRenderer');
11-
goog.require('todomvc.view.ToDoItemControl');
12-
goog.require('todomvc.view.ToDoListContainer');
13-
14-
/**
15-
* @fileoverview The controller/business logic for the application.
16-
*
17-
* This file creates the interface and marshalls changes from the interface to the model and back.
18-
*/
19-
20-
21-
/**
22-
* @type {Array.<todomvc.model.ToDoItem>}
23-
*/
24-
var items = [];
25-
26-
/**
27-
* @type {Element}
28-
*/
29-
var todoStats = document.getElementById('todo-stats');
30-
31-
/**
32-
* @type {goog.ui.Control}
33-
*/
34-
var itemCountControl = new goog.ui.Control(null, todomvc.view.ItemCountControlRenderer.getInstance());
35-
itemCountControl.render(todoStats);
36-
37-
/**
38-
* @type {goog.ui.Control}
39-
*/
40-
var clearCompletedControl = new goog.ui.Control(null, todomvc.view.ClearCompletedControlRenderer.getInstance());
41-
clearCompletedControl.render(todoStats);
42-
43-
goog.events.listen(clearCompletedControl, goog.ui.Component.EventType.ACTION, function(e) {
44-
// go backwards to avoid collection modification problems
45-
goog.array.forEachRight(items, function(model) {
46-
if (model.isDone()) {
47-
goog.array.remove(items, model);
48-
// do optimised model view sync
49-
container.forEachChild(function(control) {
50-
if (control.getModel() === model) {
51-
container.removeChild(control, true);
52-
}
53-
});
54-
}
55-
});
56-
updateStats();
57-
});
58-
59-
function updateStats() {
60-
var doneCount = goog.array.reduce(items, function(count, model) {
61-
return model.isDone() ? count + 1 : count;
62-
}, 0);
63-
var remainingCount = items.length - (/**@type {number}*/ doneCount);
64-
itemCountControl.setContent((/**@type {string}*/ remainingCount));
65-
itemCountControl.setVisible(remainingCount > 0);
66-
clearCompletedControl.setContent((/**@type {string}*/ doneCount));
67-
clearCompletedControl.setVisible((/**@type {number}*/ doneCount) > 0);
68-
}
69-
updateStats();
70-
71-
/**
72-
* @type {todomvc.view.ToDoListContainer}
73-
*/
74-
var container = new todomvc.view.ToDoListContainer();
75-
container.decorate(document.getElementById('todo-list'));
76-
77-
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.EDIT, function(e) {
78-
/**
79-
* @type {todomvc.view.ToDoItemControl}
80-
*/
81-
var control = e.target;
82-
83-
/**
84-
* @type {todomvc.model.ToDoItem}
85-
*/
86-
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
87-
88-
// do optimised model view sync
89-
model.setNote((/**@type {!string} */ control.getContent()));
90-
model.setDone((/**@type {!boolean} */ control.isChecked()));
91-
92-
updateStats();
93-
});
94-
95-
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.DESTROY, function(e) {
96-
/**
97-
* @type {todomvc.view.ToDoItemControl}
98-
*/
99-
var control = e.target;
100-
101-
/**
102-
* @type {todomvc.model.ToDoItem}
103-
*/
104-
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
105-
106-
// do optimised model view sync
107-
goog.array.remove(items, model);
108-
container.removeChild(control, true);
109-
110-
updateStats();
111-
});
112-
113-
/**
114-
* @type {Element}
115-
*/
116-
var newToDo = document.getElementById('new-todo');
117-
goog.events.listen(newToDo, goog.events.EventType.KEYUP, function(e) {
118-
if (e.keyCode === goog.events.KeyCodes.ENTER) {
119-
/**
120-
* @type {todomvc.model.ToDoItem}
121-
*/
122-
var model = new todomvc.model.ToDoItem(newToDo.value);
123-
124-
/**
125-
* @type {todomvc.view.ToDoItemControl}
126-
*/
127-
var control = new todomvc.view.ToDoItemControl();
128-
129-
// do optimised model view sync
130-
items.push(model);
131-
132-
control.setContent(model.getNote());
133-
control.setChecked(model.isDone());
134-
control.setModel(model);
135-
136-
container.addChild(control, true);
137-
138-
// clear the input box
139-
newToDo.value = '';
140-
141-
updateStats();
142-
}
1+
goog.require('goog.array');
2+
goog.require('goog.events.EventType');
3+
goog.require('goog.events.KeyCodes');
4+
goog.require('goog.ui.Component');
5+
goog.require('goog.ui.Control');
6+
7+
goog.require('todomvc.model.ToDoItem');
8+
goog.require('todomvc.view');
9+
goog.require('todomvc.view.ClearCompletedControlRenderer');
10+
goog.require('todomvc.view.ItemCountControlRenderer');
11+
goog.require('todomvc.view.ToDoItemControl');
12+
goog.require('todomvc.view.ToDoListContainer');
13+
14+
/**
15+
* @fileoverview The controller/business logic for the application.
16+
*
17+
* This file creates the interface and marshalls changes from the interface to the model and back.
18+
*/
19+
20+
21+
/**
22+
* @type {Array.<todomvc.model.ToDoItem>}
23+
*/
24+
var items = [];
25+
26+
/**
27+
* @type {Element}
28+
*/
29+
var todoStats = document.getElementById('todo-stats');
30+
31+
/**
32+
* @type {goog.ui.Control}
33+
*/
34+
var itemCountControl = new goog.ui.Control(null, todomvc.view.ItemCountControlRenderer.getInstance());
35+
itemCountControl.render(todoStats);
36+
37+
/**
38+
* @type {goog.ui.Control}
39+
*/
40+
var clearCompletedControl = new goog.ui.Control(null, todomvc.view.ClearCompletedControlRenderer.getInstance());
41+
clearCompletedControl.render(todoStats);
42+
43+
goog.events.listen(clearCompletedControl, goog.ui.Component.EventType.ACTION, function(e) {
44+
// go backwards to avoid collection modification problems
45+
goog.array.forEachRight(items, function(model) {
46+
if (model.isDone()) {
47+
goog.array.remove(items, model);
48+
// do optimised model view sync
49+
container.forEachChild(function(control) {
50+
if (control.getModel() === model) {
51+
container.removeChild(control, true);
52+
}
53+
});
54+
}
55+
});
56+
updateStats();
57+
});
58+
59+
function updateStats() {
60+
var doneCount = goog.array.reduce(items, function(count, model) {
61+
return model.isDone() ? count + 1 : count;
62+
}, 0);
63+
var remainingCount = items.length - (/**@type {number}*/ doneCount);
64+
itemCountControl.setContent((/**@type {string}*/ remainingCount));
65+
itemCountControl.setVisible(remainingCount > 0);
66+
clearCompletedControl.setContent((/**@type {string}*/ doneCount));
67+
clearCompletedControl.setVisible((/**@type {number}*/ doneCount) > 0);
68+
}
69+
updateStats();
70+
71+
/**
72+
* @type {todomvc.view.ToDoListContainer}
73+
*/
74+
var container = new todomvc.view.ToDoListContainer();
75+
container.decorate(document.getElementById('todo-list'));
76+
77+
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.EDIT, function(e) {
78+
/**
79+
* @type {todomvc.view.ToDoItemControl}
80+
*/
81+
var control = e.target;
82+
83+
/**
84+
* @type {todomvc.model.ToDoItem}
85+
*/
86+
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
87+
88+
// do optimised model view sync
89+
model.setNote((/**@type {!string} */ control.getContent()));
90+
model.setDone((/**@type {!boolean} */ control.isChecked()));
91+
92+
updateStats();
93+
});
94+
95+
goog.events.listen(container, todomvc.view.ToDoItemControl.EventType.DESTROY, function(e) {
96+
/**
97+
* @type {todomvc.view.ToDoItemControl}
98+
*/
99+
var control = e.target;
100+
101+
/**
102+
* @type {todomvc.model.ToDoItem}
103+
*/
104+
var model = (/**@type {todomvc.model.ToDoItem} */ control.getModel());
105+
106+
// do optimised model view sync
107+
goog.array.remove(items, model);
108+
container.removeChild(control, true);
109+
110+
updateStats();
111+
});
112+
113+
/**
114+
* @type {Element}
115+
*/
116+
var newToDo = document.getElementById('new-todo');
117+
goog.events.listen(newToDo, goog.events.EventType.KEYUP, function(e) {
118+
if (e.keyCode === goog.events.KeyCodes.ENTER) {
119+
/**
120+
* @type {todomvc.model.ToDoItem}
121+
*/
122+
var model = new todomvc.model.ToDoItem(newToDo.value);
123+
124+
/**
125+
* @type {todomvc.view.ToDoItemControl}
126+
*/
127+
var control = new todomvc.view.ToDoItemControl();
128+
129+
// do optimised model view sync
130+
items.push(model);
131+
132+
control.setContent(model.getNote());
133+
control.setChecked(model.isDone());
134+
control.setModel(model);
135+
136+
container.addChild(control, true);
137+
138+
// clear the input box
139+
newToDo.value = '';
140+
141+
updateStats();
142+
}
143143
});
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
goog.provide('todomvc.model.ToDoItem');
2-
3-
/**
4-
* The model object representing a todo item.
5-
*
6-
* @param {!string} note the text associated with this item
7-
* @param {!boolean=} opt_done is this item complete? defaults to false
8-
* @constructor
9-
*/
10-
todomvc.model.ToDoItem = function(note, opt_done) {
11-
/**
12-
* note the text associated with this item
13-
* @private
14-
* @type {!string}
15-
*/
16-
this.note_ = note;
17-
18-
/**
19-
* is this item complete?
20-
* @private
21-
* @type {!boolean}
22-
*/
23-
this.done_ = opt_done || false;
24-
};
25-
26-
/**
27-
* @return {!string} the text associated with this item
28-
*/
29-
todomvc.model.ToDoItem.prototype.getNote = function() {
30-
return this.note_;
31-
};
32-
33-
/**
34-
* @return {!boolean} is this item complete?
35-
*/
36-
todomvc.model.ToDoItem.prototype.isDone = function() {
37-
return this.done_;
38-
};
39-
40-
/**
41-
* @param {!string} note the text associated with this item
42-
*/
43-
todomvc.model.ToDoItem.prototype.setNote = function(note) {
44-
this.note_ = note;
45-
};
46-
47-
/**
48-
* @param {!boolean} done is this item complete?
49-
*/
50-
todomvc.model.ToDoItem.prototype.setDone = function(done) {
51-
this.done_ = done;
1+
goog.provide('todomvc.model.ToDoItem');
2+
3+
/**
4+
* The model object representing a todo item.
5+
*
6+
* @param {!string} note the text associated with this item
7+
* @param {!boolean=} opt_done is this item complete? defaults to false
8+
* @constructor
9+
*/
10+
todomvc.model.ToDoItem = function(note, opt_done) {
11+
/**
12+
* note the text associated with this item
13+
* @private
14+
* @type {!string}
15+
*/
16+
this.note_ = note;
17+
18+
/**
19+
* is this item complete?
20+
* @private
21+
* @type {!boolean}
22+
*/
23+
this.done_ = opt_done || false;
24+
};
25+
26+
/**
27+
* @return {!string} the text associated with this item
28+
*/
29+
todomvc.model.ToDoItem.prototype.getNote = function() {
30+
return this.note_;
31+
};
32+
33+
/**
34+
* @return {!boolean} is this item complete?
35+
*/
36+
todomvc.model.ToDoItem.prototype.isDone = function() {
37+
return this.done_;
38+
};
39+
40+
/**
41+
* @param {!string} note the text associated with this item
42+
*/
43+
todomvc.model.ToDoItem.prototype.setNote = function(note) {
44+
this.note_ = note;
45+
};
46+
47+
/**
48+
* @param {!boolean} done is this item complete?
49+
*/
50+
todomvc.model.ToDoItem.prototype.setDone = function(done) {
51+
this.done_ = done;
5252
};

0 commit comments

Comments
 (0)