Initial commit
This commit is contained in:
12
content.js
Normal file
12
content.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function onLoad() {
|
||||
console.log('Starter extension content script loaded on', location.href);
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', onLoad);
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message?.type === 'GET_NUM_LINKS') {
|
||||
const count = document.querySelectorAll('a').length;
|
||||
sendResponse({ count });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user