File path in JavaScript Plugin  

User avatar
charal3
Member
 
Topic author
Posts: 155
Likes: 1 post
Liked in: 2 posts
Joined: Mon Jan 23, 2012 10:01 am
Location: Sophia-Antipolis
Info

File path in JavaScript Plugin

by charal3 » Fri Dec 16, 2016 4:43 pm

Hi everyone,

I am doing a plugin in JavaScript, and i've been stuck.
I would like to make an image appears in front (like a simple button), but I have a problem with the file loaded.

I get the file path thanks to a filechooser in .xml like this :
Code: Select all
<filechooser id="file" name="tr:File" default="" filters="images,flash" allowRemote="true"/>

And then I retrieve it in a .tmpl file :
Code: Select all
<option name="file" value="{{ p.file.fileName }}" type="string" />

Finally, now I am writting the behavior in JavaScript, and I don't know how to transform this (which is in Django) :
Code: Select all
url="%FIRSTXML%/{{pluginDirectory}}/{{plugin.file.fileName}}"

Into JavaScript, something like this :
Code: Select all
var file = getKrValue("ptplugin["+pPlugID+"].settings[0].option[file].value", "string");
jQuery(button).css('url-background', file);

I need to get the value of %FIRSTXML% and {{pluginDirectory}}, to get the full path of my file (I believe).

If anyone could help me, it'd be great !
Thank you all.

User avatar
360-compunics-com-ni
Member
 
Posts: 418
Likes: 15 posts
Liked in: 163 posts
Joined: Wed Dec 17, 2014 12:37 am
Location: León, Nicaragua
Info

Re: File path in JavaScript Plugin

by 360-compunics-com-ni » Mon Dec 19, 2016 11:48 pm

Do you have 'settings'-elements defined in your plugin?
If not, the call to retrieve the value might be:
Code: Select all
var file = getKrValue("ptplugin["+pPlugID+"].option[file].value", "string");
Out now: DeviceCheck for PTP plugins! https://www.kolor.com/forum/viewtopic.php?f=40&t=37446

Want to know how clients use your tours? Google Analytics Track Events plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=34442

Add actions to your hotspots: Hotspot Actionlist plugin: http://www.kolor.com/forum/viewtopic.php?f=40&t=35829


Who is online

Users browsing this forum: No registered users and 2 guests

cron