mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 11:56:36 +11:00
perf: updated lib, typing issues (#195)
Fixes deduplication of stuff and fixes the deprecated warnings by changing the methods to use the new one. Signed-off-by: Darren <git@darrennathanael.com>
This commit is contained in:
parent
8dfbb2e352
commit
a9e843367a
3 changed files with 9 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Add data-platform to the body tag to show platform related shortcuts
|
// 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';
|
document.body.dataset.platform = isMac ? 'mac' : 'win';
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -108,7 +108,8 @@ if (clipboardLink && clipboardField) {
|
||||||
clipboardLink.onclick = function(e) {
|
clipboardLink.onclick = function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
clipboardField.select();
|
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) {
|
snippetClipboardLink.onclick = function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
snippetClipboardField.select();
|
snippetClipboardField.select();
|
||||||
document.execCommand('Copy');
|
// because execCommand is deprecated.
|
||||||
|
navigator.clipboard.writeText(snippetClipboardField.value);
|
||||||
snippetClipboardConfirm.style.maxHeight = '80px';
|
snippetClipboardConfirm.style.maxHeight = '80px';
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,10 +51,11 @@
|
||||||
.form-lexer { grid-area: a;}
|
.form-lexer { grid-area: a;}
|
||||||
.form-expire { grid-area: b; }
|
.form-expire { grid-area: b; }
|
||||||
.form-rtl { grid-area: c; white-space: nowrap; }
|
.form-rtl { grid-area: c; white-space: nowrap; }
|
||||||
.form-action { grid-area: d; }
|
// .form-action { grid-area: d; }
|
||||||
.form-textarea { grid-area: e; }
|
.form-textarea { grid-area: e; }
|
||||||
|
|
||||||
.form-action {
|
.form-action {
|
||||||
|
grid-area: d;
|
||||||
.btn {
|
.btn {
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 6px 20px;
|
padding: 6px 20px;
|
||||||
|
|
|
@ -19,7 +19,8 @@ def get_expire_values(expires):
|
||||||
expires = None
|
expires = None
|
||||||
else:
|
else:
|
||||||
expire_type = Snippet.EXPIRE_TIME
|
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))
|
expires = datetime.datetime.now() + datetime.timedelta(seconds=int(expires))
|
||||||
return expires, expire_type
|
return expires, expire_type
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue