summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2013-05-12 17:59:47 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2013-05-12 17:59:47 -0400
commit9acb57e21e4d06a2b786131a3a60e38f86639c12 (patch)
tree1fde52a688a4a6efdb2b0ed72cb5fc4b47ae81ae /js
parent4f186b0987e88d84671e979783ed25618239d9b6 (diff)
adds shortcut to star and jump
Diffstat (limited to 'js')
-rw-r--r--js/app/directives/itemshortcuts.coffee5
-rw-r--r--js/public/app.js111
2 files changed, 115 insertions, 1 deletions
diff --git a/js/app/directives/itemshortcuts.coffee b/js/app/directives/itemshortcuts.coffee
index 3ddcda37c..9045ea949 100644
--- a/js/app/directives/itemshortcuts.coffee
+++ b/js/app/directives/itemshortcuts.coffee
@@ -106,8 +106,11 @@ angular.module('News').directive 'itemShortcuts', ['$window', ($window) ->
# s or i or l
else if e.keyCode == 73 or e.keyCode == 83 or e.keyCode == 76
starCurrentItem(scrollArea)
-
+ # h
+ else if e.keyCode == 72
+ starCurrentItem(scrollArea)
+ jumpToNextItem(scrollArea)
] \ No newline at end of file
diff --git a/js/public/app.js b/js/public/app.js
index 68626ce8e..590940590 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -236,6 +236,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return keepUnreadCurrentItem(scrollArea);
} else if (e.keyCode === 73 || e.keyCode === 83 || e.keyCode === 76) {
return starCurrentItem(scrollArea);
+ } else if (e.keyCode === 72) {
+ starCurrentItem(scrollArea);
+ return jumpToNextItem(scrollArea);
}
}
});
@@ -3219,6 +3222,114 @@ 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