summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-30 16:34:35 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-30 16:34:35 +0200
commit5699fff8893d38a3524013266a0b7e94be79bb31 (patch)
treeae72aa93fb2c37506cd3ee4216752b8f3b7a58ef /core/js/js.js
parent22fd04eb4117e80341becce13190d5a8fcea98ca (diff)
parent009d1f3214f76cf1ae2318504449110104e159fb (diff)
downloadnextcloud-server-5699fff8893d38a3524013266a0b7e94be79bb31.tar.gz
nextcloud-server-5699fff8893d38a3524013266a0b7e94be79bb31.zip
Merge pull request #17175 from owncloud/add-download-feedback
Add loading spinner to download icon
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 8380d56e31e..45c9c90362f 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1609,8 +1609,38 @@ OC.Util = {
}
}
return aa.length - bb.length;
+ },
+ /**
+ * Calls the callback in a given interval until it returns true
+ * @param {function} callback
+ * @param {integer} interval in milliseconds
+ */
+ waitFor: function(callback, interval) {
+ var internalCallback = function() {
+ if(callback() !== true) {
+ setTimeout(internalCallback, interval);
+ }
+ };
+
+ internalCallback();
+ },
+ /**
+ * Checks if a cookie with the given name is present and is set to the provided value.
+ * @param {string} name name of the cookie
+ * @param {string} value value of the cookie
+ * @return {boolean} true if the cookie with the given name has the given value
+ */
+ isCookieSetToValue: function(name, value) {
+ var cookies = document.cookie.split(';');
+ for (var i=0; i < cookies.length; i++) {
+ var cookie = cookies[i].split('=');
+ if (cookie[0].trim() === name && cookie[1].trim() === value) {
+ return true;
+ }
+ }
+ return false;
}
-}
+};
/**
* Utility class for the history API,