I decided to do another try of creating an map-overlay script in javaScript for replacing the current I'm using, witch is made in flash.
When reffering to an image in my script, I need to use an absolute path for it to work.
For example the html in the card looks like this:
<div id="root"></div>
<SCRIPT LANGUAGE="JavaScript">var x = 268;var y = 400;var i = 'basal-ganglia.jpg';</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="imageHelper_files/d9.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="imageHelper_files/placeDot.js"></SCRIPT>
The variable i declares the path to the map. For it to work, the path needs to be absolute like this:
var i = 'file:///C:/Users/User/AppData/Roaming/Mnemosyne/default.db_media/basal-ganglia.jpg';
In the script linked (placeDot.js), the image is inserted into the document like this:
var map = document.createElement('IMG');
map.src = i;
root.appendChild(map);
I could link the image file in the card html, but that would not be ideal because it would require more code in the card and it would be harder to make changes later. Normally the absolute path can be found using window.location.pathname+window.location.search. But this only returns "blank" in mnemosyne.
I wonder if a workaround could be made where the absolute path is declared in the html template by mnemosyne, for example:
<SCRIPT LANGUAGE="JavaScript">var db_media = full path to db_media goes here;</SCRIPT>
Then later accesed by the users script.
Or that mnemosyne replaces text containing a certain codename in the html, for example:
var i = 'db_media:///basal-ganglia.jpg';
It would be nice if there could be a workaround for this.