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
Sven Franck
todomvc
Commits
7dc0920f
Commit
7dc0920f
authored
Feb 11, 2012
by
Ryan Niemeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Knockout example to conform to template
parent
d76d3eef
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
261 additions
and
472 deletions
+261
-472
architecture-examples/knockoutjs/css/app.css
architecture-examples/knockoutjs/css/app.css
+208
-0
architecture-examples/knockoutjs/css/destroy.png
architecture-examples/knockoutjs/css/destroy.png
+0
-0
architecture-examples/knockoutjs/css/todos.css
architecture-examples/knockoutjs/css/todos.css
+0
-400
architecture-examples/knockoutjs/index.html
architecture-examples/knockoutjs/index.html
+38
-51
architecture-examples/knockoutjs/js/app.js
architecture-examples/knockoutjs/js/app.js
+15
-21
architecture-examples/knockoutjs/js/libs/amplify.store.min.js
...itecture-examples/knockoutjs/js/libs/amplify.store.min.js
+0
-0
architecture-examples/knockoutjs/js/libs/json2.js
architecture-examples/knockoutjs/js/libs/json2.js
+0
-0
architecture-examples/knockoutjs/js/libs/knockout-2.0.0.debug.js
...cture-examples/knockoutjs/js/libs/knockout-2.0.0.debug.js
+0
-0
architecture-examples/knockoutjs/js/libs/knockout-2.0.0.js
architecture-examples/knockoutjs/js/libs/knockout-2.0.0.js
+0
-0
No files found.
architecture-examples/knockoutjs/css/app.css
0 → 100644
View file @
7dc0920f
html
,
body
{
margin
:
0
;
padding
:
0
;
}
body
{
font
:
14px
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
width
:
520px
;
margin
:
0
auto
;
-webkit-font-smoothing
:
antialiased
;
}
#todoapp
{
background
:
#fff
;
padding
:
20px
;
margin-bottom
:
40px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
0
0
10px
0
;
}
#todoapp
input
[
type
=
"text"
]
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
line-height
:
1.4em
;
border
:
0
;
outline
:
none
;
padding
:
6px
;
border
:
1px
solid
#999999
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todoapp
input
::-webkit-input-placeholder
{
font-style
:
italic
;
}
#main
{
display
:
none
;
}
#todo-list
{
margin
:
10px
0
;
padding
:
0
;
list-style
:
none
;
}
#todo-list
li
{
padding
:
18px
20px
18px
0
;
position
:
relative
;
font-size
:
24px
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:last-child
{
border-bottom
:
none
;
}
#todo-list
li
.done
label
{
color
:
#777777
;
text-decoration
:
line-through
;
}
#todo-list
li
.destroy
{
display
:
none
;
position
:
absolute
;
top
:
20px
;
right
:
10px
;
cursor
:
pointer
;
width
:
20px
;
height
:
20px
;
background
:
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAABGdBTUEAALGPC/xhBQAAACdQTFRFzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMAAAA////zMzMhnu0WAAAAAt0Uk5T5u3pqtV3jFQEKAC0bVelAAAAfUlEQVQI12NYtWpFsc8R865VqxhWrZpyBgg8QcylZ8AgCsjMgTCPrWJYfgYKqhjWwJgaDDVnzpw+c2bPmTPHGWzOnNm95/TuM2cOM/AARXfvBooeZAAp270bRCIz4QoOIGtDMqwJZoUEQzvCYrhzuhhWtUKYEahOX7UK6iEA3A6NUGwCTZIAAAAASUVORK5CYII=')
no-repeat
center
center
;
}
#todo-list
li
:hover
.destroy
{
display
:
block
;
}
#todo-list
li
.editing
{
border-bottom
:
none
;
margin-top
:
-1px
;
padding
:
0
;
}
#todo-list
li
.editing
:last-child
{
margin-bottom
:
-1px
;
}
#todo-list
li
.editing
.edit
{
display
:
block
;
width
:
444px
;
padding
:
13px
15px
14px
20px
;
margin
:
0
;
}
#todo-list
li
.editing
.view
{
display
:
none
;
}
#todo-list
li
.view
label
{
word-break
:
break-word
;
}
#todo-list
li
.edit
{
display
:
none
;
}
#todoapp
footer
{
display
:
none
;
margin
:
0
-20px
-20px
-20px
;
overflow
:
hidden
;
color
:
#555555
;
background
:
#f4fce8
;
border-top
:
1px
solid
#ededed
;
padding
:
0
20px
;
line-height
:
37px
;
-webkit-border-radius
:
0
0
5px
5px
;
-moz-border-radius
:
0
0
5px
5px
;
-ms-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#clear-completed
{
display
:
none
;
float
:
right
;
line-height
:
20px
;
text-decoration
:
none
;
background
:
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#555555
;
font-size
:
11px
;
margin-top
:
8px
;
margin-bottom
:
8px
;
padding
:
0
10px
1px
;
cursor
:
pointer
;
-webkit-border-radius
:
12px
;
-moz-border-radius
:
12px
;
-ms-border-radius
:
12px
;
-o-border-radius
:
12px
;
border-radius
:
12px
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
}
#clear-completed
:hover
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-ms-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
}
#clear-completed
:active
{
position
:
relative
;
top
:
1px
;
}
#todo-count
span
{
font-weight
:
bold
;
}
#instructions
{
margin
:
10px
auto
;
color
:
#777777
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
color
:
#336699
;
}
#credits
{
margin
:
30px
auto
;
color
:
#999
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
color
:
#888
;
}
\ No newline at end of file
architecture-examples/knockoutjs/css/destroy.png
deleted
100644 → 0
View file @
d76d3eef
555 Bytes
architecture-examples/knockoutjs/css/todos.css
deleted
100644 → 0
View file @
d76d3eef
html
,
body
,
div
,
span
,
applet
,
object
,
iframe
,
h1
,
h2
,
h3
,
h4
,
h5
,
h6
,
p
,
blockquote
,
pre
,
a
,
abbr
,
acronym
,
address
,
big
,
cite
,
code
,
del
,
dfn
,
em
,
font
,
img
,
ins
,
kbd
,
q
,
s
,
samp
,
small
,
strike
,
strong
,
sub
,
sup
,
tt
,
var
,
dl
,
dt
,
dd
,
ol
,
ul
,
li
,
fieldset
,
form
,
label
,
legend
,
table
,
caption
,
tbody
,
tfoot
,
thead
,
tr
,
th
,
td
{
margin
:
0
;
padding
:
0
;
border
:
0
;
outline
:
0
;
font-weight
:
inherit
;
font-style
:
inherit
;
font-size
:
100%
;
font-family
:
inherit
;
vertical-align
:
baseline
;
}
body
{
line-height
:
1
;
color
:
black
;
background
:
white
;
}
ol
,
ul
{
list-style
:
none
;
}
a
img
{
border
:
none
;
}
html
{
background
:
#eeeeee
;
}
body
{
font-family
:
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
14px
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
}
#todoapp
{
width
:
480px
;
margin
:
0
auto
40px
;
background
:
white
;
padding
:
20px
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
-moz-border-radius
:
0
0
5px
5px
;
-o-border-radius
:
0
0
5px
5px
;
-webkit-border-radius
:
0
0
5px
5px
;
border-radius
:
0
0
5px
5px
;
}
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
20px
0
30px
0
;
line-height
:
1
;
}
#create-todo
{
position
:
relative
;
}
#create-todo
input
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
line-height
:
1.4em
;
border
:
0
;
outline
:
none
;
padding
:
6px
;
border
:
1px
solid
#999999
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#create-todo
input
::-webkit-input-placeholder
{
font-style
:
italic
;
}
#create-todo
span
{
position
:
absolute
;
z-index
:
999
;
width
:
170px
;
left
:
50%
;
margin-left
:
-85px
;
}
#todo-list
{
margin-top
:
10px
;
}
#todo-list
li
{
padding
:
12px
20px
11px
0
;
position
:
relative
;
font-size
:
24px
;
line-height
:
1.1em
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-list
li
.editing
{
padding
:
0
;
border-bottom
:
0
;
}
#todo-list
.editing
.display
,
#todo-list
.edit
{
display
:
none
;
}
#todo-list
.editing
.edit
{
display
:
block
;
}
#todo-list
.editing
input
{
width
:
444px
;
font-size
:
24px
;
font-family
:
inherit
;
margin
:
0
;
line-height
:
1.6em
;
border
:
0
;
outline
:
none
;
padding
:
10px
7px
0px
27px
;
border
:
1px
solid
#999999
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todo-list
.check
{
position
:
relative
;
top
:
9px
;
margin
:
0
10px
0
7px
;
float
:
left
;
}
#todo-list
.done
.todo-content
{
text-decoration
:
line-through
;
color
:
#777777
;
}
#todo-list
.todo-destroy
{
position
:
absolute
;
right
:
5px
;
top
:
14px
;
display
:
none
;
cursor
:
pointer
;
width
:
20px
;
height
:
20px
;
background
:
url(destroy.png)
no-repeat
0
0
;
}
#todo-list
li
:hover
.todo-destroy
{
display
:
block
;
}
#todo-list
.todo-destroy
:hover
{
background-position
:
0
-20px
;
}
#todo-stats
{
*
zoom
:
1
;
margin-top
:
10px
;
color
:
#777777
;
}
#todo-stats
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-stats
.todo-count
{
float
:
left
;
}
#todo-stats
.todo-count
.number
{
font-weight
:
bold
;
color
:
#333333
;
}
#todo-stats
.todo-clear
{
float
:
right
;
}
#todo-stats
.todo-clear
a
{
color
:
#777777
;
font-size
:
12px
;
}
/* these two rules are overridden below. find ".todo-clear a" */
#todo-stats
.todo-clear
a
:visited
{
color
:
#777777
;
}
#todo-stats
.todo-clear
a
:hover
,
#todo-stats
.todo-clear
a
:focus
{
color
:
#336699
;
}
#instructions
{
width
:
520px
;
margin
:
10px
auto
;
color
:
#777777
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
color
:
#336699
;
}
#credits
{
width
:
520px
;
margin
:
30px
auto
;
color
:
#999
;
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
color
:
#888
;
}
/*
* François 'cahnory' Germain
*/
.ui-tooltip
,
.ui-tooltip-top
,
.ui-tooltip-right
,
.ui-tooltip-bottom
,
.ui-tooltip-left
{
color
:
#ffffff
;
cursor
:
normal
;
display
:
-moz-inline-stack
;
display
:
inline-block
;
font-size
:
12px
;
font-family
:
arial
;
padding
:
.5em
1em
;
position
:
relative
;
text-align
:
center
;
text-shadow
:
0
-1px
1px
#111111
;
-webkit-border-top-left-radius
:
4px
;
-webkit-border-top-right-radius
:
4px
;
-webkit-border-bottom-right-radius
:
4px
;
-webkit-border-bottom-left-radius
:
4px
;
-khtml-border-top-left-radius
:
4px
;
-khtml-border-top-right-radius
:
4px
;
-khtml-border-bottom-right-radius
:
4px
;
-khtml-border-bottom-left-radius
:
4px
;
-moz-border-radius-topleft
:
4px
;
-moz-border-radius-topright
:
4px
;
-moz-border-radius-bottomright
:
4px
;
-moz-border-radius-bottomleft
:
4px
;
border-top-left-radius
:
4px
;
border-top-right-radius
:
4px
;
border-bottom-right-radius
:
4px
;
border-bottom-left-radius
:
4px
;
-o-box-shadow
:
0
1px
2px
#000000
,
inset
0
0
0
1px
#222222
,
inset
0
2px
#666666
,
inset
0
-2px
2px
#444444
;
-moz-box-shadow
:
0
1px
2px
#000000
,
inset
0
0
0
1px
#222222
,
inset
0
2px
#666666
,
inset
0
-2px
2px
#444444
;
-khtml-box-shadow
:
0
1px
2px
#000000
,
inset
0
0
0
1px
#222222
,
inset
0
2px
#666666
,
inset
0
-2px
2px
#444444
;
-webkit-box-shadow
:
0
1px
2px
#000000
,
inset
0
0
0
1px
#222222
,
inset
0
2px
#666666
,
inset
0
-2px
2px
#444444
;
box-shadow
:
0
1px
2px
#000000
,
inset
0
0
0
1px
#222222
,
inset
0
2px
#666666
,
inset
0
-2px
2px
#444444
;
background-color
:
#3b3b3b
;
background-image
:
-moz-linear-gradient
(
top
,
#555555
,
#222222
);
background-image
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0
,
#555555
),
color-stop
(
1
,
#222222
));
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorStr
=
#555555
,
EndColorStr
=
#222222
);
-ms-filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorStr
=
#555555
,
EndColorStr
=
#222222
);
}
.ui-tooltip
:after
,
.ui-tooltip-top
:after
,
.ui-tooltip-right
:after
,
.ui-tooltip-bottom
:after
,
.ui-tooltip-left
:after
{
content
:
"\25B8"
;
display
:
block
;
font-size
:
2em
;
height
:
0
;
line-height
:
0
;
position
:
absolute
;
}
.ui-tooltip
:after
,
.ui-tooltip-bottom
:after
{
color
:
#2a2a2a
;
bottom
:
0
;
left
:
1px
;
text-align
:
center
;
text-shadow
:
1px
0
2px
#000000
;
-o-transform
:
rotate
(
90deg
);
-moz-transform
:
rotate
(
90deg
);
-khtml-transform
:
rotate
(
90deg
);
-webkit-transform
:
rotate
(
90deg
);
width
:
100%
;
}
.ui-tooltip-top
:after
{
bottom
:
auto
;
color
:
#4f4f4f
;
left
:
-2px
;
top
:
0
;
text-align
:
center
;
text-shadow
:
none
;
-o-transform
:
rotate
(
-90deg
);
-moz-transform
:
rotate
(
-90deg
);
-khtml-transform
:
rotate
(
-90deg
);
-webkit-transform
:
rotate
(
-90deg
);
width
:
100%
;
}
.ui-tooltip-right
:after
{
color
:
#222222
;
right
:
-0.375em
;
top
:
50%
;
margin-top
:
-.05em
;
text-shadow
:
0
1px
2px
#000000
;
-o-transform
:
rotate
(
0
);
-moz-transform
:
rotate
(
0
);
-khtml-transform
:
rotate
(
0
);
-webkit-transform
:
rotate
(
0
);
}
.ui-tooltip-left
:after
{
color
:
#222222
;
left
:
-0.375em
;
top
:
50%
;
margin-top
:
.1em
;
text-shadow
:
0
-1px
2px
#000000
;
-o-transform
:
rotate
(
180deg
);
-moz-transform
:
rotate
(
180deg
);
-khtml-transform
:
rotate
(
180deg
);
-webkit-transform
:
rotate
(
180deg
);
}
/* new additions - cleanup required*/
/* line 109 */
#todoapp
#todo-stats
{
*
zoom
:
1
;
margin-top
:
10px
;
color
:
#555555
;
-moz-border-radius-bottomleft
:
5px
;
-webkit-border-bottom-left-radius
:
5px
;
-o-border-bottom-left-radius
:
5px
;
-ms-border-bottom-left-radius
:
5px
;
-khtml-border-bottom-left-radius
:
5px
;
border-bottom-left-radius
:
5px
;
-moz-border-radius-bottomright
:
5px
;
-webkit-border-bottom-right-radius
:
5px
;
-o-border-bottom-right-radius
:
5px
;
-ms-border-bottom-right-radius
:
5px
;
-khtml-border-bottom-right-radius
:
5px
;
border-bottom-right-radius
:
5px
;
background
:
#f4fce8
;
border-top
:
1px
solid
#ededed
;
padding
:
0
20px
;
line-height
:
36px
;
}
/* line 22, /opt/ree/lib/ruby/gems/1.8/gems/compass-0.10.5/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
#todoapp
#todo-stats
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
/* line 118 */
#todoapp
#todo-stats
.todo-count
{
float
:
left
;
}
/* line 120 */
#todoapp
#todo-stats
.todo-count
.number
{
font-weight
:
bold
;
color
:
#555555
;
}
/* line 123 */
#todoapp
#todo-stats
.todo-clear
{
float
:
right
;
}
/* line 125 */
#todoapp
#todo-stats
.todo-clear
a
{
display
:
block
;
line-height
:
20px
;
text-decoration
:
none
;
-moz-border-radius
:
12px
;
-webkit-border-radius
:
12px
;
-o-border-radius
:
12px
;
-ms-border-radius
:
12px
;
-khtml-border-radius
:
12px
;
border-radius
:
12px
;
background
:
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#555555
;
font-size
:
11px
;
margin-top
:
8px
;
padding
:
0
10px
1px
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
}
/* line 136 */
#todoapp
#todo-stats
.todo-clear
a
:hover
,
#todoapp
#todo-stats
.todo-clear
a
:focus
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
}
/* line 139 */
#todoapp
#todo-stats
.todo-clear
a
:active
{
position
:
relative
;
top
:
1px
;
}
architecture-examples/knockoutjs/index.html
View file @
7dc0920f
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml
"
>
<!
doctype html
>
<html
lang=
"en
"
>
<head>
<title>
Knockout.js
</title>
<link
href=
"css/todos.css"
media=
"all"
rel=
"stylesheet"
type=
"text/css"
/>
<meta
charset=
"utf-8"
>
<title>
Knockout.js
</title>
<link
rel=
"stylesheet"
href=
"css/app.css"
>
</head>
<body>
<div
id=
"todoapp"
>
<
div
class=
"title"
>
<
header
>
<h1>
Todos
</h1>
</div>
<div
class=
"content"
>
<div
id=
"create-todo"
>
<input
id=
"new-todo"
data-bind=
"value: current, valueUpdate: 'afterkeydown', enterKey: add"
placeholder=
"What needs to be done?"
/>
<span
class=
"ui-tooltip-top"
data-bind=
"visible: showTooltip"
style=
"display: none;"
>
Press Enter to save this task
</span>
<input
id=
"new-todo"
type=
"text"
data-bind=
"value: current, valueUpdate: 'afterkeydown', enterKey: add"
placeholder=
"What needs to be done?"
/>
</header>
<section
id=
"main"
data-bind=
"block: todos().length"
>
<input
id=
"toggle-all"
type=
"checkbox"
data-bind=
"checked: allCompleted"
>
<label
for=
"toggle-all"
>
Mark all as complete
</label>
<ul
id=
"todo-list"
data-bind=
"foreach: todos"
>
<li
data-bind=
"css: { done: done, editing: editing }"
>
<div
class=
"view"
>
<input
class=
"toggle"
type=
"checkbox"
data-bind=
"checked: done"
>
<label
data-bind=
"text: content, event: { dblclick: edit }"
></label>
<a
class=
"destroy"
href=
"#"
data-bind=
"click: $root.remove"
></a>
</div>
<input
class=
"edit"
type=
"text"
data-bind=
"value: content, valueUpdate: 'afterkeydown', enterKey: stopEditing, hasfocus: editing, event: { blur: stopEditing }"
/>
</li>
</ul>
</section>
<footer
data-bind=
"block: completedCount() || remainingCount()"
>
<a
id=
"clear-completed"
href=
"#"
data-bind=
"inline: completedCount, click: removeCompleted"
>
Clear
<span
data-bind=
"text: completedCount"
></span>
completed
<span
data-bind=
"text: getLabel(completedCount)"
></span>
</a>
<div
id=
"todo-count"
data-bind=
"inline: remainingCount"
>
<span
data-bind=
"text: remainingCount"
></span>
<span
data-bind=
"text: getLabel(remainingCount)"
style=
"font-weight: normal"
></span>
left.
</div>
<div
id=
"todos"
>
<div
data-bind=
"visible: todos().length"
>
<input
id=
"check-all"
class=
"check"
type=
"checkbox"
data-bind=
"checked: allCompleted"
/>
<label
for=
"check-all"
>
Mark all as complete
</label>
</div>
<ul
id=
"todo-list"
data-bind=
"foreach: todos"
>
<li
data-bind=
"css: { editing: editing }"
>
<div
class=
"todo"
data-bind=
"css: { done : done }"
>
<div
class=
"display"
>
<input
class=
"check"
type=
"checkbox"
data-bind=
"checked: done"
/>
<div
class=
"todo-content"
data-bind=
"text: content, event: { dblclick: edit }"
style=
"cursor: pointer;"
></div>
<span
class=
"todo-destroy"
data-bind=
"click: $root.remove"
></span>
</div>
<div
class=
"edit"
>
<input
class=
"todo-input"
data-bind=
"value: content, valueUpdate: 'afterkeydown', enterKey: stopEditing, event: { blur: stopEditing }"
/>
</div>
</div>
</li>
</ul>
</div>
<div
id=
"todo-stats"
>
<span
class=
"todo-count"
data-bind=
"visible: remainingCount"
>
<span
class=
"number"
data-bind=
"text: remainingCount"
></span>
<span
class=
"word"
data-bind=
"text: getLabel(remainingCount)"
></span>
left.
</span>
<span
class=
"todo-clear"
data-bind=
"visible: completedCount"
>
<a
href=
"#"
data-bind=
"click: removeCompleted"
>
Clear
<span
class=
"number-done"
data-bind=
"text: completedCount"
></span>
completed
<span
class=
"word-done"
data-bind=
"text: getLabel(completedCount)"
></span>
</a>
</span>
</div>
</div>
</footer>
</div>
<div
id=
"instructions"
data-bind=
"visible: todos().length"
>
Double-click to edit a todo.
</div>
<ul
id=
"instructions"
>
<li
data-bind=
"visible: todos().length"
>
Double-click to edit a todo.
</li>
</ul>
<div
id=
"credits"
>
Created by
<br
/>
...
...
@@ -68,14 +56,13 @@
<br
/>
<a
href=
"http://twitter.com/addyosmani"
>
Addy Osmani
</a>
</div>
<!-- Knockout has no direct dependencies -->
<script
src=
"js/knockout-2.0.0.js"
type=
"text/javascript"
></script>
<script
src=
"js/
libs/
knockout-2.0.0.js"
type=
"text/javascript"
></script>
<!-- needed to support JSON.stringify in older browsers (for local storage) -->
<script
src=
"js/json2.js"
type=
"text/javascript"
></script>
<script
src=
"js/
libs/
json2.js"
type=
"text/javascript"
></script>
<!-- used for local storage -->
<script
src=
"js/amplify.store.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/
libs/
amplify.store.min.js"
type=
"text/javascript"
></script>
<!-- our app code -->
<script
src=
"js/
todos
.js"
type=
"text/javascript"
></script>
<script
src=
"js/
app
.js"
type=
"text/javascript"
></script>
</body>
</html>
\ No newline at end of file
architecture-examples/knockoutjs/js/
todos
.js
→
architecture-examples/knockoutjs/js/
app
.js
View file @
7dc0920f
...
...
@@ -21,6 +21,20 @@
}
};
ko
.
bindingHandlers
.
block
=
{
update
:
function
(
element
,
valueAccessor
)
{
var
value
=
ko
.
utils
.
unwrapObservable
(
valueAccessor
());
element
.
style
.
display
=
value
?
"
block
"
:
"
none
"
;
}
};
ko
.
bindingHandlers
.
inline
=
{
update
:
function
(
element
,
valueAccessor
)
{
var
value
=
ko
.
utils
.
unwrapObservable
(
valueAccessor
());
element
.
style
.
display
=
value
?
"
inline
"
:
"
none
"
;
}
};
//represent a single todo item
var
Todo
=
function
(
content
,
done
)
{
...
...
@@ -32,7 +46,7 @@
//can place methods on prototype, as there can be many todos
ko
.
utils
.
extend
(
Todo
.
prototype
,
{
edit
:
function
()
{
this
.
editing
(
true
);
},
stopEditing
:
function
()
{
this
.
editing
(
false
);
}
stopEditing
:
function
()
{
console
.
log
(
"
stop editing
"
);
this
.
editing
(
false
);
}
});
...
...
@@ -93,26 +107,6 @@
}
});
//track whether the tooltip should be shown
self
.
showTooltip
=
ko
.
observable
(
false
);
self
.
showTooltip
.
setTrue
=
function
()
{
self
.
showTooltip
(
true
);
};
//avoid an anonymous function each time
//watch the current value
self
.
current
.
subscribe
(
function
(
newValue
)
{
//if the value was just updated, then the tooltip should not be shown
self
.
showTooltip
(
false
);
//clear the current timer, as it is actively being updated
if
(
self
.
showTooltip
.
timer
)
{
clearTimeout
(
self
.
showTooltip
.
timer
);
}
//if there is a value and then show the tooltip after 1 second
if
(
newValue
)
{
self
.
showTooltip
.
timer
=
setTimeout
(
self
.
showTooltip
.
setTrue
,
1000
);
}
});
//helper function to keep expressions out of markup
self
.
getLabel
=
function
(
count
)
{
return
ko
.
utils
.
unwrapObservable
(
count
)
===
1
?
"
item
"
:
"
items
"
;
...
...
architecture-examples/knockoutjs/js/amplify.store.min.js
→
architecture-examples/knockoutjs/js/
libs/
amplify.store.min.js
View file @
7dc0920f
File moved
architecture-examples/knockoutjs/js/json2.js
→
architecture-examples/knockoutjs/js/
libs/
json2.js
View file @
7dc0920f
File moved
architecture-examples/knockoutjs/js/knockout-2.0.0.debug.js
→
architecture-examples/knockoutjs/js/
libs/
knockout-2.0.0.debug.js
View file @
7dc0920f
File moved
architecture-examples/knockoutjs/js/knockout-2.0.0.js
→
architecture-examples/knockoutjs/js/
libs/
knockout-2.0.0.js
View file @
7dc0920f
File moved
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