~jstys-z/helioviewer.org/client5

88 by V. Keith Hughitt
nightly build 07-04-2008
1
/**
180 by V. Keith Hughitt
nightly build 01-29-2009: Added jsdoc-toolkit generated code documentation. See /docs
2
 * @fileOverview Contains the main application class and controller for Helioviewer.
797 by Jeff Stys
NOTE:
3
 * @author <a href="mailto:jeff.stys@nasa.gov">Jeff Stys</a>
237 by V. Keith Hughitt
nightly build 2009-06-22: Switching from epoch times to ISO 8601 UTC Date strings as default date/time format.
4
 * @author <a href="mailto:keith.hughitt@nasa.gov">Keith Hughitt</a>
88 by V. Keith Hughitt
nightly build 07-04-2008
5
 */
797 by Jeff Stys
NOTE:
6
/*jslint browser: true, white: true, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: true,
402.1.32 by Keith Hughitt
Added Ant task to run JSLint. Delintified code from Config.js to LayerManager.js
7
  bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxlen: 120, sub: true */
797 by Jeff Stys
NOTE:
8
/*global document, window, $, HelioviewerClient, ImageSelectTool, MovieBuilder,
643 by Keith Hughitt
Combined ViewportController, Viewport, and HelioviewerViewport classes into a single class in order to refactor and properly separate UI code.
9
  TooltipHelper, HelioviewerViewport, ScreenshotBuilder, ScreenshotHistory,
402.4.60 by Keith Hughitt
Added button to open HEK cutout service query that corresponds to a given movie
10
  MovieHistory, UserVideoGallery, MessageConsole, Helioviewer,
823 by Jeff Stys
Attached Zoom and Center controls to left drawer so that it may be used regardless of the opened/closed state of the drawer.
11
  KeyboardManager, SettingsLoader, TimeControls,
797 by Jeff Stys
NOTE:
12
  ZoomControls, ScreenshotManagerUI, MovieManagerUI, assignTouchHandlers,
402.4.60 by Keith Hughitt
Added button to open HEK cutout service query that corresponds to a given movie
13
  TileLayerAccordion, VisualGlossary, _gaq */
