diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-30 16:34:35 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-30 16:34:35 +0200 |
commit | 5699fff8893d38a3524013266a0b7e94be79bb31 (patch) | |
tree | ae72aa93fb2c37506cd3ee4216752b8f3b7a58ef /core/js/js.js | |
parent | 22fd04eb4117e80341becce13190d5a8fcea98ca (diff) | |
parent | 009d1f3214f76cf1ae2318504449110104e159fb (diff) | |
download | nextcloud-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.js | 32 |
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, |