This is a set of bookmarklets
Add a JavaScript snippet as a bookmark in your browser.
Example: Checking a npmjs.com package health thanks to Snyk Advisor .
To do so I will use snyk.js script present in npm/snyk.js
:
- Bookmark name: NPM - Snyk
- Bookmark url:
javascript:(function(){
const urlSplit = location.href.split('/');
const packageName = urlSplit[urlSplit.length - 1].split('#')[0];
const snykUrl = `https://snyk.io/advisor/npm-package/${packageName}`;
window.open(snykUrl, '_blank');
})();
When I am on https://www.npmjs.com/package/bootstrap I open the freshly created bookmark then my browser opens https://snyk.io/advisor/npm-package/bootstrap in a new tab.
You can import all bookmarklets in your browser thanks to the import HTML file bookmarklets-import.html.
git clone https://github.com/0kyn/bookmarklets
cd bookmarklets
npm install
# add a new bookmarklet executable in a specific context
## [context]/[action].js
## jump to the accepted answer in stackoverflow
touch stackoverflow/scroll-to-accepted-answer.js
/* Scroll to the accepted answer */
(function(){
/* code... */
})();
# once the script has been edited
# generate the HTML bookmarks import file
npm run gen