374 by Keith Hughitt
Delinified Helioviewer.js, etc.
14
"use strict";
640 by Keith Hughitt
Broke up JavaScript Helioviewer.org appliation class into several classes for easier customization.
15
var HelioviewerWebClient = HelioviewerClient.extend(
16
    /** @lends HelioviewerWebClient.prototype */
357 by Keith Hughitt
Fixed white-space
17
    {
18
    /**
640 by Keith Hughitt
Broke up JavaScript Helioviewer.org appliation class into several classes for easier customization.
19
     * Creates a new Helioviewer.org instance.
357 by Keith Hughitt
Fixed white-space
20
     * @constructs
797 by Jeff Stys
NOTE:
21
     *
402.1.642 by Keith Hughitt
Updated structure of user settings. Preferences are now broken up into different categories (state, defaults, history and notifications). Also added some yet unimplemented settings to future-proof the settings structure a bit.
22
     * @param {Object} urlSettings Client-specified settings to load.
23
     *  Includes imageLayers, date, and imageScale. May be empty.
402.1.325 by Keith Hughitt
Updated coverage script to work with AIA. Added a simple diagram describing relationship between Helioviewer.org and Dynamo.
24
     * @param {Object} serverSettings Server settings loaded from Config.ini
357 by Keith Hughitt
Fixed white-space
25
     */
664 by Keith Hughitt
Main front-end queries now use JSONP when remote API is specified.
26
    init: function (urlSettings, serverSettings, zoomLevels) {
822 by Jeff Stys
Animated left and right drawer opening.
27
        var urlDate, imageScale, paddingHeight, accordionsToOpen, self=this;
28
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
29
        this.header                    = $('#hv-header');
30
        this.viewport                  = $('#helioviewer-viewport');
31
        this.drawerSpeed               = 0;
32
        this.drawerLeft                = $('#hv-drawer-left');
33
        this.drawerLeftOpened          = false;
34
        this.drawerLeftOpenedWidth     = 25;    /* em */
35
        this.drawerLeftTab             = $('#hv-drawer-tab-left');
36
        this.drawerLeftTabLeft         = -2.6; /* em */
37
        this.drawerLeftTabBorderRight  = "2pt solid rgba(0,0,0,1)";
38
        this.drawerLeftTabBorderBottom = "2pt solid rgba(0,0,0,1)";
39
        this.drawerNews                = $('#hv-drawer-news');
40
        this.drawerNewsOpenedHeight    = 'auto';
41
        this.drawerNewsOpenedWidth     = '25em';
42
        this.drawerMovies              = $('#hv-drawer-movies');
43
        this.drawerMoviesOpenedHeight  = 'auto';
44
        this.drawerMoviesOpenedWidth   = '25em';
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
45
        this.drawerScreenshots             = $('#hv-drawer-screenshots');
46
        this.drawerScreenshotsOpenedHeight = 'auto';
47
        this.drawerScreenshotsOpenedWidth  = '25em';
48
        this.drawerYoutube             = $('#hv-drawer-youtube');
49
        this.drawerYoutubeOpenedHeight = '55em';
50
        this.drawerYoutubeOpenedWidth  = '25em';
51
        this.drawerData                = $('#hv-drawer-data');
52
        this.drawerDataOpenedHeight    = 'auto';
53
        this.drawerDataOpenedWidth     = '25em';
54
        this.drawerShare               = $('#hv-drawer-share');
55
        this.drawerShareOpenedHeight   = 'auto';
56
        this.drawerShareOpenedWidth    = '25em';
57
58
        this.tabbedDrawers = ['#hv-drawer-news', '#hv-drawer-movies',
59
                              '#hv-drawer-screenshots', '#hv-drawer-youtube',
60
                              '#hv-drawer-data', '#hv-drawer-share'];
61
        this.tabbedDrawerButtons = {
62
            '#hv-drawer-news'        : '#news-button',
63
            '#hv-drawer-youtube'     : '#youtube-button',
64
            '#hv-drawer-movies'      : '#movies-button',
65
            '#hv-drawer-screenshots' : '#screenshots-button',
66
            '#hv-drawer-data'        : '#data-button',
67
            '#hv-drawer-share'       : '#share-button'};
797 by Jeff Stys
NOTE:
68
664 by Keith Hughitt
Main front-end queries now use JSONP when remote API is specified.
69
        this._super(urlSettings, serverSettings, zoomLevels);
402.1.690 by Keith Hughitt
Added user video gallery mockups.
70
402.1.691 by Keith Hughitt
Window dimensions now displayed in bottom-right corner in debug mode.
71
        // Debugging helpers
640 by Keith Hughitt
Broke up JavaScript Helioviewer.org appliation class into several classes for easier customization.
72
        if (urlSettings.debug) {
402.1.691 by Keith Hughitt
Window dimensions now displayed in bottom-right corner in debug mode.
73
            this._showDebugHelpers();
74
        }
797 by Jeff Stys
NOTE:
75
402.1.537 by Keith Hughitt
Beginning front-end refactoring: removed UIController class (does very little in current form)
76
        this._initLoadingIndicator();
402.1.643 by Keith Hughitt
Fixed tooltip style issue for datepicker. timestep stored across sessions.
77
        this._initTooltips();
797 by Jeff Stys
NOTE:
78
602 by Keith Hughitt
Zoom-levels computed server-side to normalize any differences between clients.
79
        // Determine image scale to use
80
        imageScale = this._chooseInitialImageScale(Helioviewer.userSettings.get('state.imageScale'), zoomLevels);
797 by Jeff Stys
NOTE:
81
402.1.672 by Keith Hughitt
Fixed URL parameter parsing
82
        // Use URL date if specified
602 by Keith Hughitt
Zoom-levels computed server-side to normalize any differences between clients.
83
        urlDate = urlSettings.date ? Date.parseUTCDate(urlSettings.date) : false;
402.1.672 by Keith Hughitt
Fixed URL parameter parsing
84
797 by Jeff Stys
NOTE:
85
        this.timeControls = new TimeControls('#date', '#time',
402.1.672 by Keith Hughitt
Fixed URL parameter parsing
86
            '#timestep-select', '#timeBackBtn', '#timeForwardBtn', urlDate);
402.1.537 by Keith Hughitt
Beginning front-end refactoring: removed UIController class (does very little in current form)
87
88
        // Get available data sources and initialize viewport
818 by Jeff Stys
Fullscreen viewport (with left and right columns and footer below the fold).
89
        this._initViewport(this.timeControls.getDate(), 0, 0);
402.1.538 by Keith Hughitt
Reorganized main application class
90
91
        this.messageConsole = new MessageConsole();
92
        this.keyboard       = new KeyboardManager();
797 by Jeff Stys
NOTE:
93
402.1.538 by Keith Hughitt
Reorganized main application class
94
        // User Interface components
602 by Keith Hughitt
Zoom-levels computed server-side to normalize any differences between clients.
95
        this.zoomControls   = new ZoomControls('#zoomControls', imageScale, zoomLevels,
797 by Jeff Stys
NOTE:
96
                                               this.serverSettings.minImageScale,
97
                                               this.serverSettings.maxImageScale);
98
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
99
        this.earthScale = new ImageScale();
402.1.538 by Keith Hughitt
Reorganized main application class
100
865 by Jeff Stys
+ Major refactoring of Earth Scale widget to work in new user-interface paradigm.
101
        this.displayBlogFeed(8, false);
797 by Jeff Stys
NOTE:
102
581 by Keith Hughitt
Added support for using custom video feed URL, including output from Yahoo Pipes.
103
        this._userVideos = new UserVideoGallery(this.serverSettings.videoFeed);
797 by Jeff Stys
NOTE:
104
584 by Keith Hughitt
Few small improvements relating to recent changes to YouTube-uploading logic.
105
        this.imageSelectTool = new ImageSelectTool();
797 by Jeff Stys
NOTE:
106
402.1.579 by Keith Hughitt
Created a MovieManagerUI class similar to ScreenshotManagerUI. Screenshot and Movie Manager classes now instantiated from within their respective UI classes
107
        this._screenshotManagerUI = new ScreenshotManagerUI();
108
        this._movieManagerUI      = new MovieManagerUI();
402.1.539 by Keith Hughitt
Created ScreenshotManager, ScreenshotManagerUI, and MediaManager classes to replace current screenshot front-end classes.
109
402.1.765 by Keith Hughitt
Initial Visual glossary implementation finished.
110
        this._glossary = new VisualGlossary(this._setupDialog);
111
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
112
        this._setupDialogs();
402.1.168 by Keith Hughitt
Removed legacy event-related code. Refactoring viewport and layers.
113
        this._initEventHandlers();
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
114
        this._setupSettingsUI();
797 by Jeff Stys
NOTE:
115
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
116
        this._displayGreeting();
822 by Jeff Stys
Animated left and right drawer opening.
117
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
118
        /* Open Left and Right Drawers */
822 by Jeff Stys
Animated left and right drawer opening.
119
        setTimeout(
120
            function () {
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
121
                self.drawerLeftClick(true);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
122
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
123
                $('#accordion-date   .disclosure-triangle').click();
124
                $('#accordion-images .disclosure-triangle').click();
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
125
                //$('#accordion-events .disclosure-triangle').click();
126
822 by Jeff Stys
Animated left and right drawer opening.
127
                setTimeout(
128
                    function () {
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
129
                        self.drawerYoutubeClick(true);
822 by Jeff Stys
Animated left and right drawer opening.
130
                    },
131
                    250
132
                );
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
133
134
                $('#accordion-youtube     .disclosure-triangle').click();
135
                $('#accordion-news        .disclosure-triangle').click();
136
                $('#accordion-screenshots .disclosure-triangle').click();
137
                $('#accordion-movies      .disclosure-triangle').click();
138
                $('#accordion-vso         .disclosure-triangle').click();
139
                $('#accordion-sdo         .disclosure-triangle').click();
868 by Jeff Stys
+ Added image area select buttons to SDO AIA/HMI Cut-out Service accordion
140
                $('#accordion-link        .disclosure-triangle').click();
141
                $('#accordion-social      .disclosure-triangle').click();
822 by Jeff Stys
Animated left and right drawer opening.
142
            },
143
            500
144
        );
823 by Jeff Stys
Attached Zoom and Center controls to left drawer so that it may be used regardless of the opened/closed state of the drawer.
145
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
146
    },
797 by Jeff Stys
NOTE:
147
402.1.537 by Keith Hughitt
Beginning front-end refactoring: removed UIController class (does very little in current form)
148
    /**
149
     * @description Sets up a simple AJAX-request loading indicator
150
     */
151
    _initLoadingIndicator: function () {
152
        $(document).ajaxStart(function () {
153
            $('#loading').show();
154
        })
155
        .ajaxStop(function () {
156
            $('#loading').hide();
797 by Jeff Stys
NOTE:
157
        });
402.1.537 by Keith Hughitt
Beginning front-end refactoring: removed UIController class (does very little in current form)
158
    },
797 by Jeff Stys
NOTE:
159
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
160
    /**
402.1.612 by Keith Hughitt
Fixed basic tooltips
161
     * Add tooltips to static HTML buttons and elements
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
162
     */
163
    _initTooltips: function () {
402.1.641 by Keith Hughitt
Added a bunch of fixes to small issues surrounding the new front-end code.
164
        // Overide qTip defaults
165
        $.fn.qtip.defaults = $.extend(true, {}, $.fn.qtip.defaults, {
166
            show: {
167
                delay: 1000
168
            },
402.1.612 by Keith Hughitt
Fixed basic tooltips
169
            style: {
170
                classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
171
            }
172
        });
797 by Jeff Stys
NOTE:
173
402.1.783 by Keith Hughitt
Fixed missing tooltips.
174
        // Bottom-right tooltips
175
        $("*[title]:not(.qtip-left)").qtip();
797 by Jeff Stys
NOTE:
176
402.1.783 by Keith Hughitt
Fixed missing tooltips.
177
        // Bottom-left tooltips
178
        $(".qtip-left").qtip({
402.1.612 by Keith Hughitt
Fixed basic tooltips
179
            position: {
180
                my: "top right",
181
                at: "bottom middle"
182
            }
183
        });
797 by Jeff Stys
NOTE:
184
185
        // Top-left tooltips
186
        $(".qtip-topleft").qtip({
187
            position: {
188
                my: "bottom right",
189
                at: "top middle"
190
            }
191
        });
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
192
    },
797 by Jeff Stys
NOTE:
193
402.1.177 by Keith Hughitt
Tooltip manager now listens for \'create-tooltip\' event.
194
    /**
641 by Keith Hughitt
Moved TileLayerAccordion out of viewport
195
     * Initializes the viewport
402.1.186 by Keith Hughitt
TileLayerManager moved into Viewport class (composition). Next, TileLayer dependencies on viewport can be removed.
196
     */
644 by Keith Hughitt
Viewport top and bottom margins now specifiable during construction.
197
    _initViewport: function (date, marginTop, marginBottom) {
818 by Jeff Stys
Fullscreen viewport (with left and right columns and footer below the fold).
198
        var self = this;
797 by Jeff Stys
NOTE:
199
641 by Keith Hughitt
Moved TileLayerAccordion out of viewport
200
        $(document).bind("datasources-initialized", function (e, dataSources) {
797 by Jeff Stys
NOTE:
201
            var tileLayerAccordion = new TileLayerAccordion('#tileLayerAccordion', dataSources, date);
202
        });
203
204
        $(document).bind("event-types-initialized", function (e, eventTypes, date) {
205
            var eventLayerAccordion = new EventLayerAccordion('#eventLayerAccordion', eventTypes, date);
206
        });
207
646 by Keith Hughitt
Added option to specify viewport container element
208
        this._super("#helioviewer-viewport-container-outer", date, marginTop, marginBottom);
602 by Keith Hughitt
Zoom-levels computed server-side to normalize any differences between clients.
209
    },
797 by Jeff Stys
NOTE:
210
602 by Keith Hughitt
Zoom-levels computed server-side to normalize any differences between clients.
211
    /**
402.1.729 by Keith Hughitt
Added support for loading a movie into history using URL params
212
     * Adds a movie to the user's history and displays the movie
797 by Jeff Stys
NOTE:
213
     *
402.1.729 by Keith Hughitt
Added support for loading a movie into history using URL params
214
     * @param string movieId Identifier of the movie to be shown
215
     */
402.1.784 by Keith Hughitt
Improved support for sharing movies
216
    loadMovie: function (movieId) {
402.1.729 by Keith Hughitt
Added support for loading a movie into history using URL params
217
        if (!this._movieManagerUI.has(movieId)) {
218
            this._movieManagerUI.addMovieUsingId(movieId);
402.1.730 by Keith Hughitt
Fixed bug #616377: Add option to generate a link to load a specific movie into Helioviewer.org
219
        } else {
797 by Jeff Stys
NOTE:
220
            this._movieManagerUI.playMovie(movieId);
402.1.729 by Keith Hughitt
Added support for loading a movie into history using URL params
221
        }
222
    },
797 by Jeff Stys
NOTE:
223
402.1.729 by Keith Hughitt
Added support for loading a movie into history using URL params
224
    /**
204 by V. Keith Hughitt
nightly build 04-01-2009
225
     * @description Sets up event-handlers for dialog components
226
     */
227
    _setupDialogs: function () {
402.1.514 by Keith Hughitt
Progress save
228
        var self = this;
797 by Jeff Stys
NOTE:
229
204 by V. Keith Hughitt
nightly build 04-01-2009
230
        // About dialog
402.1.334 by Keith Hughitt
Simplified popup dialog code.
231
        this._setupDialog("#helioviewer-about", "#about-dialog", {
797 by Jeff Stys
NOTE:
232
            "title"  : "Helioviewer - About",
233
            "height" : 400
204 by V. Keith Hughitt
nightly build 04-01-2009
234
        });
235
402.1.661 by Keith Hughitt
Settings dialog can now be hidden by pressing the setting button a second time.
236
        // Keyboard shortcuts dialog
402.1.334 by Keith Hughitt
Simplified popup dialog code.
237
        this._setupDialog("#helioviewer-usage", "#usage-dialog", {
238
            "title": "Helioviewer - Usage Tips"
239
        });
797 by Jeff Stys
NOTE:
240
402.1.661 by Keith Hughitt
Settings dialog can now be hidden by pressing the setting button a second time.
241
        // Settings dialog
242
        this._setupDialog("#settings-button", "#settings-dialog", {
243
            "buttons": {
244
                "Ok": function () {
245
                    $(this).dialog("close");
246
                }
247
            },
248
            "title": "Helioviewer - Settings",
249
            "width": 400,
250
            "height": 'auto',
251
            "resizable": false,
252
            "create": function (e) {
402.1.514 by Keith Hughitt
Progress save
253
402.1.661 by Keith Hughitt
Settings dialog can now be hidden by pressing the setting button a second time.
254
            }
402.1.514 by Keith Hughitt
Progress save
255
        });
402.1.334 by Keith Hughitt
Simplified popup dialog code.
256
    },
797 by Jeff Stys
NOTE:
257
402.1.334 by Keith Hughitt
Simplified popup dialog code.
258
    /**
259
     * Sets up event handlers for a single dialog
260
     */
402.1.769 by Keith Hughitt
Implemented visual glossary category selection.
261
    _setupDialog: function (btn, dialog, options, onLoad) {
402.1.334 by Keith Hughitt
Simplified popup dialog code.
262
        // Default options
263
        var defaults = {
264
            title     : "Helioviewer.org",
265
            autoOpen  : true,
266
            draggable : true,
267
            width     : 480,
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
268
            height    : 400
402.1.769 by Keith Hughitt
Implemented visual glossary category selection.
269
        };
797 by Jeff Stys
NOTE:
270
402.1.334 by Keith Hughitt
Simplified popup dialog code.
271
        // Button click handler
272
        $(btn).click(function () {
273
            var d   = $(dialog),
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
274
                btn = $(this);
402.1.334 by Keith Hughitt
Simplified popup dialog code.
275
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
276
            if (btn.hasClass("dialog-loaded")) {
204 by V. Keith Hughitt
nightly build 04-01-2009
277
                if (d.dialog('isOpen')) {
357 by Keith Hughitt
Fixed white-space
278
                    d.dialog('close');
279
                }
280
                else {
281
                    d.dialog('open');
282
                }
204 by V. Keith Hughitt
nightly build 04-01-2009
283
            } else {
402.1.769 by Keith Hughitt
Implemented visual glossary category selection.
284
                d.load(this.href, onLoad).dialog($.extend(defaults, options));
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
285
                btn.addClass("dialog-loaded");
204 by V. Keith Hughitt
nightly build 04-01-2009
286
            }
797 by Jeff Stys
NOTE:
287
            return false;
204 by V. Keith Hughitt
nightly build 04-01-2009
288
        });
289
    },
797 by Jeff Stys
NOTE:
290
402.1.691 by Keith Hughitt
Window dimensions now displayed in bottom-right corner in debug mode.
291
    /**
292
     * Enables some debugging helpers that display extra information to help
293
     * during development
294
     */
295
    _showDebugHelpers: function () {
296
        var dimensions, win = $(window);
797 by Jeff Stys
NOTE:
297
402.1.691 by Keith Hughitt
Window dimensions now displayed in bottom-right corner in debug mode.
298
        dimensions = $("<div id='debug-dimensions'></div>").appendTo("body");
299
300
        win.resize(function (e) {
301
            dimensions.html(win.width() + "x" + win.height());
302
        });
303
    },
797 by Jeff Stys
NOTE:
304
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
305
    /**
306
     * Configures the user settings form to match the stored values and
307
     * initializes event-handlers
308
     */
309
    _setupSettingsUI: function () {
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
310
        var form, dateLatest, datePrevious, autorefresh, self = this;
797 by Jeff Stys
NOTE:
311
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
312
        form         = $("#helioviewer-settings");
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
313
        dateLatest   = $("#settings-date-latest");
314
        datePrevious = $("#settings-date-previous");
797 by Jeff Stys
NOTE:
315
        autorefresh  = $("#settings-latest-image");
316
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
317
        // Starting date
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
318
        if (Helioviewer.userSettings.get("options.date") === "latest") {
797 by Jeff Stys
NOTE:
319
            dateLatest.attr("checked", "checked");
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
320
        } else {
321
            datePrevious.attr("checked", "checked");
322
        }
797 by Jeff Stys
NOTE:
323
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
324
        // Auto-refresh
325
        if (Helioviewer.userSettings.get("options.autorefresh")) {
326
            autorefresh.attr("checked", "checked");
327
            this.timeControls.enableAutoRefresh();
328
        } else {
329
            autorefresh.removeAttr("checked");
330
            this.timeControls.disableAutoRefresh();
331
        }
797 by Jeff Stys
NOTE:
332
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
333
        // Event-handlers
334
        dateLatest.change(function (e) {
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
335
            Helioviewer.userSettings.set("options.date", "latest");
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
336
        });
337
        datePrevious.change(function (e) {
402.1.897 by Keith Hughitt
Fixed bug #887604: Add setting to automatically display latest image
338
            Helioviewer.userSettings.set("options.date", "previous");
339
        });
340
        autorefresh.change(function (e) {
341
            Helioviewer.userSettings.set("options.autorefresh", e.target.checked);
342
            if (e.target.checked) {
343
                self.timeControls.enableAutoRefresh();
344
            } else {
345
                self.timeControls.disableAutoRefresh();
346
            }
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
347
        });
797 by Jeff Stys
NOTE:
348
402.1.896 by Keith Hughitt
Fixed bug #78221: Enable user to choose default behavior for initial observation date
349
    },
105 by V. Keith Hughitt
nightly build 08-19-2008: Separate event layers, event details hotkey, support for TRACE.
350
357 by Keith Hughitt
Fixed white-space
351
    /**
352
     * @description Initialize event-handlers for UI components controlled by the Helioviewer class
353
     */
402.1.168 by Keith Hughitt
Removed legacy event-related code. Refactoring viewport and layers.
354
    _initEventHandlers: function () {
797 by Jeff Stys
NOTE:
355
        var self = this,
832 by Jeff Stys
Numerous graphical UI changes to features and events, news, user videos, generate screenshot, and dialog boxes.
356
            msg  = "Link directly to the current state of Helioviewer:",
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
357
            btns;
797 by Jeff Stys
NOTE:
358
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
359
360
        $(document).bind('update-external-datasource-integration', $.proxy(this.updateExternalDataSourceIntegration, this));
361
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
362
        $('#accordion-vso input[type=text]').bind('change', $.proxy(this.updateExternalDataSourceIntegration, this));
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
363
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
364
        $('#accordion-sdo input[type=text]').bind('change', $.proxy(this.updateExternalDataSourceIntegration, this));
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
365
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
366
        $(this.drawerLeftTab).bind('click', $.proxy(this.drawerLeftClick, this));
822 by Jeff Stys
Animated left and right drawer opening.
367
        this.drawerLeft.bind('mouseover', function (event) { event.stopPropagation(); });
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
368
369
        $('#news-button').bind('click', $.proxy(this.drawerNewsClick, this));
370
        $('#youtube-button').bind('click', $.proxy(this.drawerYoutubeClick, this));
371
        $('#movies-button').bind('click', $.proxy(this.drawerMoviesClick, this));
372
        $('#screenshots-button').bind('click', $.proxy(this.drawerScreenshotsClick, this));
373
        $('#data-button').bind('click', $.proxy(this.drawerDataClick, this));
374
        $('#share-button').bind('click', $.proxy(this.drawerShareClick, this));
375
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
376
        $('.drawer-contents .header').bind('click', $.proxy(this.accordionHeaderClick, this));
377
        $('.contextual-help').bind('click', $.proxy(this.contextualHelpClick, this));
822 by Jeff Stys
Animated left and right drawer opening.
378
379
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
380
        $('#link-button').click(function (e) {
402.1.833 by Keith Hughitt
Added feature #789115: Enable event tracking with Google analytics; added support for tracking movie downloads and link button presses.
381
            // Google analytics event
402.4.60 by Keith Hughitt
Added button to open HEK cutout service query that corresponds to a given movie
382
            if (typeof(_gaq) !== "undefined") {
402.1.833 by Keith Hughitt
Added feature #789115: Enable event tracking with Google analytics; added support for tracking movie downloads and link button presses.
383
                _gaq.push(['_trackEvent', 'Shares', 'Homepage - URL']);
797 by Jeff Stys
NOTE:
384
            }
402.1.790 by Keith Hughitt
Updated to metadata handler.
385
            self.displayURL(self.toURL(), msg);
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
386
        });
797 by Jeff Stys
NOTE:
387
655 by Keith Hughitt
Cleaned up icon hover event handling
388
389
        // Highlight both text and icons for text buttons
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
390
391
        btns = $("#social-buttons .text-btn, " +
392
                 "#movie-manager-container .text-btn, " +
393
                 "#image-area-select-buttons > .text-btn, " +
394
                 "#screenshot-manager-container .text-btn, " +
395
                 "#event-container .text-btn");
396
        btns.live("mouseover",
655 by Keith Hughitt
Cleaned up icon hover event handling
397
            function () {
398
                $(this).find(".ui-icon").addClass("ui-icon-hover");
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
399
            });
400
        btns.live("mouseout",
655 by Keith Hughitt
Cleaned up icon hover event handling
401
            function () {
402
                $(this).find(".ui-icon").removeClass("ui-icon-hover");
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
403
            });
797 by Jeff Stys
NOTE:
404
402.1.510 by Keith Hughitt
Improved support for Mobile devices: opacity and zoom sliders now working; drag and drop works inside the viewport. Fixes bug #387365.
405
        // Fix drag and drop for mobile browsers
406
        $("#helioviewer-viewport, .ui-slider-handle").each(function () {
407
            assignTouchHandlers(this);
408
        });
797 by Jeff Stys
NOTE:
409
402.4.60 by Keith Hughitt
Added button to open HEK cutout service query that corresponds to a given movie
410
        $("#helioviewer-url-shorten").click(function (e) {
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
411
            var url;
412
413
            if (e.target.checked) {
797 by Jeff Stys
NOTE:
414
                url = $("#helioviewer-short-url").attr("value");
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
415
            } else {
416
                url = $("#helioviewer-long-url").attr("value");
417
            }
797 by Jeff Stys
NOTE:
418
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
419
            $("#helioviewer-url-input-box").attr('value', url).select();
420
        });
834 by Jeff Stys
Pulled Movie Generation interface into right drawer.
421
422
        $('#facebook-button').bind('click', $.proxy(this.facebook, this));
423
        $('#pinterest-button').bind('click', $.proxy(this.pinterest, this));
866 by Jeff Stys
+ Added mouse coordinate readout to the Helioviewer Header to the left of the scale viewport-action buttons.
424
425
        $('#mouse-cartesian').click( function (event) {
426
            $(document).trigger('toggle-mouse-coords');
427
            $(this).toggleClass('active');
428
        });
429
        $('#mouse-polar').click(function () {
430
            $(document).trigger('toggle-mouse-coords');
431
            $(this).toggleClass('active');
432
        });
400 by Keith Hughitt
Moved keyboard event-handlers to separate class.
433
    },
797 by Jeff Stys
NOTE:
434
238 by V. Keith Hughitt
nightly build 2009-06-23: Updated API to use ISO 8601 Date strings and underscore delineated layer identifiers (e.g. SOH_EIT_EIT_171 instead of SOHEITEIT171). Improvements to view API. Added a simple Link button to generate URL's corresponding with the current view.
435
    /**
239 by V. Keith Hughitt
nightly build 2009-06-24
436
     * displays a dialog containing a link to the current page
437
     * @param {Object} url
438
     */
402.1.790 by Keith Hughitt
Updated to metadata handler.
439
    displayURL: function (url, msg) {
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
440
        // Get short URL before displaying
441
        var callback = function (response) {
442
            $("#helioviewer-long-url").attr("value", url);
443
            $("#helioviewer-short-url").attr("value", response.data.url);
797 by Jeff Stys
NOTE:
444
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
445
            // Display URL
446
            $("#helioviewer-url-box-msg").text(msg);
447
            $("#url-dialog").dialog({
448
                dialogClass: 'helioviewer-modal-dialog',
832 by Jeff Stys
Numerous graphical UI changes to features and events, news, user videos, generate screenshot, and dialog boxes.
449
                height    : 125,
450
                maxHeight : 125,
451
                width     : $('html').width() * 0.5,
452
                minWidth  : 350,
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
453
                modal     : true,
832 by Jeff Stys
Numerous graphical UI changes to features and events, news, user videos, generate screenshot, and dialog boxes.
454
                resizable : true,
455
                title     : "Helioviewer - Direct Link",
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
456
                open      : function (e) {
457
                    $("#helioviewer-url-shorten").removeAttr("checked");
458
                    $('.ui-widget-overlay').hide().fadeIn();
459
                    $("#helioviewer-url-input-box").attr('value', url).select();
460
                }
461
            });
462
        };
797 by Jeff Stys
NOTE:
463
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
464
        // Get short version of URL and open dialog
465
        $.ajax({
466
            url: Helioviewer.api,
467
            dataType: Helioviewer.dataType,
468
            data: {
469
                "action": "shortenURL",
797 by Jeff Stys
NOTE:
470
                "queryString": url.substr(this.serverSettings.rootURL.length + 2)
680 by Keith Hughitt
Switched shortenURL requests to use chained functions instead of a synchronous request to better support JSONP.
471
            },
472
            success: callback
239 by V. Keith Hughitt
nightly build 2009-06-24
473
        });
474
    },
797 by Jeff Stys
NOTE:
475
476
239 by V. Keith Hughitt
nightly build 2009-06-24
477
    /**
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
478
     * Displays a URL to a Helioviewer.org movie
797 by Jeff Stys
NOTE:
479
     *
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
480
     * @param string Id of the movie to be linked to
481
     */
402.1.790 by Keith Hughitt
Updated to metadata handler.
482
    displayMovieURL: function (movieId) {
483
        var msg = "Use the following link to refer to this movie:",
484
            url = this.serverSettings.rootURL + "/?movieId=" + movieId;
402.1.754 by Keith Hughitt
Fixed text for movie link popup
485
402.1.833 by Keith Hughitt
Added feature #789115: Enable event tracking with Google analytics; added support for tracking movie downloads and link button presses.
486
        // Google analytics event
402.4.60 by Keith Hughitt
Added button to open HEK cutout service query that corresponds to a given movie
487
        if (typeof(_gaq) !== "undefined") {
402.1.833 by Keith Hughitt
Added feature #789115: Enable event tracking with Google analytics; added support for tracking movie downloads and link button presses.
488
            _gaq.push(['_trackEvent', 'Shares', 'Movie - URL']);
797 by Jeff Stys
NOTE:
489
        }
490
        this.displayURL(url, msg);
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
491
    },
797 by Jeff Stys
NOTE:
492
402.1.734 by Keith Hughitt
Added a button to the video popup to display a link to the movie
493
    /**
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
494
     * Displays recent news from the Helioviewer Project blog
495
     */
668 by Keith Hughitt
Updated news feed query to support JSONP
496
    displayBlogFeed: function (n, showDescription, descriptionWordLength) {
497
        var url, dtype, html = "";
797 by Jeff Stys
NOTE:
498
668 by Keith Hughitt
Updated news feed query to support JSONP
499
        url = this.serverSettings.newsURL;
797 by Jeff Stys
NOTE:
500
668 by Keith Hughitt
Updated news feed query to support JSONP
501
        // For remote queries, retrieve XML using JSONP
502
        if (Helioviewer.dataType === "jsonp") {
503
            dtype = "jsonp text xml";
504
        } else {
505
            dtype = "xml";
506
        }
797 by Jeff Stys
NOTE:
507
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
508
        $.getFeed({
668 by Keith Hughitt
Updated news feed query to support JSONP
509
            url: Helioviewer.api,
510
            data: {"action": "getNewsFeed"},
511
            dataType: dtype,
402.1.482 by Keith Hughitt
Fixed an issue resulting in smaller YouTube thumbnails being used in user video gallery. Cleaned up lint.
512
            success: function (feed) {
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
513
                var link, date, more, description;
797 by Jeff Stys
NOTE:
514
581 by Keith Hughitt
Added support for using custom video feed URL, including output from Yahoo Pipes.
515
                // Display message if there was an error retrieving the feed
516
                if (!feed.items) {
517
                    $("#social-panel").append("Unable to retrieve news feed...");
518
                    return;
519
                }
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
520
521
                // Grab the n most recent articles
522
                $.each(feed.items.slice(0, n), function (i, a) {
523
                    link = "<a href='" + a.link + "' alt='" + a.title + "' target='_blank'>" + a.title + "</a><br />";
402.1.482 by Keith Hughitt
Fixed an issue resulting in smaller YouTube thumbnails being used in user video gallery. Cleaned up lint.
524
                    date = "<div class='article-date'>" + a.updated.slice(0, 26) + "UTC</div>";
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
525
                    html += "<div class='blog-entry'>" + link + date;
797 by Jeff Stys
NOTE:
526
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
527
                    // Include description?
528
                    if (showDescription) {
529
                        description = a.description;
530
531
                        // Shorten if requested
532
                        if (typeof descriptionWordLength === "number") {
533
                            description = description.split(" ").slice(0, descriptionWordLength).join(" ") + " [...]";
534
                        }
535
                        html += "<div class='article-desc'>" + description + "</div>";
536
                    }
797 by Jeff Stys
NOTE:
537
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
538
                    html += "</div>";
539
                });
797 by Jeff Stys
NOTE:
540
402.1.686 by Keith Hughitt
Added configuration option to specify blog base URL.
541
                more = "<div id='more-articles'><a href='" + url +
801 by Jeff Stys
Overhaul of API Documentation, Sidebar Toggle, Movie Player Dialog updates, Bug Fixes.
542
                       "' title='The Helioviewer Project Blog'>Visit Blog...</a></div>";
797 by Jeff Stys
NOTE:
543
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
544
                $("#social-panel").append(html + more);
545
            }
546
        });
547
    },
797 by Jeff Stys
NOTE:
548
402.1.461 by Keith Hughitt
Added New section. Added a 'getUserVideos' API method to retrieve the latest videos uploaded to YouTube by Helioviewer.org users.
549
    /**
402.1.146 by Keith Hughitt
Refactoring Viewport. Moved text-shadows method to application class.
550
     * Launches an instance of JHelioviewer
797 by Jeff Stys
NOTE:
551
     *
402.1.233 by Keith Hughitt
Time controls now returns data by value instead of reference. Optimal time window computed for purpose of JNLP generation.
552
     * Helioviewer attempts to choose a 24-hour window around the current observation time. If the user is
553
     * currently browsing near the end of the available data then the window for which the movie is created
554
     * is shifted backward to maintain it's size.
402.1.146 by Keith Hughitt
Refactoring Viewport. Moved text-shadows method to application class.
555
     */
556
    launchJHelioviewer: function () {
402.1.233 by Keith Hughitt
Time controls now returns data by value instead of reference. Optimal time window computed for purpose of JNLP generation.
557
        var endDate, params;
797 by Jeff Stys
NOTE:
558
402.1.233 by Keith Hughitt
Time controls now returns data by value instead of reference. Optimal time window computed for purpose of JNLP generation.
559
        // If currently near the end of available data, shift window back
402.1.241 by Keith Hughitt
Fixed an issue preventing layeringOrder from updating after changing an existing layer's data-source. Overrode Date.prototype.toISOString in order to normalize behavior across browsers: fixes several issues in IE, etc.
560
        endDate = new Date(Math.min(this.timeControls.getDate().addHours(12), new Date()));
402.1.233 by Keith Hughitt
Time controls now returns data by value instead of reference. Optimal time window computed for purpose of JNLP generation.
561
562
        params = {
402.1.234 by Keith Hughitt
Implemented launchJHelioviewer method compatable with JHelioviewer's new command-line interface. Merged in Jaclyn's recent changes to tile generation code.
563
            "action"    : "launchJHelioviewer",
564
            "endTime"   : endDate.toISOString(),
565
            "startTime" : endDate.addHours(-24).toISOString(),
402.1.237 by Keith Hughitt
Fixed JHelioviewer launcher so that image scale is dynamically set. Moved launchJHelioviewer method to JHelioviewer module.
566
            "imageScale": this.viewport.getImageScaleInKilometersPerPixel(),
402.1.234 by Keith Hughitt
Implemented launchJHelioviewer method compatable with JHelioviewer's new command-line interface. Merged in Jaclyn's recent changes to tile generation code.
567
            "layers"    : this.viewport.serialize()
402.1.233 by Keith Hughitt
Time controls now returns data by value instead of reference. Optimal time window computed for purpose of JNLP generation.
568
        };
664 by Keith Hughitt
Main front-end queries now use JSONP when remote API is specified.
569
        window.open(Helioviewer.api + "?" + $.param(params), "_blank");
402.1.146 by Keith Hughitt
Refactoring Viewport. Moved text-shadows method to application class.
570
    },
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
571
572
    /**
573
     * Displays welcome message on user's first visit
574
     */
575
    _displayGreeting: function () {
402.1.642 by Keith Hughitt
Updated structure of user settings. Preferences are now broken up into different categories (state, defaults, history and notifications). Also added some yet unimplemented settings to future-proof the settings structure a bit.
576
        if (!Helioviewer.userSettings.get("notifications.welcome")) {
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
577
            return;
578
        }
402.3.56 by Jaclyn Beck
Working on refactoring front-end. Made some changes to Helioviewer.js and the Viewport classes
579
797 by Jeff Stys
NOTE:
580
        $(document).trigger("message-console-info",
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
581
            ["<b>Welcome to Helioviewer.org</b>, a solar data browser. First time here? Be sure to check out our " +
797 by Jeff Stys
NOTE:
582
             "<a href=\"http://wiki.helioviewer.org/wiki/Helioviewer.org_User_Guide_2.4.0\" " +
583
             "class=\"message-console-link\" target=\"_blank\"> User Guide</a>.</br>", {sticky: true}]
402.1.642 by Keith Hughitt
Updated structure of user settings. Preferences are now broken up into different categories (state, defaults, history and notifications). Also added some yet unimplemented settings to future-proof the settings structure a bit.
584
        );
797 by Jeff Stys
NOTE:
585
402.1.642 by Keith Hughitt
Updated structure of user settings. Preferences are now broken up into different categories (state, defaults, history and notifications). Also added some yet unimplemented settings to future-proof the settings structure a bit.
586
        Helioviewer.userSettings.set("notifications.welcome", false);
402.1.176 by Keith Hughitt
2010/05/10: Continuing refactoring of client-side code.
587
    },
797 by Jeff Stys
NOTE:
588
402.1.146 by Keith Hughitt
Refactoring Viewport. Moved text-shadows method to application class.
589
    /**
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
590
     * Returns the current observation date
797 by Jeff Stys
NOTE:
591
     *
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
592
     * @return {Date} observation date
593
     */
594
    getDate: function () {
595
        return this.timeControls.getDate();
596
    },
797 by Jeff Stys
NOTE:
597
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
598
    /**
599
     * Returns the currently loaded layers
797 by Jeff Stys
NOTE:
600
     *
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
601
     * @return {String} Serialized layer string
602
     */
603
    getLayers: function () {
604
        return this.viewport.serialize();
605
    },
797 by Jeff Stys
NOTE:
606
607
    /**
608
     * Returns the currently selected event layers
609
     *
610
     * @return {String} Serialized event layer string
611
     */
612
    getEvents: function () {
613
        return this.viewport.serializeEvents();
614
    },
615
616
    /**
617
     * Returns the currently selected event layers
618
     *
619
     * @return {String} Serialized event layer string
620
     */
621
    getEventsLabels: function () {
622
        return Helioviewer.userSettings.get("state.eventLabels");
623
    },
624
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
625
    /**
402.4.3 by Keith Hughitt
Layers that don't share an overlap with the request region are now filtered out during screenshot/movie creation.
626
     * Returns a string representation of the layers which are visible and
627
     * overlap the specified region of interest
628
     */
629
    getVisibleLayers: function (roi) {
630
        return this.viewport.getVisibleLayers(roi);
631
    },
797 by Jeff Stys
NOTE:
632
402.4.3 by Keith Hughitt
Layers that don't share an overlap with the request region are now filtered out during screenshot/movie creation.
633
    /**
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
634
     * Returns the currently displayed image scale
635
     *
636
     * @return {Float} image scale in arc-seconds/pixel
637
     */
638
    getImageScale: function () {
639
        return this.viewport.getImageScale();
640
    },
797 by Jeff Stys
NOTE:
641
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
642
    /**
643
     * Returns the top-left and bottom-right coordinates for the viewport region of interest
797 by Jeff Stys
NOTE:
644
     *
645
     * @return {Object} Current ROI
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
646
     */
647
    getViewportRegionOfInterest: function () {
648
        return this.viewport.getRegionOfInterest();
649
    },
797 by Jeff Stys
NOTE:
650
402.1.540 by Keith Hughitt
Continuing refactoring of Screenshot front-end code; created new helper methods in application class to make it easier to retrieve information about observation date, layers, etc
651
    /**
402.1.141 by Keith Hughitt
Beginning refactoring to use jQuery custom events to decouple classes.
652
     * Builds a URL for the current view
653
     *
654
     * @TODO: Add support for viewport offset, event layers, opacity
797 by Jeff Stys
NOTE:
655
     *
402.1.141 by Keith Hughitt
Beginning refactoring to use jQuery custom events to decouple classes.
656
     * @returns {String} A URL representing the current state of Helioviewer.org.
657
     */
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
658
    toURL: function (shorten) {
659
        // URL parameters
402.1.726 by Keith Hughitt
Updated link creation to include centering information.
660
        var params = {
813 by jeff Stys
Addressed bug (#1383440) "Link button does not use requested date/time"
661
            "date"        : this.viewport._tileLayerManager.getRequestDateAsISOString(),
402.1.726 by Keith Hughitt
Updated link creation to include centering information.
662
            "imageScale"  : this.viewport.getImageScale(),
663
            "centerX"     : Helioviewer.userSettings.get("state.centerX"),
797 by Jeff Stys
NOTE:
664
            "centerY"     : Helioviewer.userSettings.get("state.centerY"),
665
            "imageLayers" : encodeURI(this.viewport.serialize()),
666
            "eventLayers" : encodeURI(this.viewport.serializeEvents()),
667
            "eventLabels" : Helioviewer.userSettings.get("state.eventLabels")
402.1.726 by Keith Hughitt
Updated link creation to include centering information.
668
        };
797 by Jeff Stys
NOTE:
669
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
670
        return this.serverSettings.rootURL + "/?" + decodeURIComponent($.param(params));
671
    },
797 by Jeff Stys
NOTE:
672
822 by Jeff Stys
Animated left and right drawer opening.
673
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
674
    drawerLeftClick: function(openNow) {
823 by Jeff Stys
Attached Zoom and Center controls to left drawer so that it may be used regardless of the opened/closed state of the drawer.
675
        var self = this;
676
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
677
        if ( this.drawerLeftOpened || openNow === false ) {
822 by Jeff Stys
Animated left and right drawer opening.
678
            this.drawerLeft.css('width', 0);
679
            $('.drawer-contents', this.drawerLeft).hide();
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
680
            this.drawerLeftTab.css('left', '-2.7em');
822 by Jeff Stys
Animated left and right drawer opening.
681
            this.drawerLeft.css('padding', 0);
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
682
            this.drawerLeft.css('border', 'none');
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
683
684
            this.drawerLeftOpened = false;
822 by Jeff Stys
Animated left and right drawer opening.
685
        }
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
686
        else if ( !this.drawerLeftOpened || openNow === true ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
687
            this.drawerLeft.css('width', this.drawerLeftOpenedWidth+'em');
688
            this.drawerLeft.css('border-right', this.drawerLeftTabBorderRight);
689
            this.drawerLeft.css('border-bottom', this.drawerLeftTabBorderBottom);
690
            this.drawerLeftTab.css('left', (this.drawerLeftOpenedWidth+this.drawerLeftTabLeft)+'em');
691
            $(this.drawerLeft.parent()).css('left', this.drawerLeftOpenedWidth+'em');
822 by Jeff Stys
Animated left and right drawer opening.
692
            setTimeout(function () {
823 by Jeff Stys
Attached Zoom and Center controls to left drawer so that it may be used regardless of the opened/closed state of the drawer.
693
                $('.drawer-contents', this.drawerLeft).show();
822 by Jeff Stys
Animated left and right drawer opening.
694
            }, this.drawerSpeed);
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
695
696
            this.drawerLeftOpened = true;
822 by Jeff Stys
Animated left and right drawer opening.
697
        }
698
699
        return;
700
    },
701
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
702
    drawerNewsClick: function() {
703
        var self = this,
704
            buttonId = '#news-button';
705
706
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerNews.attr('id'));
707
708
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
709
            self.drawerNews.css('transition', '');
710
            $('.drawer-contents', self.drawerNews).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
711
            self.drawerNews.css('height', 0);
712
            self.drawerNews.css('padding', 0);
713
            self.drawerNews.hide();
714
            $(buttonId).removeClass('opened');
715
        }
716
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
717
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
718
            self.drawerNews.css('height', self.drawerNewsOpenedHeight);
719
            setTimeout(function () {
720
                self.drawerNews.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
721
                $('.drawer-contents', self.drawerNews).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
722
            }, self.drawerSpeed);
723
            $(buttonId).addClass('opened');
724
        }
725
726
        return;
727
    },
