Commit 909f686c authored by Christoph Burgdorf's avatar Christoph Burgdorf

removed dependency on jquery by using the node method select() instead of the jquery one

parent 5ec4ec5e
<!doctype html> <!doctype html>
<html xmlns:ng="http://angularjs.org/" xmlns:my="http://rx.org"> <html xmlns:ng="http://angularjs.org/" xmlns:my="http://rx.org">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>AngularJS - TodoMVC</title> <title>AngularJS - TodoMVC</title>
<link rel="stylesheet" href="css/base.css"> <link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/app.css"> <link rel="stylesheet" href="css/app.css">
</head> </head>
<body> <body>
<div ng:controller="App.Controllers.TodoController" id="todoapp"> <div ng:controller="App.Controllers.TodoController" id="todoapp">
<header> <header>
<h1>Todos</h1> <h1>Todos</h1>
<form id="todo-form" ng:submit="addTodo()"> <form id="todo-form" ng:submit="addTodo()">
<input id="new-todo" name="newTodo" type="text" placeholder="What needs to be done?"> <input id="new-todo" name="newTodo" type="text" placeholder="What needs to be done?">
</form> </form>
</header> </header>
<!-- TODO: figure out if its spec compliant to remove the #main id if its getting into the way?--> <!-- TODO: figure out if its spec compliant to remove the #main id if its getting into the way?-->
<section id="main" ng:show="hasTodos()"> <section id="main" ng:show="hasTodos()">
<input id="toggle-all" type="checkbox" name="allChecked" ng:click="toggleAllStates()"> <input id="toggle-all" type="checkbox" name="allChecked" ng:click="toggleAllStates()">
<label for="toggle-all">Mark all as complete</label> <label for="toggle-all">Mark all as complete</label>
<ul id="todo-list"> <ul id="todo-list">
<li ng:repeat="todo in todos" my:dblclick="editTodo(todo)" ng:class="(todo.done && ' done ') + (todo.editing && ' editing ')"> <li ng:repeat="todo in todos" my:dblclick="editTodo(todo)" ng:class="(todo.done && ' done ') + (todo.editing && ' editing ')">
<div class="view"> <div class="view">
<input class="toggle" type="checkbox" name="todo.done"> <input class="toggle" type="checkbox" name="todo.done">
<label>{{ todo.title }}</label> <label>{{ todo.title }}</label>
<a class="destroy" ng:click="removeTodo(todo)"></a> <a class="destroy" ng:click="removeTodo(todo)"></a>
</div> </div>
<form ng:submit="finishEditing(todo)"> <form ng:submit="finishEditing(todo)">
<input class="edit" type="text" name="todo.title" my:focus="todo.editing" my:blur="finishEditing(todo)"> <input class="edit" type="text" name="todo.title" my:focus="todo.editing" my:blur="finishEditing(todo)">
</form> </form>
</li> </li>
</ul> </ul>
</section> </section>
<footer ng:show="hasTodos()"> <footer ng:show="hasTodos()">
<a id="clear-completed" ng:click="clearCompletedItems()" ng:show="hasFinishedTodos()">{{ clearItemsText() }}</a> <a id="clear-completed" ng:click="clearCompletedItems()" ng:show="hasFinishedTodos()">{{ clearItemsText() }}</a>
<div id="todo-count"><b>{{ remainingTodos() }}</b> {{ itemsLeftText() }}</div> <div id="todo-count"><b>{{ remainingTodos() }}</b> {{ itemsLeftText() }}</div>
</footer> </footer>
</div> </div>
<div id="instructions"> <div id="instructions">
Double-click to edit a todo. Double-click to edit a todo.
</div> </div>
<div id="credits"> <div id="credits">
Created by <a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>. Created by <a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>.
</div> </div>
<script src="js/booter.js"></script> <script src="js/booter.js"></script>
<script src="js/libs/angular/angular.min.js" ng:autobind></script> <script src="js/libs/angular/angular.min.js" ng:autobind></script>
<script src="js/libs/jquery-1.7.1.min.js"></script> <script src="js/controllers.js"></script>
<script src="js/controllers.js"></script> <script src="js/directive.js"></script>
<script src="js/directive.js"></script> </body>
</body> </html>
</html>
angular.directive('my:blur', function(expression, compiledElement) { angular.directive('my:blur', function(expression, compiledElement) {
var compiler = this; var compiler = this;
return function(linkElement) { return function(linkElement) {
var scope = this; var scope = this;
linkElement.bind('blur', function(event) { linkElement.bind('blur', function(event) {
scope.$apply(expression, linkElement); scope.$apply(expression, linkElement);
event.stopPropagation(); event.stopPropagation();
}); });
}; };
}); });
angular.directive('my:dblclick', function(expression, compiledElement) { angular.directive('my:dblclick', function(expression, compiledElement) {
var compiler = this; var compiler = this;
return function(linkElement) { return function(linkElement) {
var scope = this; var scope = this;
linkElement.bind('dblclick', function(event) { linkElement.bind('dblclick', function(event) {
scope.$apply(expression, linkElement); scope.$apply(expression, linkElement);
event.stopPropagation(); event.stopPropagation();
}); });
}; };
}); });
angular.directive("my:focus", function(expression, compiledElement){ angular.directive("my:focus", function(expression, compiledElement){
return function(element){ return function(element){
this.$watch(expression, function(){ this.$watch(expression, function(){
if(angular.formatter.boolean.parse(expression)){ if(angular.formatter.boolean.parse(expression)){
element[0].focus(); element[0].focus();
$(element[0]).select(); element[0].select();
} }
}, element); }, element);
}; };
}); });
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