From ea8667302ca5b723edf62a02fe8c0155f13a3da7 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 19 Jan 2017 15:35:38 +0100 Subject: [PATCH 1/2] Display only a placeholder when the poll title is default --- www/poll/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/poll/main.js b/www/poll/main.js index 8ad1b4c0e..e15adab41 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -488,7 +488,7 @@ define([ }; var suggestName = function (fallback) { - return document.title || defaultName || ""; + return (document.title === defaultName) ? "" : document.title; }; From 99b8898e5448d055144a8dab17b5f2b97ee9e045 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 19 Jan 2017 15:41:25 +0100 Subject: [PATCH 2/2] Apply new title when clicking on the page without pressing enter --- www/common/toolbar.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/www/common/toolbar.js b/www/common/toolbar.js index aeee16456..a4c63a902 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -556,26 +556,34 @@ define([ $container.find('.cryptpad-dropdown').hide(); }; var cancelEditTitle = function (e) { + // Now we want to apply the title even if we click somewhere else if ($(e.target).parents('.' + TITLE_CLS).length || !$titleElement) { return; } + + var e = jQuery.Event("keyup"); + e.which = 13; + $titleElement.find('input').trigger(e); + + /* $titleElement.find('input').hide(); $titleElement.find('span.title').show(); $titleElement.find('span.pencilIcon').css('display', ''); + */ }; $(config.ifrw).on('click', removeDropdowns); $(config.ifrw).on('click', cancelEditTitle); - try { - if (config.ifrw.$('iframe').length) { - var innerIfrw = config.ifrw.$('iframe').each(function (i, el) { - $(el.contentWindow).on('click', removeDropdowns); - $(el.contentWindow).on('click', cancelEditTitle); - }); + try { + if (config.ifrw.$('iframe').length) { + var innerIfrw = config.ifrw.$('iframe').each(function (i, el) { + $(el.contentWindow).on('click', removeDropdowns); + $(el.contentWindow).on('click', cancelEditTitle); + }); + } + } catch (e) { + // empty try catch in case this iframe is problematic } - } catch (e) { - // empty try catch in case this iframe is problematic - } } // Update user list