|  |  |  | var App = function () { | 
					
						
							|  |  |  |     this.Map = new Map(this); | 
					
						
							|  |  |  |     this.Slider = new Slider(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.Startup = function () { | 
					
						
							|  |  |  |         this.ReLayout(); | 
					
						
							|  |  |  |         this.RedirectPage(); | 
					
						
							|  |  |  |         window.onresize = this.ReLayout.bind(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.Map.Startup(); | 
					
						
							|  |  |  |         this.ResetTimeList(); | 
					
						
							|  |  |  |         this.Slider.Startup(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $('.particle-switch a').on('click', this.OnParticleSwitchButtonClick.bind(this)); | 
					
						
							|  |  |  |         $('#calc-btn').on('click', this.OnRefreshButtonClick.bind(this)); | 
					
						
							|  |  |  |         $('#shrink').on('click', this.OnShrinkClick.bind(this)); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.ReLayout = function () { | 
					
						
							|  |  |  |         var width = $(window).width(); | 
					
						
							|  |  |  |         var height = $(window).height(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $('.main').width(width - (this.IsShrink ? 0 : 286)); | 
					
						
							|  |  |  |         $('.main').height(height - 54); | 
					
						
							|  |  |  |         $('.right').height(height - 54); | 
					
						
							|  |  |  |         $('.calc-list').height(height - 370); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.RedirectPage = function () { | 
					
						
							|  |  |  |         var user = document.getElementById('user-info'); | 
					
						
							|  |  |  |         if (user.getAttribute('class') === 'user-login') | 
					
						
							|  |  |  |             window.location.href = '/User/Login'; | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.ResetTimeList = function () { | 
					
						
							|  |  |  |         var list = $('#calc-list ul'); | 
					
						
							|  |  |  |         list.empty(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         var now = new Date(); | 
					
						
							|  |  |  |         var fromHour = new Date(now.getFullYear(), now.getMonth(), now.getDate()); | 
					
						
							|  |  |  |         for (var i = 0; i < 48; i++) { | 
					
						
							|  |  |  |             var time = moment(fromHour).add('hours', i); | 
					
						
							|  |  |  |             var label = "<li time='{0}'>{1}</li>".format(time.format("YYYYMMDDHH"), time.format("YYYY-MM-DD HH:mm")); | 
					
						
							|  |  |  |             list.append(label); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.OnParticleSwitchButtonClick = function () { | 
					
						
							|  |  |  |         $('.particle-switch').toggleClass('switch-on'); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     this.OnRefreshButtonClick = function () { | 
					
						
							|  |  |  |         this.ResetTimeList(); | 
					
						
							|  |  |  |         this.Slider.Startup(); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.OnShrinkClick = function () { | 
					
						
							|  |  |  |         var width = $(window).width(); | 
					
						
							|  |  |  |         this.IsShrink = !this.IsShrink; | 
					
						
							|  |  |  |         if (this.IsShrink) { | 
					
						
							|  |  |  |             $('.main').width(width); | 
					
						
							|  |  |  |             $('.shrink').addClass('shrink-toggle'); | 
					
						
							|  |  |  |             $('.right').addClass('right-toggle'); | 
					
						
							|  |  |  |             $('.btn-group').addClass('real-btn-toggle'); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $('.main').width(width - 286); | 
					
						
							|  |  |  |             $('.shrink').removeClass('shrink-toggle'); | 
					
						
							|  |  |  |             $('.right').removeClass('right-toggle'); | 
					
						
							|  |  |  |             $('.btn-group').removeClass('real-btn-toggle'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         this.Map.CenterMap(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(document).ready(function () { | 
					
						
							|  |  |  |     var app = new App(); | 
					
						
							|  |  |  |     app.Startup(); | 
					
						
							|  |  |  | }); |