Skip to content

Instantly share code, notes, and snippets.

@alexandr-kazakov
Created March 20, 2018 06:24
Show Gist options
  • Save alexandr-kazakov/8222b6aa96d9de4a8f3e4062f2714de7 to your computer and use it in GitHub Desktop.
Save alexandr-kazakov/8222b6aa96d9de4a8f3e4062f2714de7 to your computer and use it in GitHub Desktop.
/* -------------------------------------------------------------------------
begin Bookmark
* ------------------------------------------------------------------------- */
$('.bookmark-add').click(function(event) {
event.preventDefault();
if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(document.title, window.location.href, '');
} else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite
window.external.AddFavorite(location.href, document.title);
} else if (window.opera && window.print) { // Opera Hotlist
this.title = document.title;
return true;
} else { // webkit - safari/chrome
alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.');
}
});
/* -------------------------------------------------------------------------
end Bookmark
* ------------------------------------------------------------------------- */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment