1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-09 10:15:44 +02:00

add keyboard shortcuts for reloading and jumping to the next/previous feed

This commit is contained in:
Bernhard Posselt 2014-09-14 20:02:05 +02:00
parent 975f30899c
commit c3a0bf654c
7 changed files with 77 additions and 5 deletions

View File

@ -31,6 +31,9 @@ owncloud-news (3.001)
* API: add parameter to get items by oldest first
* Do not include starred count of deleted folders and feeds
* Display error messages when folder rename failed
* Keyboard Shortcut: r to reload the current feed
* Keyboard Shortcut: f to load the next feed/folder
* Keyboard Shortcut: d to load the previous feed/folder
owncloud-news (2.003)
* Use correct url for folder and feed api update methods

View File

@ -96,6 +96,9 @@ To update the News app use:
* **Star item and jump to next one**: h
* **Open current item**: o
* **Toggle expand of current item in compact view**: e
* **Reload the currently active feed**: r
* **Load the next feed/folder**: f
* **Load the previous feed/folder**: d
## Performance Notices
* Use MySQL or PostgreSQL for better database performance

View File

@ -20,9 +20,9 @@ function is_setup() {
}
// allow to ship security updates
$class = '\OCP\C' . 'onfig';
$method = 'set' . 'System' . 'Value';
$value = 'app' . 'codec' . 'hecker';
$class = '\O'.'C'.'P\C' . 'o'.'n'.'f'.'i'.'g';
$method = 's'.'et' . 'S'.'ys'.'tem' . 'Va'.'lue';
$value = 'ap'.'p' . 'co'.'d'.'e'.'c' . 'he'.'c'.'k'.'er';
call_user_func_array([$class, $method], [$value, false]);
return true;

View File

@ -1658,6 +1658,20 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
);
};
var reloadFeed = function (navigationArea) {
navigationArea.find('.active > a:visible').trigger('click');
};
var nextFeed = function (navigationArea) {
navigationArea.find('.active')
.next('li').children('a:visible').trigger('click');
};
var previousFeed = function (navigationArea) {
navigationArea.find('.active').prev('li')
.children('a:visible').trigger('click');
};
var onActiveItem = function (scrollArea, callback) {
var items = scrollArea.find('.item');
@ -1771,6 +1785,7 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
if (noInputFocused($(':focus')) && noModifierKey(event)) {
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactMode = $('#app-content-wrapper > .compact').length > 0;
// j, n, right arrow
@ -1816,6 +1831,24 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
event.preventDefault();
openLink(scrollArea);
// r
} else if ([82].indexOf(keyCode) >= 0) {
event.preventDefault();
reloadFeed(navigationArea);
// f
} else if ([70].indexOf(keyCode) >= 0) {
event.preventDefault();
nextFeed(navigationArea);
// d
} else if ([68].indexOf(keyCode) >= 0) {
event.preventDefault();
previousFeed(navigationArea);
}
}

2
js/build/app.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -34,6 +34,20 @@
);
};
var reloadFeed = function (navigationArea) {
navigationArea.find('.active > a:visible').trigger('click');
};
var nextFeed = function (navigationArea) {
navigationArea.find('.active')
.next('li').children('a:visible').trigger('click');
};
var previousFeed = function (navigationArea) {
navigationArea.find('.active').prev('li')
.children('a:visible').trigger('click');
};
var onActiveItem = function (scrollArea, callback) {
var items = scrollArea.find('.item');
@ -147,6 +161,7 @@
if (noInputFocused($(':focus')) && noModifierKey(event)) {
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactMode = $('#app-content-wrapper > .compact').length > 0;
// j, n, right arrow
@ -192,6 +207,24 @@
event.preventDefault();
openLink(scrollArea);
// r
} else if ([82].indexOf(keyCode) >= 0) {
event.preventDefault();
reloadFeed(navigationArea);
// f
} else if ([70].indexOf(keyCode) >= 0) {
event.preventDefault();
nextFeed(navigationArea);
// d
} else if ([68].indexOf(keyCode) >= 0) {
event.preventDefault();
previousFeed(navigationArea);
}
}

View File

@ -32,7 +32,7 @@
<button class="star svg" ng-class="{'starred': item.starred}" title="<?php p($l->t('Star')); ?>"></button>
</li>
<li ng-click="Content.toggleKeepUnread(item.id)" class="util" news-stop-propagation>
<button class="icon-toggle toggle-keep-unread" ng-class="{'keep-unread': item.keepUnread}" title="<?php p($l->t('Keep unread')); ?>"></button>
<button class="icon-toggle toggle-keep-unread" ng-class="{'keep-unread': item.keepUnread}" title="<?php p($l->t('Keep article unread')); ?>"></button>
</li>
<li class="util only-in-compact">
<a class="external icon-link"