I am trying to append a number to the beginning of each search result on google.com but my chrome extension is failing to do so. The css injection is working correctly but the js is not. I found that .S3Uucc is a common class name for the anchor tag on each result.
manifest.json:
{
"manifest_version": 2,
"name": "number",
"version": "0.1.0",
"description": "numbering",
"browser_action": {
"default_icon": "icon.png"
},
"background": {
"scripts": ["jquery-3.4.1.js","number.js"]
},
"permissions": ["tabs", "<all_urls>", "file:///*"]
}
number.js:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
chrome.tabs.insertCSS({file:"number.css"});
$(document).ready(function(){
var a = $(".S3Uucc").textContent;
$(".S3Uucc").textContent="10: "+a;
});
});