Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
bcc74618
Commit
bcc74618
authored
Feb 20, 2013
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
angular-perf: jshint style
parent
d62e2bd0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
173 deletions
+189
-173
architecture-examples/angularjs-perf/index.html
architecture-examples/angularjs-perf/index.html
+70
-70
architecture-examples/angularjs-perf/js/app.js
architecture-examples/angularjs-perf/js/app.js
+2
-0
architecture-examples/angularjs-perf/js/controllers/todoCtrl.js
...ecture-examples/angularjs-perf/js/controllers/todoCtrl.js
+86
-75
architecture-examples/angularjs-perf/js/directives/todoBlur.js
...tecture-examples/angularjs-perf/js/directives/todoBlur.js
+8
-7
architecture-examples/angularjs-perf/js/directives/todoFocus.js
...ecture-examples/angularjs-perf/js/directives/todoFocus.js
+11
-10
architecture-examples/angularjs-perf/js/services/todoStorage.js
...ecture-examples/angularjs-perf/js/services/todoStorage.js
+12
-11
No files found.
architecture-examples/angularjs-perf/index.html
View file @
bcc74618
<!doctype html>
<html
lang=
"en"
ng-app=
"todomvc"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<title>
AngularJS • TodoMVC
</title>
...
...
@@ -10,8 +10,8 @@
<script src="../../assets/ie.js"></script>
<![endif]-->
</head>
<body>
</head>
<body>
<section
id=
"todoapp"
ng-controller=
"TodoCtrl"
>
<header
id=
"header"
>
<h1>
todos
</h1>
...
...
@@ -70,5 +70,5 @@
<script
src=
"js/services/todoStorage.js"
></script>
<script
src=
"js/directives/todoFocus.js"
></script>
<script
src=
"js/directives/todoBlur.js"
></script>
</body>
</body>
</html>
architecture-examples/angularjs-perf/js/app.js
View file @
bcc74618
/*global angular*/
/*jshint unused:false*/
'
use strict
'
;
/**
...
...
architecture-examples/angularjs-perf/js/controllers/todoCtrl.js
View file @
bcc74618
/*global todomvc*/
'
use strict
'
;
/**
...
...
@@ -5,29 +6,33 @@
* - retrieves and persist the model via the todoStorage service
* - exposes the model to the template and provides event handlers
*/
todomvc
.
controller
(
'
TodoCtrl
'
,
function
TodoCtrl
(
$scope
,
$location
,
todoStorage
,
filterFilter
)
{
todomvc
.
controller
(
'
TodoCtrl
'
,
function
TodoCtrl
(
$scope
,
$location
,
todoStorage
,
filterFilter
)
{
var
todos
=
$scope
.
todos
=
todoStorage
.
get
();
$scope
.
newTodo
=
""
;
$scope
.
newTodo
=
''
;
$scope
.
remainingCount
=
filterFilter
(
todos
,
{
completed
:
false
}).
length
;
$scope
.
editedTodo
=
null
;
if
(
$location
.
path
()
===
''
)
$location
.
path
(
'
/
'
);
if
(
$location
.
path
()
===
''
)
{
$location
.
path
(
'
/
'
);
}
$scope
.
location
=
$location
;
$scope
.
$watch
(
'
location.path()
'
,
function
(
path
)
{
$scope
.
statusFilter
=
(
path
==
'
/active
'
)
?
{
completed
:
false
}
:
(
path
==
'
/completed
'
)
?
$scope
.
$watch
(
'
location.path()
'
,
function
(
path
)
{
$scope
.
statusFilter
=
(
path
=
==
'
/active
'
)
?
{
completed
:
false
}
:
(
path
=
==
'
/completed
'
)
?
{
completed
:
true
}
:
null
;
});
$scope
.
$watch
(
'
remainingCount == 0
'
,
function
(
val
)
{
$scope
.
$watch
(
'
remainingCount == 0
'
,
function
(
val
)
{
$scope
.
allChecked
=
val
;
});
$scope
.
addTodo
=
function
()
{
if
(
$scope
.
newTodo
.
length
===
0
)
return
;
$scope
.
addTodo
=
function
()
{
if
(
$scope
.
newTodo
.
length
===
0
)
{
return
;
}
todos
.
push
({
title
:
$scope
.
newTodo
,
...
...
@@ -40,41 +45,47 @@ todomvc.controller( 'TodoCtrl', function TodoCtrl( $scope, $location, todoStorag
};
$scope
.
editTodo
=
function
(
todo
)
{
$scope
.
editTodo
=
function
(
todo
)
{
$scope
.
editedTodo
=
todo
;
};
$scope
.
doneEditing
=
function
(
todo
)
{
$scope
.
doneEditing
=
function
(
todo
)
{
$scope
.
editedTodo
=
null
;
if
(
!
todo
.
title
)
$scope
.
removeTodo
(
todo
);
if
(
!
todo
.
title
)
{
$scope
.
removeTodo
(
todo
);
}
todoStorage
.
put
(
todos
);
};
$scope
.
removeTodo
=
function
(
todo
)
{
$scope
.
removeTodo
=
function
(
todo
)
{
$scope
.
remainingCount
-=
todo
.
completed
?
0
:
1
;
todos
.
splice
(
todos
.
indexOf
(
todo
),
1
);
todoStorage
.
put
(
todos
);
};
$scope
.
todoCompleted
=
function
(
todo
)
{
todo
.
completed
?
$scope
.
remainingCount
--
:
$scope
.
remainingCount
++
;
$scope
.
todoCompleted
=
function
(
todo
)
{
if
(
todo
.
completed
)
{
$scope
.
remainingCount
--
;
}
else
{
$scope
.
remainingCount
++
;
}
todoStorage
.
put
(
todos
);
};
$scope
.
clearDoneTodos
=
function
()
{
$scope
.
todos
=
todos
=
todos
.
filter
(
function
(
val
)
{
$scope
.
clearDoneTodos
=
function
()
{
$scope
.
todos
=
todos
=
todos
.
filter
(
function
(
val
)
{
return
!
val
.
completed
;
});
todoStorage
.
put
(
todos
);
};
$scope
.
markAll
=
function
(
done
)
{
todos
.
forEach
(
function
(
todo
)
{
$scope
.
markAll
=
function
(
done
)
{
todos
.
forEach
(
function
(
todo
)
{
todo
.
completed
=
done
;
});
$scope
.
remainingCount
=
done
?
0
:
todos
.
length
;
...
...
architecture-examples/angularjs-perf/js/directives/todoBlur.js
View file @
bcc74618
/*global todomvc*/
'
use strict
'
;
/**
* Directive that executes an expression when the element it is applied to loses focus.
*/
todomvc
.
directive
(
'
todoBlur
'
,
function
()
{
return
function
(
scope
,
elem
,
attrs
)
{
elem
.
bind
(
'
blur
'
,
function
()
{
*/
todomvc
.
directive
(
'
todoBlur
'
,
function
()
{
return
function
(
scope
,
elem
,
attrs
)
{
elem
.
bind
(
'
blur
'
,
function
()
{
scope
.
$apply
(
attrs
.
todoBlur
);
});
};
...
...
architecture-examples/angularjs-perf/js/directives/todoFocus.js
View file @
bcc74618
/*global todomvc*/
'
use strict
'
;
/**
* Directive that places focus on the element it is applied to when the expression it binds to evaluates to true.
*/
todomvc
.
directive
(
'
todoFocus
'
,
function
(
$timeout
)
{
return
function
(
scope
,
elem
,
attrs
)
{
scope
.
$watch
(
attrs
.
todoFocus
,
function
(
newval
)
{
if
(
newval
)
{
$timeout
(
function
()
{
todomvc
.
directive
(
'
todoFocus
'
,
function
(
$timeout
)
{
return
function
(
scope
,
elem
,
attrs
)
{
scope
.
$watch
(
attrs
.
todoFocus
,
function
(
newval
)
{
if
(
newval
)
{
$timeout
(
function
()
{
elem
[
0
].
focus
();
},
0
,
false
);
}
...
...
architecture-examples/angularjs-perf/js/services/todoStorage.js
View file @
bcc74618
/*global todomvc*/
'
use strict
'
;
/**
* Services that persists and retrieves TODOs from localStorage.
*/
todomvc
.
factory
(
'
todoStorage
'
,
function
()
{
*/
todomvc
.
factory
(
'
todoStorage
'
,
function
()
{
var
STORAGE_ID
=
'
todos-angularjs-perf
'
;
return
{
get
:
function
()
{
get
:
function
()
{
return
JSON
.
parse
(
localStorage
.
getItem
(
STORAGE_ID
)
||
'
[]
'
);
},
put
:
function
(
todos
)
{
put
:
function
(
todos
)
{
localStorage
.
setItem
(
STORAGE_ID
,
JSON
.
stringify
(
todos
));
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment