writing/assets/js/svg-fix.js
2020-12-23 17:39:28 +00:00

19 lines
548 B
JavaScript
Executable File

// SVG map fix
(function() {
var allItems = document.querySelectorAll('use');
for (var i = 0; i < allItems.length; i++) {
var item = allItems[i];
var anchor = '#' + item.getAttribute('xlink:href').split('#')[1];
var itemData = window.publiiSvgFix[anchor];
if(!itemData) {
console.log('ANCHOR', anchor, i);
continue;
}
var svgItem = item.parentNode;
svgItem.innerHTML = itemData.content;
svgItem.setAttribute('viewBox', itemData.viewbox);
}
})();