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
2e9e2cab
Commit
2e9e2cab
authored
Oct 16, 2014
by
TasteBot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the build files for gh-pages [ci skip]
parent
3e13921d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
130 additions
and
107 deletions
+130
-107
examples/thorax_lumbar/public/base.js
examples/thorax_lumbar/public/base.js
+125
-103
examples/thorax_lumbar/public/todomvc.js
examples/thorax_lumbar/public/todomvc.js
+5
-4
No files found.
examples/thorax_lumbar/public/base.js
View file @
2e9e2cab
(
function
()
{
(
function
()
{
'
use strict
'
;
'
use strict
'
;
if
(
location
.
hostname
===
'
todomvc.com
'
)
{
// Underscore's Template Module
window
.
_gaq
=
[[
'
_setAccount
'
,
'
UA-31081062-1
'
],[
'
_trackPageview
'
]];(
function
(
d
,
t
){
var
g
=
d
.
createElement
(
t
),
s
=
d
.
getElementsByTagName
(
t
)[
0
];
g
.
src
=
'
//www.google-analytics.com/ga.js
'
;
s
.
parentNode
.
insertBefore
(
g
,
s
)}(
document
,
'
script
'
));
// Courtesy of underscorejs.org
}
var
_
=
(
function
(
_
)
{
_
.
defaults
=
function
(
object
)
{
function
getSourcePath
()
{
if
(
!
object
)
{
// If accessed via tastejs.github.io/todomvc/, strip the project path.
return
object
;
if
(
location
.
hostname
.
indexOf
(
'
github.io
'
)
>
0
)
{
}
return
location
.
pathname
.
replace
(
/todomvc
\/
/
,
''
);
for
(
var
argsIndex
=
1
,
argsLength
=
arguments
.
length
;
argsIndex
<
argsLength
;
argsIndex
++
)
{
var
iterable
=
arguments
[
argsIndex
];
if
(
iterable
)
{
for
(
var
key
in
iterable
)
{
if
(
object
[
key
]
==
null
)
{
object
[
key
]
=
iterable
[
key
];
}
}
}
}
return
object
;
}
}
return
location
.
pathname
;
}
function
appendSourceLink
()
{
// By default, Underscore uses ERB-style template delimiters, change the
var
sourceLink
=
document
.
createElement
(
'
a
'
);
// following template settings to use alternative delimiters.
var
paragraph
=
document
.
createElement
(
'
p
'
);
_
.
templateSettings
=
{
var
footer
=
document
.
getElementById
(
'
info
'
);
evaluate
:
/<%
([\s\S]
+
?)
%>/g
,
var
urlBase
=
'
https://github.com/tastejs/todomvc/tree/gh-pages
'
;
interpolate
:
/<%=
([\s\S]
+
?)
%>/g
,
escape
:
/<%-
([\s\S]
+
?)
%>/g
};
if
(
footer
)
{
// When customizing `templateSettings`, if you don't want to define an
sourceLink
.
href
=
urlBase
+
getSourcePath
();
// interpolation, evaluation or escaping regex, we need one that is
sourceLink
.
appendChild
(
document
.
createTextNode
(
'
Check out the source
'
));
// guaranteed not to match.
paragraph
.
appendChild
(
sourceLink
);
var
noMatch
=
/
(
.
)
^/
;
footer
.
appendChild
(
paragraph
);
}
// Certain characters need to be escaped so that they can be put into a
// string literal.
var
escapes
=
{
"
'
"
:
"
'
"
,
'
\\
'
:
'
\\
'
,
'
\r
'
:
'
r
'
,
'
\n
'
:
'
n
'
,
'
\t
'
:
'
t
'
,
'
\
u2028
'
:
'
u2028
'
,
'
\
u2029
'
:
'
u2029
'
};
var
escaper
=
/
\\
|'|
\r
|
\n
|
\t
|
\u
2028|
\u
2029/g
;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_
.
template
=
function
(
text
,
data
,
settings
)
{
var
render
;
settings
=
_
.
defaults
({},
settings
,
_
.
templateSettings
);
// Combine delimiters into one regular expression via alternation.
var
matcher
=
new
RegExp
([
(
settings
.
escape
||
noMatch
).
source
,
(
settings
.
interpolate
||
noMatch
).
source
,
(
settings
.
evaluate
||
noMatch
).
source
].
join
(
'
|
'
)
+
'
|$
'
,
'
g
'
);
// Compile the template source, escaping string literals appropriately.
var
index
=
0
;
var
source
=
"
__p+='
"
;
text
.
replace
(
matcher
,
function
(
match
,
escape
,
interpolate
,
evaluate
,
offset
)
{
source
+=
text
.
slice
(
index
,
offset
)
.
replace
(
escaper
,
function
(
match
)
{
return
'
\\
'
+
escapes
[
match
];
});
if
(
escape
)
{
source
+=
"
'+
\n
((__t=(
"
+
escape
+
"
))==null?'':_.escape(__t))+
\n
'
"
;
}
if
(
interpolate
)
{
source
+=
"
'+
\n
((__t=(
"
+
interpolate
+
"
))==null?'':__t)+
\n
'
"
;
}
if
(
evaluate
)
{
source
+=
"
';
\n
"
+
evaluate
+
"
\n
__p+='
"
;
}
index
=
offset
+
match
.
length
;
return
match
;
});
source
+=
"
';
\n
"
;
// If a variable is not specified, place data values in local scope.
if
(
!
settings
.
variable
)
source
=
'
with(obj||{}){
\n
'
+
source
+
'
}
\n
'
;
source
=
"
var __t,__p='',__j=Array.prototype.join,
"
+
"
print=function(){__p+=__j.call(arguments,'');};
\n
"
+
source
+
"
return __p;
\n
"
;
try
{
render
=
new
Function
(
settings
.
variable
||
'
obj
'
,
'
_
'
,
source
);
}
catch
(
e
)
{
e
.
source
=
source
;
throw
e
;
}
if
(
data
)
return
render
(
data
,
_
);
var
template
=
function
(
data
)
{
return
render
.
call
(
this
,
data
,
_
);
};
// Provide the compiled function source as a convenience for precompilation.
template
.
source
=
'
function(
'
+
(
settings
.
variable
||
'
obj
'
)
+
'
){
\n
'
+
source
+
'
}
'
;
return
template
;
};
return
_
;
})({});
if
(
location
.
hostname
===
'
todomvc.com
'
)
{
window
.
_gaq
=
[[
'
_setAccount
'
,
'
UA-31081062-1
'
],[
'
_trackPageview
'
]];(
function
(
d
,
t
){
var
g
=
d
.
createElement
(
t
),
s
=
d
.
getElementsByTagName
(
t
)[
0
];
g
.
src
=
'
//www.google-analytics.com/ga.js
'
;
s
.
parentNode
.
insertBefore
(
g
,
s
)}(
document
,
'
script
'
));
}
}
function
redirect
()
{
function
redirect
()
{
...
@@ -34,14 +122,15 @@
...
@@ -34,14 +122,15 @@
}
}
function
findRoot
()
{
function
findRoot
()
{
var
base
=
[
'
labs
'
,
'
architecture-examples
'
,
'
dependency-examples
'
].
filter
(
function
(
href
)
{
var
base
=
location
.
href
.
indexOf
(
'
examples/
'
);
return
location
.
href
.
match
(
new
RegExp
(
href
));
return
location
.
href
.
substr
(
0
,
base
);
})[
0
];
return
location
.
href
.
substr
(
0
,
location
.
href
.
indexOf
(
base
));
}
}
function
getFile
(
file
,
callback
)
{
function
getFile
(
file
,
callback
)
{
if
(
!
location
.
host
)
{
return
console
.
info
(
'
Miss the info bar? Run TodoMVC from a server to avoid a cross-origin error.
'
);
}
var
xhr
=
new
XMLHttpRequest
();
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
findRoot
()
+
file
,
true
);
xhr
.
open
(
'
GET
'
,
findRoot
()
+
file
,
true
);
...
@@ -79,9 +168,10 @@
...
@@ -79,9 +168,10 @@
}
}
if
(
!
framework
&&
document
.
querySelector
(
'
[data-framework]
'
))
{
if
(
!
framework
&&
document
.
querySelector
(
'
[data-framework]
'
))
{
framework
=
document
.
querySelector
(
'
[data-framework]
'
).
getAttribute
(
'
data-framework
'
)
;
framework
=
document
.
querySelector
(
'
[data-framework]
'
).
dataset
.
framework
;
}
}
if
(
template
&&
learnJSON
[
framework
])
{
if
(
template
&&
learnJSON
[
framework
])
{
this
.
frameworkJSON
=
learnJSON
[
framework
];
this
.
frameworkJSON
=
learnJSON
[
framework
];
this
.
template
=
template
;
this
.
template
=
template
;
...
@@ -90,88 +180,21 @@
...
@@ -90,88 +180,21 @@
}
}
}
}
Learn
.
prototype
.
_prepareTemplate
=
function
()
{
Learn
.
prototype
.
append
=
function
()
{
var
aside
=
document
.
createElement
(
'
aside
'
);
var
block
=
aside
.
cloneNode
(
aside
);
block
.
innerHTML
=
this
.
template
;
var
header
=
block
.
cloneNode
(
aside
);
header
.
removeChild
(
header
.
querySelector
(
'
ul
'
));
header
.
removeChild
(
header
.
querySelectorAll
(
'
footer
'
)[
1
]);
return
{
header
:
header
,
links
:
block
.
cloneNode
(
aside
).
querySelector
(
'
ul a
'
),
footer
:
block
.
cloneNode
(
aside
).
querySelectorAll
(
'
footer
'
)[
1
]
};
};
Learn
.
prototype
.
_parseTemplate
=
function
()
{
if
(
!
this
.
template
)
{
return
;
}
var
frameworkJSON
=
this
.
frameworkJSON
;
var
template
=
this
.
_prepareTemplate
();
var
aside
=
document
.
createElement
(
'
aside
'
);
var
aside
=
document
.
createElement
(
'
aside
'
);
var
linksTemplate
=
template
.
links
.
outerHTML
;
aside
.
innerHTML
=
_
.
template
(
this
.
template
,
this
.
frameworkJSON
);
var
parser
=
/
\{\{([^
}
]
*
)\}\}
/g
;
aside
.
className
=
'
learn
'
;
var
header
,
examples
,
links
;
header
=
template
.
header
.
innerHTML
.
replace
(
parser
,
function
(
match
,
key
)
{
// Localize demo links
return
frameworkJSON
[
key
];
var
demoLinks
=
aside
.
querySelectorAll
(
'
.demo-link
'
);
Array
.
prototype
.
forEach
.
call
(
demoLinks
,
function
(
demoLink
)
{
demoLink
.
setAttribute
(
'
href
'
,
findRoot
()
+
demoLink
.
getAttribute
(
'
href
'
));
});
});
aside
.
innerHTML
=
header
;
if
(
frameworkJSON
.
examples
)
{
examples
=
frameworkJSON
.
examples
.
map
(
function
(
example
)
{
return
''
+
'
<h5>
'
+
example
.
name
+
'
</h5>
'
+
'
<p>
'
+
'
<a href="https://github.com/tastejs/todomvc/tree/gh-pages/
'
+
(
example
.
source_url
||
example
.
url
)
+
'
">Source</a>
'
+
'
</p>
'
;
}).
join
(
''
);
aside
.
querySelector
(
'
.source-links
'
).
innerHTML
=
examples
;
}
if
(
frameworkJSON
.
link_groups
)
{
links
=
frameworkJSON
.
link_groups
.
map
(
function
(
linkGroup
)
{
return
''
+
'
<h4>
'
+
linkGroup
.
heading
+
'
</h4>
'
+
'
<ul>
'
+
linkGroup
.
links
.
map
(
function
(
link
)
{
return
''
+
'
<li>
'
+
linksTemplate
.
replace
(
parser
,
function
(
match
,
key
)
{
return
link
[
key
];
})
+
'
</li>
'
;
}).
join
(
''
)
+
'
</ul>
'
;
}).
join
(
''
);
aside
.
innerHTML
+=
links
;
aside
.
innerHTML
+=
template
.
footer
.
outerHTML
;
}
return
aside
;
};
Learn
.
prototype
.
append
=
function
()
{
var
aside
=
this
.
_parseTemplate
();
aside
.
className
=
'
learn
'
;
document
.
body
.
className
=
(
document
.
body
.
className
+
'
learn-bar
'
).
trim
();
document
.
body
.
className
=
(
document
.
body
.
className
+
'
learn-bar
'
).
trim
();
document
.
body
.
insertAdjacent
Element
(
'
afterBegin
'
,
aside
);
document
.
body
.
insertAdjacent
HTML
(
'
afterBegin
'
,
aside
.
outerHTML
);
};
};
appendSourceLink
();
redirect
();
redirect
();
getFile
(
'
learn.json
'
,
Learn
);
getFile
(
'
learn.json
'
,
Learn
);
})();
})();
...
@@ -16608,7 +16631,6 @@ if (isIE) {
...
@@ -16608,7 +16631,6 @@ if (isIE) {
})();
})();
;;
;;
/**
/**
* Backbone localStorage Adapter
* Backbone localStorage Adapter
...
...
examples/thorax_lumbar/public/todomvc.js
View file @
2e9e2cab
Application
[
'
todomvc
'
]
=
(
function
()
{
Application
[
'
todomvc
'
]
=
(
function
()
{
var
module
=
{
exports
:
{}};
var
module
=
{
exports
:
{}};
var
exports
=
module
.
exports
;
var
exports
=
module
.
exports
;
...
@@ -12,7 +13,7 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
...
@@ -12,7 +13,7 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
// Todo Model
// Todo Model
// ----------
// ----------
// Our basic **Todo** model has `title` and `completed` attributes.
// Our basic **Todo** model has `title`
, `order`,
and `completed` attributes.
window
.
app
.
Todo
=
Thorax
.
Model
.
extend
({
window
.
app
.
Todo
=
Thorax
.
Model
.
extend
({
// Default attributes for the todo
// Default attributes for the todo
...
@@ -62,18 +63,18 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
...
@@ -62,18 +63,18 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
localStorage
:
new
Store
(
'
todos-backbone-thorax
'
),
localStorage
:
new
Store
(
'
todos-backbone-thorax
'
),
// Filter down the list of all todo items that are finished.
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
completed
:
function
()
{
return
this
.
where
({
completed
:
true
});
return
this
.
where
({
completed
:
true
});
},
},
// Filter down the list to only todo items that are still not finished.
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
remaining
:
function
()
{
return
this
.
where
({
completed
:
false
});
return
this
.
where
({
completed
:
false
});
},
},
// We keep the Todos in sequential order, despite being saved by unordered
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
nextOrder
:
function
()
{
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
},
...
...
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