Inject SVG sprite via ajax (#10320)

* AJAX SVG
* Fix PWA
* Remove unused PWA assets

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-Authored-by: silverwind <me@silverwind.io>
This commit is contained in:
John Olheiser 2020-02-17 17:11:59 -06:00 committed by GitHub
parent 05c1f2b45c
commit e76a64dda1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View file

@ -3581,3 +3581,12 @@ window.onOAuthLoginClick = function () {
oauthNav.show();
}, 5000);
};
// Pull SVGs via AJAX to workaround CORS issues with <use> tags
// https://css-tricks.com/ajaxing-svg-sprite/
$.get(`${window.config.StaticUrlPrefix}/img/svg/icons.svg`, (data) => {
const div = document.createElement('div');
div.style.display = 'none';
div.innerHTML = new XMLSerializer().serializeToString(data.documentElement);
document.body.insertBefore(div, document.body.childNodes[0]);
});