mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
mermaid: remove console warnings in IE11 #308
This commit is contained in:
parent
8f6e091a65
commit
8f59c36e10
2 changed files with 12 additions and 4 deletions
|
@ -18,6 +18,10 @@
|
|||
{{- end }}
|
||||
<script>
|
||||
function useMathJax( config ){
|
||||
if( !Object.assign ){
|
||||
// We don't support MathJax for IE11 anyways, so bail out early
|
||||
return;
|
||||
}
|
||||
window.MathJax = Object.assign( window.MathJax || {}, {
|
||||
loader: {
|
||||
load: ['[tex]/mhchem']
|
||||
|
|
|
@ -896,6 +896,10 @@ jQuery.fn.highlight = function(words, options) {
|
|||
};
|
||||
|
||||
function useMermaid( config ){
|
||||
if( !Object.assign ){
|
||||
// We don't support Mermaid for IE11 anyways, so bail out early
|
||||
return;
|
||||
}
|
||||
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
|
||||
mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, config ) );
|
||||
if( config.theme && variants ){
|
||||
|
@ -904,8 +908,8 @@ function useMermaid( config ){
|
|||
}
|
||||
}
|
||||
}
|
||||
if( themeUseMermaid ){
|
||||
useMermaid( themeUseMermaid );
|
||||
if( window.themeUseMermaid ){
|
||||
useMermaid( window.themeUseMermaid );
|
||||
}
|
||||
|
||||
function useSwagger( config ){
|
||||
|
@ -914,6 +918,6 @@ function useSwagger( config ){
|
|||
write_style.setProperty( '--CONFIG-SWAGGER-theme', config.theme );
|
||||
}
|
||||
}
|
||||
if( themeUseSwagger ){
|
||||
useSwagger( themeUseSwagger );
|
||||
if( window.themeUseSwagger ){
|
||||
useSwagger( window.themeUseSwagger );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue