Skip to content

Commit

Permalink
b3log#959
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Sep 17, 2019
1 parent 1162b1f commit 363cb8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
26 changes: 8 additions & 18 deletions src/main/webapp/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,13 @@ var Util = {
}
},
parseHljs: function () {
Util.addStyle('https://cdn.jsdelivr.net/npm/vditor/dist/js/highlight.js/styles/github.css', 'vditorHljsStyle')
if (!Label.luteAvailable) {
if (typeof hljs === 'undefined') {
$.ajax({
url: 'https://cdn.jsdelivr.net/npm/vditor/dist/js/highlight.js/highlight.pack.js',
dataType: 'script',
cache: true,
success: function () {
hljs.initHighlighting.called = false
hljs.initHighlighting()
},
})
} else {
hljs.initHighlighting.called = false
hljs.initHighlighting()
}
if ($('.vditor-reset pre > code').length === 0) {
return
}
if (Label.luteAvailable) {
Util.addStyle('https://cdn.jsdelivr.net/npm/vditor/dist/js/chroma/github.css', 'vditorHljsStyle')
} else {
Vditor.highlightRender(Label.hljsStyle, true, document)
}
},
/**
Expand Down Expand Up @@ -657,9 +648,8 @@ var Util = {
if (element.style.display === 'none') {
return
}
Util.parseHljs()
Util.LazyLoadImage()
},
}
},
upload: {
max: Label.fileMaxSize,
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/skins/classic/footer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<script src="${staticServePath}/js/symbol-defs${miniPostfix}.js?${staticResourceVersion}"></script>
<script src="${staticServePath}/js/lib/compress/libs.min.js?${staticResourceVersion}"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js Vditor.mathRender(document.body)"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>
<script src="${staticServePath}/js/common${miniPostfix}.js?${staticResourceVersion}"></script>
<script>
var Label = {
Expand Down

0 comments on commit 363cb8d

Please sign in to comment.