summaryrefslogtreecommitdiff
path: root/app/views/javascript/main.phtml
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 17:08:17 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 17:08:17 +0200
commit48a1aa7d52e712d5f64a33a003b31f23a00b99f5 (patch)
treeab6e6de44c007836edda8f0b2ded29c8d28ca1a1 /app/views/javascript/main.phtml
parent32ee8feccfb28aa3141469581cd04d4813fd6835 (diff)
ajout de la fonctionnalité pour paramétrer les raccourcis
Diffstat (limited to 'app/views/javascript/main.phtml')
-rw-r--r--app/views/javascript/main.phtml27
1 files changed, 19 insertions, 8 deletions
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml
index c801ba7d0..beae6c12b 100644
--- a/app/views/javascript/main.phtml
+++ b/app/views/javascript/main.phtml
@@ -4,9 +4,15 @@ var hide_posts = true;
var hide_posts = false;
<?php } ?>
-function redirect (url) {
+<?php $s = $this->conf->shortcuts (); ?>
+
+function redirect (url, new_tab = false) {
if (url) {
- location.href = url;
+ if (new_tab) {
+ window.open (url);
+ } else {
+ location.href = url;
+ }
}
}
@@ -98,19 +104,19 @@ $(document).ready (function () {
});
// Touches de manipulation
- shortcut.add("m", function () {
+ shortcut.add("<?php echo $s['mark_read']; ?>", function () {
// on marque comme lu ou non lu
active = $(".post.flux.active");
mark_read (active);
});
- shortcut.add("f", function () {
+ shortcut.add("<?php echo $s['mark_favorite']; ?>", function () {
// on marque comme favori ou non favori
active = $(".post.flux.active");
mark_favorite (active);
});
// Touches de navigation
- shortcut.add("page_up", function () {
+ shortcut.add("<?php echo $s['prev_entry']; ?>", function () {
old_active = $(".post.flux.active");
last_active = $(".post.flux:last");
new_active = old_active.prev ();
@@ -121,7 +127,7 @@ $(document).ready (function () {
slide (last_active, old_active);
}
});
- shortcut.add("page_down", function () {
+ shortcut.add("<?php echo $s['next_entry']; ?>", function () {
old_active = $(".post.flux.active");
first_active = $(".post.flux:first");
new_active = old_active.next ();
@@ -132,7 +138,7 @@ $(document).ready (function () {
slide (first_active, old_active);
}
});
- shortcut.add("right", function () {
+ shortcut.add("<?php echo $s['next_page']; ?>", function () {
url = $(".pager-next a").attr ("href");
if (url === undefined) {
url = $(".pager-first a").attr ("href");
@@ -140,7 +146,7 @@ $(document).ready (function () {
redirect (url);
});
- shortcut.add("left", function () {
+ shortcut.add("<?php echo $s['prev_page']; ?>", function () {
url = $(".pager-previous a").attr ("href");
if (url === undefined) {
url = $(".pager-last a").attr ("href");
@@ -148,4 +154,9 @@ $(document).ready (function () {
redirect (url);
});
+ shortcut.add("<?php echo $s['go_website']; ?>", function () {
+ url = $(".post.flux.active h1.title a").attr ("href");
+
+ redirect (url, true);
+ });
});