From 6eb7828b628faecc314c7acfee0860fb24635737 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 1 Feb 2014 11:40:20 -0500 Subject: [PATCH 1/4] Modification du partage au clavier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le raccourci de partage a été modifié pour partager automatiquement un article s'il n'existe qu'un mode de partage. Les modes de partage sont rendus accessibles au clavier en utilisant les chiffres de 1 à 9. Quand un article est partagé, la liste des modes est cachée automatiquement. --- p/scripts/main.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index f0d2bbf7b..ee729b9e5 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -252,10 +252,27 @@ function collapse_entry() { $(".flux.current").toggleClass("active"); } -function auto_share() { +function auto_share(key) { var share = $(".flux.current.active").find('.dropdown-target[id^="dropdown-share"]'); - if (share.length) { + var shares = share.siblings('.dropdown-menu').find('.item a'); + if (typeof key === "undefined") { + if (!share.length) { + return; + } + // Display the share div window.location.hash = share.attr('id'); + // Force the key value if there is only one action, so we can trigger it automatically + if (shares.length === 1) { + key = 1; + } else { + return; + } + } + // Trigger selected share action and hide the share div + key = parseInt(key); + if (key <= shares.length) { + shares[key - 1].click(); + share.siblings('.dropdown-menu').find('.dropdown-close a')[0].click(); } } @@ -390,6 +407,13 @@ function init_shortcuts() { }, { 'disable_in_input': true }); + for(var i = 1; i < 10; i++){ + shortcut.add(i.toString(), function (e) { + auto_share(String.fromCharCode(e.keyCode)); + }, { + 'disable_in_input': true + }); + } // Touches de navigation shortcut.add(shortcuts.prev_entry, prev_entry, { From f8be8eb41b50d0bea6f6c362abc33fb4ac546f3d Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 1 Feb 2014 16:23:43 -0500 Subject: [PATCH 2/4] Modification de l'affichage des modes de partage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout de la numérotation des modes de partage pour rendre l'utilisation des raccourcis plus aisée. --- app/views/helpers/view/normal_view.phtml | 16 ++++++++-------- p/themes/Dark/global.css | 5 +++++ p/themes/Flat/global.css | 5 +++++ p/themes/Origine/global.css | 5 +++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 7b7faccee..ae93b627c 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -147,49 +147,49 @@ if (!empty($this->entries)) {