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
28b669e4
Commit
28b669e4
authored
Mar 16, 2015
by
Sam Saccone
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1164 from yavorsky/master
Update exoskeleton to 0.7.0
parents
f90608ba
8e9e5c77
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
902 additions
and
806 deletions
+902
-806
examples/exoskeleton/.gitignore
examples/exoskeleton/.gitignore
+3
-0
examples/exoskeleton/index.html
examples/exoskeleton/index.html
+2
-0
examples/exoskeleton/js/views/app-view.js
examples/exoskeleton/js/views/app-view.js
+13
-7
examples/exoskeleton/js/views/todo-view.js
examples/exoskeleton/js/views/todo-view.js
+1
-1
examples/exoskeleton/node_modules/backbone.nativeview/backbone.nativeview.js
...n/node_modules/backbone.nativeview/backbone.nativeview.js
+169
-0
examples/exoskeleton/node_modules/exoskeleton/exoskeleton.js
examples/exoskeleton/node_modules/exoskeleton/exoskeleton.js
+712
-797
examples/exoskeleton/package.json
examples/exoskeleton/package.json
+2
-1
No files found.
examples/exoskeleton/.gitignore
View file @
28b669e4
...
@@ -4,6 +4,9 @@ node_modules/exoskeleton/*
...
@@ -4,6 +4,9 @@ node_modules/exoskeleton/*
node_modules/backbone.localstorage/*
node_modules/backbone.localstorage/*
!node_modules/backbone.localstorage/backbone.localStorage.js
!node_modules/backbone.localstorage/backbone.localStorage.js
node_modules/backbone.nativeview/*
!node_modules/backbone.nativeview/backbone.nativeview.js
node_modules/todomvc-app-css/*
node_modules/todomvc-app-css/*
!node_modules/todomvc-app-css/index.css
!node_modules/todomvc-app-css/index.css
...
...
examples/exoskeleton/index.html
View file @
28b669e4
...
@@ -53,6 +53,8 @@
...
@@ -53,6 +53,8 @@
<script
src=
"node_modules/exoskeleton/exoskeleton.js"
></script>
<script
src=
"node_modules/exoskeleton/exoskeleton.js"
></script>
<script
src=
"node_modules/microtemplates/index.js"
></script>
<script
src=
"node_modules/microtemplates/index.js"
></script>
<script
src=
"node_modules/backbone.localstorage/backbone.localStorage.js"
></script>
<script
src=
"node_modules/backbone.localstorage/backbone.localStorage.js"
></script>
<script
src=
"node_modules/backbone.nativeview/backbone.nativeview.js"
></script>
<script>
Backbone
.
View
=
Backbone
.
NativeView
;
</script>
<script
src=
"js/models/todo.js"
></script>
<script
src=
"js/models/todo.js"
></script>
<script
src=
"js/collections/todos.js"
></script>
<script
src=
"js/collections/todos.js"
></script>
<script
src=
"js/views/todo-view.js"
></script>
<script
src=
"js/views/todo-view.js"
></script>
...
...
examples/exoskeleton/js/views/app-view.js
View file @
28b669e4
...
@@ -8,6 +8,12 @@ var app = app || {};
...
@@ -8,6 +8,12 @@ var app = app || {};
el
.
style
.
display
=
toggle
?
''
:
'
none
'
;
el
.
style
.
display
=
toggle
?
''
:
'
none
'
;
};
};
var
matchesSelector
=
function
(
node
,
selector
)
{
return
[].
some
.
call
(
document
.
querySelectorAll
(
selector
),
function
(
el
)
{
return
el
===
node
;
});
};
// The Application
// The Application
// ---------------
// ---------------
...
@@ -32,10 +38,10 @@ var app = app || {};
...
@@ -32,10 +38,10 @@ var app = app || {};
// collection, when items are added or changed. Kick things off by
// collection, when items are added or changed. Kick things off by
// loading any preexisting todos that might be saved in *localStorage*.
// loading any preexisting todos that might be saved in *localStorage*.
initialize
:
function
()
{
initialize
:
function
()
{
this
.
allCheckbox
=
this
.
find
(
'
#toggle-all
'
);
this
.
allCheckbox
=
this
.
$
(
'
#toggle-all
'
).
item
(
0
);
this
.
input
=
this
.
find
(
'
#new-todo
'
);
this
.
input
=
this
.
$
(
'
#new-todo
'
).
item
(
0
);
this
.
footer
=
this
.
find
(
'
#footer
'
);
this
.
footer
=
this
.
$
(
'
#footer
'
).
item
(
0
);
this
.
main
=
this
.
find
(
'
#main
'
);
this
.
main
=
this
.
$
(
'
#main
'
).
item
(
0
);
this
.
listenTo
(
app
.
todos
,
'
add
'
,
this
.
addOne
);
this
.
listenTo
(
app
.
todos
,
'
add
'
,
this
.
addOne
);
this
.
listenTo
(
app
.
todos
,
'
reset
'
,
this
.
addAll
);
this
.
listenTo
(
app
.
todos
,
'
reset
'
,
this
.
addAll
);
...
@@ -66,9 +72,9 @@ var app = app || {};
...
@@ -66,9 +72,9 @@ var app = app || {};
remaining
:
remaining
remaining
:
remaining
});
});
this
.
findAll
(
'
#filters li a
'
).
forEach
(
function
(
el
)
{
[].
forEach
.
call
(
this
.
$
(
'
#filters li a
'
),
function
(
el
)
{
el
.
classList
.
remove
(
'
selected
'
);
el
.
classList
.
remove
(
'
selected
'
);
if
(
Backbone
.
utils
.
matchesSelector
(
el
,
selector
))
{
if
(
matchesSelector
(
el
,
selector
))
{
el
.
classList
.
add
(
'
selected
'
);
el
.
classList
.
add
(
'
selected
'
);
}
}
});
});
...
@@ -90,7 +96,7 @@ var app = app || {};
...
@@ -90,7 +96,7 @@ var app = app || {};
// Add all items in the **Todos** collection at once.
// Add all items in the **Todos** collection at once.
addAll
:
function
()
{
addAll
:
function
()
{
this
.
find
(
'
#todo-list
'
).
innerHTML
=
''
;
this
.
$
(
'
#todo-list
'
).
item
(
0
).
innerHTML
=
''
;
app
.
todos
.
forEach
(
this
.
addOne
,
this
);
app
.
todos
.
forEach
(
this
.
addOne
,
this
);
},
},
...
...
examples/exoskeleton/js/views/todo-view.js
View file @
28b669e4
...
@@ -41,7 +41,7 @@ var app = app || {};
...
@@ -41,7 +41,7 @@ var app = app || {};
var
method
=
this
.
model
.
get
(
'
completed
'
)
?
'
add
'
:
'
remove
'
;
var
method
=
this
.
model
.
get
(
'
completed
'
)
?
'
add
'
:
'
remove
'
;
this
.
el
.
classList
[
method
](
'
completed
'
);
this
.
el
.
classList
[
method
](
'
completed
'
);
this
.
toggleVisible
();
this
.
toggleVisible
();
this
.
input
=
this
.
find
(
'
.edit
'
);
this
.
input
=
this
.
$
(
'
.edit
'
).
item
(
0
);
return
this
;
return
this
;
},
},
...
...
examples/exoskeleton/node_modules/backbone.nativeview/backbone.nativeview.js
0 → 100644
View file @
28b669e4
// Backbone.NativeView.js 0.3.2
// ---------------
// (c) 2014 Adam Krebs, Jimmy Yuen Ho Wong
// Backbone.NativeView may be freely distributed under the MIT license.
// For all details and documentation:
// https://github.com/akre54/Backbone.NativeView
(
function
(
factory
)
{
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
([
'
backbone
'
],
factory
);
}
else
if
(
typeof
exports
===
'
object
'
)
{
factory
(
require
(
'
backbone
'
));
}
else
{
factory
(
Backbone
);
}
}(
function
(
Backbone
)
{
// Cached regex to match an opening '<' of an HTML tag, possibly left-padded
// with whitespace.
var
paddedLt
=
/^
\s
*</
;
// Caches a local reference to `Element.prototype` for faster access.
var
ElementProto
=
(
typeof
Element
!==
'
undefined
'
&&
Element
.
prototype
)
||
{};
// Cross-browser event listener shims
var
elementAddEventListener
=
ElementProto
.
addEventListener
||
function
(
eventName
,
listener
)
{
return
this
.
attachEvent
(
'
on
'
+
eventName
,
listener
);
}
var
elementRemoveEventListener
=
ElementProto
.
removeEventListener
||
function
(
eventName
,
listener
)
{
return
this
.
detachEvent
(
'
on
'
+
eventName
,
listener
);
}
var
indexOf
=
function
(
array
,
item
)
{
for
(
var
i
=
0
,
len
=
array
.
length
;
i
<
len
;
i
++
)
if
(
array
[
i
]
===
item
)
return
i
;
return
-
1
;
}
// Find the right `Element#matches` for IE>=9 and modern browsers.
var
matchesSelector
=
ElementProto
.
matches
||
ElementProto
.
webkitMatchesSelector
||
ElementProto
.
mozMatchesSelector
||
ElementProto
.
msMatchesSelector
||
ElementProto
.
oMatchesSelector
||
// Make our own `Element#matches` for IE8
function
(
selector
)
{
// Use querySelectorAll to find all elements matching the selector,
// then check if the given element is included in that list.
// Executing the query on the parentNode reduces the resulting nodeList,
// (document doesn't have a parentNode).
var
nodeList
=
(
this
.
parentNode
||
document
).
querySelectorAll
(
selector
)
||
[];
return
!!~
indexOf
(
nodeList
,
this
);
};
// Cache Backbone.View for later access in constructor
var
BBView
=
Backbone
.
View
;
// To extend an existing view to use native methods, extend the View prototype
// with the mixin: _.extend(MyView.prototype, Backbone.NativeViewMixin);
Backbone
.
NativeViewMixin
=
{
_domEvents
:
null
,
constructor
:
function
()
{
this
.
_domEvents
=
[];
return
BBView
.
apply
(
this
,
arguments
);
},
$
:
function
(
selector
)
{
return
this
.
el
.
querySelectorAll
(
selector
);
},
_removeElement
:
function
()
{
this
.
undelegateEvents
();
if
(
this
.
el
.
parentNode
)
this
.
el
.
parentNode
.
removeChild
(
this
.
el
);
},
// Apply the `element` to the view. `element` can be a CSS selector,
// a string of HTML, or an Element node.
_setElement
:
function
(
element
)
{
if
(
typeof
element
==
'
string
'
)
{
if
(
paddedLt
.
test
(
element
))
{
var
el
=
document
.
createElement
(
'
div
'
);
el
.
innerHTML
=
element
;
this
.
el
=
el
.
firstChild
;
}
else
{
this
.
el
=
document
.
querySelector
(
element
);
}
}
else
{
this
.
el
=
element
;
}
},
// Set a hash of attributes to the view's `el`. We use the "prop" version
// if available, falling back to `setAttribute` for the catch-all.
_setAttributes
:
function
(
attrs
)
{
for
(
var
attr
in
attrs
)
{
attr
in
this
.
el
?
this
.
el
[
attr
]
=
attrs
[
attr
]
:
this
.
el
.
setAttribute
(
attr
,
attrs
[
attr
]);
}
},
// Make a event delegation handler for the given `eventName` and `selector`
// and attach it to `this.el`.
// If selector is empty, the listener will be bound to `this.el`. If not, a
// new handler that will recursively traverse up the event target's DOM
// hierarchy looking for a node that matches the selector. If one is found,
// the event's `delegateTarget` property is set to it and the return the
// result of calling bound `listener` with the parameters given to the
// handler.
delegate
:
function
(
eventName
,
selector
,
listener
)
{
if
(
typeof
selector
===
'
function
'
)
{
listener
=
selector
;
selector
=
null
;
}
var
root
=
this
.
el
;
var
handler
=
selector
?
function
(
e
)
{
var
node
=
e
.
target
||
e
.
srcElement
;
for
(;
node
&&
node
!=
root
;
node
=
node
.
parentNode
)
{
if
(
matchesSelector
.
call
(
node
,
selector
))
{
e
.
delegateTarget
=
node
;
listener
(
e
);
}
}
}
:
listener
;
elementAddEventListener
.
call
(
this
.
el
,
eventName
,
handler
,
false
);
this
.
_domEvents
.
push
({
eventName
:
eventName
,
handler
:
handler
,
listener
:
listener
,
selector
:
selector
});
return
handler
;
},
// Remove a single delegated event. Either `eventName` or `selector` must
// be included, `selector` and `listener` are optional.
undelegate
:
function
(
eventName
,
selector
,
listener
)
{
if
(
typeof
selector
===
'
function
'
)
{
listener
=
selector
;
selector
=
null
;
}
if
(
this
.
el
)
{
var
handlers
=
this
.
_domEvents
.
slice
();
for
(
var
i
=
0
,
len
=
handlers
.
length
;
i
<
len
;
i
++
)
{
var
item
=
handlers
[
i
];
var
match
=
item
.
eventName
===
eventName
&&
(
listener
?
item
.
listener
===
listener
:
true
)
&&
(
selector
?
item
.
selector
===
selector
:
true
);
if
(
!
match
)
continue
;
elementRemoveEventListener
.
call
(
this
.
el
,
item
.
eventName
,
item
.
handler
,
false
);
this
.
_domEvents
.
splice
(
indexOf
(
handlers
,
item
),
1
);
}
}
return
this
;
},
// Remove all events created with `delegate` from `el`
undelegateEvents
:
function
()
{
if
(
this
.
el
)
{
for
(
var
i
=
0
,
len
=
this
.
_domEvents
.
length
;
i
<
len
;
i
++
)
{
var
item
=
this
.
_domEvents
[
i
];
elementRemoveEventListener
.
call
(
this
.
el
,
item
.
eventName
,
item
.
handler
,
false
);
};
this
.
_domEvents
.
length
=
0
;
}
return
this
;
}
};
Backbone
.
NativeView
=
Backbone
.
View
.
extend
(
Backbone
.
NativeViewMixin
);
return
Backbone
.
NativeView
;
}));
examples/exoskeleton/node_modules/exoskeleton/exoskeleton.js
View file @
28b669e4
This diff is collapsed.
Click to expand it.
examples/exoskeleton/package.json
View file @
28b669e4
{
{
"private"
:
true
,
"private"
:
true
,
"dependencies"
:
{
"dependencies"
:
{
"exoskeleton"
:
"^0.
3
.0"
,
"exoskeleton"
:
"^0.
7
.0"
,
"backbone.localstorage"
:
"^1.1.16"
,
"backbone.localstorage"
:
"^1.1.16"
,
"backbone.nativeview"
:
"^0.3.2"
,
"todomvc-app-css"
:
"^1.0.0"
,
"todomvc-app-css"
:
"^1.0.0"
,
"todomvc-common"
:
"^1.0.1"
,
"todomvc-common"
:
"^1.0.1"
,
"microtemplates"
:
"^0.1.0"
"microtemplates"
:
"^0.1.0"
...
...
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