Search…

X3 Photo Gallery Support Forums

Search…
 
MaciejK
Experienced
Topic Author
Posts: 54
Joined: 25 Jun 2017, 14:27

Embedding Java Script in content

11 Jul 2017, 13:27

Hi

Is it possible to embed some java script in content of the page?

I'd like to embed some external code to view my 360VR spherical panoramas. Code is like this:
Code
<script type="text/javascript">
        // hide URL field on the iPhone/iPod touch
        function hideUrlBar() {

            document.getElementsByTagName("body")[0].style.marginTop="1px";
            window.scrollTo(0, 1);
        }
        window.addEventListener("load", hideUrlBar);
        window.addEventListener("resize", hideUrlBar);
        window.addEventListener("orientationchange", hideUrlBar);
    </script>
    <style type="text/css" title="Default">
        .warning { 
            font-weight: bold;
        } 
        /* fix for scroll bars on webkit & Mac OS X Lion */ 
        ::-webkit-scrollbar {
            background-color: rgba(0,0,0,0.5);
            width: 0.75em;
        }
        ::-webkit-scrollbar-thumb {
            background-color:  rgba(255,255,255,0.5);
        }
        #container {
        font-family: Verdana, Geneva, sans-serif;
        height: 480px;
        width: 90%;
        border: 12px solid rgb(255,255,255);
        margin-top: 15px;
        margin-right: auto;
        margin-bottom: 10px;
        margin-left: auto;
        box-shadow: 0px 0px 5px 4px rgb(0,0,0);
        -moz-box-shadow: 0px 0px 5px 4px rgb(0,0,0);
        -webkit-box-shadow: 0px 0px 5px 4px rgb(0,0,0);
        overflow: hidden;
        }
    </style>    
    <script type="text/javascript" src="pano2vr_player.js">
    </script>
    <script type="text/javascript" src="skin.js">
    </script>
    <script type="text/javascript" src="pano2vrgyro.js">
    </script>
    <div id="container">
    This content requires HTML5/CSS3, WebGL, or Adobe Flash Player Version 9 or higher.
    </div>
    <script type="text/javascript">


        // create the panorama player with the container
        pano=new pano2vrPlayer("container");
        // add the skin object
        skin=new pano2vrSkin(pano);
        // load the configuration
        pano.readConfigUrl("Sphere_out.xml");
        // hide the URL bar on the iPhone
        hideUrlBar();
        // add gyroscope controller
        gyro=new pano2vrGyro(pano,"container");
    </script>
    <noscript>
    <p><b>Please enable Javascript!</b></p>
    </noscript>
Thank You in advance
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14452
Joined: 30 Sep 2006, 03:37

Re: Embedding Java Script in content

11 Jul 2017, 13:59

It's a really hacky way to do it, but there is no reason the above would not work. Did you try it? Keep in mind, panoramas viewers are very complex scripts ... If it doesn't work, I can look at the link (if you can provide), but I can't just "get it to work for you". For instance, you need to make sure the PATHS to the JS and XML files are correct. In your example, you are just referring to the file names without any path ... where did you upload the XML and JS files?

X3 will have it's own native panorama-plugin later this year, which can be directly to images in the gallery, as well as custom images.
 
MaciejK
Experienced
Topic Author
Posts: 54
Joined: 25 Jun 2017, 14:27

Re: Embedding Java Script in content

12 Jul 2017, 12:39

So my mentioned X3 website with where i'd like to embed is http://www.kolasinski.art.pl/Nowa/Galer ... raz/360VR/
JS & XML files are placed inside subdirectory of 360VR named 'DabLato'. All the script is generated by panorama software pano2vr and i cpoy pasted it inside the content of lonked page.

My goal is to achieve similar look like on my present web gallery created in joomla with the same code embeded http://www.kolasinski.art.pl/index.php/ ... topelklato.

I've read future plans to implement 360VR panoramas in X3 what is great but till that i'd like to make such workaround.

Hope it will work
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14452
Joined: 30 Sep 2006, 03:37

Re: Embedding Java Script in content

12 Jul 2017, 15:11

MaciejK wrote:So my mentioned X3 website with where i'd like to embed is http://www.kolasinski.art.pl/Nowa/Galer ... raz/360VR/
JS & XML files are placed inside subdirectory of 360VR named 'DabLato'. All the script is generated by panorama software pano2vr and i cpoy pasted it inside the content of lonked page.
I checked the page, and it looks like you have somehow pasted the encoded HTML code (I don't know how). Therefore, the code itself is just displaying on the page as html, instead of actually rendering as code.

Another thing you would have to deal with, is loading of the script files. The URL itself is not a file path, and the file path is in fact /content/3.Galerie/2.Krajobraz/2.360VR. You can use variable {{path}}filename.xml.

Considering the above issues, it is probably easier if you send panel login to me, and I will see if I can fix it.
MaciejK wrote:My goal is to achieve similar look like on my present web gallery created in joomla with the same code embeded http://www.kolasinski.art.pl/index.php/ ... topelklato.
Should be able to get it working similar to that.
 
MaciejK
Experienced
Topic Author
Posts: 54
Joined: 25 Jun 2017, 14:27

Re: Embedding Java Script in content

12 Jul 2017, 16:28

OK. I sent You login details.
Please note that js and xml files are not in 2.360VR but in subfolder of it DabLato.

This code I copy/pasted from chrome 'source' display of page generated by pano2vr so maybe that's why it is not plain text?

I appreciate Your efforts to get it working

Thanks