Marvin JS (downloaded from http://dl.chemaxon.com/marvinjs/15.2.16/marvinjs-15.2.16-all.zip) is a JavaScript-based chemical structure editing program that I would like to be able to embed into MediaWiki articles on my local server. I have read https://www.mediawiki.org/wiki/Manual:Developing_extensions but my understanding of PHP is very rudimentary so it wasn't particularly helpful.
I would like such an extension to create the following parser extension tag:
<marvin src = URL width = W height = H></marvin>
where URL is the location (on the local server) of the file being loaded by the Marvin JS program, W is the width of the applet and H is its height.
My efforts to date to add Marvin JS to articles via other means
I have seen several examples of how this applet can be embedded into HTML pages and as I knew writing an extension would be very difficult for me with my lack of PHP knowledge I did attempt to embed this applet as a Widget and via the AddScriptCss extension, both have failed me.
AddScriptCss
For AddScriptCss after installing the extension I added:
<addScript src = "Marvin/js/lib/jquery-1.9.1.min.js"></addScript>
<addScript src="Marvin/js/lib/rainbow/rainbow-custom.min.js"></addScript>
<addScript src="Marvin/gui/lib/promise-0.1.1.min.js"></addScript>
<addScript src="Marvin/js/marvinjslauncher.js"></addScript>
to an article and received this output on the page after I saved this:
UNIQ5d2750bb5e9527b2-addScript-00000004-QINU UNIQ5d2750bb5e9527b2-addScript-00000005-QINU UNIQ5d2750bb5e9527b2-addScript-00000006-QINU UNIQ5d2750bb5e9527b2-addScript-00000007-QINU
adding the rest of the URL to the src field (e.g., http://127.0.0.1/mediawiki/) doesn't seem to correct this problem. Opening up 'Developer tools' (I'm using Chrome) shows two errors:
Uncaught SyntaxError: Unexpected string (@ index.php line 154. Which is a WikEd line)
http://ads.dfgio.com/loader.js?client=topaz0001 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
I also saw this Mediawiki Extension add Javascript in Header stackoverflow question so I attempted following 2nd's answer (Mediawiki Extension add Javascript in Header) and after replacing script
with addHeadItem
and saving the page all I was left with was my original wikitext except with the URLs hyperlinked.
Widgets
As far as Widgets go I tried adding:
<includeonly><script type = "text/javascript" src="http://127.0.0.1/mediawiki/Marvin/gui/lib/promise-0.1.1.min.js"></script>
<script type = "text/javascript" src="http://127.0.0.1/mediawiki/Marvin/js/marvinjslauncher.js"></script></includeonly>
To Widget:Marvin, then I added {{#widget:Marvin}}
to a page with no results (quite literally; when I loaded the page after saving this edit there was nothing there). Here is a screenshot showing the screen that came up upon opening developers tools on this page.