PATH:
home
/
antoinems
/
www
/
_Montreal_folklore
/
2013
/
res
/
photosphere
/
Editing: photo-sphere-viewer.min.js
var PhotoSphereViewer=function(e){var t=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},o=function(){var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl"))},i=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},n=function(e,t,o){return Math.max(t,Math.min(o,e))},r=function(e,t,o,i){var n=o-e,r=i-t;return n*n+r*r},a=function(e,t){return t=void 0!==t&&!!t,t&&e==2*Math.PI?2*Math.PI:e-2*Math.floor(e/(2*Math.PI))*Math.PI};this.load=function(){if(Pe.innerHTML="",/JavaFX\/[0-9.]+/.test(navigator.userAgent)&&!o()){var e=document.createElement("div");return e.className="error icon-warning text-center",e.textContent=" The 360° viewer uses WebGL which is not supported by this browser. Please preview the album in an external browser or upload the album and view it online!",void Pe.appendChild(e)}if(st&&1===st.nodeType)Pe.appendChild(st);else if(st&&"string"==typeof st)Pe.innerHTML=st;else if(at){var i=document.createElement("img");i.setAttribute("src",at),i.setAttribute("alt",rt),Pe.appendChild(i)}else Pe.textContent=rt;return Le=document.createElement("div"),Le.style.width="100%",Le.style.height="100%",Le.style.position="relative",Le.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(Te={width:0,height:0,ratio:0},void(Qe&&!De.match(/^data:image\/[a-z]+;base64/)?d():c())):void(Pe.textContent="Canvas is not supported, update your browser!")};var s=function(e){for(var t=0,o=0,i="";-1!=(t=e.indexOf("<x:xmpmeta",o))&&-1!=(o=e.indexOf("</x:xmpmeta>",t));)if(-1!=(i=e.substring(t,o)).indexOf("GPano:"))return i;return""},l=function(e,t){var o=e.indexOf("GPano:"+t)+t.length+8,i=e.indexOf('"',o);return-1==i&&(o=e.indexOf("GPano:"+t)+t.length+7,i=e.indexOf("<",o)),e.substring(o,i)},d=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(Pe.textContent="XHR is not supported, update your browser!");try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){e=new ActiveXObject("Microsoft.XMLHTTP")}}e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){var t=s(e.responseText);if(!t.length)return void c();tt={full_width:parseInt(l(t,"FullPanoWidthPixels")),full_height:parseInt(l(t,"FullPanoHeightPixels")),cropped_width:parseInt(l(t,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(l(t,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(l(t,"CroppedAreaLeftPixels")),cropped_y:parseInt(l(t,"CroppedAreaTopPixels"))},nt=!0,c()}},e.open("GET",De,!0),e.send(null)},c=function(){var e=new Image;e.onload=function(){var t={full_width:e.width,full_height:e.height,cropped_width:e.width,cropped_height:e.height,cropped_x:null,cropped_y:null};if(360!=it.horizontal_fov||180!=it.vertical_fov){if(tt.cropped_width=t.cropped_width,tt.cropped_height=t.cropped_height,tt.full_width=t.full_width,tt.full_height=t.full_height,360!=it.horizontal_fov){var i=it.horizontal_fov/360;tt.full_width=tt.cropped_width/i}if(180!=it.vertical_fov){var n=it.vertical_fov/180;tt.full_height=tt.cropped_height/n}}else{for(var r in tt)null===tt[r]&&void 0!==t[r]&&(tt[r]=t[r]);if(nt){if(tt.cropped_width!=t.cropped_width){var a=t.cropped_width/tt.cropped_width;tt.cropped_width=t.cropped_width,tt.full_width*=a,tt.cropped_x*=a}if(tt.cropped_height!=t.cropped_height){var s=t.cropped_height/tt.cropped_height;tt.cropped_height=t.cropped_height,tt.full_height*=s,tt.cropped_y*=s}}}null===tt.cropped_x&&(tt.cropped_x=(tt.full_width-tt.cropped_width)/2),null===tt.cropped_y&&(tt.cropped_y=(tt.full_height-tt.cropped_height)/2);var l=2048;if(o()){var d=document.createElement("canvas").getContext("webgl");l=d.getParameter(d.MAX_TEXTURE_SIZE)}var c=Math.min(tt.full_width,l),h=c/tt.full_width;tt.full_width=c,tt.cropped_width*=h,tt.cropped_x*=h,e.width=tt.cropped_width,tt.full_height*=h,tt.cropped_height*=h,tt.cropped_y*=h,e.height=tt.cropped_height;var p=document.createElement("canvas");p.width=tt.full_width,p.height=tt.full_height,p.getContext("2d").drawImage(e,tt.cropped_x,tt.cropped_y,tt.cropped_width,tt.cropped_height),u(p.toDataURL("image/jpeg"))},et&&!De.match(/^data:image\/[a-z]+;base64/)&&e.setAttribute("crossOrigin","anonymous"),e.src=De},u=function(e){var t=new THREE.Texture,o=function(e){t.needsUpdate=!0,t.image=e,h(t)};(new THREE.ImageLoader).load(e,o)},h=function(e){void 0!==Be.width&&(Pe.style.width=Be.width.css),void 0!==Be.height&&(Pe.style.height=Be.height.css),w(),(Xe=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer).setSize(Te.width,Te.height),We=new THREE.Scene,(Ne=new THREE.PerspectiveCamera(oe,Te.ratio,1,300)).position.set(0,0,0),We.add(Ne);var t=new THREE.SphereGeometry(200,ge,pe),n=new THREE.MeshBasicMaterial({map:e,overdraw:!0}),r=new THREE.Mesh(t,n);if(r.scale.x=-1,We.add(r),Oe=document.createElement("div"),Oe.style.position="absolute",Oe.style.zIndex=0,Le.appendChild(Oe),ze&&(Ce.setStyle(Ee),Ce.create(),Le.appendChild(Ce.getBar())),null!==lt){var a=document.createElement("img");a.onload=function(){a.style.display="block",a.style.position="absolute",a.style[lt.position.x]="5px",a.style[lt.position.y]="5px","bottom"==lt.position.y&&ze&&(a.style.bottom=Ce.getBar().offsetHeight+5+"px"),void 0!==lt.size&&(a.style.width=lt.size.width,a.style.height=lt.size.height),Le.appendChild(a)},a.src=lt.image}i(window,"resize",w),Se&&(i(Oe,"mousedown",S),i(document,"mousemove",P),i(Oe,"mousemove",V),i(document,"mouseup",M),i(Oe,"touchstart",T),i(document,"touchend",M),i(document,"touchmove",H),Re&&(i(Oe,"mousewheel",O),i(Oe,"DOMMouseScroll",O)),dt.addAction("fullscreen-mode",C)),i(document,"fullscreenchange",$),i(document,"mozfullscreenchange",$),i(document,"webkitfullscreenchange",$),i(document,"MSFullscreenChange",$),Ze.addListener(L),Pe.innerHTML="",Pe.appendChild(Le);var s=Xe.domElement;s.style.display="block",Oe.appendChild(s),p(),ve>0&&D(ve),f(),U("ready")},p=function(){var e=new THREE.Vector3;e.setX(Math.cos(ce)*Math.sin(ue)),e.setY(Math.sin(ce)),e.setZ(Math.cos(ce)*Math.cos(ue)),Ne.lookAt(e),null!==$e?$e.render(We,Ne):Xe.render(We,Ne)},g=function(){($e=new THREE.StereoEffect(Xe)).eyeSeparation=Me,$e.setSize(Te.width,Te.height),B(),G(),Ce.mustBeHidden(),p(),U("stereo-effect",!0)},v=function(){$e=null,Xe.setSize(Te.width,Te.height),Ce.mustBeHidden(!1),p(),U("stereo-effect",!1)};this.toggleStereo=function(){null!==$e?v():g()};var f=function(){!1!==ye&&(Ke=setTimeout(y,ye))},m=function(){ce-=(ce-_e)*xe,ue+=be;var e=!0;se||(ue=n(ue,le,de))!=le&&ue!=de||(we?be*=-1:(b(),e=!1)),ue=a(ue,!0),U("position-updated",{longitude:ue,latitude:ce}),p(),e&&(Ue=setTimeout(m,me))},y=function(){m(),U("autorotate",!0)},b=function(){clearTimeout(Ke),Ke=null,clearTimeout(Ue),Ue=null,U("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(Ke),Ue?b():y()};var w=function(){Pe.clientWidth==Te.width&&Pe.clientHeight==Te.height||x({width:Pe.clientWidth,height:Pe.clientHeight})};this.fitToContainer=function(){w()};var x=function(e){Te.width=void 0!==e.width?parseInt(e.width):Te.width,Te.height=void 0!==e.height?parseInt(e.height):Te.height,Te.ratio=Te.width/Te.height,Ne&&(Ne.aspect=Te.ratio,Ne.updateProjectionMatrix()),Xe&&(Xe.setSize(Te.width,Te.height),p()),$e&&($e.setSize(Te.width,Te.height),p())};this.getPosition=function(){return{longitude:ue,latitude:ce}},this.getPositionInDegrees=function(){return{longitude:180*ue/Math.PI,latitude:180*ce/Math.PI}};var _=function(e,t){var o=j(e);se||(o=n(o,le,de));var i=j(t);i>Math.PI&&(i-=2*Math.PI),i=n(i,ne,ie),U("position-updated",{longitude:ue=o,latitude:ce=i}),p()};this.moveTo=function(e,t){_(e,t)};var k=function(e,t){e=j(e),t=j(t),_(ue+e,ce+t)};this.rotate=function(e,t){k(e,t)};var C=function(e){(e?window.addEventListener:window.removeEventListener)("keydown",E)},z=function(e){if(e.key)return/^Arrow/.test(e.key)?e.key:"Arrow"+e.key;if(e.keyCode||e.which){var t=e.keyCode?e.keyCode:e.which,o={38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",37:"ArrowLeft"};if(void 0!==o[t])return o[t]}return""},E=function(e){var t=0,o=0;switch(z(e)){case"ArrowUp":o=ee;break;case"ArrowRight":t=-Q;break;case"ArrowDown":o=-ee;break;case"ArrowLeft":t=Q}k(t,o)},S=function(e){R(parseInt(e.clientX),parseInt(e.clientY))},T=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==Oe&&R(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(M(),e.touches[0].target.parentNode==Oe&&e.touches[1].target.parentNode==Oe&&I(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));V()},R=function(e,t){qe=e,Ve=t,b(),Ge=!0},I=function(e){je=e,Ye=!0},M=function(e){Ge=!1,Ye=!1},P=function(e){e.preventDefault(),F(parseInt(e.clientX),parseInt(e.clientY))},H=function(e){if(1==e.touches.length&&Ge){var t=e.touches[0];t.target.parentNode==Oe&&(e.preventDefault(),F(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==Oe&&e.touches[1].target.parentNode==Oe&&Ye){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),i=o-je;if(0!==i){var n=i/Math.abs(i);D(ve+n*Ie),je=o}}},F=function(e,t){Ge&&(K?(ue+=(e-qe)/Te.height*fe*Math.PI/180,ce+=(t-Ve)/Te.height*fe*Math.PI/180):(ue+=(e-qe)*Z,ce+=(t-Ve)*J),qe=e,Ve=t,se||(ue=n(ue,le,de)),ue=a(ue,!0),ce=n(ce,ne,ie),U("position-updated",{longitude:ue,latitude:ce}),p())},B=function(){Ze.start(),b(),U("device-orientation",!0)},A=function(){Ze.stop(),U("device-orientation",!1)};this.toggleDeviceOrientation=function(){Ze.isEventAttached()?A():B()};var L=function(e){ue=n(e.longitude,le,de),ce=n(e.latitude,ne,ie),U("position-updated",{longitude:ue,latitude:ce}),p()},O=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!==t){var o=parseInt(t/Math.abs(t));D(ve+o*Ie)}};this.mouseWheel=function(e){O(e)};var D=function(e){ve=n(e,0,100),fe=oe+ve/100*(te-oe),Ne.fov=fe,Ne.updateProjectionMatrix(),p(),U("zoom-updated",ve)};this.getZoomLevel=function(){return ve},this.zoom=function(e){D(e)},this.zoomIn=function(){ve<100&&D(ve+Ie)},this.zoomOut=function(){ve>0&&D(ve-Ie)};var X=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},W=function(){return"absolute"!==He&&"fixed"!==He||(Pe.style.left=Fe.left,Pe.style.top=Fe.top,Pe.style.position=He),!0},N=function(){"absolute"!==He&&"fixed"!==He||(Fe={left:Pe.style.left,top:Pe.style.top},Pe.style.position="static",Pe.style.left=Pe.style.top="0px")},$=function(){document.webkitFullscreenElement||document.msFullscreenElement?(N(),Ae.width=Pe.style.width,Ae.height=Pe.style.height,Pe.style.width="100%",Pe.style.height="100%",w()):(Pe.webkitRequestFullscreen||Pe.msRequestFullscreen)&&(Pe.style.width=Ae.width,Pe.style.height=Ae.height,w()),X()?U("fullscreen-mode",!0):(U("fullscreen-mode",!1),W())},G=function(){Pe.requestFullscreen?Pe.requestFullscreen():Pe.mozRequestFullScreen?Pe.mozRequestFullScreen():Pe.webkitRequestFullscreen?Pe.webkitRequestFullscreen():Pe.msRequestFullscreen&&Pe.msRequestFullscreen()},q=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?(document.webkitExitFullscreen(),W()):document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){X()?q():G()};var V=function(){ze&&Ce.show()},Y=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),o=e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();o.match(/(pm|per minute)$/)&&(t/=60);var i=0;switch(o){case"rpm":case"rev per minute":case"revolutions per minute":case"rps":case"rev per second":case"revolutions per second":i=2*t*Math.PI;break;case"dpm":case"deg per minute":case"degrees per minute":case"dps":case"deg per second":case"degrees per second":i=t*Math.PI/180;break;case"rad per minute":case"radians per minute":case"rad per second":case"radians per second":i=t;break;default:m_anim=!1}return i*me/1e3},j=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1"));return"deg"==e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim()&&(t*=Math.PI/180),a(t)};this.addAction=function(e,t){e in Je||(Je[e]=[]),Je[e].push(t)};var U=function(e,t){if(e in Je&&Je[e].length)for(var o=0,i=Je[e].length;o<i;++o)void 0!==t?Je[e][o](t):Je[e][o]()};if(void 0===e||void 0===e.panorama||void 0===e.container)return void console.log("PhotoSphereViewer: no value given for panorama or container");var K=void 0===e.smooth_user_moves||!!e.smooth_user_moves,Z=void 0!==e.long_offset?j(e.long_offset):Math.PI/360,J=void 0!==e.lat_offset?j(e.lat_offset):Math.PI/180,Q=void 0!==e.keyboard_long_offset?j(e.keyboard_long_offset):Math.PI/60,ee=void 0!==e.keyboard_lat_offset?j(e.keyboard_lat_offset):Math.PI/120,te=void 0!==e.min_fov?n(parseFloat(e.min_fov),1,179):30,oe=void 0!==e.max_fov?n(parseFloat(e.max_fov),1,179):90,ie=void 0!==e.tilt_up_max?n(j(e.tilt_up_max),0,Math.PI/2):Math.PI/2,ne=void 0!==e.tilt_down_max?-n(j(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,re=void 0!==e.min_longitude?j(e.min_longitude):0,ae=void 0!==e.max_longitude?j(e.max_longitude):0,se=re==ae;se?(re=0,ae=2*Math.PI):0===ae&&(ae=2*Math.PI);var le,de;re<ae?(le=re,de=ae):(le=ae,de=re);var ce=0,ue=le;if(void 0!==e.default_position){if(void 0!==e.default_position.lat){var he=j(e.default_position.lat);he>Math.PI&&(he-=2*Math.PI),ce=n(he,ne,ie)}void 0!==e.default_position.long&&(ue=n(j(e.default_position.long),le,de))}var pe=void 0!==e.segments?parseInt(e.segments):100,ge=void 0!==e.rings?parseInt(e.rings):100,ve=0;void 0!==e.zoom_level&&(ve=n(parseInt(Math.round(e.zoom_level)),0,100));var fe=oe+ve/100*(te-oe),me=1e3/60,ye=2e3;void 0!==e.time_anim&&(ye="number"==typeof e.time_anim&&e.time_anim>=0&&e.time_anim);var be=Y(void 0!==e.anim_speed?e.anim_speed:"2rpm"),we=!0;void 0!==e.reverse_anim&&(we=!!e.reverse_anim);var xe=Y(void 0!==e.vertical_anim_speed?e.vertical_anim_speed:"2rpm"),_e=0;if(void 0!==e.vertical_anim_target){var ke=j(e.vertical_anim_target);ke>Math.PI&&(ke-=2*Math.PI),_e=n(ke,ne,ie)}var Ce=new PSVNavBar(this),ze=void 0!==e.navbar&&!!e.navbar,Ee=void 0!==e.navbar_style?e.navbar_style:{},Se=void 0===e.allow_user_interactions||!!e.allow_user_interactions;Se||(ze=!1);var Te,Re=void 0===e.allow_scroll_to_zoom||!!e.allow_scroll_to_zoom,Ie=void 0!==e.zoom_speed?parseFloat(e.zoom_speed):1,Me=void 0!==e.eyes_offset?parseFloat(e.eyes_offset):5,Pe="string"==typeof e.container?document.getElementById(e.container):e.container,He=Pe.style.position||getComputedStyle(Pe).position,Fe={left:Pe.style.left,top:Pe.style.top},Be={},Ae={};void 0!==e.size&&function(e){for(var t in e)if("width"==t||"height"==t){var o=e[t].toString().trim(),i=parseFloat(o.replace(/^([0-9]+(?:\.[0-9]*)?).*$/,"$1")),n=o.replace(/^[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();"%"!=n&&(n="px"),Be[t]={css:i+n,unit:n}}}(e.size);var Le,Oe,De=e.panorama,Xe=null,We=null,Ne=null,$e=null,Ge=!1,qe=0,Ve=0,Ye=!1,je=0,Ue=null,Ke=null,Ze=new Sphoords,Je={},Qe=void 0===e.usexmpdata||!!e.usexmpdata,et=void 0===e.cors_anonymous||!!e.cors_anonymous,tt={full_width:null,full_height:null,cropped_width:null,cropped_height:null,cropped_x:null,cropped_y:null};if(void 0!==e.pano_size){for(var ot in tt)void 0!==e.pano_size[ot]&&(tt[ot]=parseInt(e.pano_size[ot]));Qe=!1}var it={horizontal_fov:360,vertical_fov:180};if(void 0!==e.captured_view){for(var ot in it)void 0!==e.captured_view[ot]&&(it[ot]=parseFloat(e.captured_view[ot]));Qe=!1}var nt=!1,rt=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",at=void 0!==e.loading_img?e.loading_img.toString():null,st=void 0!==e.loading_html?e.loading_html:null,lt=null;void 0!==e.overlay&&void 0!==e.overlay.image&&(lt={image:e.overlay.image,position:{x:"left",y:"bottom"}},void 0!==e.overlay.position&&(void 0===e.overlay.position.x||"left"!=e.overlay.position.x&&"right"!=e.overlay.position.x||(lt.position.x=e.overlay.position.x),void 0===e.overlay.position.y||"top"!=e.overlay.position.y&&"bottom"!=e.overlay.position.y||(lt.position.y=e.overlay.position.y)),void 0!==e.overlay.size&&(lt.size={width:void 0!==e.overlay.size.width?e.overlay.size.width:"auto",height:void 0!==e.overlay.size.height?e.overlay.size.height:"auto"}));var dt=this;void 0!==e.onready&&this.addAction("ready",e.onready),(void 0===e.autoload||!!e.autoload)&&this.load()},PSVNavBar=function(e){var t=function(e,t){for(var o=0,i=t.length;o<i;++o)if(t[o]==e)return!0;return!1},o=function(e,o){return t(e,h)&&"string"==typeof o&&("transparent"==o||!!o.match(/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/)||!!o.match(/^rgb\((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])(,\s*(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}\)$/)||!!o.match(/^rgba\(((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),\s*){3}(0(\.[0-9]*)?|1)\)$/))||t(e,p)&&!isNaN(parseFloat(o))&&isFinite(o)&&o>=0};this.setStyle=function(e){for(var t in e)t in u&&o(t,e[t])&&(u[t]=e[t])},this.create=function(){(r=document.createElement("div")).style.backgroundColor=u.backgroundColor,r.style.position="absolute",r.style.zIndex=10,r.style.bottom=0,r.style.width="100%",r.style.boxSizing="content-box",r.style.transition="bottom 0.4s ease-out",a=new PSVNavBarButton(e,"autorotate",u),r.appendChild(a.getButton()),s=new PSVNavBarButton(e,"zoom",u),r.appendChild(s.getButton()),l=new PSVNavBarButton(e,"fullscreen",u),r.appendChild(l.getButton()),Sphoords.isDeviceOrientationSupported&&(d=new PSVNavBarButton(e,"orientation",u),r.appendChild(d.getButton()),c=new PSVNavBarButton(e,"virtual-reality",u),r.appendChild(c.getButton()))},this.getBar=function(){return r};var i=function(){g&&(clearTimeout(g),!v&&f&&(g=setTimeout(n,5e3))),v&&(r.style.bottom=0,v=!1,f&&(g=setTimeout(n,5e3)))};this.show=function(){i()};var n=function(){v||(r.style.bottom=1-r.offsetHeight+"px",v=!0)};this.hide=function(){n()},this.isHidden=function(){return v},this.mustBeHidden=function(e){(f=void 0===e||!!e)?n():i()};var r,a,s,l,d,c,u={backgroundColor:"rgba(61, 61, 61, 0.5)",buttonsColor:"rgba(255, 255, 255, 0.7)",buttonsBackgroundColor:"transparent",activeButtonsBackgroundColor:"rgba(255, 255, 255, 0.1)",buttonsHeight:20,autorotateThickness:1,zoomRangeWidth:50,zoomRangeThickness:1,zoomRangeDisk:7,fullscreenRatio:4/3,fullscreenThickness:2,gyroscopeThickness:1,virtualRealityRatio:4/3,virtualRealityBorderRadius:2},h=["backgroundColor","buttonsColor","buttonsBackgroundColor","activeButtonsBackgroundColor"],p=["buttonsHeight","autorotateThickness","zoomRangeWidth","zoomRangeThickness","zoomRangeDisk","fullscreenRatio","fullscreenThickness"],g=null,v=!1,f=!1},PSVNavBarButton=function(e,t,o){var i=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)};this.getButton=function(){return s};var n,r,a,s,l=function(e){s.style.backgroundColor=e?o.activeButtonsBackgroundColor:o.buttonsBackgroundColor},d=function(e){a.style.left=e/100*o.zoomRangeWidth-o.zoomRangeDisk/2+"px"},c=function(e){h(parseInt(e.clientX))},u=function(e){var t=e.touches[0];t.target!=n&&t.target!=r&&t.target!=a||h(parseInt(t.clientX))},h=function(e){y=!0,f(e)},p=function(e){y=!1},g=function(e){e.preventDefault(),f(parseInt(e.clientX))},v=function(e){var t=e.touches[0];t.target!=n&&t.target!=r&&t.target!=a||(e.preventDefault(),f(parseInt(t.clientX)))},f=function(t){if(y){var i=(t-r.getBoundingClientRect().left)/o.zoomRangeWidth*100;e.zoom(i)}},m=function(t){e.mouseWheel(t)},y=!1;!function(){switch(t){case"autorotate":var h=o.buttonsHeight-2*o.autorotateThickness,f=h/10;(s=document.createElement("div")).style.cssFloat="left",s.style.boxSizing="inherit",s.style.padding="10px",s.style.width=o.buttonsHeight+"px",s.style.height=o.buttonsHeight+"px",s.style.backgroundColor=o.buttonsBackgroundColor,s.style.position="relative",s.style.cursor="pointer",i(s,"click",function(){e.toggleAutorotate()});var y=document.createElement("div");y.style.boxSizing="inherit",y.style.width=h+"px",y.style.height=h+"px",y.style.borderRadius="50%",y.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,s.appendChild(y);var b=document.createElement("div");b.style.boxSizing="inherit",b.style.width=h+"px",b.style.height=f+"px",b.style.borderRadius="50%",b.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,b.style.position="absolute",b.style.top="50%",b.style.marginTop=-(f/2+o.autorotateThickness)+"px",s.appendChild(b),e.addAction("autorotate",l);break;case"zoom":(s=document.createElement("div")).style.cssFloat="left",s.style.boxSizing="inherit";var w=document.createElement("div");w.style.cssFloat="left",w.style.boxSizing="inherit",w.style.padding="10px",w.style.height=o.buttonsHeight+"px",w.style.backgroundColor=o.buttonsBackgroundColor,w.style.lineHeight=o.buttonsHeight+"px",w.style.color=o.buttonsColor,w.style.cursor="pointer",w.textContent="-",i(w,"click",function(){e.zoomOut()}),s.appendChild(w),(n=document.createElement("div")).style.cssFloat="left",n.style.boxSizing="inherit",n.style.padding=10+(o.buttonsHeight-o.zoomRangeThickness)/2+"px 5px",n.style.backgroundColor=o.buttonsBackgroundColor,n.style.cursor="pointer",s.appendChild(n),(r=document.createElement("div")).style.boxSizing="inherit",r.style.width=o.zoomRangeWidth+"px",r.style.height=o.zoomRangeThickness+"px",r.style.backgroundColor=o.buttonsColor,r.style.position="relative",n.appendChild(r),(a=document.createElement("div")).style.position="absolute",a.style.top=(o.zoomRangeThickness-o.zoomRangeDisk)/2+"px",a.style.left=-o.zoomRangeDisk/2+"px",a.style.boxSizing="inherit",a.style.width=o.zoomRangeDisk+"px",a.style.height=o.zoomRangeDisk+"px",a.style.borderRadius="50%",a.style.backgroundColor=o.buttonsColor,e.addAction("zoom-updated",d),i(n,"mousedown",c),i(n,"touchstart",u),i(document,"mousemove",g),i(document,"touchmove",v),i(document,"mouseup",p),i(document,"touchend",p),i(n,"mousewheel",m),i(n,"DOMMouseScroll",m),r.appendChild(a);var x=document.createElement("div");x.style.cssFloat="left",x.style.boxSizing="inherit",x.style.padding="10px",x.style.height=o.buttonsHeight+"px",x.style.backgroundColor=o.buttonsBackgroundColor,x.style.lineHeight=o.buttonsHeight+"px",x.style.color=o.buttonsColor,x.style.cursor="pointer",x.textContent="+",i(x,"click",function(){e.zoomIn()}),s.appendChild(x);break;case"fullscreen":var _=o.buttonsHeight*o.fullscreenRatio,k=.3*o.buttonsHeight,C=(o.buttonsHeight-k)/2,z=.3*_,E=(_-z)/2-o.fullscreenThickness,S=o.buttonsHeight-2*o.fullscreenThickness;(s=document.createElement("div")).style.cssFloat="right",s.style.boxSizing="inherit",s.style.padding="10px",s.style.width=_+"px",s.style.height=o.buttonsHeight+"px",s.style.backgroundColor=o.buttonsBackgroundColor,s.style.cursor="pointer",i(s,"click",function(){e.toggleFullscreen()});var T=document.createElement("div");T.style.cssFloat="left",T.style.boxSizing="inherit",T.style.width=o.fullscreenThickness+"px",T.style.height=k+"px",T.style.borderStyle="solid",T.style.borderColor=o.buttonsColor+" transparent",T.style.borderWidth=C+"px 0",s.appendChild(T);var R=document.createElement("div");R.style.cssFloat="left",R.style.boxSizing="inherit",R.style.width=E+"px",R.style.height=S+"px",R.style.borderStyle="solid",R.style.borderColor=o.buttonsColor+" transparent",R.style.borderWidth=o.fullscreenThickness+"px 0",s.appendChild(R);var I=document.createElement("div");I.style.cssFloat="left",I.style.boxSizing="inherit",I.style.marginLeft=z+"px",I.style.width=E+"px",I.style.height=S+"px",I.style.borderStyle="solid",I.style.borderColor=o.buttonsColor+" transparent",I.style.borderWidth=o.fullscreenThickness+"px 0",s.appendChild(I);var M=document.createElement("div");M.style.cssFloat="left",M.style.boxSizing="inherit",M.style.width=o.fullscreenThickness+"px",M.style.height=k+"px",M.style.borderStyle="solid",M.style.borderColor=o.buttonsColor+" transparent",M.style.borderWidth=C+"px 0",s.appendChild(M);var P=document.createElement("div");P.style.clear="left",s.appendChild(P),e.addAction("fullscreen-mode",l);break;case"orientation":var H=o.buttonsHeight-2*o.gyroscopeThickness,F=H-4*o.gyroscopeThickness,B=H/10;(s=document.createElement("div")).style.cssFloat="right",s.style.boxSizing="inherit",s.style.padding="10px",s.style.width=o.buttonsHeight+"px",s.style.height=o.buttonsHeight+"px",s.style.backgroundColor=o.buttonsBackgroundColor,s.style.position="relative",s.style.cursor="pointer",i(s,"click",function(){e.toggleDeviceOrientation()});var A=document.createElement("div");A.style.boxSizing="inherit",A.style.width=H+"px",A.style.height=H+"px",A.style.borderRadius="50%",A.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,s.appendChild(A);var L=document.createElement("div");L.style.boxSizing="inherit",L.style.width=F+"px",L.style.height=B+"px",L.style.borderRadius="50%",L.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,L.style.position="absolute",L.style.top="50%",L.style.left="50%",L.style.marginTop=-(B/2+o.gyroscopeThickness)+"px",L.style.marginLeft=-(F/2+o.gyroscopeThickness)+"px",s.appendChild(L);var O=document.createElement("div");O.style.boxSizing="inherit",O.style.width=B+"px",O.style.height=F+"px",O.style.borderRadius="50%",O.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,O.style.position="absolute",O.style.top="50%",O.style.left="50%",O.style.marginTop=-(F/2+o.gyroscopeThickness)+"px",O.style.marginLeft=-(B/2+o.gyroscopeThickness)+"px",s.appendChild(O),e.addAction("device-orientation",l);break;case"virtual-reality":var D=o.buttonsHeight*o.virtualRealityRatio,X=D/4,W=X/2;(s=document.createElement("div")).style.cssFloat="right",s.style.position="relative",s.style.boxSizing="inherit",s.style.padding="10px",s.style.width=D+"px",s.style.height=o.buttonsHeight+"px",s.style.backgroundColor=o.buttonsBackgroundColor,s.style.cursor="pointer",i(s,"click",function(){e.toggleStereo()});var N=document.createElement("div");N.style.boxSizing="inherit",N.style.width=D+"px",N.style.height=o.buttonsHeight+"px",N.style.borderRadius=o.virtualRealityBorderRadius+"px",N.style.backgroundColor=o.buttonsColor,s.appendChild(N);var $=document.createElement("div");$.style.boxSizing="inherit",$.style.width=X+"px",$.style.height=X+"px",$.style.position="absolute",$.style.top=W+10+"px",$.style.left=W+10+"px",$.style.borderRadius="50%",$.style.backgroundColor=o.backgroundColor,s.appendChild($);var G=document.createElement("div");G.style.boxSizing="inherit",G.style.width=X+"px",G.style.height=X+"px",G.style.position="absolute",G.style.top=W+10+"px",G.style.right=W+10+"px",G.style.borderRadius="50%",G.style.backgroundColor=o.backgroundColor,s.appendChild(G);var q=document.createElement("div");q.style.boxSizing="inherit",q.style.width=X+"px",q.style.height=o.buttonsHeight/2+"px",q.style.position="absolute",q.style.left="50%",q.style.bottom="10px",q.style.marginLeft=-X/2+"px",q.style.borderTopLeftRadius="50% 60%",q.style.borderTopRightRadius="50% 60%",q.style.backgroundColor=o.backgroundColor,s.appendChild(q),e.addAction("stereo-effect",l)}}()},Sphoords=function(){var e=function(e){return e-360*Math.floor(e/360)};this.start=function(){return Sphoords.isDeviceOrientationSupported?(window.addEventListener("deviceorientation",t,!1),i=!0,!0):(console.log("Device Orientation API not supported"),!1)},this.stop=function(){i&&(window.removeEventListener("deviceorientation",t,!1),i=!1)},this.toggle=function(){i?this.stop():this.start()},this.isEventAttached=function(){return i};var t=function(t){var i=0,u=0;switch(d=Sphoords.getScreenOrientation()){case"portrait-primary":i=t.alpha+t.gamma,u=t.beta-90;break;case"landscape-primary":if(i=t.alpha+t.beta-90,u=-t.gamma-90,Math.abs(t.beta)>90)switch(c){case"Blink":u+=180;break;case"Gecko":default:u=-u}"WebKit"===c&&window.orientation&&(u<0&&(u=-1*(u+180)),i>=180?i-=180:i+=180);break;case"landscape-secondary":if(i=t.alpha-t.beta+90,u=t.gamma-90,Math.abs(t.beta)>90)switch(c){case"Blink":u+=180;break;case"Gecko":default:u=-u}"WebKit"===c&&window.orientation&&(u<0&&(u=-1*(u+180)),i>=180?i-=180:i+=180);break;case"portrait-secondary":i=t.alpha-t.gamma,u=180-(t.beta-90),u=270-t.beta}(u=e(u))>=180&&(u-=360),n=e(i),r=Math.max(-90,Math.min(90,u)),a=n*l,s=r*l,o()};this.getCoordinates=function(){return{longitude:a,latitude:s}},this.getCoordinatesInDegrees=function(){return{longitude:n,latitude:r}},this.getScreenOrientation=function(){return d},this.addListener=function(e){u.push(e)};var o=function(){if(u.length)for(var e=0,t=u.length;e<t;++e)u[e]({longitude:a,latitude:s})},i=!1,n=0,r=0,a=0,s=0,l=Math.PI/180,d=Sphoords.getScreenOrientation(),c=function(){var e=navigator.userAgent;return/Gecko\/[0-9.]+/.test(e)?"Gecko":/Chrome\/[0-9.]+/.test(e)?"Blink":/AppleWebKit\/[0-9.]+/.test(e)?"WebKit":/Trident\/[0-9.]+/.test(e)?"Trident":/Opera\/[0-9.]+/.test(e)?"Presto":"Gecko"}(),u=[]};Sphoords.getScreenOrientation=function(){var e=null;if(screen.orientation)e=screen.orientation;else if(screen.mozOrientation)e=screen.mozOrientation;else if(screen.msOrientation)e=screen.msOrientation;else if(window.orientation||0===window.orientation)switch(window.orientation){case 0:e="portrait-primary";break;case 180:e="portrait-secondary";break;case-90:e="landscape-primary";break;case 90:e="landscape-secondary"}return null!==e&&"object"==typeof e?e.type:e},Sphoords.isDeviceOrientationSupported=!1,function(){function e(t){null!==t&&null!==t.alpha&&(Sphoords.isDeviceOrientationSupported=!0,window.removeEventListener("deviceorientation",e))}window.DeviceOrientationEvent&&null!==Sphoords.getScreenOrientation()&&window.addEventListener("deviceorientation",e)}();
SAVE
CANCEL