Skip to content

Commit

Permalink
各種ホットキー(ショートカットキー)を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kanreisa committed Feb 6, 2019
1 parent 2f3a8b7 commit d839943
Show file tree
Hide file tree
Showing 3 changed files with 2,484 additions and 2,448 deletions.
18 changes: 18 additions & 0 deletions web/chinachu.js
Expand Up @@ -171,11 +171,22 @@
pref: "cog",
search: "search"
};
var hotkeyMap = {
dashboard: "H",
schedule: "S",
rules: "R",
reserves: "E",
recording: "C",
recorded: "O",
pref: "P",
search: "F"
};

app.pm.index.categoryIndex.each(function(categoryName, i) {
flagrate.createElement("li", { "class": "category-" + categoryName }).insert(
flagrate.createElement("a", {
id: "category-" + categoryName + "-a",
title: categoryName.__() + " (" + hotkeyMap[categoryName] + ")",
href: "#!/" + categoryName + "/" + app.pm.index.category[categoryName].defaultPage + "/"
})
.insert('<span class="glyphicon glyphicon-' + glyphiconMap[categoryName] + '"></span>')
Expand All @@ -186,6 +197,13 @@
flagrate.createElement("i", { "class": "badge", id: "category-" + categoryName + "-badge" })
.insertTo($("category-" + categoryName + "-a"));
}

// ホットキー
sakura.shortcut.add(hotkeyMap[categoryName], function () {
window.location.hash = "!/" + categoryName + "/" + app.pm.index.category[categoryName].defaultPage + "/";
}, {
protectInput: true
});
});

//
Expand Down

0 comments on commit d839943

Please sign in to comment.