const compiled = _.template(`<div><%= counter %></div>
<img class="infinitimg" src="img/<%= counter %>.png">`);
compiled({ 'counter': 1 });
// => '<div>1</div><img class="infinitimg" src="img/1.png">'
Оно может быть либо подключено как распакованное, либо из магазина.
chrome.runtime.getURL('style.css')
. Путь задается от корня каталога расширения.injectCSSToPage (codeOrUrl, inline = true) {
if (inline) {
const style = document.createElement('style');
style.textContent = codeOrUrl;
document.head.appendChild(style);
} else {
const link = document.createElement('link');
link.href = codeOrUrl;
link.rel = 'stylesheet';
document.head.appendChild(link);
}
}
что ещё запрещено делать в content script?
this.map.on("zoomend", () => this.onZoomEnd(МАССИВ));
onZoomEnd(residentials) {
const { oldZoom } = this,
newZoom = this.map.getZoom();
const template =
oldZoom > this.switchOnZoom && newZoom <= this.switchOnZoom
? this.setMiniMarker
: oldZoom <= this.switchOnZoom && newZoom > this.switchOnZoom
? this.setZoomMarker
: null;
if (template) {
Object.values(this.markers._layers).forEach((marker, i) => {
marker._icon.innerHTML = template(residentials[i]);
});
}
}