728
729
    drawerYoutubeClick: function() {
730
        var self = this,
731
            buttonId = '#youtube-button';
732
733
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerYoutube.attr('id'));
734
735
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
736
            self.drawerNews.css('transition', '');
737
            $('.drawer-contents', this.drawerYoutube).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
738
            this.drawerYoutube.css('height', 0);
739
            this.drawerYoutube.css('padding', 0);
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
740
            this.drawerYoutube.css({'display':'none'});
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
741
            $(buttonId).removeClass('opened');
742
        }
743
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
744
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
745
            this.drawerYoutube.css('height', this.drawerYoutubeOpenedHeight);
746
            setTimeout(function () {
747
                self.drawerYoutube.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
748
                $('.drawer-contents', this.drawerYoutube).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
749
            }, this.drawerSpeed);
750
            $(buttonId).addClass('opened');
751
        }
752
753
        return;
754
    },
755
756
    drawerMoviesClick: function() {
757
        var self = this,
758
            buttonId = '#movies-button';
759
760
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerMovies.attr('id'));
761
762
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
763
            self.drawerNews.css('transition', '');
764
            $('.drawer-contents', this.drawerMovies).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
765
            this.drawerMovies.css('height', 0);
766
            this.drawerMovies.css('padding', 0);
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
767
            this.drawerMovies.css({'display':'none'});
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
768
            $(buttonId).removeClass('opened');
