From 812d8f87708a3075ccf0c1e5aea7ac902afa85b2 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 27 Mar 2020 15:47:59 +0100 Subject: [PATCH 1/2] Deprecate 'skip PCS' feature --- www/common/common-ui-elements.js | 45 +----- www/common/sframe-app-framework.js | 6 - www/common/sframe-common.js | 5 +- www/common/toolbar3.js | 2 +- www/poll/inner.js | 7 - www/settings/inner.js | 246 ----------------------------- 6 files changed, 4 insertions(+), 307 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 60a3bcfc5..22836a234 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2796,18 +2796,6 @@ define([ var $advanced; - var $advancedContainer = $('
'); - var priv = common.getMetadataMgr().getPrivateData(); - var c = (priv.settings.general && priv.settings.general.creation) || {}; - if (AppConfig.displayCreationScreen && common.isLoggedIn() && c.skip) { - var $cboxLabel = $(UI.createCheckbox('cp-app-toolbar-creation-advanced', - Messages.creation_newPadModalAdvanced, true)) - .appendTo($advancedContainer); - $advanced = $cboxLabel.find('input'); - $description.append('
'); - $description.append(Messages.creation_newPadModalDescriptionAdvanced); - } - var $container = $('
'); var i = 0; var types = AppConfig.availablePadTypes.filter(function (p) { @@ -2872,7 +2860,7 @@ define([ }); - $modal.find('.cp-modal').append($container).append($advancedContainer); + $modal.find('.cp-modal').append($container); window.setTimeout(function () { $modal.show(); $modal.focus(); @@ -3117,15 +3105,6 @@ define([ right ]); - var settings = h('div.cp-creation-remember', [ - UI.createCheckbox('cp-creation-remember', Messages.dontShowAgain, false), - createHelper('/settings/#creation', Messages.creation_settings), - h('div.cp-creation-remember-help.cp-creation-slider', [ - h('span.fa.fa-exclamation-circle.cp-creation-warning'), - Messages.creation_rememberHelp - ]) - ]); - var createDiv = h('div.cp-creation-create'); var $create = $(createDiv); @@ -3134,7 +3113,6 @@ define([ owned, expire, password, - settings, templates, createDiv ])).appendTo($creation); @@ -3282,16 +3260,6 @@ define([ $creation.focus(); }); - // Display settings help when checkbox checked - $creation.find('#cp-creation-remember').on('change', function () { - if ($(this).is(':checked')) { - $creation.find('.cp-creation-remember-help:not(.active)').addClass('active'); - return; - } - $creation.find('.cp-creation-remember-help').removeClass('active'); - $creation.focus(); - }); - // Keyboard shortcuts $creation.find('#cp-creation-expire-val').keydown(function (e) { if (e.which === 9) { @@ -3309,9 +3277,6 @@ define([ if (!cfg.owned && typeof cfg.owned !== "undefined") { $creation.find('#cp-creation-owned').prop('checked', false); } - if (cfg.skip) { - $creation.find('#cp-creation-remember').prop('checked', true).trigger('change'); - } UIElements.setExpirationValue(cfg.expire, $creation); // Create the pad @@ -3354,14 +3319,6 @@ define([ var create = function () { var val = getFormValues(); - var skip = $('#cp-creation-remember').is(':checked'); - common.setAttribute(['general', 'creation', 'skip'], skip, function (e) { - if (e) { return void console.error(e); } - }); - common.setAttribute(['general', 'creation', 'noTemplate'], skip, function (e) { - if (e) { return void console.error(e); } - }); - common.setAttribute(['general', 'creation', 'owned'], val.owned, function (e) { if (e) { return void console.error(e); } }); diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index a90877ff1..e1378bbac 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -402,12 +402,6 @@ define([ Thumb.initPadThumbnails(common, options.thumbnail); } } - - var skipTemp = Util.find(privateDat, ['settings', 'general', 'creation', 'noTemplate']); - var skipCreation = Util.find(privateDat, ['settings', 'general', 'creation', 'skip']); - if (newPad && (!AppConfig.displayCreationScreen || (!skipTemp && skipCreation))) { - common.openTemplatePicker(); - } }); }; var onConnectionChange = function (info) { diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 8d04c6263..be85f2fdc 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -293,10 +293,9 @@ define([ var priv = ctx.metadataMgr.getPrivateData(); if (priv.isNewFile) { var c = (priv.settings.general && priv.settings.general.creation) || {}; - var skip = !AppConfig.displayCreationScreen || (c.skip && !priv.forceCreationScreen); // If this is a new file but we have a hash in the URL and pad creation screen is // not displayed, then display an error... - if (priv.isDeleted && (!funcs.isLoggedIn() || skip)) { + if (priv.isDeleted && !funcs.isLoggedIn()) { UI.errorLoadingScreen(Messages.inactiveError, false, function () { UI.addLoadingScreen(); return void funcs.createPad({}, waitFor()); @@ -305,7 +304,7 @@ define([ } // Otherwise, if we don't display the screen, it means it is not a deleted pad // so we can continue and start realtime... - if (!funcs.isLoggedIn() || skip) { + if (!funcs.isLoggedIn()) { return void funcs.createPad(c, waitFor()); } // If we display the pad creation screen, it will handle deleted pads directly diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 13f7b9f50..db1d0288e 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -941,7 +941,7 @@ MessengerUI, Messages) { id: 'cp-app-toolbar-creation-advanced', href: origin }, - content: ' ' + Messages.creation_appMenuName + content: ' ' + Messages.creation_appMenuName // XXX change value }); var dropdownConfig = { text: '', // Button initial text diff --git a/www/poll/inner.js b/www/poll/inner.js index 38ed1b79c..5c9f9f182 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -1066,13 +1066,6 @@ define([ common.openPadChat(function () {}); UI.removeLoadingScreen(); - var privateDat = metadataMgr.getPrivateData(); - var skipTemp = Util.find(privateDat, - ['settings', 'general', 'creation', 'noTemplate']); - var skipCreation = Util.find(privateDat, ['settings', 'general', 'creation', 'skip']); - if (isNew && (!AppConfig.displayCreationScreen || (!skipTemp && skipCreation))) { - common.openTemplatePicker(); - } }; var onError = function (info) { diff --git a/www/settings/inner.js b/www/settings/inner.js index 7dbe8b3ce..5541277ed 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -62,12 +62,6 @@ define([ 'cp-settings-safe-links', 'cp-settings-userfeedback', ], - 'creation': [ - 'cp-settings-creation-owned', - 'cp-settings-creation-expire', - 'cp-settings-creation-skip', - 'cp-settings-creation-template' - ], 'drive': [ 'cp-settings-drive-duplicate', 'cp-settings-thumbnails', @@ -101,9 +95,6 @@ define([ } }; - if (!AppConfig.displayCreationScreen) { - delete categories.creation; - } if (AppConfig.disableFeedback) { var feedbackIdx = categories.account.indexOf('cp-settings-userfeedback'); categories.account.splice(feedbackIdx, 1); @@ -610,242 +601,6 @@ define([ cb($cbox); }, true); - // Pad Creation settings - - var setHTML = function (e, html) { - e.innerHTML = html; - return e; - }; - create['creation-owned'] = function () { - if (!common.isLoggedIn()) { return; } - var owned = h('div.cp-settings-creation-owned.cp-sidebarlayout-element', [ - h('label', [ - Messages.creation_ownedTitle - ]), - setHTML(h('p.cp-sidebarlayout-description'), - Messages.creation_owned1 + '
' + Messages.creation_owned2), - h('input#cp-creation-owned-true.cp-creation-owned-value', { - type: 'radio', - name: 'cp-creation-owned', - value: 1, - checked: 'checked' - }), - h('label', { 'for': 'cp-creation-owned-true' }, Messages.creation_ownedTrue), - h('input#cp-creation-owned-false.cp-creation-owned-value', { - type: 'radio', - name: 'cp-creation-owned', - value: 0, - }), - h('label', { 'for': 'cp-creation-owned-false' }, Messages.creation_ownedFalse), - h('span.fa.fa-check', {title: Messages.saved}), - h('span.fa.fa-spinner.fa-pulse'), - ]); - - var $owned = $(owned); - - var $ok = $owned.find('.fa-check').hide(); - var $spinner = $owned.find('.fa-spinner').hide(); - - $owned.find('input').change(function () { - $spinner.show(); - $ok.hide(); - var val = parseInt($owned.find('[name="cp-creation-owned"]:checked').val()); - common.setAttribute(['general', 'creation', 'owned'], val, function (e) { - if (e) { return void console.error(e); } - $spinner.hide(); - $ok.show(); - }); - }); - common.getAttribute(['general', 'creation', 'owned'], function (e, val) { - if (!val && typeof val !== "undefined") { - $owned.find('#cp-creation-owned-false').attr('checked', true); - } - }); - - return $owned; - }; - create['creation-expire'] = function () { - if (!common.isLoggedIn()) { return; } - var expire = h('div.cp-settings-creation-expire.cp-sidebarlayout-element', [ - h('label', [ - Messages.creation_expireTitle - ]), - setHTML(h('p.cp-sidebarlayout-description'), - Messages.creation_expire1 + '
' + Messages.creation_expire2), - h('input#cp-creation-expire-false.cp-creation-expire-value', { - type: 'radio', - name: 'cp-creation-expire', - value: 0, - checked: 'checked' - }), - h('label', { 'for': 'cp-creation-expire-false' }, Messages.creation_expireFalse), - h('input#cp-creation-expire-true.cp-creation-expire-value', { - type: 'radio', - name: 'cp-creation-expire', - value: 1 - }), - h('label', { 'for': 'cp-creation-expire-true' }, [ - Messages.creation_expireTrue, - h('span.cp-creation-expire-picker', [ - h('input#cp-creation-expire-val', { - type: "number", - min: 1, - max: 100, - value: 3 - }), - h('select#cp-creation-expire-unit', [ - h('option', { value: 'hour' }, Messages.creation_expireHours), - h('option', { value: 'day' }, Messages.creation_expireDays), - h('option', { - value: 'month', - selected: 'selected' - }, Messages.creation_expireMonths) - ]) - ]) - ]), - h('span.fa.fa-check', {title: Messages.saved}), - h('span.fa.fa-spinner.fa-pulse'), - ]); - - var $expire = $(expire); - - var $ok = $expire.find('.fa-check').hide(); - var $spinner = $expire.find('.fa-spinner').hide(); - - var getValue = function () { - if(!parseInt($expire.find('[name="cp-creation-expire"]:checked').val())) { return 0; } - var unit = 0; - switch ($expire.find('#cp-creation-expire-unit').val()) { - case "hour" : unit = 3600; break; - case "day" : unit = 3600 * 24; break; - case "month": unit = 3600 * 24 * 30; break; - default: unit = 0; - } - return ($expire.find('#cp-creation-expire-val').val() || 0) * unit; - }; - $expire.find('input, select').change(function () { - $spinner.show(); - $ok.hide(); - common.setAttribute(['general', 'creation', 'expire'], getValue(), function (e) { - if (e) { return void console.error(e); } - $spinner.hide(); - $ok.show(); - }); - }); - common.getAttribute(['general', 'creation', 'expire'], function (e, val) { - UIElements.setExpirationValue(val, $expire); - }); - - return $expire; - }; - create['creation-skip'] = function () { - if (!common.isLoggedIn()) { return; } - var skip = h('div.cp-settings-creation-skip.cp-sidebarlayout-element', [ - h('label', [ - Messages.settings_creationSkip - ]), - setHTML(h('p.cp-sidebarlayout-description'), Messages.settings_creationSkipHint), - h('input#cp-creation-skip-true.cp-creation-skip-value', { - type: 'radio', - name: 'cp-creation-skip', - value: 1, - }), - h('label', { 'for': 'cp-creation-skip-true' }, Messages.settings_creationSkipTrue), - h('input#cp-creation-skip-false.cp-creation-skip-value', { - type: 'radio', - name: 'cp-creation-skip', - value: 0, - checked: 'checked' - }), - h('label', { 'for': 'cp-creation-skip-false' }, Messages.settings_creationSkipFalse), - h('span.fa.fa-check', {title: Messages.saved}), - h('span.fa.fa-spinner.fa-pulse'), - ]); - - var $div = $(skip); - - var $ok = $div.find('.fa-check').hide(); - var $spinner = $div.find('.fa-spinner').hide(); - - $div.find('input').change(function () { - $spinner.show(); - $ok.hide(); - var val = parseInt($div.find('[name="cp-creation-skip"]:checked').val()); - // If we don't skip the pad creation screen, we dont' need settings to hide the templates - // modal - if (!val) { - $('.cp-settings-creation-template').addClass('cp-settings-creation-skipped'); - } else { - $('.cp-settings-creation-template').removeClass('cp-settings-creation-skipped'); - } - common.setAttribute(['general', 'creation', 'skip'], val, function (e) { - if (e) { return void console.error(e); } - $spinner.hide(); - $ok.show(); - }); - }); - common.getAttribute(['general', 'creation', 'skip'], function (e, val) { - if (val) { - $div.find('#cp-creation-skip-true').attr('checked', true); - return; - } - // If we don't skip the pad creation screen, we dont' need settings to hide the templates - // modal - $('.cp-settings-creation-template').addClass('cp-settings-creation-skipped'); - }); - - return $div; - }; - create['creation-template'] = function () { - var skip = h('div.cp-settings-creation-template.cp-sidebarlayout-element', [ - h('label', [ - Messages.settings_templateSkip - ]), - setHTML(h('p.cp-sidebarlayout-description'), Messages.settings_templateSkipHint), - h('input#cp-creation-template-true.cp-creation-template-value', { - type: 'radio', - name: 'cp-creation-template', - value: 1, - }), - h('label', { 'for': 'cp-creation-template-true' }, Messages.settings_creationSkipTrue), - h('input#cp-creation-template-false.cp-creation-template-value', { - type: 'radio', - name: 'cp-creation-template', - value: 0, - checked: 'checked' - }), - h('label', { 'for': 'cp-creation-template-false' }, Messages.settings_creationSkipFalse), - h('span.fa.fa-check', {title: Messages.saved}), - h('span.fa.fa-spinner.fa-pulse'), - ]); - - var $div = $(skip); - - var $ok = $div.find('.fa-check').hide(); - var $spinner = $div.find('.fa-spinner').hide(); - - $div.find('input').change(function () { - $spinner.show(); - $ok.hide(); - var val = parseInt($div.find('[name="cp-creation-template"]:checked').val()); - common.setAttribute(['general', 'creation', 'noTemplate'], val, function (e) { - if (e) { return void console.error(e); } - $spinner.hide(); - $ok.show(); - }); - }); - common.getAttribute(['general', 'creation', 'noTemplate'], function (e, val) { - if (val) { - $div.find('#cp-creation-template-true').attr('checked', true); - } - }); - - return $div; - }; - - - - // Drive settings create['drive-duplicate'] = function () { @@ -1720,7 +1475,6 @@ define([ if (key === 'cursor') { $category.append($('', {'class': 'fa fa-i-cursor' })); } if (key === 'code') { $category.append($('', {'class': 'fa fa-file-code-o' })); } if (key === 'pad') { $category.append($('', {'class': 'fa fa-file-word-o' })); } - if (key === 'creation') { $category.append($('', {'class': 'fa fa-plus-circle' })); } if (key === 'security') { $category.append($('', {'class': 'fa fa-lock' })); } if (key === 'subscription') { $category.append($('', {'class': 'fa fa-star-o' })); } From 8370f3121c07416e78660d590374ed51f9e5d1c3 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 6 Apr 2020 16:26:29 +0200 Subject: [PATCH 2/2] Remove XXX --- www/common/toolbar3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index db1d0288e..13f7b9f50 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -941,7 +941,7 @@ MessengerUI, Messages) { id: 'cp-app-toolbar-creation-advanced', href: origin }, - content: ' ' + Messages.creation_appMenuName // XXX change value + content: ' ' + Messages.creation_appMenuName }); var dropdownConfig = { text: '', // Button initial text