add hotkeys to select marked/published articles

This commit is contained in:
Andrew Dolgov 2012-10-08 14:32:17 +04:00
parent 441a89d3c5
commit 5482b38807
3 changed files with 35 additions and 2 deletions

View File

@ -43,6 +43,8 @@
<table>
<tr><td class='n'>a a</td><td><?php echo __("Select all articles") ?></td></tr>
<tr><td class='n'>a u</td><td><?php echo __("Select unread articles") ?></td></tr>
<tr><td class='n'>a U</td><td><?php echo __("Select starred articles") ?></td></tr>
<tr><td class='n'>a p</td><td><?php echo __("Select published articles") ?></td></tr>
<tr><td class='n'>a i</td><td><?php echo __("Invert article selection") ?></td></tr>
<tr><td class='n'>a n</td><td><?php echo __("Deselect all articles") ?></td></tr>
</table>

View File

@ -839,11 +839,21 @@ function hotkey_handler(e) {
return;
}
if (keycode == 85) { // u
if (keycode == 85 && !shift_key) { // u
selectArticles('unread');
return;
}
if (keycode == 80) { // p
selectArticles('published');
return;
}
if (keycode == 85 && shift_key) { // u
selectArticles('marked');
return;
}
if (keycode == 73) { // i
selectArticles('invert');
return;

View File

@ -851,7 +851,7 @@ function getLoadedArticleIds() {
}
// mode = all,none,unread,invert
// mode = all,none,unread,invert,marked,published
function selectArticles(mode) {
try {
@ -872,6 +872,27 @@ function selectArticles(mode) {
child.removeClassName("Selected");
cb.checked = false;
}
} else if (mode == "marked") {
var img = $("FMPIC-" + child.id.replace("RROW-", ""));
if (img && img.src.match("mark_set")) {
child.addClassName("Selected");
cb.checked = true;
} else {
child.removeClassName("Selected");
cb.checked = false;
}
} else if (mode == "published") {
var img = $("FPPIC-" + child.id.replace("RROW-", ""));
if (img && img.src.match("pub_set")) {
child.addClassName("Selected");
cb.checked = true;
} else {
child.removeClassName("Selected");
cb.checked = false;
}
} else if (mode == "invert") {
if (child.hasClassName("Selected")) {
child.removeClassName("Selected");