Last active
April 3, 2025 01:30
-
-
Save ashtonmeuser/e20e5ffd7ea503ff6b0fd80787b00b82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Toastify from 'https://cdn.jsdelivr.net/npm/toastify-js'; | |
import css from 'https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css'; | |
const injectStylesheet = (id: string) => { | |
if (document.getElementById(id)) return; | |
let style = document.createElement('style'); | |
style.innerHTML = css; | |
style.id = id; | |
document.head.appendChild(style); | |
}; | |
export default (message: string, id: string = 'bookmarklet-toast') => { | |
injectStylesheet(id); | |
Toastify({ | |
text: message, | |
duration: 3000, | |
close: false, | |
position: "center", | |
style: { | |
color: 'black', | |
background: 'white', | |
cursor: 'unset', | |
'box-shadow': '0 3px 6px -1px #0000001f,0 10px 36px -4px #0000004d', | |
}, | |
}).showToast(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment