forked from CodeByZach/pace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support templating the color of the themes
- Loading branch information
Showing
20 changed files
with
453 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
loadTheme = (name, cb) -> | ||
$.ajax | ||
url: "/pace/templates/pace-theme-#{ name }.tmpl.css" | ||
success: cb | ||
|
||
compileTheme = (body, vars={}) -> | ||
body.replace /\{\{\s*([^\} \|]+)(?:\|"([^\} ]+)")?\s*\}\}/g, (match, varName, def) -> | ||
val = vars[varName] or def | ||
|
||
if not val? | ||
throw "Theme Template Error: #{ varName } not provided" | ||
|
||
val | ||
|
||
if module? | ||
module.exports = {compileTheme} | ||
else | ||
window.loadTheme = loadTheme | ||
window.compileTheme = compileTheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function() { | ||
var compileTheme, loadTheme; | ||
|
||
loadTheme = function(name, cb) { | ||
return $.ajax({ | ||
url: "/pace/templates/pace-theme-" + name + ".tmpl.css", | ||
success: cb | ||
}); | ||
}; | ||
|
||
compileTheme = function(body, vars) { | ||
if (vars == null) { | ||
vars = {}; | ||
} | ||
return body.replace(/\{\{\s*([^\} \|]+)(?:\|"([^\} ]+)")?\s*\}\}/g, function(match, varName, def) { | ||
var val; | ||
val = vars[varName] || def; | ||
if (val == null) { | ||
throw "Theme Template Error: " + varName + " not provided"; | ||
} | ||
return val; | ||
}); | ||
}; | ||
|
||
if (typeof module !== "undefined" && module !== null) { | ||
module.exports = { | ||
compileTheme: compileTheme | ||
}; | ||
} else { | ||
window.loadTheme = loadTheme; | ||
window.compileTheme = compileTheme; | ||
} | ||
|
||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.pace { | ||
-webkit-pointer-events: none; | ||
pointer-events: none; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.pace .pace-progress { | ||
background-color: {{ color|"#29d" }}; | ||
position: fixed; | ||
z-index: 100; | ||
top: 0; | ||
left: 0; | ||
height: 12px; | ||
overflow: hidden; | ||
} | ||
|
||
.pace .pace-progress-inner { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: -32px; | ||
bottom: 0; | ||
|
||
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.2)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.75, rgba(255, 255, 255, 0.2)), color-stop(0.75, transparent), to(transparent)); | ||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent); | ||
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent); | ||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent); | ||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent); | ||
-webkit-background-size: 32px 32px; | ||
-moz-background-size: 32px 32px; | ||
-o-background-size: 32px 32px; | ||
background-size: 32px 32px; | ||
|
||
-webkit-animation: pace-stripe-animation 500ms linear infinite; | ||
-moz-animation: pace-stripe-animation 500ms linear infinite; | ||
-ms-animation: pace-stripe-animation 500ms linear infinite; | ||
-o-animation: pace-stripe-animation 500ms linear infinite; | ||
animation: pace-stripe-animation 500ms linear infinite; | ||
} | ||
|
||
@-webkit-keyframes pace-stripe-animation { | ||
0% { -webkit-transform: none; transform: none; } | ||
100% { -webkit-transform: translate(-32px, 0); transform: translate(-32px, 0); } | ||
} | ||
@-moz-keyframes pace-stripe-animation { | ||
0% { -moz-transform: none; transform: none; } | ||
100% { -moz-transform: translate(-32px, 0); transform: translate(-32px, 0); } | ||
} | ||
@-o-keyframes pace-stripe-animation { | ||
0% { -o-transform: none; transform: none; } | ||
100% { -o-transform: translate(-32px, 0); transform: translate(-32px, 0); } | ||
} | ||
@-ms-keyframes pace-stripe-animation { | ||
0% { -ms-transform: none; transform: none; } | ||
100% { -ms-transform: translate(-32px, 0); transform: translate(-32px, 0); } | ||
} | ||
@keyframes pace-stripe-animation { | ||
0% { transform: none; transform: none; } | ||
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.pace { | ||
-webkit-pointer-events: none; | ||
pointer-events: none; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.pace .pace-progress { | ||
position: fixed; | ||
z-index: 100; | ||
top: 0; | ||
right: 0; | ||
height: 5rem; | ||
width: 5rem; | ||
} | ||
|
||
.pace .pace-progress:after { | ||
display: block; | ||
position: absolute; | ||
top: 0; | ||
right: .5rem; | ||
content: attr(data-progress); | ||
font-family: "Helvetica Neue", sans-serif; | ||
font-weight: 100; | ||
font-size: 5rem; | ||
line-height: 1; | ||
text-align: right; | ||
color: #444; | ||
color: rgba(0, 0, 0, 0.2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.pace { | ||
-webkit-pointer-events: none; | ||
pointer-events: none; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.pace .pace-activity { | ||
display: block; | ||
position: fixed; | ||
z-index: 100; | ||
top: 0; | ||
right: 0; | ||
width: 300px; | ||
height: 300px; | ||
background: #29d; | ||
-webkit-transition: -webkit-transform 0.3s; | ||
transition: transform 0.3s; | ||
-webkit-transform: translateX(100%) translateY(-100%) rotate(45deg); | ||
transform: translateX(100%) translateY(-100%) rotate(45deg); | ||
pointer-events: none; | ||
} | ||
|
||
.pace.pace-active .pace-activity { | ||
-webkit-transform: translateX(50%) translateY(-50%) rotate(45deg); | ||
transform: translateX(50%) translateY(-50%) rotate(45deg); | ||
} | ||
|
||
.pace .pace-activity::before, | ||
.pace .pace-activity::after { | ||
position: absolute; | ||
bottom: 30px; | ||
left: 50%; | ||
display: block; | ||
border: 5px solid #fff; | ||
border-radius: 50%; | ||
content: ''; | ||
} | ||
|
||
.pace .pace-activity::before { | ||
margin-left: -40px; | ||
width: 80px; | ||
height: 80px; | ||
border-right-color: rgba(0, 0, 0, .2); | ||
border-left-color: rgba(0, 0, 0, .2); | ||
-webkit-animation: pace-rotation 3s linear infinite; | ||
animation: pace-rotation 3s linear infinite; | ||
} | ||
|
||
.pace .pace-activity::after { | ||
bottom: 50px; | ||
margin-left: -20px; | ||
width: 40px; | ||
height: 40px; | ||
border-top-color: rgba(0, 0, 0, .2); | ||
border-bottom-color: rgba(0, 0, 0, .2); | ||
-webkit-animation: pace-rotation 1s linear infinite; | ||
animation: pace-rotation 1s linear infinite; | ||
} | ||
|
||
@-webkit-keyframes pace-rotation { | ||
0% { -webkit-transform: rotate(0deg); } | ||
100% { -webkit-transform: rotate(359deg); } | ||
} | ||
@keyframes pace-rotation { | ||
0% { transform: rotate(0deg); } | ||
100% { transform: rotate(359deg); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.pace { | ||
-webkit-pointer-events: none; | ||
pointer-events: none; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.pace .pace-progress { | ||
background-color: rgba(0, 0, 0, 0.2); | ||
position: fixed; | ||
z-index: -1; | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
} |
Oops, something went wrong.