Skip to content

Instantly share code, notes, and snippets.

@ashtonmeuser
Last active April 3, 2025 01:30
Show Gist options
  • Save ashtonmeuser/e20e5ffd7ea503ff6b0fd80787b00b82 to your computer and use it in GitHub Desktop.
Save ashtonmeuser/e20e5ffd7ea503ff6b0fd80787b00b82 to your computer and use it in GitHub Desktop.
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