Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Commit

Permalink
fix #635
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Posselt committed Apr 30, 2015
1 parent 5515371 commit 2e54780
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
owncloud-news (5.3.3)
* **Enhancement**: Add shortcut for marking the current article's feed/folder read, #635

owncloud-news (5.3.2)
* **Enhancement**: Disable expand on key navigation setting if compact view is not enabled, #774
* **Bugfix**: Update picoFeed to the latest version to fix a bug that would cause the fetcher timeout setting to be ignored
Expand Down
2 changes: 1 addition & 1 deletion css/news.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/news.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 28 additions & 8 deletions js/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,14 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
);
};

var markAllRead = function (navigationArea) {
var selector = '.active > .app-navigation-entry-menu .mark-read button';
var button = navigationArea.find(selector);
if (button.length > 0) {
button.trigger('click');
}
};

var isInScrollView = function (elem, scrollArea) {
// offset().top adds the navigation bar too so we have to subract it
var elemTop = elem.offset().top - scrollArea.offset().top;
Expand Down Expand Up @@ -2384,15 +2392,15 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)


$(document).keyup(function (event) {
if (noInputFocused($(':focus')) && noModifierKey(event)) {
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactView = $('#articles.compact').length > 0;
var isExpandItem = $('#articles')
.attr('news-compact-expand') === 'true';
var expandItemInCompact = isCompactView && isExpandItem;
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactView = $('#articles.compact').length > 0;
var isExpandItem = $('#articles')
.attr('news-compact-expand') === 'true';
var expandItemInCompact = isCompactView && isExpandItem;

if (noInputFocused($(':focus')) && noModifierKey(event)) {
// j, n, right arrow
if ([74, 78, 39].indexOf(keyCode) >= 0) {

Expand Down Expand Up @@ -2481,9 +2489,21 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)

// page up
} else if ([33].indexOf(keyCode) >= 0) {

tryReload(navigationArea, scrollArea);

}

// everything with shift
} else if (noInputFocused($(':focus')) && event.shiftKey) {

// shift + a
if ([65].indexOf(keyCode) >= 0) {

event.preventDefault();
markAllRead(navigationArea);

}
}
});

Expand Down
5 changes: 2 additions & 3 deletions js/build/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/build/app.min.js.map

Large diffs are not rendered by default.

36 changes: 28 additions & 8 deletions js/gui/KeyboardShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
);
};

var markAllRead = function (navigationArea) {
var selector = '.active > .app-navigation-entry-menu .mark-read button';
var button = navigationArea.find(selector);
if (button.length > 0) {
button.trigger('click');
}
};

var isInScrollView = function (elem, scrollArea) {
// offset().top adds the navigation bar too so we have to subract it
var elemTop = elem.offset().top - scrollArea.offset().top;
Expand Down Expand Up @@ -339,15 +347,15 @@


$(document).keyup(function (event) {
if (noInputFocused($(':focus')) && noModifierKey(event)) {
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactView = $('#articles.compact').length > 0;
var isExpandItem = $('#articles')
.attr('news-compact-expand') === 'true';
var expandItemInCompact = isCompactView && isExpandItem;
var keyCode = event.keyCode;
var scrollArea = $('#app-content');
var navigationArea = $('#app-navigation');
var isCompactView = $('#articles.compact').length > 0;
var isExpandItem = $('#articles')
.attr('news-compact-expand') === 'true';
var expandItemInCompact = isCompactView && isExpandItem;

if (noInputFocused($(':focus')) && noModifierKey(event)) {
// j, n, right arrow
if ([74, 78, 39].indexOf(keyCode) >= 0) {

Expand Down Expand Up @@ -436,9 +444,21 @@

// page up
} else if ([33].indexOf(keyCode) >= 0) {

tryReload(navigationArea, scrollArea);

}

// everything with shift
} else if (noInputFocused($(':focus')) && event.shiftKey) {

// shift + a
if ([65].indexOf(keyCode) >= 0) {

event.preventDefault();
markAllRead(navigationArea);

}
}
});

Expand Down
4 changes: 4 additions & 0 deletions templates/part.content.shortcuts.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<td>q</td>
<td><?php p($l->t('Focus search field')); ?></td>
</tr>
<tr>
<td>shift + a</td>
<td><?php p($l->t('Mark current article\'s feed/folder read')); ?></td>
</tr>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion templates/part.navigation.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class="icon-delete"
title="<?php p($l->t('Delete feed')); ?>">
</button>
</li>
<li ng-show="Navigation.getFeedUnreadCount(feed.id) > 0">
<li ng-show="Navigation.getFeedUnreadCount(feed.id) > 0" class="mark-read">
<button class="icon-checkmark"
ng-click="Navigation.markFeedRead(feed.id)"
title="<?php p($l->t('Mark all articles read')); ?>">
Expand Down
2 changes: 1 addition & 1 deletion templates/part.navigation.folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class="icon-delete"
title="<?php p($l->t('Delete folder')); ?>">
</button>
</li>
<li ng-show="Navigation.getFolderUnreadCount(folder.id) > 0">
<li ng-show="Navigation.getFolderUnreadCount(folder.id) > 0" class="mark-read">
<button class="icon-checkmark"
ng-click="Navigation.markFolderRead(folder.id)"
title="<?php p($l->t('Mark all articles read')); ?>">
Expand Down
2 changes: 1 addition & 1 deletion templates/part.navigation.unreadfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class="subscriptions-feed with-counter with-menu">

<div class="app-navigation-entry-menu">
<ul>
<li><button class="icon-checkmark"
<li class="mark-read"><button class="icon-checkmark"
title="<?php p($l->t('Mark all articles read')); ?>"
ng-click="Navigation.markRead()"></button>
</li>
Expand Down

0 comments on commit 2e54780

Please sign in to comment.