|
|
- /*!
- Virtual Sky
- (c) Stuart Lowe, Las Cumbres Observatory Global Telescope
- A browser planetarium using HTML5's <canvas>.
- */
- (function($){
- /*@cc_on
- // Fix for IE's inability to handle arguments to setTimeout/setInterval
- // From http://webreflection.blogspot.com/2007/06/simple-settimeout-setinterval-extra.html
- (function(f){
- window.setTimeout =f(window.setTimeout);
- window.setInterval =f(window.setInterval);
- })(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
- @*/
- function is(a,b){return typeof a===b}$.query=function(){var r={length:0};var q=location.search;if(q&&q!="#"){q=q.replace(/^\?/,"").replace(/\&$/,"");jQuery.each(q.split("&"),function(){var key=this.split("=")[0];var val=this.split("=")[1];if(/^-?[0-9.]+$/.test(val)){val=parseFloat(val)}if(val=="true"){val=true}if(val=="false"){val=false}if(/^\?[0-9\.]+$/.test(val)){val=parseFloat(val)}r[key]=val})}return r};$.extend($.fn.addTouch=function(){this.each(function(i,el){$(el).bind("touchstart touchmove touchend touchcancel touchdbltap",function(){handleTouch(event)})});var handleTouch=function(event){event.preventDefault();var simulatedEvent;var touches=event.changedTouches,first=touches[0],type="";switch(event.type){case"touchstart":type=["mousedown","click"];break;case"touchmove":type=["mousemove"];break;case"touchend":type=["mouseup"];break;case"touchdbltap":type=["dblclick"];break;default:return}for(var i=0;i<type.length;i++){simulatedEvent=document.createEvent("MouseEvent");simulatedEvent.initMouseEvent(type[i],true,true,window,1,first.screenX,first.screenY,first.clientX,first.clientY,false,false,false,false,0,null);first.target.dispatchEvent(simulatedEvent)}}});
- /*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
- * Licensed under the MIT License (LICENSE.txt).
- *
- * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
- * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
- * Thanks to: Seamus Leahy for adding deltaX and deltaY
- *
- * Version: 3.1.3
- *
- * Requires: 1.2.2+
- */
- (function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{if(typeof exports==="object"){module.exports=factory}else{factory(jQuery)}}}(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"];var toBind="onwheel" in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];var lowestDelta,lowestDeltaXY;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta){delta=orgEvent.wheelDelta}if(orgEvent.detail){delta=orgEvent.detail*-1}if(orgEvent.deltaY){deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX){deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined){deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined){deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY){lowestDeltaXY=absDeltaXY}fn=delta>0?"floor":"ceil";delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}}));
- /*! VirtualSky */
- function VirtualSky(input){this.version="0.6.7";this.ie=false;this.excanvas=(typeof G_vmlCanvasManager!="undefined")?true:false;
- /*@cc_on
- this.ie = true
- @*/
- this.q=$.query();this.dir=$("script[src*=virtualsky]").attr("src").match(/^.*\//);this.dir=this.dir&&this.dir[0]||"";this.langurl=this.dir+"lang/%LANG%.json";this.id="";this.gradient=true;this.magnitude=5;this.background="rgba(0,0,0,0)";this.color="";this.wide=0;this.tall=0;this.d2r=Math.PI/180;this.r2d=180/Math.PI;this.setLongitude(-119.86286);this.setLatitude(34.4326);this.spin=false;this.cardinalpoints=true;this.constellation={lines:false,boundaries:false,labels:false};this.meteorshowers=false;this.negative=false;this.showgalaxy=false;this.showstars=true;this.showstarlabels=false;this.showplanets=true;this.showplanetlabels=true;this.showorbits=false;this.showdate=true;this.showposition=true;this.scalestars=1;this.ground=false;this.grid={az:false,eq:false,gal:false,step:30};this.ecliptic=false;this.meridian=false;this.keyboard=false;this.mouse=true;this.islive=false;this.fullscreen=false;this.transparent=false;this.fps=10;this.credit=(location.host=="lco.global"&&location.href.indexOf("/embed")<0)?false:false;this.callback={geo:"",mouseenter:"",mouseout:""};this.keys=new Array();this.base="";this.az_step=0;this.az_off=0;this.ra_off=0;this.dc_off=0;this.fov=30;this.plugins=[];this.calendarevents=[];this.events={};this.projections={polar:{title:"Polar projection",azel2xy:function(az,el,w,h){var radius=h/2;var r=radius*((Math.PI/2)-el)/(Math.PI/2);return{x:(w/2-r*Math.sin(az)),y:(radius-r*Math.cos(az)),el:el}},polartype:true,atmos:true},fisheye:{title:"Fisheye polar projection",azel2xy:function(az,el,w,h){var radius=h/2;var r=radius*Math.sin(((Math.PI/2)-el)/2)/0.70710678;return{x:(w/2-r*Math.sin(az)),y:(radius-r*Math.cos(az)),el:el}},polartype:true,atmos:true},ortho:{title:"Orthographic polar projection",azel2xy:function(az,el,w,h){var radius=h/2;var r=radius*Math.cos(el);return{x:(w/2-r*Math.sin(az)),y:(radius-r*Math.cos(az)),el:el}},polartype:true,atmos:true},stereo:{title:"Stereographic projection",azel2xy:function(az,el,w,h){var f=0.42;var sinel1=0;var cosel1=1;var cosaz=Math.cos((az-Math.PI));var sinaz=Math.sin((az-Math.PI));var sinel=Math.sin(el);var cosel=Math.cos(el);var k=2/(1+sinel1*sinel+cosel1*cosel*cosaz);return{x:(w/2+f*k*h*cosel*sinaz),y:(h-f*k*h*(cosel1*sinel-sinel1*cosel*cosaz)),el:el}},atmos:true},lambert:{title:"Lambert projection",azel2xy:function(az,el,w,h){var cosaz=Math.cos((az-Math.PI));var sinaz=Math.sin((az-Math.PI));var sinel=Math.sin(el);var cosel=Math.cos(el);var k=Math.sqrt(2/(1+cosel*cosaz));return{x:(w/2+0.6*h*k*cosel*sinaz),y:(h-0.6*h*k*(sinel)),el:el}},atmos:true},gnomic:{title:"Gnomic projection",azel2xy:function(az,el){if(el>=0){var pos=this.azel2radec(az,el);return this.radec2xy(pos.ra*this.d2r,pos.dec*this.d2r,[el,az])}else{return{x:-1,y:-1,el:el}}},radec2xy:function(ra,dec,coords){var fov,cd,cd0,sd,sd0,dA,A,F,scale,twopi;if(Math.abs(dec-this.dc_off)>this.maxangle){return{x:-1,y:-1,el:-1}}var ang=this.greatCircle(this.ra_off,this.dc_off,ra,dec);if(ang>this.maxangle){return{x:-1,y:-1,el:-1}}if(!coords){coords=this.coord2horizon(ra,dec)}if(this.ground&&coords[0]<-0.000001){return{x:-1,y:-1,el:coords[0]*this.r2d}}scale=this.tall/this.fov;cd=Math.cos(dec);cd0=Math.cos(this.dc_off);sd=Math.sin(dec);sd0=Math.sin(this.dc_off);dA=ra-this.ra_off;dA=inrangeAz(dA);A=cd*Math.cos(dA);F=scale*this.r2d/(sd0*sd+A*cd0);return{x:(this.wide/2)-F*cd*Math.sin(dA),y:(this.tall/2)-F*(cd0*sd-A*sd0),el:coords[0]*this.r2d}},draw:function(){if(!this.transparent){this.ctx.fillStyle=(this.hasGradient())?"rgba(0,15,30, 1)":((this.negative)?this.col.white:this.col.black);this.ctx.fillRect(0,0,this.wide,this.tall);this.ctx.fill()}},isVisible:function(el){return true},atmos:false,fullsky:true},equirectangular:{title:"Equirectangular projection",azel2xy:function(az,el,w,h){while(az<0){az+=2*Math.PI}az=(az)%(Math.PI*2);return{x:(((az-Math.PI)/(Math.PI/2))*h+w/2),y:(h-(el/(Math.PI/2))*h),el:el}},maxb:90,atmos:true},mollweide:{title:"Mollweide projection",radec2xy:function(ra,dec){var dtheta,x,y,coords,sign,outside,normra;var thetap=Math.abs(dec);var pisindec=Math.PI*Math.sin(Math.abs(dec));for(var i=0;i<20;i++){dtheta
|