summaryrefslogtreecommitdiff
path: root/src/Plugins/ActivityIndicator.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/ActivityIndicator.js')
-rw-r--r--src/Plugins/ActivityIndicator.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Plugins/ActivityIndicator.js b/src/Plugins/ActivityIndicator.js
new file mode 100644
index 0000000..8a1e83b
--- /dev/null
+++ b/src/Plugins/ActivityIndicator.js
@@ -0,0 +1,36 @@
+/**
+ *
+ * @author Victor Häggqvist
+ * @since 2016-01-14
+ */
+
+export class ActivityIndicator {
+
+ constructor() {
+ this.element = document.createElement('div');
+ this.element.id = 'imagelightbox-loading';
+ this.element.appendChild(document.createElement('div'))
+ }
+
+ /**
+ *
+ * @param {LightBox} lightbox
+ */
+ register(lightbox) {
+ lightbox.addOnLoadStartListener(this.activityIndicatorOn.bind(this));
+ lightbox.addOnLoadEndListener(this.activityIndicatorOff.bind(this));
+ lightbox.addOnEndListener(this.activityIndicatorOff.bind(this));
+ }
+
+ activityIndicatorOn() {
+ document.body.appendChild(this.element);
+ //$('<div id="imagelightbox-loading"><div></div></div>' ).appendTo('body');
+ }
+
+ activityIndicatorOff() {
+ try {
+ document.body.removeChild(this.element);
+ } catch (e) {}
+ }
+
+}