summaryrefslogtreecommitdiff
path: root/assets/js/core/utils.js
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-11 17:45:13 -0500
committerFrederic Guillot <fred@kanboard.net>2017-03-11 17:45:13 -0500
commita7db17b0b2d1a2ee720c9b923d0db1fc051c5c97 (patch)
treeb2d58778d7c9ebec168c02bd7575f738b074e4f5 /assets/js/core/utils.js
parent8372cdfa8ff7ba4400dad585cba67b54045b7c2d (diff)
Move isVisible() method
Diffstat (limited to 'assets/js/core/utils.js')
-rw-r--r--assets/js/core/utils.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/assets/js/core/utils.js b/assets/js/core/utils.js
index a3683122..ed38cf17 100644
--- a/assets/js/core/utils.js
+++ b/assets/js/core/utils.js
@@ -94,3 +94,23 @@ KB.utils.getViewportSize = function () {
height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
};
};
+
+KB.utils.isVisible = function() {
+ var property = '';
+
+ if (typeof document.hidden !== 'undefined') {
+ property = 'visibilityState';
+ } else if (typeof document.mozHidden !== 'undefined') {
+ property = 'mozVisibilityState';
+ } else if (typeof document.msHidden !== 'undefined') {
+ property = 'msVisibilityState';
+ } else if (typeof document.webkitHidden !== 'undefined') {
+ property = 'webkitVisibilityState';
+ }
+
+ if (property !== '') {
+ return document[property] === 'visible';
+ }
+
+ return true;
+};