diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/extensions/Mermaid/res/ext.mermaid.js |
first commit
Diffstat (limited to 'www/wiki/extensions/Mermaid/res/ext.mermaid.js')
-rw-r--r-- | www/wiki/extensions/Mermaid/res/ext.mermaid.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/www/wiki/extensions/Mermaid/res/ext.mermaid.js b/www/wiki/extensions/Mermaid/res/ext.mermaid.js new file mode 100644 index 00000000..b2e2b906 --- /dev/null +++ b/www/wiki/extensions/Mermaid/res/ext.mermaid.js @@ -0,0 +1,38 @@ +/*! + * @file + * @ingroup SMW + * + * @licence GNU GPL v2+ + * @author mwjames + */ + +/*global jQuery, mediaWiki, smw */ +/*jslint white: true */ + +( function( $, mw ) { + + 'use strict'; + + var config = mw.config.get( 'mermaid' ); + + mw.loader.using( [ 'mediawiki.api', 'ext.mermaid', 'ext.mermaid.theme.' + config.theme ] ).then( function () { + + $( document ).ready( function() { + + $( '.ext-mermaid' ).each( function() { + + var that = $( this ); + + var id = 'ext-mermaid-' + ( new Date().getTime() ); + var data = that.data( 'mermaid' ); + + that.find( '.mermaid-dots' ).hide(); + that.append( '<div id=' + id + '> ' + data.content + ' </div>' ); + + mermaid.initialize( data.config ); + mermaid.init( undefined, $( "#" + id ) ); + } ); + } ); +} ); + +}( jQuery, mediaWiki ) ); |