1
0
Fork 0
This repository has been archived on 2024-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
matomo-injector/js/run.js
2017-08-25 22:50:13 +02:00

20 lines
529 B
JavaScript

(function() {
function injectScript(src, where) {
var elm = document.createElement('script');
elm.src = src;
document[where || 'head'].appendChild(elm);
}
var website = location.protocol + '//' + location.host;
chrome.storage.sync.get(website, function(obj) {
var customjs = obj[website];
if (customjs && customjs.config.enable) {
// Script
if (customjs.source) {
setTimeout(function() {
injectScript(customjs.source, 'body');
}, 250);
}
}
});
})();