Code hasn't changed since 2015. As of December the chrome extension stopped working. I can't figure out why.
Manifest has:
"web_accessible_resources": [ "script.js" ]
Content Script has:
var readDiv = $("div[id*=fls_readheader]");
$("table[id*='objects_tabs_detail']").filter(function(index){ return $("thead:first-of-type > tr:first-of-type > th:first-of-type > div:first-of-type", this).html() === "Field Name";}).find(readDiv).append("<br /><div style='margin-top:3px;'><input type='checkbox' name='Check All Read' onclick='clickAllRead(this);' /></div>");
var s = document.createElement('script');
s.src = chrome.extension.getURL('script.js');
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head||document.documentElement).appendChild(s);
When I click on the checkbox I get the message:
Uncaught ReferenceError: clickAllRead is not defined at HTMLInputElement.onclick
Any ideas why this broke and how to fix it?
script.js contains:
function clickAllRead(cb) {
if(cb.checked) {
var cbs = $("input:checkbox:enabled[id*=fls_read_ck]");
$("table[id*='objects_tabs_detail']").filter(function(index){ return $("thead:first-of-type > tr:first-of-type > th:first-of-type > div:first-of-type", this).html() === "Field Name";}).find(cbs).prop('checked', true);
} else {
var cbs = $("input:checkbox:enabled");
$("table[id*='objects_tabs_detail']").filter(function(index){ return $("thead:first-of-type > tr:first-of-type > th:first-of-type > div:first-of-type", this).html() === "Field Name";}).find(cbs).prop('checked', false);
}
}
If I add script.js to the "content_scripts" of the extension's manifest, the extension works as expected. I just want to know why it broke.