window.addEventListener("beforeunload", function(event) { submitAnalyticData("page","pagetime",window.pageseconds); clearInterval(window.pagecounter); window.pagecounter = null; }); var baseUrl = "https://" + window.location.hostname; var userLang = navigator.language || navigator.userLanguage; if (os != "Mac OS" && os != "iOS") { //userLang = userLang.substring(0,2); } /* //For debug puposes var old = alert; alert = function() { console.log(new Error().stack); old.apply(window, arguments); }; */ var sPath = document.getElementById('postname').value; var model = ""; let mpSdk; var tourtype = "matterport"; var ppInMpControls = "1"; var clickedObjPos = ""; var clickedObjRot = ""; var clickedObjSca = ""; var initialLoad = 0; var gsPlayed = []; var sweepDivExists = 0; var gsPlaying = ""; var clickedObjParentName = ""; var srcImageData = ""; var movingVid = false; var mainScene; var vidInterval; var poseCache; var intersectionCache; var hastags = 0; var isPaused = false; var endticker = false; var currentSweepArray = []; var sweepLookupArray = []; var defdesc = "Click tag to learn more"; var deftitle = ""; var sweepCollection = []; var tagOrDest = ""; var mobile = false; var hasMouse = false; var hasTouch = false; var firstcurvedposition; var sweepstarted = false; var toggletranscripts = 1; var thisVideo; var posevar = null; var newsrc = "" var tickertime = 0; var hlsObj = {}; var tagcollection = []; if (/Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { mobile = true; } if (window.matchMedia("(any-pointer: coarse)").matches) { hasTouch = true; } if (window.matchMedia('(pointer:fine)').matches) { hasMouse = true; } var iPad = false; if (navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2) { iPad = true; } var iframe = document.getElementById("showcase_iframe"); let root = document.documentElement; var intersectionCache; var initialVar = 0; var moveTo; var startButton; var hrExists; var tId = null; var xcoord = null; var ycoord = null; var zcoord = null; var stem_coord = null; var lookup = []; var tag; var addTagBtn; var addFixedTagBtn; var addingTag = false; var movingTag = false; var newTag; var divcameraPose; var addFixedTag; var mediatype = ""; var mediacss = ""; var naturalHeight = 0; var naturalWidth = 0; var sinaturalHeight = 0; var sinaturalWidth = 0; var vidRecordButton = ""; var showcase; var imghover = true; var vidhover = true; var img2hover = true; var iframe = document.getElementById("showcase_iframe"); var newVideo = { "version": "1.0", "payload": { "objects": [{ "name": "newvideo", "position": { "x": -46.73015522489656, "y": 4.136230325017732, "z": -20.15128976879792 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 0.01 }, "components": [{ "type": "mp.videoRenderer", "inputs": { "src": baseUrl + "/media/3jsvidholder.mp4", "transcript": "", } }, { "type": "mp.planeRenderer", "inputs": { "transparent": false, "localScale": { "x": 0.8, "y": 0.8, "z": 0.8 }, "localPosition": { "x": 0, "y": 0, "z": 0 } } }, { "type": "mp.toggleState", "inputs": { "initialState": false } }, { "type": "mp.planeRenderer", "inputs": { "transparent": true, "opacity": 0.8, "localScale": { "x": 0.8, "y": 1.5, "z": 0.8 }, }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true } }, { "type": "mp.canvasRenderer", "inputs": { "textureRes": { "w": 1024, "h": 1024 } } }, { "type": "mp.canvasBorder", "inputs": { "position": { "x": 0, "y": 0 }, "size": { "h": 1024, "w": 1024 }, "radius": 50 } }, { "type": "mp.planeRenderer", "inputs": { "localScale": { "x": 0.1, "y": 0.1, "z": 1 }, "localPosition": { "x": 0.32, "y": -0.32, "z": 0.01 }, "transparent": true }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true } }, { "type": "mp.canvasRenderer", "inputs": { "textureRes": { "w": 128, "h": 128 } } }, { "type": "mp.canvasImage", "inputs": { "src": baseUrl + "/media/volume_on.png", "srcPosition": { "x": 0, "y": 0, "z": 0 }, "srcSize": { "w": 128, "h": 128 }, "destPosition": { "x": 0, "y": 0, "z": 0 }, "destSize": { "w": 128, "h": 128 } } }, { "type": "mp.planeRenderer", "inputs": { "localScale": { "x": 0.1, "y": 0.1, "z": 1.0 }, "localPosition": { "x": 0.32, "y": -0.32, "z": 0.01 }, "transparent": true }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true } }, { "type": "mp.canvasRenderer", "inputs": { "textureRes": { "w": 128, "h": 128 } } }, { "type": "mp.canvasImage", "inputs": { "src": baseUrl + "/media/volume_off.png", "srcPosition": { "x": 0, "y": 0, "z": 0 }, "srcSize": { "w": 128, "h": 128 }, "destPosition": { "x": 0, "y": 0, "z": 0 }, "destSize": { "w": 128, "h": 128 } } }], "bindings": [ [0, "play", 2, "state"], [1, "texture", 0, "texture"], [4, "painter", 5, "painter"], [3, "texture", 4, "texture"], [3, "aspect", 0, "aspect"], [7, "painter", 8, "painter"], [6, "texture", 7, "texture"], [6, "visible", 2, "negated"], [10, "painter", 11, "painter"], [9, "texture", 10, "texture"], [9, "visible", 2, "state"] ], "events": [ [2, "toggle", 0, "INTERACTION.CLICK"], [2, "toggle", 9, "INTERACTION.CLICK"], [2, "toggle", 6, "INTERACTION.CLICK"], [10, "repaint", 11, "paint.ready"], [7, "repaint", 8, "paint.ready"] ] }, ] } }; var newcurvedVideo = { "version": "1.0", "payload": { "objects": [{ "name": "newvideo", "position": { "x": -0.443, "y": 5.78, "z": 6.612 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "components": [{ "type": "mp.curvedVideoRenderer", "inputs": { "src": baseUrl + "/media/olympiawelcome.mp4", "transcript": "", "sweepEnable": null, "startSweep": null, "endSweep": null } }, { "type": "mp.planeRenderer", "inputs": { "transparent": false, "localScale": { "x": 0.8, "y": 0.8, "z": 0.8 }, "localPosition": { "x": 0, "y": 0, "z": 0 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, "curveDepth": 1 } }, { "type": "mp.toggleState", "inputs": { "initialState": false } }], "bindings": [ [0, "play", 2, "state"], [1, "texture", 0, "texture"], ], "events": [ [2, "toggle", 0, "INTERACTION.CLICK"] ] }, ] } }; var newImage = { "version": "1.0", "payload": { "objects": [{ "name": "newimage", "position": { "x": 3.966, "y": 0.5, "z": -2.221 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 0.01 }, "components": [{ "type": "mp.planeRenderer", "inputs": { "transparent": false, "localScale": { "x": 1, "y": 1, "z": 1 }, "localPosition": { "x": 0, "y": 0, "z": 0 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, "transparent": true }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true } }, { "type": "mp.canvasRenderer", "inputs": { "textureRes": { "w": 1024, "h": 1024 } } }, { "type": "mp.canvasImage", "inputs": { "src": baseUrl + "/media/c3daddimage.png", "dest": "", "tagdetails": { "tagTitle": "", "tagDesc": "", "tagmedia": "", }, "srcPosition": { "x": 0, "y": 0, "z": 0 }, "srcSize": { "w": 128, "h": 128 }, "destPosition": { "x": 0, "y": 0, "z": 0 }, "destSize": { "w": 1024, "h": 1024 } } }, ], "bindings": [ [0, "texture", 1, "texture"], [1, "painter", 2, "painter"] ], "events": [ [1, "repaint", 2, "paint.ready"] ] }, ] } }; var newGreenscreen = { "version": "1.0", "payload": { "objects": [{ "name": "newgreenscreen", "position": { "x": 10.966, "y": 0.7, "z": -1.221 }, "rotation": { "x": 0, "y": -60, "z": 0 }, "scale": { "x": 3.5, "y": 2, "z": 0.01 }, "components": [{ "type": "mp.greenscreen", "inputs": { "src": baseUrl + "/media/gstest2.mp4", "muted": true, "transcript": "", "chromakey": "lime", "radius": 3, }, "events": { "INTERACTION.CLICK": true }, }, ], }, ] } }; var newBox = { "version": "1.0", "payload": { "objects": [{ "name": "newbox", "position": { "x": 0, "y": 0, "z": 0 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 0.5, "y": 0.5, "z": 0.5 }, "components": [{ "type": "mp.box", "inputs": { "localScale": { "x": 1, "y": 1, "z": 1 }, "localPosition": { "x": 0, "y": 0, "z": 0 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, "tagdetails": { "tagTitle": "", "tagDesc": "", "tagmedia": "", }, "dest": "", }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true }, }, ], }, ] } }; var newSvg = { "version": "1.0", "payload": { "objects": [{ "name": "newButton", "position": { "x": 3.966, "y": 0.5, "z": -2.221 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 0.01 }, "components": [{ "type": "mp.buttonRenderer", "inputs": { "transparent": false, "localScale": { "x": 1, "y": 1, "z": 1 }, "localPosition": { "x": 0, "y": 0, "z": 0 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, "tagdetails": { "tagcolor": "FF00FF", "tagbg": "00FFFF", "tagIcon": "bitcoin", "tagTitle": "", "tagDesc": "", "tagmedia": "", }, "animation": "Pulse", "dest": "", }, "events": { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true } } ], }, ] } }; var newGltf = { "version": "1.0", "payload": { "objects": [{ "name": "newgltf", "position": { "x": 3.966, "y": 0, "z": -2.221 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "components": [{ "type": "mp.gltfLoader", "inputs": { "url": baseUrl + "/assets/3d_models/RSG_Leather_Chair.glb", "localScale": { "x": 1, "y": 1, "z": 1 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, "castShadow": true, }, "events": { "INTERACTION.CLICK": true, } }, { "type": "mp.directionalLight", "inputs": { "enabled": true, "name": "objectDirectional", "localPosition": { "x": 0, "y": 0, "z": 0 }, "color": { r: 1, g: 1, b: 1 }, "intensity": dirLightAllocated / dirLightSources, "sensor": false, "debug": false, "castShadow": false, }, }, { "type": "mp.spotLight1", "inputs": { "enabled": true, "color": { r: 1, g: 1, b: 1 }, "intensity": 0, "decay": 2, "angle": 0.3, "localPosition": { x: -1, y: 3, z: -1 }, "castShadow": false, }, }, { "type": "mp.spotLight2", "inputs": { "enabled": true, "color": { r: 1, g: 1, b: 1 }, "intensity": 0, "decay": 2, "angle": 0.3, "localPosition": { x: -1, y: 0.1, z: -1 }, "castShadow": false, }, }, { "type": "mp.shadowGeometry", "inputs": { "angleValue": 0, "radiusValue": 0, "sensor": false, "top": 2, "bottom": -2, "left": -2, "right": 2, "near": 2, "far": 2, "localScale": { "x": 1, "y": 1, "z": 1 }, "localRotation": { "x": 0, "y": 0, "z": 0 }, }, }, ], }, ] } }; var newFbx = { "version": "1.0", "payload": { "objects": [{ "name": "newfbx", "position": { "x": 3.966, "y": 0, "z": -2.221 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "components": [{ "type": "mp.fbxLoader", "inputs": { "url": baseUrl + "/assets/3d_models/ArmChair3.fbx", "localScale": { "x": 1, "y": 1, "z": 1 }, "localRotation": { "x": 0, "y": 90, "z": 0 }, "castShadow": true, }, "events": { "INTERACTION.CLICK": true } }, { "type": "mp.ambientLight", "inputs": { "enabled": true, "color": { r: 1, g: 1, b: 1 }, "intensity": 0.5, "position": { x: 0, y: 1, z: 0 }, "castShadow": false, }, }, { "type": "mp.pointLight", "inputs": { "enabled": true, "color": { r: 1, g: 1, b: 1 }, "intensity": 0.5, "position": { x: 0, y: 1.5, z: 0 }, "castShadow": false, }, }, { "type": "mp.directionalLight", "inputs": { "enabled": true, "color": { r: 1, g: 1, b: 1 }, "intensity": 0, "position": { x: 1, y: 5, z: -1 }, "target": { x: -1, y: 0, z: 1 }, "debug": true, "castShadow": true, }, }, { "type": "mp.shadowGeometry", }, ], }, ] } }; if (tourtype == "matterport") { var iframeWidth = iframe.clientWidth; // Token and Owner will be defined in PHP. var token = "TO BE ADDED"; var owner = 0; const config = { attributes: true, childList: true, subtree: true }; if (sPath != "tagbuilder" && sPath != "tagbuilderdev") { const iframechange = async function(mutationsList, observer) { for(const mutation of mutationsList) { if (mutation.attributeName == "src") { if (typeof iframe.src != "undefined" && iframe.src != "") { iframe.addEventListener("load", async function() { //$("#loading-gui").fadeOut(1000); if (owner == 1 && token != null) { try { console.log("LOGGING IN WITH OAUTH"); mpSdk = await iframe.contentWindow.MP_SDK.connect(iframe, {auth: token}); loadedShowcaseHandler(mpSdk); console.log("SDK LOADED"); mpSdk.Camera.pose.subscribe(function(pose) { posevar = pose; }); } catch (e) { console.error(e); return; } } else { try { //Key needs removing on oAuth Implementation mpSdk = await iframe.contentWindow.MP_SDK.connect(iframe, 'bc2c9f62713a42acba1d0a00d5b8c81c'); loadedShowcaseHandler(mpSdk); console.log("SDK LOADED"); mpSdk.Camera.pose.subscribe(function(pose) { posevar = pose; }); } catch (e) { console.error(e); return; } } }); } } } } const observer = new MutationObserver(iframechange); observer.observe(iframe, config); } else { if (typeof iframe.src != "undefined" && iframe.src != "") { iframe.addEventListener("load", async function() { setTimeout(async function() { var hasPwBox = $("#showcase_iframe").contents().find(".sc-password-form"); if (hasPwBox.length > 0) { $("#loading-gui").fadeOut(1000); var submitButton = iframe.contentWindow.document.getElementsByClassName("sc-password-submit"); submitButton[0].addEventListener("click", async function () { try { //Key needs removing on oAuth Implementation mpSdk = await iframe.contentWindow.MP_SDK.connect(iframe, 'bc2c9f62713a42acba1d0a00d5b8c81c'); loadedShowcaseHandler(mpSdk); console.log("SDK LOADED"); mpSdk.Camera.pose.subscribe(function(pose) { posevar = pose; }); } catch (e) { console.error(e); return; } }); } else { if (owner == 1 && token != null) { try { mpSdk = await iframe.contentWindow.MP_SDK.connect(iframe, {auth: token}); loadedShowcaseHandler(mpSdk); console.log("SDK LOADED"); mpSdk.Camera.pose.subscribe(function(pose) { posevar = pose; }); } catch (e) { console.error(e); return; } } else { try { //Key needs removing on oAuth Implementation mpSdk = await iframe.contentWindow.MP_SDK.connect(iframe, 'bc2c9f62713a42acba1d0a00d5b8c81c'); loadedShowcaseHandler(mpSdk); console.log("SDK LOADED"); mpSdk.Camera.pose.subscribe(function(pose) { posevar = pose; }); } catch (e) { console.error(e); return; } } } },400) }) } } }; function uuidv4() { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } var isMac = navigator.platform.toUpperCase().indexOf('MAC') var userAgent = window.navigator.userAgent, platform = window.navigator.platform, macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K', ], windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], iosPlatforms = ['iPhone', 'iPad', 'iPod'], os = null; var isMacLike = /(Mac)/i.test(window.navigator.platform); if (isMacLike) { os = 'Mac OS'; } if (iosPlatforms.indexOf(platform) !== -1) { os = 'iOS'; } else if (windowsPlatforms.indexOf(platform) !== -1) { os = 'Windows'; } else if (/Android/.test(userAgent)) { os = 'Android'; } else if (!os && /Linux/.test(platform)) { os = 'Linux'; } if (document.getElementById('editmodel')) { var editmodel = document.getElementById('editmodel').value; } if (document.getElementById('version')) { var version = document.getElementById('version').value; } var noSign = false; var listened = []; var initialPose = 0; window.addEventListener('message', event => { //IMPORTANT: check the origin of the data! if (event.origin.startsWith(baseUrl)) { // The data was sent from your site. // Data sent with postMessage is stored in event.data: if (event.data == "close") { $("#monitor").attr("hidden", true); } } }); window.addEventListener('DOMContentLoaded', (event) => { if (document.getElementById('loading-header') == null && document.getElementById('loading-subheader') == null) { $('head').append(''); } $("#enableTs").on('change', function() { if (enableTs.checked) { hearingimpaired = 1; } else { hearingimpaired = 0; } }); $('.burgerholder').on('click', function() { if ($(".navsubmenu").hasClass("showing")) { } var thisSubMenu = $(this).closest(".burgerMenuItem").children(".navsubmenu"); if (thisSubMenu.hasClass('showing')) { thisSubMenu.addClass('collapsed').removeClass('showing'); } else { thisSubMenu.addClass('showing').removeClass('collapsed'); } }); $('#audiotoggle').on('click', function() { if ($('#navHeader').hasClass('showing')) { $('#navHeader').addClass('collapsed').removeClass('showing'); $('#navdivider').addClass('collapsed').removeClass('showing'); $('#icon-left').removeAttr('hidden', true); $('#icon-right').attr('hidden', true); $('#navDiv').addClass('collapsed').removeClass('showing'); } else { $('#navHeader').addClass('showing').removeClass('collapsed'); $('#navdivider').addClass('showing').removeClass('collapsed'); $('#navDiv').addClass('showing').removeClass('collapsed'); $('#icon-right').removeAttr('hidden'); $('#icon-left').attr('hidden', true); } }); if (document.getElementById("myStartButton") == null) { startButton = document.getElementById('loader-cont'); } else { startButton = document.getElementById("myStartButton") } if (typeof cssFg !== 'undefined') { root.style.setProperty('--cssForeground', "#" + cssFg); root.style.setProperty('--cssBackground', "#" + cssBg); root.style.setProperty('--cssTextColor', "#" + cssTxt); root.style.setProperty('--cssFontFamily', "#" + cssFontFamily); } else { root.style.setProperty('--cssForeground', "#38b6ff"); root.style.setProperty('--cssBackground', "#000000"); root.style.setProperty('--cssTextColor', "#ffffff"); root.style.setProperty('--cssFontFamily', "#" + "Roboto"); } $("body").css("font-family", cssFontFamily); modelExists = document.getElementById("model"); if (modelExists) { model = document.getElementById('model').value; } if (startButton) { function buttonxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { var buttontitle = $("#myStartButton").html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) buttontitle = response.title; $('#myStartButton').css("width", "auto"); $('#myStartButton').html(buttontitle); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + buttontitle + "&description=&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); } } } buttonxmlHReq(); function bespokexmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { var bespoketitle = $("#loading-header").html(); var bespokedesc = $("#subheaderspan").html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) bespoketitle = response.title; bespokedesc = response.description; $('#loading-header').html(bespoketitle); $('#subheaderspan').html(bespokedesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + bespoketitle + "&description=" + bespokedesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); } } } bespokexmlHReq(); function fpxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { var fptitle = "EXPLORE 3D SPACE"; var fpdesc = "POWERED BY"; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) fptitle = response.title; fpdesc = response.description; $('#loading-subheader').html(fptitle); $('.loading-label').html(fpdesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + fptitle + "&description=" + fpdesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); } } } if (customintro != "1") { fpxmlHReq(); } translatestatics(); function translatestatics() { function defxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) deftitle = response.title; defdesc = response.description; } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + deftitle + "&description=" + defdesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); } } } defxmlHReq(); function navxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { var navtitle = ""; var navdesc = $("#navHeader").html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) navtitle = response.title; navdesc = response.description; $('#navHeader').html(navdesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + navtitle + "&description=" + navdesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); } } } navxmlHReq(); function menuheadxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.burgerdesc').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } menuheadxmlHReq(); function menuxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.movetoSweep').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } menuxmlHReq(); function navmenuxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.movetoNavSweep').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } navmenuxmlHReq(); function vidmenuxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.movetoVideoSweep').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } vidmenuxmlHReq(); function codemenuxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.movetoCodeSweep').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } codemenuxmlHReq(); function extmenuxmlHReq() { if (baselanguage != userLang) { if (dotranslation == "1") { $('.movetoMediaSweep').each(function() { var currentElement = $(this); menutitle = ""; menudesc = currentElement.html(); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText) title = response.title; menudesc = response.description; currentElement.html(menudesc); } } } xmlhttp.open("GET", baseLoc + "/translate.php?model=" + model + "&version=" + version + "&title=" + menutitle + "&description=" + menudesc + "&lang=" + userLang + "&baselanguage=" + baselanguage, true); xmlhttp.send(); }) } } } extmenuxmlHReq(); } if (mobile) { if (mobile && !iPad) { if (document.body.clientWidth > document.body.clientHeight) { $("#loading-subheader").html("PLEASE SWITCH TO PORTRAIT MODE TO START YOUR EXPERIENCE"); } else { $("#loading-subheader").html(subheader); } } $(".loading-label").css("display", "none"); $("#loading-mp-logo").css("display", "none"); $(".sharereplace").css("display", "none"); } if (fs == 1 || mobile) { try { if (document.body.requestFullscreen) { document.body.requestFullscreen(); } else if (document.mozRequestFullScreen) { /* Firefox */ iframe.mozRequestFullScreen(); } else if (document.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ document.webkitRequestFullscreen(); } else if (document.msRequestFullscreen) { /* IE/Edge */ document.msRequestFullscreen(); } } catch (error) { console.error(error); } } if (newQuery.includes("play=1") && !mobile) { $('#loading-gui').addClass('collapsed'); $('#loading-background').addClass('collapsed'); $('#framecontainer').addClass('showing'); if ($(document).height() <= 700 && !mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } document.body.addEventListener('click', event => { audio = new Audio(); audio.id = "audio"; audio.controls = true; audio.src = baseUrl + "/media/1sec.mp3"; audio.volume = 1; audio.load(); audio.play(); if (os != "iOS" && os != "Mac OS") { if ('webkitAudioContext' in window) { bgcontext = new webkitAudioContext(); } else { bgcontext = new AudioContext(); } source2 = bgcontext.createMediaElementSource(audio); gainNode2 = bgcontext.createGain(); gainNode2.gain.setValueAtTime(0.001, bgcontext.currentTime); source2.connect(gainNode2); gainNode2.connect(bgcontext.destination); if (typeof bgAudio !== 'undefined') { if (!bgAudio == "") { if (bgAudio.includes(window.location.hostname)) { audioBG = new Audio(bgAudio); } else { audioBG = new Audio("https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + bgAudio); } audioBG.crossOrigin = "anonymous"; audioBG.play(); source = bgcontext.createMediaElementSource(audioBG); gainNode = bgcontext.createGain(); gainNode.gain.setValueAtTime(0.3, bgcontext.currentTime); source.connect(gainNode); gainNode.connect(bgcontext.destination); audioBG.addEventListener('ended', function() { this.currentTime = 0; this.play(); }, false); } } } else { $("#bgButtonHolder").css("display", "none"); } }); } else { startButton.addEventListener('click', event => { ; if (newQuery != "") { newQuery = '&' + newQuery; } if (fs == 1 || mobile) { if (document.body.requestFullscreen) { document.body.requestFullscreen(); } else if (document.mozRequestFullScreen) { /* Firefox */ iframe.mozRequestFullScreen(); } else if (document.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ document.webkitRequestFullscreen(); } else if (document.msRequestFullscreen) { /* IE/Edge */ document.msRequestFullscreen(); } } if (bg_delay == 1) { if ($(".introVideo").is("img")) { console.log("IMAGE BG DELAY"); var header = document.getElementById("loading-header"); var subtitle = document.getElementById("loading-subheader"); var background = document.getElementById("loading-gui"); $(".lds-ring").fadeIn(1000); $("#loading-header").fadeOut(1000); $("#loading-subheader").fadeOut(1000); $("#loader-cont").fadeOut(1000); $("#myStartButton").fadeOut(1000); $("#enableTranscripts").css("opacity", 0); $('#tint').animate({ backgroundColor: 'rgba(0,0,0,0)' }, 'slow'); var thisI = 0; setTimeout(function() { if ($(document).height() <= 700 && !mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { if (mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } } var sdkInterval = setInterval(function() { if (mpSdk != null) { //mpSdk.App.state.subscribe(function(appState) { if (posevar != null && posevar.mode == "mode.dollhouse") { clearInterval(sdkInterval); sdkInterval = null; if (thisI == 0) { if (os != "iOS" && os != "Mac OS") { if ('webkitAudioContext' in window) { bgcontext = new webkitAudioContext(); } else { bgcontext = new AudioContext(); } source2 = bgcontext.createMediaElementSource(audio); gainNode2 = bgcontext.createGain(); gainNode2.gain.setValueAtTime(0.001, bgcontext.currentTime); source2.connect(gainNode2); gainNode2.connect(bgcontext.destination); if (typeof bgAudio !== 'undefined') { if (!bgAudio == "") { if (bgAudio.includes(window.location.hostname)) { audioBG = new Audio(bgAudio); } else { audioBG = new Audio("https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + bgAudio); } audioBG.crossOrigin = "anonymous"; audioBG.play(); source = bgcontext.createMediaElementSource(audioBG); gainNode = bgcontext.createGain(); gainNode.gain.setValueAtTime(0.3, bgcontext.currentTime); source.connect(gainNode); gainNode.connect(bgcontext.destination); audioBG.addEventListener('ended', function() { this.currentTime = 0; this.play(); }, false); } } } else { $("#bgButtonHolder").css("display", "none"); } thisI = thisI + 1; } $(".lds-ring").fadeOut(1000); $('#framecontainer').fadeIn(1000); $('#loading-gui').fadeOut(1000); } //}); } }, 50); }, 2000); } else { console.log("BG DELAY VIDEO"); var subtitle = document.getElementById("loading-subheader"); var background = document.getElementById("loading-gui"); $("#loading-header").fadeOut(1000); $("#loading-subheader").fadeOut(1000); $("#myStartButton").fadeOut(1000); $("#enableTranscripts").css("opacity", 0); $('#tint').animate({ backgroundColor: 'rgba(0,0,0,0)' }, 'slow'); var introvideo = document.getElementsByClassName('introVideo')[0]; var skipbutton = document.createElement("button"); skipbutton.id = "skipbutton"; skipbutton.innerHTML = "SKIP VIDEO"; skipbutton.addEventListener("click", function() { $("#skipbutton").fadeOut(1000); var ended = introvideo.duration; introvideo.currentTime = ended; }) skipbutton.style = style = "left: calc(40vw - 100px);background-color:#" + cssBg + "; border:2px solid #" + cssFg + "; border-radius:80px; line-height:2.6em; height:3em; width:200px; color: #" + cssTxt + "; font-weight: 400; font-size: 16px;"; if (document.getElementById("myStartButton") != null) { document.getElementById("loader-cont").removeChild(document.getElementById("myStartButton")); document.getElementById("loader-cont").appendChild(skipbutton); } introvideo.currentTime = 0; introvideo.muted = false; introvideo.removeAttribute("loop"); introvideo.onended = function() { $(".lds-ring").fadeIn(1000); if ($(document).height() <= 700 && !mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { if (mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } } var thisI = 0; var sdkInterval = setInterval(function() { if (mpSdk != null) { mpSdk.App.state.subscribe(function(appState) { if (appState.phase == "appphase.starting" || appState.phase == "appphase.playing") { clearInterval(sdkInterval); sdkInterval = null; if (thisI == 0) { if (os != "iOS" && os != "Mac OS") { if ('webkitAudioContext' in window) { bgcontext = new webkitAudioContext(); } else { bgcontext = new AudioContext(); } source2 = bgcontext.createMediaElementSource(audio); gainNode2 = bgcontext.createGain(); gainNode2.gain.setValueAtTime(0.001, bgcontext.currentTime); source2.connect(gainNode2); gainNode2.connect(bgcontext.destination); if (typeof bgAudio !== 'undefined') { if (!bgAudio == "") { if (bgAudio.includes(window.location.hostname)) { audioBG = new Audio(bgAudio); } else { audioBG = new Audio("https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + bgAudio); } audioBG.crossOrigin = "anonymous"; audioBG.play(); source = bgcontext.createMediaElementSource(audioBG); gainNode = bgcontext.createGain(); gainNode.gain.setValueAtTime(0.3, bgcontext.currentTime); source.connect(gainNode); gainNode.connect(bgcontext.destination); audioBG.addEventListener('ended', function() { this.currentTime = 0; this.play(); }, false); } } } else { $("#bgButtonHolder").css("display", "none"); } thisI = thisI + 1; } $(".lds-ring").fadeOut(2000); $('#framecontainer').fadeIn(3000); $('#loading-gui').fadeOut(2000); } }); } }, 50); } } } else { console.log("NO BG DELAY "); $(".lds-ring").fadeIn(1000); $("#loading-header").fadeOut(1000); $("#loading-subheader").fadeOut(1000); $("#myStartButton").fadeOut(1000); $('#loading-powered-by').fadeOut(1000); $("#circleLoader").fadeOut(1000); $("#enableTranscripts").fadeOut(1000); if ($(document).height() <= 700 && !mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { if (mobile) { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } else { iframe.src = baseUrl + '/bundle/showcase.php?m=' + model + '&play=1' + newQuery + '&applicationKey=bc2c9f62713a42acba1d0a00d5b8c81c&title=0&useLegacyIds=0'; } } var thisI = 0; var sdkInterval = setInterval(function() { if (mpSdk != null) { mpSdk.App.state.subscribe(function(appState) { if (appState.phase == "appphase.starting" || appState.phase == "appphase.playing") { clearInterval(sdkInterval); if (thisI == 0) { if (os != "iOS" && os != "Mac OS") { if ('webkitAudioContext' in window) { bgcontext = new webkitAudioContext(); } else { bgcontext = new AudioContext(); } source2 = bgcontext.createMediaElementSource(audio); gainNode2 = bgcontext.createGain(); gainNode2.gain.setValueAtTime(0.001, bgcontext.currentTime); source2.connect(gainNode2); gainNode2.connect(bgcontext.destination); if (typeof bgAudio !== 'undefined') { if (!bgAudio == "") { if (bgAudio.includes(window.location.hostname)) { audioBG = new Audio(bgAudio); } else { audioBG = new Audio("https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + bgAudio); } audioBG.crossOrigin = "anonymous"; audioBG.play(); source = bgcontext.createMediaElementSource(audioBG); gainNode = bgcontext.createGain(); gainNode.gain.setValueAtTime(0.3, bgcontext.currentTime); source.connect(gainNode); gainNode.connect(bgcontext.destination); audioBG.addEventListener('ended', function() { this.currentTime = 0; this.play(); }, false); } } } else { $("#bgButtonHolder").css("display", "none"); } thisI = thisI + 1; } $(".lds-ring").fadeOut(1000); $('#framecontainer').fadeIn(1000); $('#loading-gui').fadeOut(1000); } }); } }, 50); } audio = new Audio(); audio.id = "audio"; audio.controls = true; audio.src = baseUrl + "/media/1sec.mp3"; audio.volume = 1; audio.load(); audio.play(); /* for (i = 0; i < scenecomponents.payload.objects.length; i++) { var objName = scenecomponents.payload.objects[i].name; if (objName.substring(0, 5) == "video" || objName.substring(0, 5) == "gsvid") { newsrc = scenecomponents.payload.objects[i].components[0].inputs.src; var video = document.createElement("video"); video.id = objName; video.style.display = "none"; document.body.append(video); video.setAttribute("playsinline", true); video.controls = true; video.crossOrigin = 'anonymous'; video.autoplay = true; video.muted = true; video.loop = false; video.src = baseUrl + "/media/1_sec.mp4" video.load(); video.play(); } } */ for (i = 0; i < scenecomponents.payload.objects.length; i++) { var objName = scenecomponents.payload.objects[i].name; if (objName.substring(0, 5) == "video" || objName.substring(0, 5) == "gsvid") { newsrc = scenecomponents.payload.objects[i].components[0].inputs.src; var video = document.createElement("video"); video.id = objName; video.style.display = "none"; document.body.append(video); video.setAttribute("playsinline", true); video.controls = true; video.crossOrigin = 'anonymous'; video.autoplay = true; video.muted = true; if (objName.substring(0, 5) == "gsvid") { video.loop = false; } else { video.loop = true; } if (newsrc.includes(window.location.hostname)) { video.src = newsrc; video.load(); } else { if (newsrc.substring(newsrc.length - 4, newsrc.length) == "m3u8") { if (Hls.isSupported()) { hls = new Hls({ debug: false, }); hls.loadSource(newsrc); hls.attachMedia(video); video.load(); } else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = newsrc; } } else { video.src = "https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + newsrc; video.load(); } } } } }); } } else { for (i = 0; i < scenecomponents.payload.objects.length; i++) { var objName = scenecomponents.payload.objects[i].name; if (objName.substring(0, 5) == "video" || objName.substring(0, 5) == "gsvid") { var video = document.createElement("video"); video.style.display = "none"; document.body.append(video); video.id = objName; video.setAttribute("hlsname", objName); video.setAttribute("playsinline", true); video.controls = true; video.crossOrigin = 'anonymous'; video.autoplay = true; video.muted = true; if (objName.substring(0, 5) == "gsvid") { video.loop = false; } else { video.loop = true; } video.src = baseUrl + "/media/1_sec.mp4" video.load(); video.play(); } } setTimeout(function() { for (i = 0; i < scenecomponents.payload.objects.length; i++) { var objName = scenecomponents.payload.objects[i].name; if (objName.substring(0, 5) == "video" || objName.substring(0, 5) == "gsvid") { newsrc = scenecomponents.payload.objects[i].components[0].inputs.src; var video = document.getElementById(objName); if (newsrc.includes(window.location.hostname)) { video.src = newsrc; video.load(); } else { if (newsrc.substring(newsrc.length - 4, newsrc.length) == "m3u8") { if (Hls.isSupported()) { var hls = new Hls({ debug: false, }); hls.loadSource(newsrc); hls.attachMedia(video); hlsObj[objName] = hls; video.setAttribute("hlssrc", newsrc); video.load(); } else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = newsrc; } } else { video.src = "https://orange-glade-6ff7.boost3d.workers.dev/corsproxy/?apiurl=" + newsrc; video.load(); } } } } },1100); var audioenable = document.getElementById('enableaudio'); if (audioenable) { audioenable.addEventListener('click', event => { audio = new Audio(); audio.id = "audio"; audio.controls = false; audio.src = baseUrl + "/media/1sec.mp3"; audio.load(); audio.play(); audioenable.setAttribute("hidden", true); if (os != "iOS" && os != "Mac OS") { if ('webkitAudioContext' in window) { bgcontext = new webkitAudioContext(); } else { bgcontext = new AudioContext(); } source2 = bgcontext.createMediaElementSource(audio); gainNode2 = bgcontext.createGain(); gainNode2.gain.setValueAtTime(0.001, bgcontext.currentTime); source2.connect(gainNode2); gainNode2.connect(bgcontext.destination); } }); } } }); var oldPose; async function loadedShowcaseHandler(mpSdk) { /*var params = new Array(); params.push("m") params.push("experience"); console.log(JSON.stringify(mpSdk.Link.CreationPolicy.WINDOW)); await mpSdk.Link.setShareLinkPolicy(mpSdk.Link.CreationPolicy.MATTERPORT); const link = await mpSdk.Link.createLink(); console.log(link); */ function submitPageView () { window.pageseconds = 0; function incrementSeconds() { window.pageseconds += 0.5; } window.pagecounter = setInterval(incrementSeconds, 500); var asset = "page" var type = "pageview" var value = 1; submitAnalyticData(asset,type,value) } submitPageView(); function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } if (sPath != "tagbuilder" && sPath != "tagbuilderdev"){ if (collectdata == "1" && collecttimer != "") { console.log("TIMER") setTimeout(function() { var blockingdiv = document.createElement("div"); blockingdiv.id = "blockingdiv"; blockingdiv.setAttribute("style", "width:100%; height:100%; pointerEvents:none; position:absolute; top:0px; left:0px; z-index:10000; background-color:rgba(255, 255, 255,0.5)"); document.body.appendChild(blockingdiv); var blurrydiv = document.createElement("div"); blurrydiv.id = "modal-background"; blurrydiv.style="position:absolute; top:0px; left:0px; width:100%; height:100%; margin:0px; z-index:10001;"; blurrydiv.classList.add("blurry"); blockingdiv.appendChild(blurrydiv); var contactformmodal = document.createElement("div"); contactformmodal.id = "contactformmodal"; if (!mobile) { if (iframe.clientHeight > 600) { contactformmodal.setAttribute("style", "pointer-events:all; position:relative; width:400px; height:600px; margin-left:calc(50% - 200px); margin-top:calc(50vh - 300px); background-color:rgba(0,0,0,0.75);border:5px solid black; border-radius:10px;"); } else { contactformmodal.setAttribute("style", "pointer-events:all; position:relative; width:400px; height:90vh; overflow:auto; margin-left:calc(50% - 200px); margin-top:5vh; background-color:rgba(0,0,0,0.75);border:5px solid black; border-radius:10px;"); } } else { contactformmodal.setAttribute("style", "pointer-events:all; position:relative; width:90%; height:90%; margin-left:5%; margin-top:5%; background-color:rgba(0,0,0,0.75);border:5px solid black; border-radius:10px;"); } blockingdiv.appendChild(contactformmodal); var formcenter = document.createElement("center"); var formheader = document.createElement("h3"); formheader.style.color = "white"; formheader.innerHTML = "WANT MORE INFO?"; formcenter.append(formheader); contactformmodal.append(formcenter); var divider = document.createElement("div"); divider.style = "width:80%; height:2px; background-color:white;"; formcenter.append(divider); var formdiv = document.createElement("table"); formdiv.style = "width:90%; margin-top:10px; color:white; margin-left:auto; margin-right:auto"; var namediv = document.createElement("tr"); namediv.style.height = "60px"; var namelabel = document.createElement("td"); namelabel.innerHTML = "* NAME: "; namediv.append(namelabel); namelabel.style="width:25%"; var nameinputdiv = document.createElement("td"); var nameinput = document.createElement("input"); nameinput.id="nameinput"; nameinput.setAttribute("type", "text"); nameinput.style=" width:100%; color:black; height:40px;"; nameinputdiv.append(nameinput); namediv.append(nameinputdiv); formdiv.append(namediv); var maildiv = document.createElement("tr"); maildiv.style.height = "60px"; var maillabel = document.createElement("td"); maillabel.innerHTML = "* EMAIL: "; maildiv.append(maillabel); maillabel.style="width:25%"; var mailinputdiv = document.createElement("td"); var mailinput = document.createElement("input"); mailinput.id="mailinput"; mailinput.setAttribute("pattern", ".+@+."); mailinput.setAttribute("type", "email"); mailinput.style=" width:100%; color:black; height:40px;"; mailinputdiv.append(mailinput); maildiv.append(mailinputdiv); formdiv.append(maildiv); var teldiv = document.createElement("tr"); teldiv.style.height = "60px"; var tellabel = document.createElement("td"); tellabel.innerHTML = " TEL: "; teldiv.append(tellabel); tellabel.style="width:25%"; var telinputdiv = document.createElement("td"); var telinput = document.createElement("input"); telinput.id="telinput"; telinput.setAttribute("type", "etel"); telinput.style=" width:100%; color:black; height:40px;"; telinputdiv.append(telinput); teldiv.append(telinputdiv); formdiv.append(teldiv); var formdiv2 = document.createElement("table"); formdiv2.style = "width:90%; margin-top:10px; color:white; margin-left:auto; margin-right:auto"; var msgdiv1 = document.createElement("tr"); msgdiv1.style.height = "60px"; var msglabel = document.createElement("td"); msglabel.innerHTML = "* MESSAGE "; msgdiv1.append(msglabel); msglabel.style="width:100%; text-align:center;"; var msgdiv2 = document.createElement("tr"); msgdiv2.style.height = "60px"; var msginputdiv = document.createElement("td"); var msginput = document.createElement("textarea"); msginput.id="msginput"; msginput.style=" width:100%; color:black; height:150px;"; msginputdiv.append(msginput); msgdiv2.append(msginputdiv); formdiv2.append(msgdiv1); formdiv2.append(msgdiv2); contactformmodal.append(formdiv); contactformmodal.append(formdiv2); var submitdiv = document.createElement("tr"); var submitbuttondiv = document.createElement("td"); submitbuttondiv.style ="text-align:center;"; var submitbutton = document.createElement("button"); submitbutton.innerHTML = "SUBMIT"; submitbutton.classList.add("inputListButton"); submitbutton.style.height = "30px"; submitbuttondiv.append(submitbutton); submitdiv.append(submitbuttondiv); formdiv2.append(submitdiv); var continuediv = document.createElement("tr"); continuediv.style.height = "60px"; var continueholder = document.createElement("td"); continueholder.style = "text-align:center"; continueholder.innerHTML = "OR CLICK HERE TO CONTINUE"; continuediv.append(continueholder); formdiv2.append(continuediv); returnbutton.addEventListener("click", function() { blockingdiv.parentElement.removeChild(blockingdiv); }); submitbutton.addEventListener("click", function() { if (!validateEmail(document.getElementById('mailinput').value)) { alert("YOU MUST ENTER A VALID EMAIL ADDRESS"); return false; } if (document.getElementById('nameinput').value == "") { alert("YOU MUST ENTER A NAME"); return false; } if (document.getElementById('msginput').value == "") { alert("YOU MUST ENTER A MESSAGE"); return false; } var formData = new FormData(); formData.append('tourtitle', document.getElementById('loading-header').innerHTML); formData.append('name', document.getElementById('nameinput').value); formData.append('email', document.getElementById('mailinput').value); formData.append('tel', document.getElementById('telinput').value); formData.append('msg', document.getElementById('msginput').value); formData.append('ownermail', ownermail); var request = new XMLHttpRequest(); request.open('POST', baseLoc + '/sendenquiry.php'); request.setRequestHeader("Cache-Control", "no-cache"); request.send(formData); request.onreadystatechange = function() { if (request.readyState === 4) { if (request.status === 200) { setTimeout(function() { blockingdiv.parentElement.removeChild(blockingdiv); }, 500); } } } }); // whatsappchat = document.createElement("div"); // whatsappchat.innerHTML = "Send Message"; // contactformmodal.append(whatsappchat); }, Number(collecttimer)*1000); } } mpSdk.Sweep.data.subscribe({ onAdded: function(index, item, collection) { sweepCollection.push(item); sweepLookupArray.push(item.uuid); sweepLookupArray.push(item.sid); } }); console.log(tagsdisable); if (tagsdisable == 0) { await mpSdk.Mattertag.getData().then(tags => { return tags.map(tag => tag.sid); }).then(tagSids => { return mpSdk.Mattertag.remove(tagSids) }).catch(console.error); mpSdk.Mattertag.data.subscribe({ onAdded: function(index, item, collection) { tagcollection = collection; }, onRemoved: function(index, item, collection) { tagcollection = collection; } }); } else { mpSdk.Mattertag.data.subscribe({ onAdded: function(index, item, collection) { tagcollection = collection; try { if (qs != 1) { } lookup.push(item.sid); lookup.push(item.sid); } catch (error) { console.error(error); } updateTags(index, item); } }) } if (typeof nArray != 'undefined' && model !="qT76RNg48N6") { for (i = 0; i < nArray.length; i++) { tId = nArray[i].sid; if (tId.length < 20) { hastags = 1; } xcoord = nArray[i].xaxis; ycoord = nArray[i].yaxis; zcoord = nArray[i].zaxis; stem_xcoord = Number(nArray[i].stem_xaxis); stem_ycoord = Number(nArray[i].stem_yaxis); stem_zcoord = Number(nArray[i].stem_zaxis); if (stem_xcoord == "" || isNaN(stem_xcoord)) { stem_xcoord = 0; } if (stem_ycoord == "" || isNaN(stem_ycoord)) { stem_ycoord = 0; } if (stem_zcoord == "" || isNaN(stem_zcoord)) { stem_zcoord = 0; } importTags(i, tId, xcoord, ycoord, zcoord, stem_xcoord, stem_ycoord, stem_zcoord) } } else {} function importTags(i, tId, xcoord, ycoord, zcoord, stem_xcoord, stem_ycoord, stem_zcoord) { try { if (!zcoord || zcoord == null || zcoord == "" || zcoord == "unused_sweep") {} else { if (mArray.indexOf(tId) != -1) { sweepPos = mArray.indexOf(tId); var title = mArray[sweepPos + 4].replace(new RegExp("\\\\", "g"), ""); var description = mArray[sweepPos + 5].replace(new RegExp("\\\\", "g"), ""); var src = mArray[sweepPos + 1]; var type = mArray[sweepPos + 2]; if (type == "VIDEO" || type == "video") { type = mpSdk.Mattertag.MediaType.VIDEO; } if (type == "PHOTO" || type == "photo") { type = mpSdk.Mattertag.MediaType.PHOTO; } if (type == "RICH" || type == "rich") { type = mpSdk.Mattertag.MediaType.RICH; } if (type == "NONE" || type == "none") { type = mpSdk.Mattertag.MediaType.NONE; } } if (vArray.indexOf(tId) != -1) { sweepPos = vArray.indexOf(tId); var title = vArray[sweepPos + 2].replace(new RegExp("\\\\", "g"), ""); var description = vArray[sweepPos + 5].replace(new RegExp("\\\\", "g"), ""); } if (jArray.indexOf(tId) != -1) { sweepPos = jArray.indexOf(tId); var title = jArray[sweepPos + 2].replace(new RegExp("\\\\", "g"), ""); var description = jArray[sweepPos + 3]; if (description == "") { description = "Click the tag to listen"; } else { description = jArray[sweepPos + 3].replace(new RegExp("\\\\", "g"), ""); } } if (cArray.indexOf(tId) != -1) { sweepPos = cArray.indexOf(tId); var title = cArray[sweepPos + 1].replace(new RegExp("\\\\", "g"), ""); var description = cArray[sweepPos + 2].replace(new RegExp("\\\\", "g"), ""); } if (navArray.indexOf(tId) != -1) { sweepPos = navArray.indexOf(tId); var title = navArray[sweepPos + 2].replace(new RegExp("\\\\", "g"), ""); var description = navArray[sweepPos + 4].replace(new RegExp("\\\\", "g"), ""); if (description == "") { description = "Click tag to view more"; } } mpSdk.Mattertag.add([{ label: title, description: description, anchorPosition: { x: Number(xcoord), y: (+ycoord), z: Number(zcoord), }, media: { type: type, src: src }, stemVector: { // make the Mattertag stick straight up and make it 0.30 meters (~1 foot) tall x: stem_xcoord, y: stem_ycoord, z: stem_zcoord, }, color: { // blue disc r: 1.0, g: 0, b: 0, }, stemVisible: false }]).then(newSid => { mpSdk.Mattertag.data.subscribe({ onAdded: function(index, item, collection) { if (index == newSid) { if (lookup.indexOf(index) == -1) { lookup.push(index); lookup.push(tId); } else { lookup.splice(lookup.indexOf(index) + 1, 1, tId); } updateTags(index, item); } } }) }) } } catch (error) { console.error(error); } } function updateTags(index, item) { var tagset = index; var tagDiscPosition = mpSdk.Mattertag.getDiscPosition(item); var xPos = tagDiscPosition.x; var yPos = tagDiscPosition.y; var zPos = tagDiscPosition.z; var realtagPos = lookup.indexOf(tagset); var realtag = lookup[realtagPos + 1]; if (typeof tArray != "undefined" && tArray != null) { var thistag = tArray.indexOf(realtag); if (thistag == -1) { changeLanguage(index, item); } else { var mType = tArray[thistag + 1]; var thistype = tArray[thistag + 2]; var thiscolor = tArray[thistag + 3]; var thisaction = tArray[thistag + 4]; var thisbackground = tArray[thistag + 5]; var thisdefact = tArray[thistag + 7]; if (thisdefact == "c") { if (mArray.indexOf(tagset) != -1) { sweepPos = mArray.indexOf(tagset); var title = mArray[sweepPos + 4]; var description = mArray[sweepPos + 5]; var src = mArray[sweepPos + 1]; var type = mArray[sweepPos + 2]; if (type == "VIDEO" || type == "video") { type = mpSdk.Mattertag.MediaType.VIDEO; } if (type == "PHOTO" || type == "photo") { type = mpSdk.Mattertag.MediaType.PHOTO; } if (type == "RICH" || type == "rich") { type = mpSdk.Mattertag.MediaType.RICH; } if (type == "NONE" || type == "none") { type = mpSdk.Mattertag.MediaType.NONE; } mpSdk.Mattertag.editBillboard(tagset, { label: title, description: description, media: { type: mpSdk.Mattertag.MediaType.NONE, src: '' } }); } if (vArray.indexOf(tagset) != -1) { sweepPos = vArray.indexOf(tagset); var title = vArray[sweepPos + 2]; var description = vArray[sweepPos + 5]; mpSdk.Mattertag.editBillboard(tagset, { label: title, description: description, media: { type: mpSdk.Mattertag.MediaType.NONE, src: '' } }); } if (jArray.indexOf(tagset) != -1) { sweepPos = jArray.indexOf(tagset); var title = jArray[sweepPos + 2]; var description = jArray[sweepPos + 3]; if (description = "") { description = "Click the tag to listen"; } mpSdk.Mattertag.editBillboard(tagset, { label: title, description: description, media: { type: mpSdk.Mattertag.MediaType.NONE, src: '' } }); } if (cArray.indexOf(tagset) != -1) { sweepPos = cArray.indexOf(tagset); var title = cArray[sweepPos + 1]; var description = cArray[sweepPos + 2]; mpSdk.Mattertag.editBillboard(tagset, { label: title, description: description, media: { type: mpSdk.Mattertag.MediaType.NONE, src: '' } }); } if (navArray.indexOf(tagset) != -1) { sweepPos = navArray.indexOf(tagset); var title = navArray[sweepPos + 2]; var description = navArray[sweepPos + 4]; if (description == "") { description = "Click tag to view more"; } mpSdk.Mattertag.editBillboard(tagset, { label: title, description: description, media: { type: mpSdk.Mattertag.MediaType.NONE, src: '' } }); } } } var thisicon = thistype + thiscolor; if (mType == "tag") { mpSdk.Mattertag.registerIcon(thisicon, baseLoc + '/assets/icons/autogenerate.php?icon=' + thistype + '&fill=' + thiscolor + '&background=' + thisbackground); mpSdk.Mattertag.editIcon(tagset, thisicon); if (tagstems == "0") { mpSdk.Mattertag.editPosition(tagset, { anchorPosition: { x: xPos, y: yPos, z: zPos, }, stemVector: { x: 0, y: 0, z: 0, }, stemVisible: false }); } changeLanguage(index, item); } realtag = null; } } mpSdk.Sweep.data.subscribe({ onAdded: function(index, item, collection) { changeLanguage(item.uuid, item); } }); function changeLanguage(index, item) { if (startButton) { builder = "no" } else { builder = "yes"; } if (index.length > 20) { if (typeof tArray != "undefined" && tArray != null) { var wehaveasweep = tArray.indexOf(index); if (wehaveasweep != -1) { var sweepaction = tArray[wehaveasweep + 4]; if (sweepaction == "b3daudio") { if (jArray.includes(index)) { var sweepPos = jArray.indexOf(index); var title = jArray[sweepPos + 2]; var description = jArray[sweepPos + 3]; function xmlHReq(index) { if (baselanguage != userLang) { if (dotranslation == "1") { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText); title = response.title; description = response.description; jArray[sweepPos + 2] = title; jArray[sweepPos + 3] = description; } } } xmlhttp.open("GET", baseLoc + "/translate.php?type=sweep&id=" + index + "&model=" + model + "&version=" + version + "&title=" + title + "&description=" + description + "&lang=" + userLang + "&baselanguage=" + baselanguage + "&builder=" + builder, true); xmlhttp.send(); } } } xmlHReq(index); } } if (sweepaction == "b3dvideo") { if (vArray.includes(index)) { var sweepPos = vArray.indexOf(index); var title = vArray[sweepPos + 2]; var description = vArray[sweepPos + 5]; function xmlHReqVid(index) { if (baselanguage != userLang) { if (dotranslation == 1) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText); title = response.title; description = response.description; vArray[sweepPos + 2] = title; vArray[sweepPos + 5] = description; } } } xmlhttp.open("GET", baseLoc + "/translate.php?type=sweep&id=" + index + "&model=" + model + "&version=" + version + "&title=" + title + "&description=" + description + "&lang=" + userLang + "&baselanguage=" + baselanguage + "&builder=" + builder, true); xmlhttp.send(); } } } xmlHReqVid(index); } } if (sweepaction == "b3dnav") { if (navArray.includes(index)) { var sweepPos = navArray.indexOf(index); var title = navArray[sweepPos + 2]; var description = vArray[sweepPos + 4]; function xmlHReqNav(index) { if (baselanguage != userLang) { if (dotranslation == 1) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText); title = response.title; description = response.description; vArray[sweepPos + 2] = title; vArray[sweepPos + 4] = description; } } } xmlhttp.open("GET", baseLoc + "/translate.php?type=sweep&id=" + index + "&model=" + model + "&version=" + version + "&title=" + title + "&description=" + description + "&lang=" + userLang + "&baselanguage=" + baselanguage + "&builder=" + builder, true); xmlhttp.send(); } } } xmlHReqNav(index); } } if (sweepaction == "b3dext") { if (mArray.includes(index)) { var sweepPos = mArray.indexOf(index); var title = mArray[sweepPos + 4]; var description = mArray[sweepPos + 5]; function xmlHReqExt(index) { if (baselanguage != userLang) { if (dotranslation == 1) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText); title = response.title; description = response.description; mArray[sweepPos + 4] = title; mArray[sweepPos + 5] = description; } } } xmlhttp.open("GET", baseLoc + "/translate.php?type=sweep&id=" + index + "&model=" + model + "&version=" + version + "&title=" + title + "&description=" + description + "&lang=" + userLang + "&baselanguage=" + baselanguage + "&builder=" + builder, true); xmlhttp.send(); } } } xmlHReqExt(index); } } } } } else { if (typeof tArray != "undefined" && tArray != null) { var referenceTag = lookup.indexOf(index); var referenceValue = lookup[referenceTag + 1]; var thistagPos = tArray.indexOf(referenceValue); var thisaction = tArray[thistagPos + 4]; var thisdefact = tArray[thistagPos + 7]; mytag = tArray[thistagPos]; undeftag = index; if (thisaction == "b3daudio") { var sweepPos = jArray.indexOf(referenceValue); transcriptdesc = jArray[sweepPos + 3]; } else { transcriptdesc = ""; } title = item.label; description = item.description; var uc = description.indexOf("]\uff08"); var n = description.indexOf("] ("); if (uc != -1) { var amendedTitle = description.replaceAll("]\uff08", "]("); var amendedTitle2 = amendedTitle.replaceAll("\uff09", ")"); description = amendedTitle2; } if (n != -1) { var amendedTitle = description.replaceAll("] (", "]("); description = amendedTitle; } description = encodeURIComponent(description); function xmlHReq(undeftag) { if (baselanguage != userLang) { if (dotranslation == 1) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { if (this.responseText != "NOT REQUIRED") { var response = JSON.parse(this.responseText); title = response.title; var uc = response.description.indexOf("]\uff08"); var n = response.description.indexOf("] ("); if (uc != -1) { var amendedTitle = response.description.replaceAll("]\uff08", "]("); var amendedTitle2 = amendedTitle.replaceAll("\uff09", ")"); description = response.description = amendedTitle2; } if (n != -1) { var amendedTitle = response.description.replaceAll("] (", "]("); description = response.description = amendedTitle; } if (thisaction == "b3daudio") { jArray[sweepPos + 3] = response.transcriptdesc; } dType = item.media.type; source = item.media.src; mpSdk.Mattertag.editBillboard(undeftag, { label: response.title, description: response.description, media: { type: dType, src: source } }); } } } xmlhttp.open("GET", baseLoc + "/translate.php?type=tag&id=" + referenceValue + "&model=" + model + "&version=" + version + "&title=" + title + "&description=" + description + "&transcriptdesc=" + transcriptdesc + "&lang=" + userLang + "&builder=" + builder, true); xmlhttp.send(); } } } xmlHReq(undeftag); } } } const scene = (await mpSdk.Scene.query(['scene']))[0]; /* scene.traverse(child => { if (child.name == "Skysphere") { var topcolor = new THREE.Vector3(0.419,0.6156862745098039,1); var bottomcolor = new THREE.Vector3(0.1,1,0.1); child.material.uniforms.topColor.value = topcolor; child.material.uniforms.bottomColor.value = bottomcolor; child.material.uniformsNeedUpdate = true; } }) */ iframe.focus(); mpSdk.Camera.pose.subscribe(function(pose) { var toSweep = pose.sweep; var to = sweepLookupArray[sweepLookupArray.indexOf(toSweep) - 1]; if (initialVar == 0) { if (pose.mode == "mode.inside" || pose.mode == "mode.outside") { submitAnalyticData(toSweep,"sweepenter",1); window.sweepseconds = 0; function incrementSeconds() { window.sweepseconds += 0.5; } window.sweepcounter = setInterval(incrementSeconds, 500); if (typeof tArray != "undefined" && tArray != null) { var thistagPos = tArray.indexOf(to); var thistag = tArray[thistagPos]; if (thistagPos != -1) { var thisaction = tArray[thistagPos + 4]; var thistype = tArray[thistagPos + 1]; var hasAudio = tArray[thistagPos + 6]; if (thisaction == "b3daudio" || hasAudio == "YES") { if (baselanguage != userLang) { if (dotranslation == "1") { setTimeout(function() { audioplay(thistype, thistag); }, 1500); } else { audioplay(thistype, thistag); } } else { audioplay(thistype, thistag); } } if (thisaction == "b3dvideo") { if (baselanguage != userLang) { if (dotranslation == "1") { setTimeout(function() { videoplay(thistype, thistag); }, 1500); } } else { videoplay(thistype, thistag); } } if (thisaction == "b3dnav") {} if (thisaction == "b3dext") { if (baselanguage != userLang) { if (dotranslation == "1") { setTimeout(function() { mediaplay(thistype, thistag); }, 1500); } } else { mediaplay(thistype, thistag); } } if (thisaction == "b3dcode") { executeCode(thistag); } if (thisaction == "b3dimage") { imageplay(thistype, thistag); } if (thisaction == "b3dgallery") { galleryplay(thistype, thistag); } } } initialVar = 1; } if (rb != "0") { if (iframe.clientWidth > 1000) { $('#vflex').addClass('showing').removeClass('hidden'); $('#audiotoggle').addClass('showing').removeClass('collapsed'); $('#navHeader').addClass('showing').removeClass('collapsed'); $('#navdivider').addClass('showing').removeClass('collapsed'); $('#navDiv').addClass('showing').removeClass('collapsed'); $('#icon-right').removeAttr('hidden'); $('#icon-left').attr('hidden', true); } else { $('#vflex').addClass('showing').removeClass('hidden'); $('#audiotoggle').addClass('showing').removeClass('collapsed'); $('#icon-left').removeAttr('hidden'); } } } }); var bottomControls = iframe.contentWindow.document.getElementById("bottom-ui"); var buttonlist = iframe.contentWindow.document.getElementsByClassName("collapsible-list-items")[0]; if (os != "iOS" && os != "Mac OS") { if (typeof bgAudio != "undefined" && bgAudio != "") { var musicdiv = iframe.contentWindow.document.createElement("div"); musicdiv.id = "musicDiv"; musicdiv.role = "button"; musicdiv.classList.add("icon-button", "button-interactive", "mode-music"); musicdiv.innerHTML = ""; musicdiv.style.paddingTop = "4px"; musicdiv.style.paddingLeft = "6px"; musicdiv.style.paddingRight = "6px"; musicdiv.style.paddingBottom = "4px"; musicdiv.style.fontSize = "22px"; musicdiv.style.filter = "drop-shadow( 2px 2px 1px rgba(0, 0, 0, .7))"; musicdiv.setAttribute("data-balloon", "Background music on/off"); buttonlist.appendChild(musicdiv); musicdiv.addEventListener("click", function() { if (audioBG.paused) { audioBG.play(); musicdiv.style.paddingTop = "4px"; musicdiv.style.paddingLeft = "6px"; musicdiv.style.paddingRight = "6px"; musicdiv.style.paddingBottom = "4px"; musicdiv.innerHTML = ""; } else { audioBG.pause(); musicdiv.style.paddingTop = "4px"; musicdiv.style.paddingLeft = "9px"; musicdiv.style.paddingRight = "9px"; musicdiv.style.paddingBottom = "4px"; musicdiv.innerHTML = ""; } }) } } if (hearingimpaired == 1) { var hearingdiv = iframe.contentWindow.document.createElement("div"); hearingdiv.role = "button"; hearingdiv.classList.add("icon-button", "button-interactive", "mode-transcripts"); hearingdiv.innerHTML = ""; hearingdiv.style.paddingTop = "5px"; hearingdiv.style.paddingLeft = "6px"; hearingdiv.style.paddingRight = "6px"; hearingdiv.style.paddingBottom = "5px"; hearingdiv.style.filter = "drop-shadow( 2px 2px 1px rgba(0, 0, 0, .7))"; hearingdiv.setAttribute("data-balloon", "Text transcript on/off"); buttonlist.appendChild(hearingdiv); hearingdiv.addEventListener("click", function() { if (toggletranscripts == 0) { toggletranscripts = 1; hearingdiv.style.paddingTop = "5px"; hearingdiv.style.paddingLeft = "6px"; hearingdiv.style.paddingRight = "6px"; hearingdiv.style.paddingBottom = "5px"; hearingdiv.innerHTML = ""; $("#apptranscription").css("z-index", 50); } else { toggletranscripts = 0; hearingdiv.style.paddingTop = "5px"; hearingdiv.style.paddingLeft = "7px"; hearingdiv.style.paddingRight = "7px"; hearingdiv.style.paddingBottom = "6px"; hearingdiv.innerHTML = ""; $("#apptranscription").css("z-index", -50); } }) } /*var questionDiv = iframe.contentWindow.document.createElement("div"); questionDiv.id = "questiondiv"; questionDiv.role = "button"; questionDiv.classList.add("icon-button", "button-interactive", "mode-questions"); questionDiv.style.paddingTop = "3px"; questionDiv.style.paddingLeft = "12px"; questionDiv.style.paddingRight = "12px"; questionDiv.style.paddingBottom = "3px"; questionDiv.style.filter = "drop-shadow( 2px 2px 1px rgba(0, 0, 0, .7))"; questionDiv.setAttribute("data-balloon", "Tour Instructions"); questionDiv.innerHTML =""; buttonlist.appendChild(questionDiv); questionDiv.addEventListener("click", function () { try{ iframe.contentDocument.getElementById('cta-container').style.opacity = 1; //iframe.contentDocument.getElementsByTagName('main')[0].addEventListener("click", closeCTA); function closeCTA() { iframe.contentDocument.getElementById('cta-container').style.opacity = 0; iframe.contentDocument.getElementsByTagName('main')[0].removeEventListener("click", closeCTA); } } catch(error) { console.error(error); } }) */ var playpauseDiv; if (ppInMpControls == "0") { playpauseDiv = document.createElement("div"); playpauseDiv.id = "audioPlayPause"; document.body.appendChild(playpauseDiv); playpauseDiv.role = "button"; playpauseDiv.classList.add("icon-button", "button-interactive", "mode-transcripts"); playpauseDiv.style.width = "50px"; playpauseDiv.style.height = "50px"; playpauseDiv.style.marginTop = "20px"; playpauseDiv.style.marginRight = "20px"; playpauseDiv.style.backgroundColor = cssBg; playpauseDiv.style.borderRadius = "100%"; //playpauseDiv.style.filter = "drop-shadow( 2px 2px 1px rgba(0, 0, 0, .7))"; playpauseDiv.setAttribute("data-balloon", "Audio play/pause"); playpauseDiv.style.display = "none"; playpauseDiv.innerHTML = ""; } else { playpauseDiv = iframe.contentWindow.document.createElement("div"); playpauseDiv.id = "audioPlayPause"; playpauseDiv.role = "button"; playpauseDiv.classList.add("icon-button", "button-interactive", "mode-transcripts"); playpauseDiv.style.paddingTop = "3px"; playpauseDiv.style.paddingLeft = "7px"; playpauseDiv.style.paddingRight = "7px"; playpauseDiv.style.paddingBottom = "3px"; playpauseDiv.style.filter = "drop-shadow( 2px 2px 1px rgba(0, 0, 0, .7))"; playpauseDiv.setAttribute("data-balloon", "Audio play/pause"); playpauseDiv.style.display = "none"; playpauseDiv.innerHTML = ""; buttonlist.appendChild(playpauseDiv); } playpauseDiv.addEventListener("click", function() { if (audio.paused) { audio.play(); if (ppInMpControls == "0") { playpauseDiv.innerHTML = ""; } else { playpauseDiv.innerHTML = ""; } isPaused = false; if (hearingimpaired == 1) { if (toggletranscripts == 1) { $("#apptranscription").css("z-index", 50); } $(".marquee span").css("animation-play-state", "running"); $(".marquee span").css("webkitAnimation-play-state", "running"); } } else { audio.pause(); if (ppInMpControls == "0") { playpauseDiv.innerHTML = ""; } else { playpauseDiv.innerHTML = ""; } isPaused = true; if (hearingimpaired == 1) { $("#apptranscription").css("z-index", -50); } $(".marquee span").css("animation-play-state", "paused"); $(".marquee span").css("webkitAnimation-play-state", "paused"); } }); mpSdk.Camera.pose.subscribe(function(pose) { if (iframe.contentDocument.getElementById('cta-container').style.opacity == 1) { iframe.contentDocument.getElementById('cta-container').style.opacity = 0; } poseCache = pose; }); mpSdk.Sweep.current.subscribe(function(currentSweep) { if (currentSweep !== "") { currentSweepArray = []; currentSweepArray.push({ "sid": currentSweep.sid, "rotation": JSON.stringify(poseCache.rotation) }); } }); mpSdk.Pointer.intersection.subscribe(intersectionData => { intersectionCache = intersectionData; intersectionCache.time = new Date().getTime(); }) if (pucks == "1" || pucks == 1) { mpSdk.Settings.update('features/sweep_pucks', false) }; await mpSdk.Scene.configure(function(renderer, three, effectComposer) { renderer.physicallyCorrectLights = true; renderer.antialias = true renderer.shadowMap.enabled = true; renderer.shadowMap.bias = 0.0001; renderer.shadowMap.type = three.PCFSoftShadowMap; }); const raycaster = new THREE.Raycaster(); const mouse = new THREE.Vector2(); function controlsOpen(activeControl) { remove3JsInputs(); $("#controlWrapper").removeAttr("hidden"); iframe.style.width = "80%"; let controls = [$("#3JsControls"), $("#tagAddControls"), $("#existingtagEditControls"), $("#excontrolWrapper"), $("#tlNavControls"), $("#navOrderControls"), $("#mycf"), $("#mycss"), $("#mytheme"), $("#audiocontrols"), $("#videocontrols"), $("#mmControls"), $("#navcontrols"), $("#photoControls"), $("#htmlcontrols"), $("#defaultcontrols"), $("#tagAddControls"), $("#tagControls"), $("#existingtagEditControls")]; for (var i = 0; i < controls.length; i++) { if (controls[i][0].id == activeControl[0].id) { if (activeControl[0].id == $("#3JsControls")[0].id) { activeControl.css("display", "block"); } else { activeControl.removeAttr("hidden"); } } else { if (controls[i][0].id == $("#3JsControls")[0].id) { controls[i].css("display", "none"); } else { controls[i].attr("hidden", true); } } } } $('#controlsClose').click(function() { iframe.style.width = "100%"; $("#controlWrapper").attr("hidden", true); let controls = [$("#3JsControls"), $("#tagAddControls"), $("#existingtagEditControls"), $("#excontrolWrapper"), $("#tlNavControls"), $("#navOrderControls"), $("#mycf"), $("#mycss"), $("#mytheme"), $("#audiocontrols"), $("#videocontrols"), $("#mmControls"), $("#navcontrols"), $("#photoControls"), $("#htmlcontrols"), $("#defaultcontrols"), $("#tagAddControls"), $("#tagControls"), $("#existingtagEditControls")]; for (var i = 0; i < controls.length; i++) { if (controls[i][0].id == $("#3JsControls")[0].id) { controls[i].css("display", "none"); } else { controls[i].attr("hidden", true); } } window.tag = null; }); $('#addTlNavButton').click(function() { ; $("#tlNavControls").load(baseLoc + "/tlnavcontrol.php?model=" + editmodel + "&version=" + version); activeControl = $("#tlNavControls"); controlsOpen(activeControl); }); $('#editNavOrderButton').click(function() { activeControl = $("#navOrderControls"); $("#navOrderControls").load(baseLoc + "/toplevelmenu.php?model=" + editmodel + "&version=" + version); controlsOpen(activeControl); }); $('#themeControlPage').click(function() { activeControl = $("#mytheme"); controlsOpen(activeControl); }); $('#cfControlPage').click(function() { $("#mycf").load(baseLoc + "/modelcfcontrols.php?model=" + editmodel + "&version=" + version); activeControl = $("#mycf"); controlsOpen(activeControl); }); $('#cssControlPage').click(function() { $("#mycss").load(baseLoc + "/modelcsscontrols.php?model=" + editmodel + "&version=" + version); activeControl = $("#mycss"); controlsOpen(activeControl); }); $('#existingClose').click(function() { document.getElementById("tbvflex").setAttribute("hidden", true); }); function remove3JsInputs() { try { function removeAllChildNodes(parent) { try { while (parent.firstChild) { parent.removeChild(parent.firstChild); } //parent.remove(); } catch (error) { console.error(error); } } $("#PosXinput").remove(); $("#PosYinput").remove(); $("#PosZinput").remove(); $("#RotXinput").remove(); $("#RotYinput").remove(); $("#RotZinput").remove(); $("#ScaXinput").remove(); $("#ScaYinput").remove(); $("#ScaZinput").remove(); $("#objRotXinput").remove(); $("#objRotYinput").remove(); $("#objRotZinput").remove(); $("#vidNameInput").remove(); $("#curvetitle").remove(); $("#curveinput").remove(); $("#transcriptTitle").remove(); $("#transcriptinput").remove(); $("#destDiv").remove(); $("#tagDiv").remove(); $("#destinput").remove(); $("#srcinput").remove(); $("#destlabel").remove(); $("#taglabel").remove(); $("#colorHeader").remove(); $("#colorInput").remove(); $("#bgLabel").remove(); $("#bgInput").remove(); $("#iconSelect").remove(); $("#tagType").remove(); $("#chooseIcon").remove(); $("#colorHeader").remove(); $("#animInput").remove(); $("#animDiv").remove(); $("#navActionSelect").remove(); $("#tagActionSelect").remove(); $("#chromainput").remove(); $("#chromatitle").remove(); $("#transcripttitle").remove(); $("#imgXinput").remove(); $("#imgYinput").remove(); $("#lightingdiv").remove(); $("#radiusinput").remove(); $("#radiustitle").remove(); if (document.getElementById("3jsSubmitDiv") != null) { removeAllChildNodes(document.getElementById("3jsSubmitDiv")); document.getElementById("3JsControls").removeChild(document.getElementById("3jsSubmitDiv")); } document.getElementById("source").style.display = "block"; document.getElementById("3JsControls").style.display = "none"; iframe.style.width = "100%"; } catch (error) { console.error(error); } } function SvgRenderer() { 'use strict'; var group, buttonGroup, topSphere; this.inputs = { texture: null, aspect: 1, transparent: true, visible: true, opacity: 1, tagdetails: { tagcolor: "", tagbg: "", tagIcon: "", tagTitle: "", tagDesc: "", tagmedia: "", }, animation: "", dest: "", polygonOffset: false, polygonOffsetFactor: 0, polygonOffsetUnits: 0, localScale: { x: 1, y: 1, z: 1 }, localPosition: { x: 0, y: 0, z: 0 }, localRotation: { x: 0, y: 0, z: 0 } } this.events = { "INTERACTION.CLICK": true, "INTERACTION.HOVER": true, } this.onInit = async function() { this.mesh; const thisOutputs = this.outputs; this.pivotNode; const THREE = this.context.three; const scene = this.context.scene; const root = this.context.root; const renderer = this.context.renderer; const camera = this.context.camera; const node = this.context.root.obj3D; const thisSvg = this; const loader = new THREE.TextureLoader(); var texture = ""; var thisinputs = this.inputs; var imageFile = baseUrl + '/wp-content/themes/pro-child-theme/mpaudio/assets/icons/autogenerate.php?icon=' + this.inputs.tagdetails.tagIcon + '&fill=' + this.inputs.tagdetails.tagcolor + '&background=' + this.inputs.tagdetails.tagbg; function xmlHReq() { var xmlhttp = new XMLHttpRequest(); var topGeometry = new THREE.CircleGeometry(0.3, 32), material1 = new THREE.MeshBasicMaterial({ map: loader.load(imageFile), side: THREE.DoubleSide, transparent: true, }); const topCylinder = new THREE.Mesh(topGeometry, material1); thisOutputs.collider = topCylinder; node.add(topCylinder); } xmlHReq(); var animation = this.inputs.animation; mpSdk.Camera.pose.subscribe(function() { if (animation != "Tumble" && animation != "Rotate") { var camvector = new THREE.Vector3(poseCache.position.x, poseCache.position.y, poseCache.position.z); node.lookAt(camvector); node.updateMatrixWorld(); } var scaleFactor = 8; var scaleVector = new THREE.Vector3(); var scale = scaleVector.subVectors(node.position, poseCache.position).length() / scaleFactor; //if (scale < 1) { scale = 1; } if (scale > 2) { scale = 2; } node.scale.set(scale, scale, 1); }) var clock = new THREE.Clock; var growBool = true; function animate () { var animation = thisSvg.inputs.animation; window.requestAnimationFrame(animate); if (animation == "Pulse") { var t = clock.getElapsedTime(); if (t >= 0.5) { growBool = !growBool; clock = new THREE.Clock; } if (growBool == true) { node.scale.x += 0.001; node.scale.y += 0.001; } else { node.scale.x -= 0.001; node.scale.y -= 0.001; } } else { if (animation == "Bloom(TBA)") { const renderScene = new THREE.RenderPass(scene, camera); const bloomPass = new THREE.UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); bloomPass.threshold = 0; bloomPass.strength = 3; bloomPass.radius = 1; var composer = new THREE.EffectComposer(renderer); composer.addPass(renderScene); composer.addPass(bloomPass); } else { if (animation == "Tumble") { node.rotation.x += 0.01; node.rotation.y += 0.01; //node.rotation.z += 0.01; } else { if (animation == "Rotate") { node.rotation.y += 0.01; } else { if (animation == "aaa") {} else {} } } } } //node.rotation.x += 0.01; // node.rotation.y = Math.atan2((poseCache.position.x - node.position.x), (poseCache.position.z - node.position.z)); //let distance = node.position.distanceTo(poseCache.position); // node.scale.set(distance / 1.5, distance / 1.5, 0.01); } animate(); this.onInputsUpdated = function(oldInputs) { var newIcon = this.inputs.tagdetails.tagIcon; var newColor = this.inputs.tagdetails.tagcolor; //animation = this.inputs.animation; var newBg = this.inputs.tagdetails.tagbg; imageFile = baseLoc + '/assets/icons/autogenerate.php?icon=' + newIcon + '&fill=' + newColor + '&background=' + newBg; xmlHReq(); } this.onEvent = function(eventType, eventData) { this.notify(eventType, eventData); var clickedObjParent = this.context.root; var clickedObj = this.context.root.obj3D; var thisSvg = this; var clickedObjPos = this.context.root.obj3D.position; var clickedObjRot = this.context.root.obj3D.rotation; var clickedObjSca = this.context.root.obj3D.scale; if (eventType == "INTERACTION.HOVER") { if ((clickedObjParent.components[0].instance.inputs.tagdetails.tagTitle != null && clickedObjParent.components[0].instance.inputs.tagdetails.tagTitle != "") || (clickedObjParent.components[0].instance.inputs.dest != "" && clickedObjParent.components[0].instance.inputs.dest != "0") ) { if (sPath == "tagbuilder" || sPath == "tagbuilderdev") { } else { var appendingContainer = document.getElementById("framecontainer"); if (imghover && img2hover) { mpSdk.Settings.update('features/cursor', false); iframe.contentDocument.querySelector('.webgl-canvas').style.cursor = 'pointer'; var imghover2 = imghover; imghover = false; if ((clickedObjParent.components[0].instance.inputs.tagdetails.tagTitle != null && clickedObjParent.components[0].instance.inputs.tagdetails.tagTitle != "")||(clickedObjParent.components[0].instance.inputs.dest.length > 0 && clickedObjParent.components[0].instance.inputs.dest.length < 2)) { var hasTag = 1; var title = clickedObjParent.components[0].instance.inputs.tagdetails.tagTitle; var desc = clickedObjParent.components[0].instance.inputs.tagdetails.tagDesc; var media = clickedObjParent.components[0].instance.inputs.tagdetails.tagmedia; if (document.getElementById("sweepInfoDiv") == null || typeof document.getElementById("sweepInfoDiv") == "undefined") { var sweepInfoDiv = document.createElement("div"); sweepInfoDiv.id = "sweepInfoDiv"; sweepInfoDiv.style.zIndex = "1"; sweepInfoDiv.style.paddingLeft = "30px"; sweepInfoDiv.style.paddingRight = "30px"; if(mobile && iframe.clientHeight > iframe.clientWidth) { sweepInfoDiv.style.width = "90vw"; } else { if (media != "") { sweepInfoDiv.style.maxWidth = "50vw"; } else { sweepInfoDiv.style.maxWidth = "30vw" } sweepInfoDiv.style.maxHeight = "90vh"; } sweepInfoDiv.style.position = "absolute"; sweepInfoDiv.style.pointerEvents = "none"; sweepInfoDiv.style.backgroundColor = "rgba(0,0,0,0.75)"; sweepInfoDiv.style.color = "#FFFFFF"; sweepInfoDiv.style.borderRadius = "7px"; sweepInfoDiv.style.fontSize = "1em"; appendingContainer.appendChild(sweepInfoDiv); var sweepTitleDiv = document.createElement("div"); sweepTitleDiv.id = "sweepTitleDiv"; sweepTitleDiv.style.width = "100%"; var titleSpan = document.createElement("span"); if (title != "") { titleSpan.innerHTML = "
" + desc + "
Click for more" + "
" + desc + "
" + desc + "
" + desc + "
Click for more" + "
" + desc + "
" + desc + "
" + desc + "
Click for more" + "
" + desc + "
" + desc + "
" + desc + "
NO. | ID | HIDE TAG | ']; for (var i = 0; i < sweepCollection.length; i++) { shtml.push('
---|---|---|
' + (i+1) + '. | ' + sweepCollection[i].sid + ' |
${message}
${message}