Loading Bar: Utility to turn it on/off
This commit is contained in:
parent
66d9fd0908
commit
04f00cdd4f
@ -98,3 +98,15 @@ function statusBarSet(classes, html, icon_name, time){
|
|||||||
statusBarClear(time, 250);
|
statusBarClear(time, 250);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Loading Bar
|
||||||
|
* Sets .loader-bar in layout.pug as active when
|
||||||
|
* loading an asset or performing actions.
|
||||||
|
*/
|
||||||
|
function loadingBarShow(){
|
||||||
|
$('.loading-bar').addClass('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadingBarHide(){
|
||||||
|
$('.loading-bar').removeClass('active');
|
||||||
|
}
|
||||||
|
@ -400,10 +400,10 @@ nav.sidebar
|
|||||||
left: -19px
|
left: -19px
|
||||||
z-index: 1
|
z-index: 1
|
||||||
|
|
||||||
$loader-bar-width: 100px
|
$loading-bar-width: 100px
|
||||||
$loader-bar-height: 2px
|
$loading-bar-height: 2px
|
||||||
.loader-bar
|
.loading-bar
|
||||||
bottom: -$loader-bar-height
|
bottom: -$loading-bar-height
|
||||||
content: ''
|
content: ''
|
||||||
display: none
|
display: none
|
||||||
height: 0
|
height: 0
|
||||||
@ -419,22 +419,22 @@ $loader-bar-height: 2px
|
|||||||
background-image: linear-gradient(to right, $primary-accent, $primary)
|
background-image: linear-gradient(to right, $primary-accent, $primary)
|
||||||
content: ''
|
content: ''
|
||||||
display: block
|
display: block
|
||||||
height: $loader-bar-height
|
height: $loading-bar-height
|
||||||
left: -$loader-bar-width
|
left: -$loading-bar-width
|
||||||
position: absolute
|
position: absolute
|
||||||
width: $loader-bar-width
|
width: $loading-bar-width
|
||||||
|
|
||||||
&.active
|
&.active
|
||||||
display: block
|
display: block
|
||||||
height: $loader-bar-height
|
height: $loading-bar-height
|
||||||
visibility: visible
|
visibility: visible
|
||||||
|
|
||||||
&:before
|
&:before
|
||||||
animation: loader-bar-slide 2s linear infinite
|
animation: loading-bar-slide 2s linear infinite
|
||||||
|
|
||||||
@keyframes loader-bar-slide
|
@keyframes loading-bar-slide
|
||||||
from
|
from
|
||||||
left: -($loader-bar-width / 2)
|
left: -($loading-bar-width / 2)
|
||||||
width: 3%
|
width: 3%
|
||||||
|
|
||||||
50%
|
50%
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
@import "../../node_modules/bootstrap/scss/code"
|
@import "../../node_modules/bootstrap/scss/code"
|
||||||
@import "../../node_modules/bootstrap/scss/grid"
|
@import "../../node_modules/bootstrap/scss/grid"
|
||||||
@import "../../node_modules/bootstrap/scss/buttons"
|
@import "../../node_modules/bootstrap/scss/buttons"
|
||||||
|
@import "../../node_modules/bootstrap/scss/badge"
|
||||||
@import "../../node_modules/bootstrap/scss/dropdown"
|
@import "../../node_modules/bootstrap/scss/dropdown"
|
||||||
@import "../../node_modules/bootstrap/scss/custom-forms"
|
@import "../../node_modules/bootstrap/scss/custom-forms"
|
||||||
|
|
||||||
|
@ -54,3 +54,9 @@
|
|||||||
|
|
||||||
+media-sm
|
+media-sm
|
||||||
font-size: $display4-size
|
font-size: $display4-size
|
||||||
|
|
||||||
|
.display-4
|
||||||
|
font-size: $h2-font-size
|
||||||
|
|
||||||
|
+media-sm
|
||||||
|
font-size: $display4-size
|
||||||
|
@ -166,12 +166,12 @@ script.
|
|||||||
$('#search-hit-container').html(dataHtml);
|
$('#search-hit-container').html(dataHtml);
|
||||||
})
|
})
|
||||||
.done(function(){
|
.done(function(){
|
||||||
$('.loader-bar').removeClass('active');
|
loadingBarHide();
|
||||||
$('#search-error').hide();
|
$('#search-error').hide();
|
||||||
$('#search-hit-container').show();
|
$('#search-hit-container').show();
|
||||||
})
|
})
|
||||||
.fail(function(data){
|
.fail(function(data){
|
||||||
$('.loader-bar').removeClass('active');
|
loadingBarHide();
|
||||||
$('#search-hit-container').hide();
|
$('#search-hit-container').hide();
|
||||||
$('#search-error').show().html('Houston!\n\n' + data.status + ' ' + data.statusText);
|
$('#search-error').show().html('Houston!\n\n' + data.status + ' ' + data.statusText);
|
||||||
});
|
});
|
||||||
@ -180,7 +180,8 @@ script.
|
|||||||
$('body').on('click', '.js-search-hit', function(e){
|
$('body').on('click', '.js-search-hit', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$('.loader-bar').removeClass('active').addClass('active');
|
loadingBarHide();
|
||||||
|
loadingBarShow();
|
||||||
|
|
||||||
displayNode($(this).data('hit-id'));
|
displayNode($(this).data('hit-id'));
|
||||||
$('.js-search-hit').removeClass('active');
|
$('.js-search-hit').removeClass('active');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user