-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Toasts and Keybinds to Links (#13)
* Add Toasts and Keybinds to Links * Added left/right hand keybinds
- Loading branch information
Showing
10 changed files
with
138 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.toast { | ||
max-width: 260px; | ||
} | ||
|
||
#bottom-container { | ||
margin-bottom: 50px; | ||
margin-right: 25px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +0,0 @@ | ||
#bottom-container { | ||
margin-bottom: 50px; | ||
margin-right: 25px; | ||
} | ||
|
||
.toast { | ||
max-width: 260px; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
body { | ||
width: 280px; | ||
width: 280px; | ||
} | ||
|
||
input::placeholder { | ||
text-align: center; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// JS for links.html and options.html | ||
|
||
const clipboard = new ClipboardJS('.clip') | ||
|
||
clipboard.on('success', function (event) { | ||
console.info('event:', event) | ||
if (event.trigger.id === 'links-clip') { | ||
showToast('Links Copied') | ||
} else if (event.trigger.id === 'domains-clip') { | ||
showToast('Domains Copied') | ||
} else { | ||
showToast('Copied to Clipboard') | ||
} | ||
}) | ||
|
||
clipboard.on('error', function (event) { | ||
console.error('event:', event) | ||
showToast('Clipboard Copy Failed', 'warning') | ||
}) | ||
|
||
/** | ||
* Show Bootstrap Toast | ||
* Requires: jQuery | ||
* @function showToast | ||
* @param {String} message | ||
* @param {String} bsClass | ||
*/ | ||
function showToast(message, bsClass = 'success') { | ||
// TODO: Remove jQuery Dependency | ||
const toastEl = $( | ||
'<div class="toast align-items-center border-0 mt-3" role="alert" aria-live="assertive" aria-atomic="true">\n' + | ||
' <div class="d-flex">\n' + | ||
' <div class="toast-body">Options Saved</div>\n' + | ||
' <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>\n' + | ||
' </div>\n' + | ||
'</div>' | ||
) | ||
toastEl.find('.toast-body').text(message) | ||
toastEl.addClass('text-bg-' + bsClass) | ||
$('#toast-container').append(toastEl) | ||
const toast = new bootstrap.Toast(toastEl) | ||
toast.show() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters