custom parameters by external url

Q&A about the latest versions
Post Reply
User avatar
daBernd
Posts: 13
Joined: Mon Nov 26, 2018 4:29 pm
Location: Germany - Bavaria
Contact:

Hi there,
is it possible to get custom values "inside"? Not only like a DNA url.
I think of passing additional information like a value or a hotspot-ID or a string, which then can be used in the skin as a variable.

ex: ... mywebsite.com/NameOfPano/index.html#node1,-25,0.0,70,CustomValue

My intention to this, is that I want to pass the ID of a hotspot, which then will be shown in a different color, or size or even blinking.
Think about what we're doing here and what happens when there is no more electricity ... :?: :idea:
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

You can do this with some lines of JavaScript.
Just look at the code for direct node access in the index.html. There you can add a field that is written to a variable with a setVariable action.
MfG, Thomas
User avatar
daBernd
Posts: 13
Joined: Mon Nov 26, 2018 4:29 pm
Location: Germany - Bavaria
Contact:

thank you,
passing the value now works fine. I can display the value in a textfield. But now I have no idea how to compare the string-value inside a logic block.
I created a different Icon for the ht_info which should be visible if the poiID variable has got the same value as the title of the Hotspot. But comparing a variable with a variable or a placeholder does not work inside the logic block.
How can i do this?

Is this the wrong way?

Image

Image
Think about what we're doing here and what happens when there is no more electricity ... :?: :idea:
User avatar
daBernd
Posts: 13
Joined: Mon Nov 26, 2018 4:29 pm
Location: Germany - Bavaria
Contact:

I now made a workaround:

Image

and in the skin.js I replaced all occurences of the string "$me.hotspot.url" - Take care of the quotation marks - they are part of the String which needs to be replaced. The string for the replacement: me.hotspot.url .

Image

This works because now the Variable poiID is correctly compared to the concerned Hotspot-URL, and not just with a hardcoded string.

But there must be a more elegant way to do this...
Think about what we're doing here and what happens when there is no more electricity ... :?: :idea:
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

At the moment placeholders cannot be used in logic blocks as values, but this is on the todo list for a future version.
MfG, Thomas
paulk
Posts: 90
Joined: Thu Apr 29, 2010 10:53 am

Hello

Have been reading this thread with interest.

Thomas - Is it possible to give an example of the javascript addition you mentioned?

If I understand your comment correctly one could create a url link not only with the node id but I could add a variable value that could be written to a variable that has been created in the skin?

Therefore say a skin variable named 'myvariable' holds numbers and is defaulted to the value 0 - could this variable be passed a value in the url string?

So something like: "myurl.html#mynode,1" would open the node "mynode" and assign the value 1 to myvariable.
if this is possible it would be very useful.

I would be very grateful if you could show what was required to achieve this.

Many thanks
paulk
Posts: 90
Joined: Thu Apr 29, 2010 10:53 am

Hello
Anyone have any views on this?
User avatar
daBernd
Posts: 13
Joined: Mon Nov 26, 2018 4:29 pm
Location: Germany - Bavaria
Contact:

@PaulK

Hi there,
first you need to add a variable in skin-editor with the setvariable action. Let'name it myExtValue. Let it be a string which is assigned to a textfield for better testing.
Then you need to edit your .ggt file (HTML)
In there you need extend the parseParams - function. In standard there are up to 4 parameters which will be parsed. Therefore your custom value hast to be the fifth:

// get additional Parameter from URL
if (viewingParams.length >= 5) {
params.myCustomValue = viewingParams[4];
}

And your URL has to look like: ... myTours.com/tour01/index.html#nodeID,pan,tilt,fov,projection,customValue

in the .ggt - file, after the line: parseParams(document.location.hash, params); you can assign your parsed value to your skin variable:
pano.setVariableValue('myExtValue',params.myCustomValue);

BUT! ... be carefull editing your .ggt-File. First save a copy of the original.

If you do not know what you're doing, leave it to someone who knows. I'm not taking any responsibility.
Think about what we're doing here and what happens when there is no more electricity ... :?: :idea:
paulk
Posts: 90
Joined: Thu Apr 29, 2010 10:53 am

Hi DaBernd

Thank you for your reply. Lots to think about there. Will have a play with your suggestion and post my findings.

Think this would be a great feature to add btw.

Many thanks
Post Reply