Commit 2d0cb3bc authored by TasteBot's avatar TasteBot

update the build files for gh-pages [ci skip]

parent 13b7a35c
node_modules/knockback/* node_modules/backbone/*
!node_modules/knockback/knockback.js !node_modules/backbone/backbone.js
!node_modules/knockback/node_modules
node_modules/knockback/node_modules/backbone/*
!node_modules/knockback/node_modules/backbone/backbone.js
node_modules/knockback/node_modules/underscore/* node_modules/backbone.localStorage/*
!node_modules/knockback/node_modules/underscore/underscore.js !node_modules/backbone.localStorage/backbone.localStorage.js
node_modules/knockback/node_modules/knockout/*
!node_modules/knockback/node_modules/knockout/build
node_modules/knockback/node_modules/knockout/build/*
!node_modules/knockback/node_modules/knockout/build/output
node_modules/knockback/node_modules/knockout/build/output/*
!node_modules/knockback/node_modules/knockout/build/output/knockout-latest.debug.js
node_modules/jquery/* node_modules/jquery/*
!node_modules/jquery/dist !node_modules/jquery/dist
node_modules/jquery/dist/* node_modules/jquery/dist/*
!node_modules/jquery/dist/jquery.js !node_modules/jquery/dist/jquery.js
node_modules/knockback/*
!node_modules/knockback/knockback.js
node_modules/knockout/*
!node_modules/knockout/build
node_modules/knockout/build/*
!node_modules/knockout/build/output
node_modules/knockout/build/output/*
!node_modules/knockout/build/output/knockout-latest.debug.js
node_modules/todomvc-app-css/* node_modules/todomvc-app-css/*
!node_modules/todomvc-app-css/index.css !node_modules/todomvc-app-css/index.css
node_modules/todomvc-common/* node_modules/todomvc-common/*
!node_modules/todomvc-common/base.css !node_modules/todomvc-common/base.css
!node_modules/todomvc-common/base.js !node_modules/todomvc-common/base.js
node_modules/underscore/*
!node_modules/underscore/underscore.js
{print} = require 'util'
{spawn} = require 'child_process'
task 'build', 'Build js/ from src/', ->
coffee = spawn 'coffee', ['-c', '-o', 'js', 'src']
coffee.stderr.on 'data', (data) ->
message = data.toString()
if message.search('is now called') < 0
process.stderr.write message
coffee.stdout.on 'data', (data) ->
print data.toString()
coffee.on 'exit', (code) ->
callback?() if code is 0
task 'watch', 'Watch src/ for changes', ->
coffee = spawn 'coffee', ['-w', '-c', '-o', 'js', 'src']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
print data.toString()
\ No newline at end of file
...@@ -7,42 +7,45 @@ ...@@ -7,42 +7,45 @@
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css"> <link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
</head> </head>
<body> <body>
<section id="todoapp" kb-inject="AppViewModel"> <section class="todoapp" kb-inject="AppViewModel">
<header id="header"> <header class="header">
<h1>todos</h1> <h1>todos</h1>
<input id="new-todo" type="text" data-bind="value: title, valueUpdate: 'afterkeydown', event: {keyup: onAddTodo}" placeholder="What needs to be done?" autofocus> <input class="new-todo" type="text" data-bind="value: title, valueUpdate: 'afterkeydown', event: {keyup: onAddTodo}" placeholder="What needs to be done?" autofocus>
</header> </header>
<section id="main" data-bind="block: tasks_exist"> <section class="main" data-bind="visible: todoStats().tasksExist">
<input id="toggle-all" type="checkbox" data-bind="checked: all_completed"> <input class="toggle-all" type="checkbox" data-bind="checked: toggleCompleted">
<label for="toggle-all">Mark all as complete</label> <label for="toggle-all">Mark all as complete</label>
<ul id="todo-list" data-bind="foreach: todos"> <ul class="todo-list" data-bind="foreach: todos">
<li data-bind="css: {completed: completed, editing: editing}"> <li data-bind="css: {completed: completed, editing: editing}">
<div class="view" data-bind="event: {dblclick: onCheckEditBegin}"> <div class="view" data-bind="event: {dblclick: onCheckEditBegin}">
<input class="toggle" type="checkbox" data-bind="checked: completed" checked> <input class="toggle" type="checkbox" data-bind="checked: completed" checked>
<label data-bind="text: title"></label> <label data-bind="text: title"></label>
<button class="destroy" data-bind="click: onDestroyTodo"></button> <button class="destroy" data-bind="click: onDestroy"></button>
</div> </div>
<input class="edit" type="text" data-bind="value: title, selectAndFocus: editing, event: {blur: onCheckEditEnd, keyup: onCheckEditEnd}"> <input class="edit" type="text" data-bind="value: editTitle, event: {blur: onCheckEditEnd, keyup: onCheckEditEnd}">
</li> </li>
</ul> </ul>
</section> </section>
<footer id="footer" data-bind="block: tasks_exist"> <footer class="footer" data-bind="visible: todoStats().tasksExist">
<span id="todo-count" data-bind="html: loc.remaining_message"></span> <span class="todo-count">
<ul id="filters"> <strong data-bind="text: todoStats().remainingCount">0</strong>
<span data-bind="text: getLabel(todoStats().remainingCount)"></span> left
</span>
<ul class="filters">
<li> <li>
<a href="#/" data-bind="css: {selected: list_filter_mode()==''}">All</a> <a href="#/" data-bind="css: {selected: filterMode()==''}">All</a>
</li> </li>
<li> <li>
<a href="#/active" data-bind="css: {selected: list_filter_mode()=='active'}">Active</a> <a href="#/active" data-bind="css: {selected: filterMode()=='active'}">Active</a>
</li> </li>
<li> <li>
<a href="#/completed" data-bind="css: {selected: list_filter_mode()=='completed'}">Completed</a> <a href="#/completed" data-bind="css: {selected: filterMode()=='completed'}">Completed</a>
</li> </li>
</ul> </ul>
<button id="clear-completed" data-bind="text: loc.clear_message, block: loc.clear_message, click: onDestroyCompleted"></button> <button class="clear-completed" data-bind="visible: todoStats().completedCount, click: onClearCompleted">Clear completed</button>
</footer> </footer>
</section> </section>
<footer id="info"> <footer class="info">
<p>Double-click to edit a todo</p> <p>Double-click to edit a todo</p>
<p>Created by <a href="https://github.com/kmalakoff">Kevin Malakoff</a>. <br/> <p>Created by <a href="https://github.com/kmalakoff">Kevin Malakoff</a>. <br/>
Please try out the <a href="http://kmalakoff.github.com/knockback-todos-app/">enhanced version</a> <br/> Please try out the <a href="http://kmalakoff.github.com/knockback-todos-app/">enhanced version</a> <br/>
...@@ -54,16 +57,15 @@ ...@@ -54,16 +57,15 @@
<!-- App Dependencies --> <!-- App Dependencies -->
<script src="node_modules/todomvc-common/base.js"></script> <script src="node_modules/todomvc-common/base.js"></script>
<script src="node_modules/jquery/dist/jquery.js"></script> <script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/knockback/node_modules/underscore/underscore.js"></script> <script src="node_modules/underscore/underscore.js"></script>
<script src="node_modules/knockback/node_modules/backbone/backbone.js"></script> <script src="node_modules/backbone/backbone.js"></script>
<script src="node_modules/knockback/node_modules/knockout/build/output/knockout-latest.debug.js"></script> <script src="node_modules/knockout/build/output/knockout-latest.debug.js"></script>
<script src="node_modules/knockback/knockback.js"></script> <script src="node_modules/knockback/knockback.js"></script>
<script src="node_modules/backbone.localStorage/backbone.localStorage.js"></script> <script src="node_modules/backbone.localstorage/backbone.localStorage.js"></script>
<!-- App and Components --> <!-- App and Components -->
<script src="js/lib/knockout-extended-bindings.js"></script>
<script src="js/models/todo.js"></script> <script src="js/models/todo.js"></script>
<script src="js/models/todo_collection.js"></script> <script src="js/collections/todos.js"></script>
<script src="js/viewmodels/todo.js"></script> <script src="js/viewmodels/todo.js"></script>
<script src="js/viewmodels/app.js"></script> <script src="js/viewmodels/app.js"></script>
</body> </body>
......
/*global Backbone */
var app = app || {};
(function () {
'use strict';
// Todo Collection
// ---------------
// The collection of todos is backed by *localStorage* instead of a remote server.
app.Todos = Backbone.Collection.extend({
// Reference to this collection's model.
model: app.Todo,
// Save all of the todo items under the `"todos"` namespace.
localStorage: new Backbone.LocalStorage('todos-knockback')
});
})();
// Generated by CoffeeScript 1.8.0
(function() {
ko.bindingHandlers.dblclick = {
init: function(element, value_accessor) {
return $(element).dblclick(ko.utils.unwrapObservable(value_accessor()));
}
};
ko.bindingHandlers.block = {
update: function(element, value_accessor) {
return element.style.display = ko.utils.unwrapObservable(value_accessor()) ? 'block' : 'none';
}
};
ko.bindingHandlers.selectAndFocus = {
init: function(element, value_accessor, all_bindings_accessor) {
ko.bindingHandlers.hasfocus.init(element, value_accessor, all_bindings_accessor);
return ko.utils.registerEventHandler(element, 'focus', function() {
return element.select();
});
},
update: function(element, value_accessor) {
ko.utils.unwrapObservable(value_accessor());
return _.defer(function() {
return ko.bindingHandlers.hasfocus.update(element, value_accessor);
});
}
};
}).call(this);
// Generated by CoffeeScript 1.8.0 /*global Backbone */
(function() { var app = app || {};
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
window.Todo = (function(_super) { (function () {
__extends(Todo, _super); 'use strict';
function Todo() { // Todo Model
return Todo.__super__.constructor.apply(this, arguments); // ----------
}
Todo.prototype.completed = function(completed) { // Our basic **Todo** model has `title` and `completed` attributes.
if (arguments.length === 0) { app.Todo = Backbone.Model.extend({
return !!this.get('completed'); // Default attributes for the todo
defaults: {
title: '',
completed: false
} }
return this.save({
completed: completed ? new Date() : null
}); });
}; })();
return Todo;
})(Backbone.Model);
}).call(this);
// Generated by CoffeeScript 1.8.0
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
window.TodoCollection = (function(_super) {
__extends(TodoCollection, _super);
function TodoCollection() {
return TodoCollection.__super__.constructor.apply(this, arguments);
}
TodoCollection.prototype.localStorage = new Store('todos-knockback');
TodoCollection.prototype.model = Todo;
TodoCollection.prototype.completedCount = function() {
return this.models.reduce((function(prev, cur) {
return prev + (cur.completed() ? 1 : 0);
}), 0);
};
TodoCollection.prototype.remainingCount = function() {
return this.models.length - this.completedCount();
};
TodoCollection.prototype.completeAll = function(completed) {
return this.each(function(todo) {
return todo.completed(completed);
});
};
TodoCollection.prototype.destroyCompleted = function() {
var completed_tasks, model, _i, _len;
completed_tasks = this.filter(function(todo) {
return todo.completed();
});
for (_i = 0, _len = completed_tasks.length; _i < _len; _i++) {
model = completed_tasks[_i];
model.destroy();
}
};
return TodoCollection;
})(Backbone.Collection);
}).call(this);
// Generated by CoffeeScript 1.8.0 /*global Knockback */
(function() { var app = app || {};
var ENTER_KEY;
ENTER_KEY = 13; (function () {
'use strict';
window.AppViewModel = function() { var ENTER_KEY = 13;
var filter_fn, router;
this.collections = { // Application View Model
todos: new TodoCollection() // ---------------
};
this.collections.todos.fetch(); // The application View Model is created and bound from the HTML using kb-inject.
this.list_filter_mode = ko.observable(''); window.AppViewModel = kb.ViewModel.extend({
filter_fn = ko.computed((function(_this) { constructor: function () {
return function() { var self = this;
switch (_this.list_filter_mode()) { kb.ViewModel.prototype.constructor.call(this);
// New todo title.
this.title = ko.observable('');
// The function used for filtering is dynamically selected based on the filterMode.
this.filterMode = ko.observable('');
var filterFn = ko.computed(function () {
switch (self.filterMode()) {
case 'active': case 'active':
return function(model) { return (function (model) { return !model.get('completed'); });
return !model.completed();
};
case 'completed': case 'completed':
return function(model) { return (function (model) { return model.get('completed'); });
return model.completed();
};
default:
return function() {
return true;
};
}
}; };
})(this)); return (function () { return true; });
this.todos = kb.collectionObservable(this.collections.todos, {
view_model: TodoViewModel,
filters: filter_fn
}); });
this.todos_changed = kb.triggeredObservable(this.collections.todos, 'change add remove');
this.tasks_exist = ko.computed((function(_this) { // A collectionObservable can be used to hold the instance of the collection.
return function() { this.todos = kb.collectionObservable(new app.Todos(), app.TodoViewModel, {filters: filterFn});
_this.todos_changed();
return !!_this.collections.todos.length; // Note: collectionObservables do not track nested model attribute changes by design to avoid
// list redrawing when models change so changes need to be manually tracked and triggered.
this.todoAttributesTrigger = kb.triggeredObservable(this.todos.collection(), 'change add remove');
this.todoStats = ko.computed(function () {
self.todoAttributesTrigger(); // manual dependency on model attribute changes
return {
tasksExist: !!self.todos.collection().length,
completedCount: self.todos.collection().where({completed: true}).length,
remainingCount: self.todos.collection().where({completed: false}).length
}; };
})(this));
this.title = ko.observable('');
this.onAddTodo = (function(_this) {
return function(view_model, event) {
if (!$.trim(_this.title()) || (event.keyCode !== ENTER_KEY)) {
return true;
}
_this.collections.todos.create({
title: $.trim(_this.title())
}); });
return _this.title('');
}; // When the checkbox state is written to the observable, all of the models are updated
})(this); this.toggleCompleted = ko.computed({
this.remaining_count = ko.computed((function(_this) { read: function () { return !self.todoStats().remainingCount; },
return function() { write: function (value) { self.todos.collection().each(function (model) { model.save({completed: value}); }); }
_this.todos_changed();
return _this.collections.todos.remainingCount();
};
})(this));
this.completed_count = ko.computed((function(_this) {
return function() {
_this.todos_changed();
return _this.collections.todos.completedCount();
};
})(this));
this.all_completed = ko.computed({
read: (function(_this) {
return function() {
return !_this.remaining_count();
};
})(this),
write: (function(_this) {
return function(completed) {
return _this.collections.todos.completeAll(completed);
};
})(this)
}); });
this.onDestroyCompleted = (function(_this) {
return function() { // Fetch the todos and the collectionObservable will update once the models are loaded
return _this.collections.todos.destroyCompleted(); this.todos.collection().fetch();
};
})(this); // Use a Backbone router to update the filter mode
this.loc = { new Backbone.Router().route('*filter', null, function (filter) { self.filterMode(filter || ''); });
remaining_message: ko.computed((function(_this) {
return function() {
return "<strong>" + (_this.remaining_count()) + "</strong> " + (_this.remaining_count() === 1 ? 'item' : 'items') + " left";
};
})(this)),
clear_message: ko.computed((function(_this) {
return function() {
var count;
if ((count = _this.completed_count())) {
return "Clear completed";
} else {
return '';
}
};
})(this))
};
router = new Backbone.Router;
router.route('', null, (function(_this) {
return function() {
return _this.list_filter_mode('');
};
})(this));
router.route('active', null, (function(_this) {
return function() {
return _this.list_filter_mode('active');
};
})(this));
router.route('completed', null, (function(_this) {
return function() {
return _this.list_filter_mode('completed');
};
})(this));
Backbone.history.start(); Backbone.history.start();
}; },
}).call(this); // Create a new model in the underlying collection and the observable will automatically synchronize
onAddTodo: function (self, e) {
if (e.keyCode === ENTER_KEY && $.trim(self.title())) {
self.todos.collection().create({title: $.trim(self.title())});
self.title('');
}
},
// Operate on the underlying collection instead of the observable given the observable could be filtered
onClearCompleted: function (self) { _.invoke(self.todos.collection().where({completed: true}), 'destroy'); },
// Helper function to keep expressions out of markup
getLabel: function (count) { return ko.utils.unwrapObservable(count) === 1 ? 'item' : 'items'; }
});
})();
// Generated by CoffeeScript 1.8.0 /*global Knockback */
(function() { var app = app || {};
window.TodoViewModel = function(model) {
var ENTER_KEY, ESCAPE_KEY; (function () {
ENTER_KEY = 13; 'use strict';
ESCAPE_KEY = 27;
var ENTER_KEY = 13;
var ESC_KEY = 27;
// Todo View Model
// ---------------
app.TodoViewModel = kb.ViewModel.extend({
constructor: function (model, options) {
// 'keys' option ensures two-way observables are created only for the title and completed attributes.
// 'requires' option allows observables to be created for any attributes in addition to ensuring title and completed.
// 'excludes' option blocks observables being created for specific attributes.
kb.ViewModel.prototype.constructor.call(this, model, {keys: ['title', 'completed']}, options);
// Use editTitle to delay updating model attributes until changes are accepted.
this.editTitle = ko.observable();
this.editing = ko.observable(false); this.editing = ko.observable(false);
this.completed = kb.observable(model, {
key: 'completed', // Subscribe to changes in completed so that they can be saved automatically
read: (function() { this.completed.subscribe(function (completed) { this.model().save({completed: completed}); }.bind(this));
return model.completed(); },
}),
write: (function(completed) { onDestroy: function (self) { self.model().destroy(); },
return model.completed(completed);
}) // Start editing if not already editing.
}, this); onCheckEditBegin: function (self) {
this.title = kb.observable(model, { if (!self.editing()) {
key: 'title', self.editTitle(self.title());
write: ((function(_this) { self.editing(true);
return function(title) { $('.todo-input').focus(); // give the input focus
if ($.trim(title)) {
model.save({
title: $.trim(title)
});
} else {
_.defer(function() {
return model.destroy();
});
}
return _this.editing(false);
};
})(this))
}, this);
this.onDestroyTodo = (function(_this) {
return function() {
return model.destroy();
};
})(this);
this.onCheckEditBegin = (function(_this) {
return function() {
if (!_this.editing()) {
_this.editing(true);
return $('.todo-input').focus();
} }
}; },
})(this);
this.onCheckEditEnd = (function(_this) { // Stop editing if already editing.
return function(view_model, event) { onCheckEditEnd: function (self, event) {
if (event.keyCode === ESCAPE_KEY) { if (self.editing()) {
_this.editing(false); if (event.keyCode === ESC_KEY) {
self.editing(false);
} }
if ((event.keyCode === ENTER_KEY) || (event.type === 'blur')) { if ((event.keyCode === ENTER_KEY) || (event.type === 'blur')) {
$('.todo-input').blur(); self.editing(false);
return _this.editing(false);
}
};
})(this);
};
}).call(this); // Save the editTitle in the model's title or delete the model if blank
var title = self.editTitle();
$.trim(title) ? self.model().save({title: $.trim(title)}) : self.model().destroy();
}
}
}
});
})();
/*! /*!
* jQuery JavaScript Library v2.1.3 * jQuery JavaScript Library v2.1.4
* http://jquery.com/ * http://jquery.com/
* *
* Includes Sizzle.js * Includes Sizzle.js
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-12-18T15:11Z * Date: 2015-04-28T16:01Z
*/ */
(function( global, factory ) { (function( global, factory ) {
...@@ -67,7 +67,7 @@ var ...@@ -67,7 +67,7 @@ var
// Use the correct document accordingly with window argument (sandbox) // Use the correct document accordingly with window argument (sandbox)
document = window.document, document = window.document,
version = "2.1.3", version = "2.1.4",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -531,7 +531,12 @@ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli ...@@ -531,7 +531,12 @@ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli
}); });
function isArraylike( obj ) { function isArraylike( obj ) {
var length = obj.length,
// Support: iOS 8.2 (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = "length" in obj && obj.length,
type = jQuery.type( obj ); type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) { if ( type === "function" || jQuery.isWindow( obj ) ) {
......
...@@ -114,7 +114,12 @@ ...@@ -114,7 +114,12 @@
})({}); })({});
if (location.hostname === 'todomvc.com') { if (location.hostname === 'todomvc.com') {
window._gaq = [['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script')); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-31081062-1', 'auto');
ga('send', 'pageview');
} }
/* jshint ignore:end */ /* jshint ignore:end */
...@@ -228,7 +233,7 @@ ...@@ -228,7 +233,7 @@
xhr.onload = function (e) { xhr.onload = function (e) {
var parsedResponse = JSON.parse(e.target.responseText); var parsedResponse = JSON.parse(e.target.responseText);
if (parsedResponse instanceof Array) { if (parsedResponse instanceof Array) {
var count = parsedResponse.length var count = parsedResponse.length;
if (count !== 0) { if (count !== 0) {
issueLink.innerHTML = 'This app has ' + count + ' open issues'; issueLink.innerHTML = 'This app has ' + count + ' open issues';
document.getElementById('issue-count').style.display = 'inline'; document.getElementById('issue-count').style.display = 'inline';
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment