-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Also fixed positioning
- Loading branch information
James Feigel
committed
Sep 24, 2015
1 parent
8093cc7
commit d42fa68
Showing
6 changed files
with
160 additions
and
20 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "ng-loaders", | ||
"main": "ngLoader.js", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jfeigel/ngLoader", | ||
"authors": [ | ||
"James Feigel <[email protected]>" | ||
|
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,115 @@ | ||
.loader-bars { | ||
height: 25px; | ||
width: 30px; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
.bar { | ||
background-color: #ccc; | ||
float: left; | ||
height: 25px; | ||
margin-left: 4px; | ||
width: 5px; | ||
opacity: 0.1; | ||
-moz-animation-name: bounceG; | ||
-moz-animation-duration: 1.5s; | ||
-moz-animation-iteration-count: infinite; | ||
-moz-animation-direction: linear; | ||
-moz-transform: scale(0.7); | ||
-webkit-animation-name: bounceG; | ||
-webkit-animation-duration: 1.5s; | ||
-webkit-animation-iteration-count: infinite; | ||
-webkit-animation-direction: linear; | ||
-webkit-transform: scale(0.7); | ||
-ms-animation-name: bounceG; | ||
-ms-animation-duration: 1.5s; | ||
-ms-animation-iteration-count: infinite; | ||
-ms-animation-direction: linear; | ||
-ms-transform: scale(0.7); | ||
-o-animation-name: bounceG; | ||
-o-animation-duration: 1.5s; | ||
-o-animation-iteration-count: infinite; | ||
-o-animation-direction: linear; | ||
-o-transform: scale(0.7); | ||
animation-name: bounceG; | ||
animation-duration: 1.5s; | ||
animation-iteration-count: infinite; | ||
animation-direction: linear; | ||
transform: scale(0.7); | ||
} | ||
|
||
.bar1 { | ||
-moz-animation-delay: 0.45s; | ||
-webkit-animation-delay: 0.45s; | ||
-ms-animation-delay: 0.45s; | ||
-o-animation-delay: 0.45s; | ||
animation-delay: 0.45s; | ||
} | ||
|
||
.bar2 { | ||
-moz-animation-delay: 0.6s; | ||
-webkit-animation-delay: 0.6s; | ||
-ms-animation-delay: 0.6s; | ||
-o-animation-delay: 0.6s; | ||
animation-delay: 0.6s; | ||
} | ||
|
||
.bar3 { | ||
-moz-animation-delay: 0.75s; | ||
-webkit-animation-delay: 0.75s; | ||
-ms-animation-delay: 0.75s; | ||
-o-animation-delay: 0.75s; | ||
animation-delay: 0.75s; | ||
} | ||
|
||
@-moz-keyframes bounceG { | ||
0% { | ||
-moz-transform: scale(1.2); | ||
opacity: 1; | ||
} | ||
100% { | ||
-moz-transform: scale(0.7); | ||
opacity: 0.1; | ||
} | ||
} | ||
@-webkit-keyframes bounceG { | ||
0% { | ||
-webkit-transform: scale(1.2); | ||
opacity: 1; | ||
} | ||
100% { | ||
-webkit-transform: scale(0.7); | ||
opacity: 0.1; | ||
} | ||
} | ||
@-ms-keyframes bounceG { | ||
0% { | ||
-ms-transform: scale(1.2); | ||
opacity: 1; | ||
} | ||
100% { | ||
-ms-transform: scale(0.7); | ||
opacity: 0.1; | ||
} | ||
} | ||
@-o-keyframes bounceG { | ||
0% { | ||
-o-transform: scale(1.2); | ||
opacity: 1; | ||
} | ||
100% { | ||
-o-transform: scale(0.7); | ||
opacity: 0.1; | ||
} | ||
} | ||
@keyframes bounceG { | ||
0% { | ||
transform: scale(1.2); | ||
opacity: 1; | ||
} | ||
100% { | ||
transform: scale(0.7); | ||
opacity: 0.1; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/**! | ||
* AngularJS Loader animation | ||
* @author James Feigel <[email protected]> | ||
* @version 0.1.0 | ||
* @version 0.2.0 | ||
*/ | ||
angular.module('ngLoaderTemplates', ['template/ngLoader/ngLoaderTemplate1.html', 'template/ngLoader/ngLoaderTemplate2.html', 'template/ngLoader/ngLoaderTemplate3.html', 'template/ngLoader/ngLoaderTemplate4.html', 'template/ngLoader/ngLoaderTemplate5.html', 'template/ngLoader/ngLoaderTemplate6.html', 'template/ngLoader/ngLoaderTemplate7.html', 'template/ngLoader/ngLoaderTemplate8.html']); | ||
angular.module('ngLoaderTemplates', ['template/ngLoader/ngLoaderTemplate1.html', 'template/ngLoader/ngLoaderTemplate2.html', 'template/ngLoader/ngLoaderTemplate3.html', 'template/ngLoader/ngLoaderTemplate4.html', 'template/ngLoader/ngLoaderTemplate5.html', 'template/ngLoader/ngLoaderTemplate6.html', 'template/ngLoader/ngLoaderTemplate7.html', 'template/ngLoader/ngLoaderTemplate8.html', 'template/ngLoader/ngLoaderTemplate9.html']); | ||
|
||
angular.module('template/ngLoader/ngLoaderTemplate1.html', []).run(['$templateCache', | ||
function($templateCache) { | ||
|
@@ -227,6 +227,20 @@ angular.module('template/ngLoader/ngLoaderTemplate8.html', []).run(['$templateCa | |
" </div>\n" + | ||
"</div>"); | ||
}]); | ||
angular.module('template/ngLoader/ngLoaderTemplate9.html', []).run(['$templateCache', | ||
function($templateCache) { | ||
$templateCache.put('template/ngLoader/ngLoaderTemplate9.html', | ||
"<div class=\"loader\" data-ng-show=\"working\" style=\"position: absolute;top: 0px;bottom: 0px;left: 0px;right: 0px;height: 100% !important;width: 100% !important;\">\n" + | ||
" <div class=\"loader-content\" style=\"position: absolute;top: 50%;left: 50%;line-height: 1;max-width: 50%;padding: 7px;-o-border-radius: 5px;border-radius: 5px;background-color: rgba(0, 0, 0, 0.5);color: #ffffff;text-transform: uppercase;text-align: center;word-break: break-word;z-index: 1;\">\n" + | ||
" <div class=\"loader-bars\">\n" + | ||
" <span class=\"bar1 bar\"></span>\n" + | ||
" <span class=\"bar2 bar\"></span>\n" + | ||
" <span class=\"bar3 bar\"></span>\n" + | ||
" </div>\n" + | ||
" <p style=\"margin: 2px 0px;\" data-ng-bind=\"message\" data-ng-cloak data-ng-show=\"message\"></p>\n" + | ||
" </div>\n" + | ||
"</div>"); | ||
}]); | ||
|
||
angular.module('ngLoader', ['ngLoaderTemplates']) | ||
.directive('loader', ['$timeout', | ||
|
@@ -244,31 +258,37 @@ angular.module('ngLoader', ['ngLoaderTemplates']) | |
if (isNaN(parseInt(tAttrs.template))) { | ||
console.error('Directive Error! Attribute \'template\' must be a number. Found \'' + tAttrs.template + '\''); | ||
} | ||
else if (parseInt(tAttrs.template) < 1 || parseInt(tAttrs.template) > 8) { | ||
console.error('Directive Error! Attribute \'template\' must be a number between 1 and 8. Found \'' + tAttrs.template + '\''); | ||
else if (parseInt(tAttrs.template) < 1 || parseInt(tAttrs.template) > 9) { | ||
console.error('Directive Error! Attribute \'template\' must be a number between 1 and 9. Found \'' + tAttrs.template + '\''); | ||
} | ||
else { | ||
return 'template/ngLoader/ngLoaderTemplate' + tAttrs.template + '.html'; | ||
} | ||
} | ||
return 'template/ngLoader/ngLoaderTemplate1.html'; | ||
return 'template/ngLoader/ngLoaderTemplate9.html'; | ||
}, | ||
link: function(scope, elem, attrs) { | ||
if (attrs.disableBackground == 'true') { | ||
scope.disableBackground = scope.$eval(scope.disableBackground); | ||
if (scope.disableBackground === true) { | ||
elem.css({ | ||
'background': 'rgba(240,240,240,0.25)', | ||
'background': 'rgba(0,0,0,0.225)', | ||
'z-index': '9999' | ||
}); | ||
} | ||
else if (attrs.disableBackground === undefined) {} | ||
else if (scope.disableBackground === undefined) {} | ||
else { | ||
console.error('Directive Error! Attribute \'disable-background\' must be \'true\' for \'false\'. Found \'' + attrs.disableBackground + '\''); | ||
console.error('Directive Error! Attribute \'disable-background\' must be \'true\' for \'false\'. Found \'' + scope.disableBackground + '\''); | ||
} | ||
var content = elem.find('div')[0]; | ||
$timeout(function() { | ||
content.style.marginTop = -(content.offsetHeight / 2)+'px'; | ||
content.style.marginLeft = -(content.offsetWidth / 2)+'px'; | ||
}); | ||
var positionWatch = scope.$watch('working', function(newValue, oldValue) { | ||
if (newValue === true) { | ||
$timeout(function() { | ||
content.style.marginTop = -(content.offsetHeight / 2)+'px'; | ||
content.style.marginLeft = -(content.offsetWidth / 2)+'px'; | ||
positionWatch(); | ||
}); | ||
} | ||
}) | ||
} | ||
}; | ||
}]); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.