Move isVisible() method
This commit is contained in:
4
assets/js/app.min.js
vendored
4
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -94,3 +94,23 @@ KB.utils.getViewportSize = function () {
|
|||||||
height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
|
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;
|
||||||
|
};
|
||||||
|
|||||||
@@ -112,23 +112,3 @@ Kanboard.App.prototype.showLoadingIcon = function() {
|
|||||||
Kanboard.App.prototype.hideLoadingIcon = function() {
|
Kanboard.App.prototype.hideLoadingIcon = function() {
|
||||||
$("#app-loading-icon").remove();
|
$("#app-loading-icon").remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
Kanboard.App.prototype.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;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Kanboard.BoardPolling.prototype.execute = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Kanboard.BoardPolling.prototype.check = function() {
|
Kanboard.BoardPolling.prototype.check = function() {
|
||||||
if (this.app.isVisible() && !this.app.get("BoardDragAndDrop").savingInProgress) {
|
if (KB.utils.isVisible() && !this.app.get("BoardDragAndDrop").savingInProgress) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.app.showLoadingIcon();
|
this.app.showLoadingIcon();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user