diff options
author | Phil Hughes <me@iamphill.com> | 2017-03-29 18:50:10 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-03-29 18:50:10 +0300 |
commit | bcebae31e2bc22db53d9043b33f8afbf0cd99b8f (patch) | |
tree | 58e69444dbc7045f47f423a3a1de2e81ae8e5a53 | |
parent | 76a15db45f4911542241ae62fe871101f1f79a78 (diff) |
Remove jQuery from IPython notebook viewer
-rw-r--r-- | app/assets/javascripts/blob/notebook/index.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/blob/notebook/index.js b/app/assets/javascripts/blob/notebook/index.js index 6e07105471c..9b8bfbfc8c0 100644 --- a/app/assets/javascripts/blob/notebook/index.js +++ b/app/assets/javascripts/blob/notebook/index.js @@ -63,16 +63,20 @@ export default () => { }, }, mounted() { - $('<link>', { - rel: 'stylesheet', - type: 'text/css', - href: gon.katex_css_url, - }).appendTo('head'); + if (gon.katex_css_url) { + const katexStyles = document.createElement('link'); + katexStyles.setAttribute('rel', 'stylesheet'); + katexStyles.setAttribute('href', gon.katex_css_url); + document.head.appendChild(katexStyles); + } if (gon.katex_js_url) { - $.getScript(gon.katex_js_url, () => { + const katexScript = document.createElement('script'); + katexScript.addEventListener('load', () => { this.loadFile(); }); + katexScript.setAttribute('src', gon.katex_js_url); + document.head.appendChild(katexScript); } else { this.loadFile(); } |