From 48a1aa7d52e712d5f64a33a003b31f23a00b99f5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 25 Oct 2012 17:08:17 +0200 Subject: ajout de la fonctionnalité pour paramétrer les raccourcis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/javascript/main.phtml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'app/views/javascript/main.phtml') 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; -function redirect (url) { +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("", function () { // on marque comme lu ou non lu active = $(".post.flux.active"); mark_read (active); }); - shortcut.add("f", function () { + shortcut.add("", 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("", 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("", 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("", 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("", 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("", function () { + url = $(".post.flux.active h1.title a").attr ("href"); + + redirect (url, true); + }); }); -- cgit v1.2.3