Initial commit
This commit is contained in:
23
code/bookmarklets/highlight-links.js
Normal file
23
code/bookmarklets/highlight-links.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Highlight Links Bookmarklet
|
||||
*
|
||||
* Highlights all links on the current page with a yellow background
|
||||
* and displays a count of total links found.
|
||||
*
|
||||
* Usage: Click the bookmarklet on any webpage
|
||||
*/
|
||||
|
||||
// Find all anchor tags
|
||||
const links = document.querySelectorAll("a");
|
||||
|
||||
// Style each link
|
||||
links.forEach((link) => {
|
||||
link.style.backgroundColor = "yellow";
|
||||
link.style.padding = "2px 4px";
|
||||
link.style.borderRadius = "3px";
|
||||
});
|
||||
|
||||
// Show result
|
||||
alert(
|
||||
`Highlighted ${links.length} link${links.length !== 1 ? "s" : ""} on this page!`,
|
||||
);
|
||||
Reference in New Issue
Block a user