diff options
Diffstat (limited to 'core/js/public/whatsnew.js')
-rw-r--r-- | core/js/public/whatsnew.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/core/js/public/whatsnew.js b/core/js/public/whatsnew.js new file mode 100644 index 00000000000..dc5862e8572 --- /dev/null +++ b/core/js/public/whatsnew.js @@ -0,0 +1,54 @@ +/** + * @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * @author Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + */ + +(function(OCP) { + "use strict"; + + OCP.WhatsNew = { + + query: function(options) { + options = options || {}; + $.ajax({ + type: 'GET', + url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json', + success: options.success || this._onQuerySuccess, + error: options.error || this._onQueryError + }); + }, + + dismiss: function(version, options) { + options = options || {}; + $.ajax({ + type: 'POST', + url: options.url || OC.linkToOCS('core', 2) + 'whatsnew', + data: {version: encodeURIComponent(version)}, + success: options.success || this._onDismissSuccess, + error: options.error || this._onDismissError + }); + }, + + _onQuerySuccess: function(data, statusText) { + console.debug('querying Whats New data was successful: ' + data || statusText); + console.debug(data); + }, + + _onQueryError: function (o, t, e) { + console.debug(o); + console.debug('querying Whats New Data resulted in an error: ' + t +e); + }, + + _onDismissSuccess: function(data) { + console.debug('dismissing Whats New data was successful: ' + data); + }, + + _onDismissError: function (data) { + console.debug('dismissing Whats New data resulted in an error: ' + data); + } + }; +})(OCP); |