mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-12 14:16:14 +00:00
refactor ui into ES6 modules for #3118
This commit is contained in:
committed by
Kushan Joshi
parent
6a4adb476c
commit
447532900b
46
modules/ui/loading.js
Normal file
46
modules/ui/loading.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { modal as modalModule } from './modal';
|
||||
|
||||
export function Loading(context) {
|
||||
var message = '',
|
||||
blocking = false,
|
||||
modal;
|
||||
|
||||
var loading = function(selection) {
|
||||
modal = modalModule(selection, blocking);
|
||||
|
||||
var loadertext = modal.select('.content')
|
||||
.classed('loading-modal', true)
|
||||
.append('div')
|
||||
.attr('class', 'modal-section fillL');
|
||||
|
||||
loadertext.append('img')
|
||||
.attr('class', 'loader')
|
||||
.attr('src', context.imagePath('loader-white.gif'));
|
||||
|
||||
loadertext.append('h3')
|
||||
.text(message);
|
||||
|
||||
modal.select('button.close')
|
||||
.attr('class', 'hide');
|
||||
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.message = function(_) {
|
||||
if (!arguments.length) return message;
|
||||
message = _;
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.blocking = function(_) {
|
||||
if (!arguments.length) return blocking;
|
||||
blocking = _;
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.close = function() {
|
||||
modal.remove();
|
||||
};
|
||||
|
||||
return loading;
|
||||
}
|
||||
Reference in New Issue
Block a user