diff --git a/client/js/dpaste.js b/client/js/dpaste.js index 560e980..89fc32b 100644 --- a/client/js/dpaste.js +++ b/client/js/dpaste.js @@ -3,7 +3,7 @@ // ----------------------------------------------------------------------------- // Add data-platform to the body tag to show platform related shortcuts // ----------------------------------------------------------------------------- -const isMac = navigator.platform.indexOf('Mac') !== -1; +const isMac = navigator.userAgentData.platform.includes('Mac') !== -1; document.body.dataset.platform = isMac ? 'mac' : 'win'; // ----------------------------------------------------------------------------- @@ -108,7 +108,8 @@ if (clipboardLink && clipboardField) { clipboardLink.onclick = function(e) { e.preventDefault(); clipboardField.select(); - document.execCommand('Copy'); + // because execCommand is deprecated. + navigator.clipboard.writeText(clipboardField.value); }; } @@ -123,7 +124,8 @@ if (snippetClipboardLink && snippetClipboardField) { snippetClipboardLink.onclick = function(e) { e.preventDefault(); snippetClipboardField.select(); - document.execCommand('Copy'); + // because execCommand is deprecated. + navigator.clipboard.writeText(snippetClipboardField.value); snippetClipboardConfirm.style.maxHeight = '80px'; window.scrollTo(0, 0); }; diff --git a/client/scss/components/_form.scss b/client/scss/components/_form.scss index 673e4a1..4b99269 100644 --- a/client/scss/components/_form.scss +++ b/client/scss/components/_form.scss @@ -51,10 +51,11 @@ .form-lexer { grid-area: a;} .form-expire { grid-area: b; } .form-rtl { grid-area: c; white-space: nowrap; } - .form-action { grid-area: d; } + // .form-action { grid-area: d; } .form-textarea { grid-area: e; } .form-action { + grid-area: d; .btn { width: auto; padding: 6px 20px; diff --git a/dpaste/forms.py b/dpaste/forms.py index 1e94362..5d271b9 100644 --- a/dpaste/forms.py +++ b/dpaste/forms.py @@ -19,7 +19,8 @@ def get_expire_values(expires): expires = None else: expire_type = Snippet.EXPIRE_TIME - expires = expires and expires or config.EXPIRE_DEFAULT + # Correct one of the identical sub-expressions on both sides of operator "and". + expires = expires or config.EXPIRE_DEFAULT expires = datetime.datetime.now() + datetime.timedelta(seconds=int(expires)) return expires, expire_type