From cf4ae5e87cf1a5d9deff96446bb80430c995a22f Mon Sep 17 00:00:00 2001 From: koanya Date: Sun, 26 May 2019 19:10:18 +0200 Subject: [PATCH] Add condition to edit note with single click on mobile and double click on PC --- client/script.js | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/client/script.js b/client/script.js index fc288b0f..46be062e 100644 --- a/client/script.js +++ b/client/script.js @@ -286,18 +286,35 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) { } ); - card.children('.content').editable(function(value, settings) { - onCardChange(id, value); - return (value); - }, { - type: 'textarea', - submit: 'OK', - style: 'inherit', - cssclass: 'card-edit-form', - placeholder: 'Double Click to Edit.', - onblur: 'submit', - event: 'dblclick', //event: 'mouseover' - }); + //to edit note, single click on mobile and double click on PC + if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { + card.children('.content').editable(function(value, settings) { + onCardChange(id, value); + return (value); + }, { + type: 'textarea', + submit: 'OK', + style: 'inherit', + cssclass: 'card-edit-form', + placeholder: 'Click to Edit.', + onblur: 'submit', + event: 'click', + }); + } + else { + card.children('.content').editable(function(value, settings) { + onCardChange(id, value); + return (value); + }, { + type: 'textarea', + submit: 'OK', + style: 'inherit', + cssclass: 'card-edit-form', + placeholder: 'Double Click to Edit.', + onblur: 'submit', + event: 'dblclick', + }); + } //add applicable sticker if (sticker !== null)