@pegakit/pegakit
Version:
The living styleguide, pattern library, UI ToolKit, and front-end build tools that power Pega's digital web properties.
30 lines (23 loc) • 835 B
JavaScript
var svgLocalstorage = require('svg-localstorage'),
svg_rev = require('../../../libs/inline_svg_rev.js'),
Promise = require('promise/lib/es6-extensions');
var iconPath = '/images/icons/icons.svg';
if (window.DrupalTheme){
iconPath = window.DrupalTheme + '/pegakit/public' + iconPath;
}
svgLocalstorage(iconPath, svg_rev.revision).then(function (svg) {
var div = document.createElement("div");
div.innerHTML = svg;
var insertSVG = function(){
document.body.insertBefore(div.children[0], document.body.childNodes[0] || null);
}
if(document.readyState === 'complete' || document.readyState === 'interactive') {
insertSVG();
} else {
document.addEventListener("DOMContentLoaded", function(event) {
insertSVG();
});
}
}, function () {
console.log('SVG is not available.');
});