From d5c7eb49a44fab3628d3b82302298727099a1bb5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 14 Jun 2017 15:33:12 +0200 Subject: [PATCH] send feedback on toolbar hide and CKE buttons --- www/pad/main.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/www/pad/main.js b/www/pad/main.js index 8be56b330..2a48f12a3 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -487,8 +487,14 @@ define([ var updateIcon = function () { $collapse.removeClass('fa-caret-down').removeClass('fa-caret-up'); var isCollapsed = !$bar.find('.cke_toolbox_main').is(':visible'); - if (isCollapsed) { $collapse.addClass('fa-caret-down'); } - else { $collapse.addClass('fa-caret-up'); } + if (isCollapsed) { + if (!initializing) { Cryptpad.feedback('HIDETOOLBAR_PAD'); } + $collapse.addClass('fa-caret-down'); + } + else { + if (!initializing) { Cryptpad.feedback('SHOWTOOLBAR_PAD'); } + $collapse.addClass('fa-caret-up'); + } }; updateIcon(); $collapse.click(function () { @@ -666,6 +672,19 @@ define([ onLocal(); return test; }; + + $bar.find('.cke_button').click(function () { + var e = this; + var classString = e.getAttribute('class'); + var classes = classString.split(' ').filter(function (c) { + return /cke_button__/.test(c); + }); + + var id = classes[0]; + if (typeof(id) === 'string') { + Cryptpad.feedback(id.toUpperCase()); + } + }); }); };