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
95624f6e
Commit
95624f6e
authored
Dec 30, 2011
by
Aaron Boushley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensuring that all apps that use localStorage use a unique name.
parent
fb21001a
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
207 deletions
+39
-207
todo-example/angularjs/persistencejs/js/services.js
todo-example/angularjs/persistencejs/js/services.js
+2
-2
todo-example/backbone+require/js/collections/todos.js
todo-example/backbone+require/js/collections/todos.js
+1
-1
todo-example/backbone/js/todos.js
todo-example/backbone/js/todos.js
+1
-1
todo-example/extjs/js/model/Task.js
todo-example/extjs/js/model/Task.js
+1
-1
todo-example/fidel/app.js
todo-example/fidel/app.js
+3
-2
todo-example/javascriptmvc/todo/todo/production.css
todo-example/javascriptmvc/todo/todo/production.css
+1
-172
todo-example/javascriptmvc/todo/todo/production.js
todo-example/javascriptmvc/todo/todo/production.js
+15
-15
todo-example/javascriptmvc/todo/todo/todo.js
todo-example/javascriptmvc/todo/todo/todo.js
+2
-2
todo-example/jquery/js/app.js
todo-example/jquery/js/app.js
+2
-2
todo-example/sammyjs/app.js
todo-example/sammyjs/app.js
+3
-3
todo-example/spine/lib/local.js
todo-example/spine/lib/local.js
+4
-2
todo-example/yuilibrary/js/app.js
todo-example/yuilibrary/js/app.js
+4
-4
No files found.
todo-example/angularjs/persistencejs/js/services.js
View file @
95624f6e
angular
.
service
(
'
persistencejs
'
,
function
()
{
persistence
.
store
.
websql
.
config
(
persistence
,
'
todo
'
,
'
todo database
'
,
5
*
1024
*
1024
);
persistence
.
store
.
websql
.
config
(
persistence
,
'
todo
-angular-persistence
'
,
'
todo database
'
,
5
*
1024
*
1024
);
var
Todo
=
persistence
.
define
(
'
todo
'
,
{
content
:
'
TEXT
'
,
done
:
'
BOOL
'
...
...
@@ -54,4 +54,4 @@ angular.service('persistencejs', function() {
});
},
};
});
\ No newline at end of file
});
todo-example/backbone+require/js/collections/todos.js
View file @
95624f6e
...
...
@@ -11,7 +11,7 @@ define([
model
:
Todo
,
// Save all of the todo items under the `"todos"` namespace.
localStorage
:
new
Store
(
"
todos
"
),
localStorage
:
new
Store
(
"
todos
-backbone-require
"
),
// Filter down the list of all todo items that are finished.
done
:
function
()
{
...
...
todo-example/backbone/js/todos.js
View file @
95624f6e
...
...
@@ -48,7 +48,7 @@ $(function(){
model
:
Todo
,
// Save all of the todo items under the `"todos"` namespace.
localStorage
:
new
Store
(
"
todos
"
),
localStorage
:
new
Store
(
"
todos
-backbone
"
),
// Filter down the list of all todo items that are finished.
done
:
function
()
{
...
...
todo-example/extjs/js/model/Task.js
View file @
95624f6e
...
...
@@ -3,6 +3,6 @@ Ext.define('Todo.model.Task', {
fields
:
[
'
id
'
,
'
label
'
,
{
name
:
'
checked
'
,
type
:
'
boolean
'
}],
proxy
:
{
type
:
'
localstorage
'
,
id
:
'
todo
'
id
:
'
todo
s-extjs
'
}
});
todo-example/fidel/app.js
View file @
95624f6e
var
localStoreName
=
'
todos-fidel
'
;
var
todoStore
=
(
function
()
{
return
{
get
:
function
()
{
var
d
=
localStorage
.
getItem
(
'
fidel.todos
'
);
var
d
=
localStorage
.
getItem
(
localStoreName
);
var
todos
=
{};
if
(
d
)
{
d
=
JSON
.
parse
(
d
);
...
...
@@ -12,7 +13,7 @@ var todoStore = (function() {
return
todos
;
},
save
:
function
(
todos
)
{
localStorage
.
setItem
(
'
fidel.todos
'
,
JSON
.
stringify
(
todos
));
localStorage
.
setItem
(
localStoreName
,
JSON
.
stringify
(
todos
));
}
};
})();
...
...
todo-example/javascriptmvc/todo/todo/production.css
View file @
95624f6e
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
;
}
body
{
font-family
:
"Helvetica Neue"
,
helvetica
,
arial
,
sans-serif
;
font-size
:
14px
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
padding
:
0px
;
margin
:
0px
;
}
#todos
{
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-webkit-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
;
-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
;
border-bottom-left-radius
:
5px
;
border-bottom-right-radius
:
5px
;
background-attachment
:
scroll
;
margin
:
0
auto
40px
;
width
:
520px
;
background-color
:
white
;
}
h1
{
font-size
:
36px
;
font-weight
:
bold
;
line-height
:
1
;
padding
:
30px
0
10px
;
text-align
:
center
;
}
#todos
.create
{
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
;
font-family
:
inherit
;
font-size
:
24px
;
line-height
:
1.4em
;
outline
:
medium
none
;
padding
:
6px
;
width
:
466px
;
}
.content
{
padding
:
20px
20px
0
;
}
#instructions
{
color
:
#777777
;
margin
:
10px
auto
;
text-align
:
center
;
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.8
);
width
:
520px
;
}
#instructions
li
{
list-style-type
:
none
;
}
.create
,
input
.text
{
font-size
:
1.4em
;
width
:
100%
;
}
ul
{
margin
:
0px
;
padding
:
0px
;
}
.todo
{
list-style
:
none
;
border-bottom
:
1px
solid
#CCCCCC
;
font-size
:
24px
;
padding
:
15px
20px
15px
0
;
position
:
relative
;
margin-left
:
15px
;
}
.todo
:hover
.todestroy
{
display
:
block
;
}
#todo-stats
{
background
:
none
repeat
scroll
0
0
#F4FCE8
;
border-bottom-left-radius
:
5px
;
border-bottom-right-radius
:
5px
;
border-top
:
1px
solid
#EDEDED
;
color
:
#555555
;
line-height
:
36px
;
margin-top
:
20px
;
padding
:
0
20px
;
}
.todo-count
.number
{
color
:
#555555
;
font-weight
:
bold
;
}
#list
{
margin-top
:
20px
;
}
.todestroy
{
background
:
url("destroy.png")
no-repeat
scroll
center
center
transparent
;
cursor
:
pointer
;
height
:
20px
;
position
:
absolute
;
right
:
0
;
top
:
16px
;
width
:
20px
;
display
:
none
;
margin-right
:
20px
;
}
.todo-clear
{
float
:
right
;
}
.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
;
}
.todo-clear
a
:hover
,
.todo-clear
a
:focus
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
}
#todoapp
#todo-stats
.todo-clear
a
:active
{
position
:
relative
;
top
:
1px
;
}
#credits
{
color
:
#999999
;
margin
:
30px
auto
;
text-align
:
center
;
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.8
);
width
:
520px
;
}
#credits
a
{
color
:
#888888
;
}
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
}
body
{
font-family
:
"Helvetica Neue"
,
helvetica
,
arial
,
sans-serif
;
font-size
:
14px
;
line-height
:
1.4em
;
background
:
#eee
;
color
:
#333
;
padding
:
0
;
margin
:
0
}
#todos
{
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
2px
6px
0
;
-webkit-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
;
-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
;
border-bottom-left-radius
:
5px
;
border-bottom-right-radius
:
5px
;
background-attachment
:
scroll
;
margin
:
0
auto
40px
;
width
:
520px
;
background-color
:
white
}
h1
{
font-size
:
36px
;
font-weight
:
bold
;
line-height
:
1
;
padding
:
30px
0
10px
;
text-align
:
center
}
#todos
.create
{
border
:
1px
solid
#999
;
-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
;
font-family
:
inherit
;
font-size
:
24px
;
line-height
:
1.4em
;
outline
:
medium
none
;
padding
:
6px
;
width
:
466px
}
.content
{
padding
:
20px
20px
0
}
#instructions
{
color
:
#777
;
margin
:
10px
auto
;
text-align
:
center
;
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.8
);
width
:
520px
}
#instructions
li
{
list-style-type
:
none
}
.create
,
input
.text
{
font-size
:
1.4em
;
width
:
100%
}
ul
{
margin
:
0
;
padding
:
0
}
.todo
{
list-style
:
none
;
border-bottom
:
1px
solid
#ccc
;
font-size
:
24px
;
padding
:
15px
20px
15px
0
;
position
:
relative
;
margin-left
:
15px
}
.todo
:hover
.todestroy
{
display
:
block
}
#todo-stats
{
background
:
none
repeat
scroll
0
0
#f4fce8
;
border-bottom-left-radius
:
5px
;
border-bottom-right-radius
:
5px
;
border-top
:
1px
solid
#ededed
;
color
:
#555
;
line-height
:
36px
;
margin-top
:
20px
;
padding
:
0
20px
}
.todo-count
.number
{
color
:
#555
;
font-weight
:
bold
}
#list
{
margin-top
:
20px
}
.todestroy
{
background
:
url(destroy.png)
no-repeat
scroll
center
center
transparent
;
cursor
:
pointer
;
height
:
20px
;
position
:
absolute
;
right
:
0
;
top
:
16px
;
width
:
20px
;
display
:
none
;
margin-right
:
20px
}
.todo-clear
{
float
:
right
}
.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
:
#555
;
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
}
#credits
{
color
:
#999
;
margin
:
30px
auto
;
text-align
:
center
;
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.8
);
width
:
520px
}
#credits
a
{
color
:
#888
}
\ No newline at end of file
todo-example/javascriptmvc/todo/todo/production.js
View file @
95624f6e
This diff is collapsed.
Click to expand it.
todo-example/javascriptmvc/todo/todo/todo.js
View file @
95624f6e
...
...
@@ -17,7 +17,7 @@ $.Model('Todo',{
* This is unimportant for understanding JavaScriptMVC!
*/
localStore
:
function
(
cb
){
var
name
=
this
.
shortName
,
var
name
=
'
todo-javascriptmvc
'
,
data
=
$
.
evalJSON
(
window
.
localStorage
[
name
]
||
(
window
.
localStorage
[
name
]
=
"
{}
"
)
),
res
=
cb
.
call
(
this
,
data
);
if
(
res
!==
false
){
...
...
@@ -251,4 +251,4 @@ $(function(){
})
});
\ No newline at end of file
});
todo-example/jquery/js/app.js
View file @
95624f6e
...
...
@@ -40,7 +40,7 @@ jQuery(function($){
this
.
$count
=
this
.
$footer
.
find
(
'
.count
'
);
this
.
$clearBtn
=
this
.
$footer
.
find
(
'
.clear
'
);
// localStorage support
this
.
store
=
new
Store
(
'
todo
app
'
);
this
.
store
=
new
Store
(
'
todo
-jquery
'
);
this
.
todos
=
this
.
store
.
get
(
'
todos
'
)
||
[];
this
.
bindEvents
();
this
.
render
();
...
...
@@ -149,4 +149,4 @@ jQuery(function($){
window
.
TodoApp
=
App
.
init
();
});
\ No newline at end of file
});
todo-example/sammyjs/app.js
View file @
95624f6e
...
...
@@ -186,14 +186,14 @@
// lists model
Lists
=
Object
.
create
(
Model
);
Lists
.
name
=
'
lists
'
;
Lists
.
name
=
'
lists
-sammyjs
'
;
Lists
.
init
();
// todos model
Todos
=
Object
.
create
(
Model
);
Todos
.
name
=
'
todos
'
;
Todos
.
name
=
'
todos
-sammyjs
'
;
Todos
.
init
();
$
(
function
()
{
app
.
run
();
});
})(
jQuery
);
\ No newline at end of file
})(
jQuery
);
todo-example/spine/lib/local.js
View file @
95624f6e
(
function
()
{
var
storageName
=
'
todos-spine
'
;
if
(
typeof
Spine
===
"
undefined
"
||
Spine
===
null
)
{
Spine
=
require
(
'
spine
'
);
}
...
...
@@ -10,11 +12,11 @@
saveLocal
:
function
()
{
var
result
;
result
=
JSON
.
stringify
(
this
);
return
localStorage
[
this
.
class
Name
]
=
result
;
return
localStorage
[
storage
Name
]
=
result
;
},
loadLocal
:
function
()
{
var
result
;
result
=
localStorage
[
this
.
class
Name
];
result
=
localStorage
[
storage
Name
];
return
this
.
refresh
(
result
||
[],
{
clear
:
true
});
...
...
todo-example/yuilibrary/js/app.js
View file @
95624f6e
YUI
().
use
(
'
event-focus
'
,
'
json
'
,
'
model
'
,
'
model-list
'
,
'
view
'
,
function
(
Y
)
{
var
TodoAppView
,
TodoList
,
TodoModel
,
TodoView
;
var
TodoAppView
,
TodoList
,
TodoModel
,
TodoView
,
localStorageName
=
'
todos-yuilibrary
'
;
// -- Model --------------------------------------------------------------------
...
...
@@ -12,7 +12,7 @@ var TodoAppView, TodoList, TodoModel, TodoView;
TodoModel
=
Y
.
TodoModel
=
Y
.
Base
.
create
(
'
todoModel
'
,
Y
.
Model
,
[],
{
// This tells the Model to use a localStorage sync provider (which we'll
// create below) to save and load information about a todo item.
sync
:
LocalStorageSync
(
'
todo
'
),
sync
:
LocalStorageSync
(
localStorageName
),
// This method will toggle the `done` attribute from `true` to `false`, or
// vice versa.
...
...
@@ -41,7 +41,7 @@ TodoList = Y.TodoList = Y.Base.create('todoList', Y.ModelList, [], {
// This tells the list to use a localStorage sync provider (which we'll
// create below) to load the list of todo items.
sync
:
LocalStorageSync
(
'
todo
'
),
sync
:
LocalStorageSync
(
localStorageName
),
// Returns an array of all models in this list with the `done` attribute
// set to `true`.
...
...
@@ -444,4 +444,4 @@ function LocalStorageSync(key) {
// in motion and bring our todo list into existence.
new
TodoAppView
();
});
\ No newline at end of file
});
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