-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (37 loc) · 1.12 KB
/
index.js
File metadata and controls
42 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function copyText(elementId) {
let inputElementValue = document.getElementById(elementId).value
console.log(inputElementValue)
navigator.clipboard.writeText(inputElementValue).then(_ => {
console.log('copied successfully!')
pushNotify('success', "تم النسخ", inputElementValue)
}, () => {
console.log('copy failed!')
pushNotify('error', "ما تم النسخ", inputElementValue)
})
}
function emptyPaste(elementId) {
let inputElement = document.getElementById(elementId)
inputElement.value = ""
navigator.clipboard.readText().then(
(clipText) => inputElement.value = clipText);
inputElement.focus()
}
function pushNotify(status, messageTitle, messageText) {
new Notify({
status: status,
title: messageTitle,
text: messageText,
effect: 'fade',
speed: 300,
customClass: null,
customIcon: null,
showIcon: true,
showCloseButton: false,
autoclose: true,
autotimeout: 2500,
gap: 20,
distance: 20,
type: 1,
position: 'x-center bottom'
})
}