aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2020-02-17 17:11:59 -0600
committerGitHub <noreply@github.com>2020-02-17 23:11:59 +0000
commite76a64dda173db84e34eefc6baaa2981fe4a6801 (patch)
tree649a0606dfbb7eb55ac6d99a42fcfe8d62453172 /web_src/js
parent05c1f2b45c168bbf3ec9192f424798846c452d57 (diff)
downloadgitea-e76a64dda173db84e34eefc6baaa2981fe4a6801.tar.gz
gitea-e76a64dda173db84e34eefc6baaa2981fe4a6801.zip
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>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/index.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 68fb4fddbc..2f2baddcfb 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -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]);
+});