diff options
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/js/public/app.js b/js/public/app.js index 590940590..1d597f2ad 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -3222,114 +3222,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. // Generated by CoffeeScript 1.6.2 /* -ownCloud - App Framework - -@author Bernhard Posselt -@copyright 2012 Bernhard Posselt nukeawhale@gmail.com - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -License as published by the Free Software Foundation; either -version 3 of the License, or any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU AFFERO GENERAL PUBLIC LICENSE for more details. - -You should have received a copy of the GNU Affero General Public -License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - - -(function() { - angular.module('News').factory('UndoQueue', [ - '$timeout', '$rootScope', function($timeout, $rootScope) { - var UndoQueue; - - UndoQueue = (function() { - function UndoQueue(_$timeout, _$rootScope) { - this._$timeout = _$timeout; - this._$rootScope = _$rootScope; - this._queue = []; - } - - UndoQueue.prototype.add = function(_caption, _callback, _timeout, _undoCallback) { - var command, data, - _this = this; - - this._caption = _caption; - this._callback = _callback; - this._timeout = _timeout != null ? _timeout : 0; - this._undoCallback = _undoCallback != null ? _undoCallback : null; - /* - @_caption the caption which indentifies the item - @_callback function the callback which should be executed when it was - not undone, this will usually be a request to the server to finally - delete something - @_timeout int the timeout after the callback should be executed - defaults to 0 - @_undoCallback function the function which should be executed when - an command has been canceled. Usually this will add back a deleted - object back to the interface, defaults to an empty function - */ - - this._executeAll(); - command = { - _undoCallback: this._undoCallback || (this._undoCallback = function() {}), - _callback: this._callback, - execute: function() { - return command._callback(); - }, - undo: function() { - command._undoCallback(); - _this._$timeout.cancel(command.promise); - return _this._queue = []; - }, - promise: this._$timeout(function() { - command.execute(); - _this._queue = []; - return _this._$rootScope.$broadcast('notUndone'); - }, this._timeout) - }; - data = { - undoCallback: command.undo, - caption: this._caption - }; - this._$rootScope.$broadcast('undoMessage', data); - return this._queue.push(command); - }; - - UndoQueue.prototype._executeAll = function() { - /* - Executes the callback before the timeout has run out - This is useful to execute all remaining commands if a new command is - added - */ - - var command, _i, _len, _ref; - - _ref = this._queue; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - command = _ref[_i]; - this._$timeout.cancel(command.promise); - command.execute(); - } - return this._queue = []; - }; - - return UndoQueue; - - })(); - return new UndoQueue($timeout, $rootScope); - } - ]); - -}).call(this); - -// Generated by CoffeeScript 1.6.2 -/* - ownCloud - News @author Bernhard Posselt |