769
        }
770
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
771
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
772
            this.drawerMovies.css('height', this.drawerMoviesOpenedHeight);
773
            setTimeout(function () {
774
                self.drawerMovies.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
775
                $('.drawer-contents', this.drawerMovies).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
776
            }, this.drawerSpeed);
777
            $(buttonId).addClass('opened');
778
        }
779
780
        return;
781
    },
782
783
    drawerScreenshotsClick: function() {
784
        var self = this,
785
            buttonId = '#screenshots-button';
786
787
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerScreenshots.attr('id'));
788
789
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
790
            self.drawerNews.css('transition', '');
791
            $('.drawer-contents', this.drawerScreenshots).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
792
            this.drawerScreenshots.css('height', 0);
793
            this.drawerScreenshots.css('padding', 0);
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
794
            this.drawerScreenshots.css({'display':'none'});
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
795
            $(buttonId).removeClass('opened');
796
        }
797
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
798
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
799
            this.drawerScreenshots.css('height', this.drawerScreenshotsOpenedHeight);
800
            setTimeout(function () {
801
                self.drawerScreenshots.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
802
                $('.drawer-contents', this.drawerScreenshots).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
803
            }, this.drawerSpeed);
804
            $(buttonId).addClass('opened');
805
        }
806
807
        return;
