Skip to content

Instantly share code, notes, and snippets.

@nw
Created November 5, 2013 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nw/7314018 to your computer and use it in GitHub Desktop.
Save nw/7314018 to your computer and use it in GitHub Desktop.
new Todo('todo');
function Todo(id){
this.items = [];
this.el = $(id);
this.input = this.el.find('input');
this.list = this.el.find('.container');
this.init();
}
Todo.prototype.init = function(){
var self = this;
this.input.on('keypress', function(){
})
this.list
.on('click', '', function(){
})
.on('click', 'li .remove', function(){
})
.on('mouseover', 'li', function(){
})
.on('mouseout', 'li', function(){
})
}
Todo.prototype.addItem = function(item){
var item = new TodoItem(item);
item.addClass(this.options.ns);
this.items.push(item);
}
/*
options:
due: Date
depends: TodoItem
*/
new TodoItem('test')
function TodoItem(item, options){
this.el = $("<div><span>"+item+"</span></div>");
}
TodoItem.prototype.remove = function(){
this.el.remove();
}
TodoItem.protoype.showRemove = function(){
}
TodoItem.prototype.hideRemove = function(){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment