Browse Source

statusbar as class

experimental
Paweł Jedwabny 4 years ago
parent
commit
aabb35327b
2 changed files with 33 additions and 18 deletions
  1. +32
    -17
      src/StatusBar/main.js
  2. +1
    -1
      src/index.js

+ 32
- 17
src/StatusBar/main.js View File

@@ -1,35 +1,50 @@
class StatusBar {
indicator = 'Base_StatusBar';
indicator_text = 'statusbar_text';

fadeOut = () => {
NProgress.configure({parent: '#nano-bar'});
NProgress.start();
let statbar = document.getElementById(this.indicator);
jQuery(statbar).fadeOut();
NProgress.done();
};

fadeIn = () => {
document.getElementById('dismiss').style.display = 'none';
let statbar = document.getElementById(this.indicator);
jQuery(statbar).fadeIn();
};

showMessage = (message) => {
document.getElementById('dismiss').style.display = '';
document.getElementById(this.indicator_text).innerHTML = message;
}
}

let status = new StatusBar();

window.statusbar_message_t='';
window.statusbar_message=function(text){
statusbar_message_t=text;
};

window.statusbar_fade=function(){
NProgress.configure({parent: '#nano-bar'});
NProgress.start();
let statbar = document.getElementById('Base_StatusBar');
jQuery(statbar).fadeOut();
NProgress.done();
};

window.updateEpesiIndicatorFunction=function(){
let statbar = document.getElementById('Base_StatusBar');

statbar.addEventListener('click', () => {if(!Epesi.procOn)statusbar_fade()});
statbar.addEventListener('click', () => {if(!Epesi.procOn)status.fadeOut()});
statbar.style.display='none';

Epesi.updateIndicator=function(){
let statbar = document.getElementById('Base_StatusBar');
if(Epesi.procOn){
document.getElementById('dismiss').style.display = 'none';
jQuery(statbar).fadeIn();
status.fadeIn();
}else{
if(statusbar_message_t !== '') {
document.getElementById('dismiss').style.display = '';
document.getElementById('statusbar_text').innerHTML = statusbar_message_t;
statusbar_message('');
setTimeout('statusbar_fade()',5000);
status.showMessage(statusbar_message_t);
statusbar_message('');
setTimeout(status.fadeOut,5000);
}else{
statusbar_fade();
status.fadeOut()
};
};
};


+ 1
- 1
src/index.js View File

@@ -22,7 +22,7 @@ import 'font-awesome/css/font-awesome.css';
import 'script-loader!../libs/nprogress/nprogress';
import '../libs/nprogress/nprogress.css';

import 'script-loader!./StatusBar/main';
import './StatusBar/main';

import Epesi from './epesi';



Loading…
Cancel
Save