808
    },
809
810
    drawerDataClick: function() {
811
        var self = this,
812
            buttonId = '#data-button';
813
814
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerData.attr('id'));
815
816
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
817
            self.drawerNews.css('transition', '');
818
            $('.drawer-contents', this.drawerData).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
819
            this.drawerData.css('height', 0);
820
            this.drawerData.css('padding', 0);
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
821
            this.drawerData.css({'display':'none'});
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
822
            $(buttonId).removeClass('opened');
823
        }
824
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
825
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
826
            this.drawerData.css('height', this.drawerDataOpenedHeight);
827
            setTimeout(function () {
828
                self.drawerData.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
829
                $('.drawer-contents', this.drawerData).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
830
            }, this.drawerSpeed);
831
            $(buttonId).addClass('opened');
832
        }
833
834
        return;
835
    },
836
837
    drawerShareClick: function() {
838
        var self = this,
839
            buttonId = '#share-button';
840
841
        this.closeTabDrawersExcept(buttonId, '#'+this.drawerShare.attr('id'));
842
843
        if ( $(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
844
            self.drawerNews.css('transition', '');
845
            $('.drawer-contents', this.drawerShare).fadeOut(10);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
846
            this.drawerShare.css('height', 0);
847
            this.drawerShare.css('padding', 0);
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
848
            this.drawerShare.css({'display':'none'});
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
849
            $(buttonId).removeClass('opened');
850
        }
851
        else if ( !$(buttonId).hasClass('opened') ) {
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
852
            self.drawerNews.css('transition', 'height 500ms');
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
853
            this.drawerShare.css('height', this.drawerShareOpenedHeight);
854
            setTimeout(function () {
855
                self.drawerShare.show();
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
856
                $('.drawer-contents', this.drawerShare).fadeIn(500);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
857
            }, this.drawerSpeed);
858
            $(buttonId).addClass('opened');
822 by Jeff Stys
Animated left and right drawer opening.
859
        }
860
861
        return;
862
    },
863
825 by Jeff Stys
Added ability to toggle accordions within drawers opened and closed.
864
    accordionHeaderClick: function(event) {
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
865
        var obj = $(event.target).parent().find('.disclosure-triangle');
825 by Jeff Stys
Added ability to toggle accordions within drawers opened and closed.
866
867
        if ( obj.attr('class').indexOf('closed') != -1 ) {
868
            obj.html('â–¼');
869
            obj.addClass('opened');
870
            obj.removeClass('closed');
871
            $('.content', obj.parent().parent()).show();
872
            $('.contextual-help', obj.parent().parent()).show();
873
        }
874
        else {
875
            obj.html('â–º');
876
            obj.addClass('closed');
877
            obj.removeClass('opened');
878
            $('.content', obj.parent().parent()).hide();
879
            $('.contextual-help', obj.parent().parent()).hide();
880
        }
881
882
        event.stopPropagation();
883
    },
884
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
885
886
    closeTabDrawersExcept: function (buttonId, drawerId) {
887
        self = this;
888
889
        $.each( this.tabbedDrawers, function (i, drawer) {
890
            if ( drawer != drawerId ) {
891
860 by Jeff Stys
+ Disabled text selection in the Viewport, Header, Drawers, Drawer Tabs, and the Viewport Control widgets.
892
                $('.drawer-contents', drawer).fadeOut(100);
859 by Jeff Stys
+ Contents of old "Data Export" tab has been subdivided into multiple drop down drawers.
893
                $(drawer).css('height', 0);
894
                $(drawer).css('padding', 0);
895
                $(self.tabbedDrawerButtons[drawer]).removeClass('opened');
896
            }
897
        });
898
899
    },
900
829 by Jeff Stys
Added the ability to toggle an accordion open or closed by clicking anywhere on it's header (rather than only on the disclosure triangle as before).
901
    contextualHelpClick: function (event) {
902
        var alertText = $(event.target).attr('title');
903
        alertText = alertText.replace(/<\/?[^>]+(>|$)/g, "");
904
        alert( alertText );
905
        event.stopPropagation();
906
    },
907
834 by Jeff Stys
Pulled Movie Generation interface into right drawer.
908
    twitter: function() {
909
        self = this;
910
        $(this).prop('data-url', encodeURIComponent(self.toURL()) );
911
        $('#twitter-button').bind('click', $.proxy(this.twitter, this));
912
        return;
913
    },
914
915
    facebook: function(e) {
916
917
        var href   = $(e.target).attr('href')
918
                   + '&u='
919
                   + encodeURIComponent(this.toURL()),
920
            target = $(e.target).attr('target');
921
        e.stopPropagation();
922
923
        window.open(href, target);
924
        return false;
925
    },
926
927
    pinterest: function() {
928
        self = this;
929
        $('#pinterest-button').unbind('click');
930
931
        var url = encodeURIComponent(self.toURL());
932
        var media = encodeURIComponent('http://api.helioviewer.org/v2/downloadScreenshot/?id=3240748');
933
        var desc = $(this).attr('data-desc')+' '+encodeURIComponent(self.toURL());
934
        window.open("//www.pinterest.com/pin/create/button/"+
935
        "?url="+url+
936
        "&media="+media+
937
        "&description="+desc, "hv_pinterest");
938
939
        $('#pinterest-button').bind('click', $.proxy(this.pinterest, this));
940
        return;
941
    },
942
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
943
    updateExternalDataSourceIntegration: function (event) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
944
        var params         = Array(),
945
            vsoLinks       = $('#vso-links'),
946
            vsoPreviews    = $('#vso-previews'),
947
            vsoButtons     = $('#vso-buttons'),
948
            sdoPreviews    = $('#sdo-previews'),
949
            sdoButtons     = $('#sdo-buttons'),
853 by Jeff Stys
Implemented generation of custom VSO website links.
950
            instruments    = Array(),
951
            wavesAll       = Array(),
952
            wavesSDO       = Array(),
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
953
            sourceIDsAll   = Array(),
954
            sourceIDsSDO   = Array(),
955
            startDate,
956
            endDate,
957
            vport,
958
            imageScale,
959
            x0, y0, width, height,
960
            x1, y1, x2, y2,
961
            width, height,
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
962
            jGrowlOpts = {sticky:true, header:'Just now'},
963
            url, body,
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
964
            self = this;
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
965
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
966
        vport = this.viewport.getViewportInformation();
967
968
        // Arc seconds per pixel
969
        imageScale = vport['imageScale'];
970
971
        // Arc seconds
972
        x1 = vport['coordinates']['left']   * vport['imageScale'];
973
        x2 = vport['coordinates']['right']  * vport['imageScale'];
974
        y1 = vport['coordinates']['top']    * vport['imageScale'];
975
        y2 = vport['coordinates']['bottom'] * vport['imageScale'];
976
        x0 = (x1 + x2) / 2;
977
        y0 = (y1 + y2) / 2;
978
        width  =  (  vport['coordinates']['right']
979
                   - vport['coordinates']['left'] ) * imageScale;
980
        height = (  vport['coordinates']['bottom']
981
                  - vport['coordinates']['top'] )   * imageScale;
982
983
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
984
        // If this method is triggered by a change to the Tile Layer dates,
985
        // then update the values in the export tool.
986
        // (Otherwise, user updated the export dates themselves)
987
        if ( event['type'] == 'update-external-datasource-integration' ) {
988
            $('#vso-start-date').val(
989
            this.viewport.getEarliestLayerDate().toUTCDateString());
990
            $('#vso-start-time').val(
991
                this.viewport.getEarliestLayerDate().toUTCTimeString());
992
            $('#vso-end-date').val(
993
                this.viewport.getLatestLayerDate().toUTCDateString());
994
            $('#vso-end-time').val(
995
                this.viewport.getLatestLayerDate().toUTCTimeString());
996
997
            $('#sdo-start-date').val(
998
                this.viewport.getEarliestLayerDate().toUTCDateString());
999
            $('#sdo-start-time').val(
1000
                this.viewport.getEarliestLayerDate().toUTCTimeString());
1001
            $('#sdo-end-date').val(
1002
                this.viewport.getLatestLayerDate().toUTCDateString());
1003
            $('#sdo-end-time').val(
1004
                this.viewport.getLatestLayerDate().toUTCTimeString());
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1005
847 by Jeff Stys
Only show up to 2 decimal places for Center (x,y) text input fields in SDO accordion.
1006
            $('#sdo-center-x').val( x0.toFixed(2) );
1007
            $('#sdo-center-y').val( y0.toFixed(2) );
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1008
1009
            $('#sdo-width').val(width.toFixed(2));
1010
            $('#sdo-height').val(height.toFixed(2));
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
1011
        }
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1012
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1013
        // Remove Old Links
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1014
        vsoLinks.html('');
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1015
1016
        // Remove Old Previews
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1017
        vsoPreviews.html('');
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1018
        sdoPreviews.html('');
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1019
1020
        // Disable Buttons
1021
        $.each( vsoButtons.children(), function (i, button) {
1022
            button = $(button);
1023
            button.removeAttr('href');
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1024
            button.unbind('click');
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1025
            button.addClass('inactive');
1026
        });
1027
        $.each( sdoButtons.children(), function (i, button) {
1028
            button = $(button);
1029
            button.removeAttr('href');
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1030
            button.unbind('click');
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1031
            button.addClass('inactive');
1032
        });
1033
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1034
        $.each( $('#accordion-images .dynaccordion-section'), function(i,accordion) {
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1035
863 by Jeff Stys
+ Added auto closing/opening of drawers when entering/exiting image area select mode (for movies and screenshots)
1036
            var html, url, nickname, date,
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1037
                sourceId, hardcodedScale, imageLayer;
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1038
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1039
            nickname  = $(accordion).find('.tile-accordion-header-left').html();
1040
            sourceId  = $(accordion).find('.tile-accordion-header-left').attr('data-sourceid');
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1041
            date      = $(accordion).find('.timestamp').html();
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
1042
1043
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1044
            startDate = $('#vso-start-date').val()
1045
                      + 'T'
1046
                      + $('#vso-start-time').val()
1047
                      + 'Z';
1048
            endDate   = $('#vso-end-date').val()
1049
                      + 'T'
1050
                      + $('#vso-end-time').val()
1051
                      + 'Z';
1052
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1053
            imageLayer = '['+sourceId+',1,100]';
1054
            sourceIDsAll.push(sourceId);
853 by Jeff Stys
Implemented generation of custom VSO website links.
1055
            instruments.push(nickname.split(' ')[0]);
1056
            if ( parseInt(nickname.split(' ')[1], 10) ) {
1057
                wavesAll.push(parseInt(nickname.split(' ')[1], 10));
1058
            }
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1059
842 by Jeff Stys
Proof-of-concept implementation of VSO Link generation.
1060
            url  = 'http://virtualsolar.org/cgi-bin/vsoui.pl'
1061
                 + '?startyear='   + startDate.split('/')[0]
1062
                 + '&startmonth='  + startDate.split('/')[1]
854 by Jeff Stys
Bug fixes to VSO link generation for individual image layers.
1063
                 + '&startday='    + startDate.split('/')[2].split('T')[0]
842 by Jeff Stys
Proof-of-concept implementation of VSO Link generation.
1064
                 + '&starthour='   + startDate.split('T')[1].split(':')[0]
1065
                 + '&startminute=' + startDate.split('T')[1].split(':')[1]
1066
                 + '&endyear='     + endDate.split('/')[0]
1067
                 + '&endmonth='    + endDate.split('/')[1]
854 by Jeff Stys
Bug fixes to VSO link generation for individual image layers.
1068
                 + '&endday='      + endDate.split('/')[2].split('T')[0]
842 by Jeff Stys
Proof-of-concept implementation of VSO Link generation.
1069
                 + '&endhour='     + endDate.split('T')[1].split(':')[0]
1070
                 + '&endminute='   + endDate.split('T')[1].split(':')[1]
854 by Jeff Stys
Bug fixes to VSO link generation for individual image layers.
1071
                 + '&instrument='  + nickname.split(' ')[0];
1072
            if ( parseInt(nickname.split(' ')[1], 10) ) {
1073
                url += '&wave='        + 'other'
1074
                    +  '&wavemin='     + nickname.split(' ')[1]
1075
                    + '&wavemax='     + nickname.split(' ')[1]
1076
                    + '&waveunit='    + 'Angstrom';
1077
            }
842 by Jeff Stys
Proof-of-concept implementation of VSO Link generation.
1078
1079
            html = '<a href="' + url + '" target="_blank">'
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1080
                 + nickname
842 by Jeff Stys
Proof-of-concept implementation of VSO Link generation.
1081
                 + ' '
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1082
                 + date
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1083
                 + ' UTC <i class="fa fa-external-link-square fa-fw"></i></a>';
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1084
            vsoLinks.append(html);
1085
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1086
            hardcodedScale = '10';
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1087
            if ( nickname.toUpperCase() == 'LASCO C2' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1088
                hardcodedScale = '50';
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1089
            }
1090
            else if ( nickname.toUpperCase() == 'LASCO C3' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1091
                hardcodedScale = '250';
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1092
            }
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1093
            else if ( nickname.toUpperCase() == 'COR1-A' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1094
                hardcodedScale = '35';
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1095
            }
1096
            else if ( nickname.toUpperCase() == 'COR1-B' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1097
                hardcodedScale = '35';
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1098
            }
1099
            else if ( nickname.toUpperCase() == 'COR2-A' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1100
                hardcodedScale = '130';
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1101
            }
1102
            else if ( nickname.toUpperCase() == 'COR2-B' ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1103
                hardcodedScale = '130';
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1104
            }
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1105
1106
            html = '';
1107
            html = '<div class="header">'
856 by Jeff Stys
Fixed UI bugs related to the Movie Generation accordion contents show/hide states.
1108
                 // +     '<input type="checkbox" checked /> '
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1109
                 +     nickname
1110
                 + '</div>'
1111
                 + '<div class="previews">'
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1112
                 +     '<img src="http://api.helioviewer.org/v2/takeScreenshot/?'
1113
                 + 'imageScale=' + hardcodedScale
1114
                 + '&layers=[' + sourceId + ',1,100]'
1115
                 + '&events=&eventLabels=false'
1116
                 + '&scale=false&scaleType=earth&scaleX=0&scaleY=0'
1117
                 + '&date=' + startDate
1118
                 + '&x0=0&y0=0&width=256&height=256&display=true&watermark=false" class="preview start" /> '
1119
                 +     '<img src="http://api.helioviewer.org/v2/takeScreenshot/?'
1120
                 + 'imageScale=' + hardcodedScale
1121
                 + '&layers=[' + sourceId + ',1,100]'
1122
                 + '&events=&eventLabels=false'
1123
                 + '&scale=false&scaleType=earth&scaleX=0&scaleY=0'
1124
                 + '&date=' + endDate
1125
                 + '&x0=0&y0=0&width=256&height=256&display=true&watermark=false" class="preview end" /> '
837 by Jeff Stys
Added Center (x,y), Width, and Height fields to SDO Cut-out Service user interface.
1126
                 + '</div>';
1127
            vsoPreviews.append(html);
1128
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1129
1130
            if ( nickname.search('AIA ') != -1 ||
1131
                 nickname.search('HMI ') != -1 ) {
1132
843 by Jeff Stys
Updated event handling to respond to manual date changes in the external datasource integration accordions (VSO and SDO).
1133
                startDate = $('#sdo-start-date').val()
1134
                          + 'T'
1135
                          + $('#sdo-start-time').val()
1136
                          + 'Z';
1137
                endDate   = $('#sdo-end-date').val()
1138
                          + 'T'
1139
                          + $('#sdo-end-time').val()
1140
                          + 'Z';
1141
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1142
                sourceIDsSDO.push(sourceId);
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1143
853 by Jeff Stys
Implemented generation of custom VSO website links.
1144
                wavesSDO.push(nickname.split(' ')[1].padLeft('0',3));
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1145
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1146
                html = '';
1147
                html = '<div class="header">'
856 by Jeff Stys
Fixed UI bugs related to the Movie Generation accordion contents show/hide states.
1148
                     // +     '<input type="checkbox" checked /> '
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1149
                     +     nickname
1150
                     + '</div>'
1151
                     + '<div class="previews">'
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1152
                     +     '<img src="http://api.helioviewer.org/v2/takeScreenshot/?'
1153
                     + 'imageScale=' + imageScale
1154
                     + '&layers=' + imageLayer
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1155
                     + '&events=&eventLabels=false'
1156
                     + '&scale=false&scaleType=earth&scaleX=0&scaleY=0'
1157
                     + '&date=' + startDate
1158
                     + '&x0=' + $('#sdo-center-x').val()
1159
                     + '&y0=' + $('#sdo-center-y').val()
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1160
                     + '&width=' + Math.round($('#sdo-width').val()/imageScale)
1161
                     + '&height=' + Math.round($('#sdo-height').val()/imageScale)
1162
                     + '&display=true&watermark=false" class="preview start" '
1163
                     + 'style="width:' + 128 + '; '
1164
                     +        'height:' + Math.round(128/(width/height)) + ';"'
1165
                     + ' />'
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1166
                     +     '<img src="http://api.helioviewer.org/v2/takeScreenshot/?'
1167
                     + 'imageScale=' + imageScale
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1168
                     + '&layers=' + imageLayer
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1169
                     + '&events=&eventLabels=false'
1170
                     + '&scale=false&scaleType=earth&scaleX=0&scaleY=0'
1171
                     + '&date=' + endDate
1172
                     + '&x0=' + $('#sdo-center-x').val()
1173
                     + '&y0=' + $('#sdo-center-y').val()
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1174
                     + '&width=' + Math.round($('#sdo-width').val()/imageScale)
1175
                     + '&height=' + Math.round($('#sdo-height').val()/imageScale)
1176
                     + '&display=true&watermark=false" class="preview end" '
1177
                     + 'style="width:' + 128 + '; '
1178
                     +        'height:' + Math.round(128/(width/height)) + ';"'
1179
                     + ' />'
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1180
                     + '</div>';
1181
                sdoPreviews.append(html);
1182
            }
1183
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1184
        });
838 by Jeff Stys
Added updating of VSO and SDO Cut-out preview images on image layer accordion update.
1185
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1186
1187
        startDate = $('#vso-start-date').val().replace(/\//g,'-')
1188
                  + 'T'
1189
                  + $('#vso-start-time').val()
1190
                  + 'Z';
1191
        endDate   = $('#vso-end-date').val().replace(/\//g,'-')
1192
                  + 'T'
1193
                  + $('#vso-end-time').val()
1194
                  + 'Z';
1195
1196
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1197
        // VSO SunPy Script Button
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1198
        $('#vso-sunpy').removeClass('inactive');
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1199
        $('#vso-sunpy').bind('click', function (e) {
1200
            url = Helioviewer.api + '/'
1201
                + '?action=getSciDataScript'
1202
                + '&imageScale=' + imageScale
1203
                + '&sourceIds=[' + sourceIDsAll.join(',')+']'
1204
                + '&startDate=' + startDate
1205
                + '&endDate=' + endDate
1206
                + '&lang=sunpy'
1207
                + '&provider=vso';
1208
            body = '<a href="' + url + '">'
1209
                 +     'Your Python/SunPy script for requesting science data '
1210
                 +     'from the VSO is ready.<br /><br />'
1211
                 +     '<b>Click here to download.</b>'
1212
                 + '</a>';
1213
            $(document).trigger("message-console-log",
1214
                                [body, jGrowlOpts, true, true]);
1215
        });
1216
1217
1218
        // VSO SolarSoft Script Button
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1219
        $('#vso-ssw').removeClass('inactive');
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1220
        $('#vso-ssw').bind('click', function (e) {
1221
            url = Helioviewer.api + '/'
1222
                + '?action=getSciDataScript'
1223
                + '&imageScale=' + imageScale
1224
                + '&sourceIds=[' + sourceIDsAll.join(',')+']'
1225
                + '&startDate=' + startDate
1226
                + '&endDate=' + endDate
1227
                + '&lang=sswidl'
849 by Jeff Stys
Fixed bugs preventing SunPy commands from being generated for download scripts and other causing blank start and end times in the scripts.
1228
                + '&provider=vso'
1229
                + '&x1=' + x1
1230
                + '&y1=' + y1
1231
                + '&x2=' + x2
1232
                + '&y2=' + y2;
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1233
            body = '<a href="' + url + '">'
1234
                 +     'Your IDL/SolarSoft script for requesting science data '
1235
                 +     'from the VSO is ready.<br /><br />'
1236
                 +     '<b>Click here to download.</b>'
1237
                 + '</a>';
1238
            $(document).trigger("message-console-log",
1239
                                [body, jGrowlOpts, true, true]);
1240
        });
1241
1242
        // VSO Website Button
851 by Jeff Stys
Virtual Solar Observatory direct link proof-of-concept (hard-coded).
1243
        $('#vso-www').attr('href', 'http://virtualsolar.org/cgi-bin/vsoui.pl'
853 by Jeff Stys
Implemented generation of custom VSO website links.
1244
            + '?startyear='   +   startDate.split('-')[0]
1245
            + '&startmonth='  +   startDate.split('-')[1]
1246
            + '&startday='    +   startDate.split('-')[2].split('T')[0]
1247
            + '&starthour='   +   startDate.split('T')[1].split(':')[0]
1248
            + '&startminute=' +   startDate.split('T')[1].split(':')[1]
1249
            + '&endyear='     +     endDate.split('-')[0]
1250
            + '&endmonth='    +     endDate.split('-')[1]
1251
            + '&endday='      +     endDate.split('-')[2].split('T')[0]
1252
            + '&endhour='     +     endDate.split('T')[1].split(':')[0]
1253
            + '&endminute='   +     endDate.split('T')[1].split(':')[1]
1254
            + '&instrument='  + instruments.join('&instrument=')
1255
            + '&wave='        +            'other'
1256
            + '&wavemin='     +    Math.min.apply(Math,wavesAll)
1257
            + '&wavemax='     +    Math.max.apply(Math,wavesAll)
1258
            + '&waveunit='    +            'Angstrom'
851 by Jeff Stys
Virtual Solar Observatory direct link proof-of-concept (hard-coded).
1259
        );
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1260
        $('#vso-www').removeClass('inactive');
1261
1262
1263
853 by Jeff Stys
Implemented generation of custom VSO website links.
1264
        if ( wavesSDO.length > 0 ) {
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1265
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1266
            // SDO SolarSoft Script Button
1267
            $('#sdo-ssw').removeClass('inactive');
1268
            $('#sdo-ssw').bind('click', function (e) {
1269
                url = Helioviewer.api+'/'
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1270
                + '?action=getSciDataScript'
1271
                + '&imageScale=' + imageScale
1272
                + '&sourceIds=[' + sourceIDsSDO.join(',')+']'
1273
                + '&startDate=' + startDate
1274
                + '&endDate=' + endDate
1275
                + '&lang=sswidl'
1276
                + '&provider=sdo'
1277
                + '&x1=' + x1
1278
                + '&y1=' + y1
1279
                + '&x2=' + x2
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1280
                + '&y2=' + y2;
1281
                body = '<a href="' + url + '">'
1282
                     +     'Your IDL/SolarSoft script for requesting science '
1283
                     +     'data from the AIA/HMI Cut-out Serivce is ready.'
1284
                     +     '<br /><br />'
1285
                     +     '<b>Click here to download.</b>'
1286
                     + '</a>';
1287
                $(document).trigger("message-console-log",
1288
                                    [body, jGrowlOpts, true, true]);
1289
            });
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1290
848 by Jeff Stys
Updated VSO and SDO Cut-Out Service buttons to produce JGrowl notifications for script downloads rather than silently downloading small files in the background (which might go unnoticed by the end user).
1291
            // SDO Website Button
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1292
            $('#sdo-www').attr('href', 'http://www.lmsal.com/get_aia_data/'
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1293
                + '?width='  + $('#sdo-width').val()
1294
                + '&height=' + $('#sdo-height').val()
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1295
                + '&xCen='   +  $('#sdo-center-x').val()
1296
                + '&yCen='   + ($('#sdo-center-y').val()*-1)
853 by Jeff Stys
Implemented generation of custom VSO website links.
1297
                + '&wavelengths=' + wavesSDO.join(',')
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1298
                + '&startDate=' + $('#vso-start-date').val().replace(/\//g,'-')
1299
                + '&startTime=' + $('#vso-start-time').val().slice(0,-3)
1300
                + '&stopDate='  + $('#vso-end-date').val().replace(/\//g,'-')
1301
                + '&stopTime='  + $('#vso-end-time').val().slice(0,-3)
850 by Jeff Stys
Fixed a bug preventing AIA 94 from being prepopulated in AIA Cut-out Service links.
1302
                + '&cadence=12'
1303
            );
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1304
            $.each( $('#accordion-sdo').find('.label, .suffix'), function (i, text) {
1305
                $(text).removeClass('inactive');
1306
            });
1307
            $.each( $('#accordion-sdo').find('input[disabled]'), function (i, input) {
1308
                $(input).attr('disabled', false);
1309
            });
846 by Jeff Stys
Bug fixes to science data integration thumbnail preview generation.
1310
            $('#sdo-www').removeClass('inactive');
845 by Jeff Stys
Implemented custom link generation for launching a VSO query matching each image layer.
1311
        }
1312
835 by Jeff Stys
Added the user interface for Virtual Solar Observatory in the right drawer.
1313
    },
1314
825 by Jeff Stys
Added ability to toggle accordions within drawers opened and closed.
1315
402.1.798 by Keith Hughitt
Added bit.ly support to front-end
1316
    /**
402.1.588 by Keith Hughitt
Progress save: normalizing image image scales to be expressed in terms of 1AU
1317
     * Sun-related Constants
1318
     */
1319
    constants: {
1320
        au: 149597870700, // 1 au in meters (http://maia.usno.navy.mil/NSFA/IAU2009_consts.html)
402.1.623 by Keith Hughitt
Removed JS Lint
1321
        rsun: 695700000  // radius of the sun in meters (JHelioviewer)
269 by V. Keith Hughitt
Fixed IE7 & 8 transparency issues (bugs #240485 and #241044)
1322
    }
67 by V. Keith Hughitt
nightly build 05-30-2008: Continuing to adapt merged code. Fixes for IE7 and 8.
1323
});