webpackJsonp([3],{ /***/ 265: /***/ (function(module, exports) { //fgnass.github.com/spin.js#v1.2.5 /** * Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de] * Licensed under the MIT license */ var prefixes = ['webkit', 'Moz', 'ms', 'O']; /* Vendor prefixes */ var animations = {}; /* Animation rules keyed by their name */ var useCssAnimations; /** * Utility function to create elements. If no tag name is given, * a DIV is created. Optionally properties can be passed. */ function createEl(tag, prop) { var el = document.createElement(tag || 'div'); var n; for(n in prop) { el[n] = prop[n]; } return el; } /** * Appends children and returns the parent. */ function ins(parent /* child1, child2, ...*/) { for (var i=1, n=arguments.length; i> 1) : o.left+mid) + 'px', top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : o.top+mid) + 'px' }); } el.setAttribute('aria-role', 'progressbar'); self.lines(el, self.opts); if (!useCssAnimations) { // No CSS animation support, use setTimeout() instead var i = 0; var fps = o.fps; var f = fps/o.speed; var ostep = (1-o.opacity)/(f*o.trail / 100); var astep = f/o.lines; !function anim() { i++; for (var s=o.lines; s; s--) { var alpha = Math.max(1-(i+s*astep)%f * ostep, o.opacity); self.opacity(el, o.lines-s, alpha, o); } self.timeout = self.el && setTimeout(anim, ~~(1000/fps)); }(); } return self; }, stop: function() { var el = this.el; if (el) { clearTimeout(this.timeout); if (el.parentNode) el.parentNode.removeChild(el); this.el = undefined; } return this; }, lines: function(el, o) { var i = 0; var seg; function fill(color, shadow) { return css(createEl(), { position: 'absolute', width: (o.length+o.width) + 'px', height: o.width + 'px', background: color, boxShadow: shadow, transformOrigin: 'left', transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)', borderRadius: (o.width>>1) + 'px' }); } for (; i < o.lines; i++) { seg = css(createEl(), { position: 'absolute', top: 1+~(o.width/2) + 'px', transform: o.hwaccel ? 'translate3d(0,0,0)' : '', opacity: o.opacity, animation: useCssAnimations && addAnimation(o.opacity, o.trail, i, o.lines) + ' ' + 1/o.speed + 's linear infinite' }); if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'})); ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)'))); } return el; }, opacity: function(el, i, val) { if (i < el.childNodes.length) el.childNodes[i].style.opacity = val; } }); ///////////////////////////////////////////////////////////////////////// // VML rendering for IE ///////////////////////////////////////////////////////////////////////// /** * Check and init VML support */ !function() { function vml(tag, attr) { return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr); } var s = css(createEl('group'), {behavior: 'url(#default#VML)'}); if (!vendor(s, 'transform') && s.adj) { // VML support detected. Insert CSS rule ... sheet.addRule('.spin-vml', 'behavior:url(#default#VML)'); Spinner.prototype.lines = function(el, o) { var r = o.length+o.width; var s = 2*r; function grp() { return css(vml('group', {coordsize: s +' '+s, coordorigin: -r +' '+-r}), {width: s, height: s}); } var margin = -(o.width+o.length)*2+'px'; var g = css(grp(), {position: 'absolute', top: margin, left: margin}); var i; function seg(i, dx, filter) { ins(g, ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}), ins(css(vml('roundrect', {arcsize: 1}), { width: r, height: o.width, left: o.radius, top: -o.width>>1, filter: filter }), vml('fill', {color: o.color, opacity: o.opacity}), vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change ) ) ); } if (o.shadow) { for (i = 1; i <= o.lines; i++) { seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)'); } } for (i = 1; i <= o.lines; i++) seg(i); return ins(el, g); }; Spinner.prototype.opacity = function(el, i, val, o) { var c = el.firstChild; o = o.shadow && o.lines || 0; if (c && i+o < c.childNodes.length) { c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild; if (c) c.opacity = val; } }; } else { useCssAnimations = vendor(s, 'animation'); } }(); module.exports = Spinner; /***/ }), /***/ 520: /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(ko) { var _jquery = __webpack_require__(6); var _jquery2 = _interopRequireDefault(_jquery); __webpack_require__(521); __webpack_require__(265); __webpack_require__(522); var _sprintf = __webpack_require__(130); var _sprintf2 = _interopRequireDefault(_sprintf); __webpack_require__(523); var _astro = __webpack_require__(525); var astro = _interopRequireWildcard(_astro); var _params = __webpack_require__(78); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // This is a small helper to handle the spinner consistently var spinner = { spinner_content: (0, _jquery2.default)('#form_result_content'), activate: function activate() { // Get the form result_content, fade it in, and put a spinner spinner.spinner_content.css({ width: '100%', height: '10em', overflow: 'visible' }).fadeIn(400).spin(); (0, _jquery2.default)('.spinner', spinner.spinner_content).css({ position: 'relative' }); }, clean_spinner: function clean_spinner(after) { spinner.spinner_content.spin(false).css({ height: 'auto' }); } }; // This view handles all the results of a query function ResultView(holder) { var self = this; self.result_error = ko.observable(false); self.result_success = ko.observable(false); self.result_fail = ko.observable(false); self.results = ko.observableArray([]); self.query_text = ko.observable(); self.fail_message = ko.observable(); self.backpane = function () { // Reset all toggles to default value, this clean up the DOM at the same time. self.result_error(false); self.result_fail(false); self.result_success(false); // Hand control back to hints view. holder.back_to_hints(); }; return self; } // This view handles all the naming hints and submit the named query function HintView(holder) { var self = this; self.galname = ko.observable(''); self.search_in_progress = ko.observable(false); self.more_results = ko.observable(false); self.hints = ko.observableArray(); self.hint_click = function (hint) { self.galname(hint); }; // Run a complete search with name self.run_search = function (name) { // Build the query. var query = 'name=' + encodeURIComponent(name); var url = '/flow_query/get_flow_galaxy?' + query; holder.results.query_text(name); holder.setup_resume('name', name); holder.go_search(url); }; self.submit_request = function () { // Indicate we are not searching for hints anymore. self.search_in_progress(false); self.more_results(false); self.run_search(self.galname()); }; self.request_id = 0; self.galname.subscribe(function (txt) { var url = '/flow_query/hint_byname?name=' + encodeURIComponent(txt); self.search_in_progress(true); self.request_id++; var this_request = self.request_id; _jquery2.default.ajax({ url: url }).done(function (data) { if (this_request < self.request_id) return; self.search_in_progress(false); self.hints(data.hints); self.more_results(data.more_results); }).fail(function () { self.search_in_progress(false); }); }); return self; } function ManualView(holder) { var self = this; self.search_longitude = ko.observable(); self.search_latitude = ko.observable(); self.search_z = ko.observable(); self.ztype = ko.observable(); self.syscoords = ko.observable(); self.run_search = function (pos_string) { var opts = pos_string.split(','); self.search_longitude(opts[0]); self.search_latitude(opts[1]); self.search_z(opts[2]); self.ztype(opts[3]); self.syscoords(opts[4]); self._go(); }; self._go = function () { // Build the query. var query = ['longitude=' + encodeURIComponent(self.search_longitude()), 'latitude=' + encodeURIComponent(self.search_latitude()), 'redshift=' + encodeURIComponent(self.search_z()), 'redshift_unit=' + self.ztype(), 'syscoords=' + self.syscoords()].join('&'); var url = '/flow_query/get_flow_by_position?' + query; // Run the query holder.go_search(url); }; self.submit_manual = function () { holder.setup_resume('position', [self.search_longitude(), self.search_latitude(), self.search_z(), self.ztype(), self.syscoords()].join(',')); self._go(); }; return self; } function processBindings() { var holder = {}; var do_search = false; holder.search_topic = ko.observable(); holder.show_search_pane = ko.observable(true); holder.results = new ResultView(holder); holder.hints = new HintView(holder); holder.manual = new ManualView(holder); holder.setup_data_handler = function (url) { return new Promise(function (resolve, reject) { var req = _jquery2.default.ajax(url); req.fail(function (xhr, status, error) { holder.results.fail_message(status); holder.results.result_fail(true); reject(); }); req.done(function (data) { if (data.code != 1) { // Mark that we are ok showing the table. holder.results.result_error(true); reject(); } else { data.results.forEach(function (element) { element.hms = astro.hms(element.ra); element.dms = astro.dms(element.dec); element.vcmb = (0, _sprintf2.default)('%(vcmb).0f', { vcmb: element.vcmb }); element.distance = (0, _sprintf2.default)('%(dist).1f', { dist: element.distance[0] }); element.distance_error = (0, _sprintf2.default)('%(dist).1f', { dist: element.distance_error[0] }); element.vel_error = false; if (!('mainName' in element)) element.mainName = ''; if (!('query' in element)) element.query = ''; }); holder.results.results(data.results); // We stop the spinner. holder.results.result_success(true); resolve(); } }); }); }; holder.go_search = function (url) { // Now redimension the form_box and fade it out to accept the spinner return new Promise(function (resolve, reject) { spinner.activate(); var r = (0, _jquery2.default)('#form_box'); holder.form_height = r.height(); r.animate({ height: '10em' }, { queue: false }).fadeOut(400, function () { resolve(); }); return holder.setup_data_handler(url).then(function () { spinner.clean_spinner(); }); }); }; holder.back_to_hints = function () { var r = (0, _jquery2.default)('#form_box'); var h = holder.form_height; r.animate({ height: h }, { queue: false }).fadeIn(); }; var valid_keys = { name: holder.hints, position: holder.manual }; holder.setup_resume = function (key, value) { for (var k in valid_keys) { if (k in _params.queryString) delete _params.queryString[k]; } _params.queryString[key] = value; (0, _params.addNewState)(); }; if ('name' in _params.queryString || 'position' in _params.queryString) { holder.show_search_pane(false); do_search = true; } else { (0, _jquery2.default)('#form_box').show(); } ko.applyBindings(holder, document.getElementById('form_box')); ko.applyBindings(holder, document.getElementById('nota2')); ko.applyBindings(holder.results, document.getElementById('form_result')); if (do_search) { for (var k in valid_keys) { if (k in _params.queryString) { valid_keys[k].run_search(_params.queryString[k]); break; } } } } (0, _jquery2.default)(document).ready(processBindings); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(71))) /***/ }), /***/ 521: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = (function($) { $.fn.animateToAutoHeight = function() { var curHeight = this.height(), height = this.wrap( "
" ) .css({ right: '-100000px', position: 'absolute', height: 'auto' }) .show() .height(), duration = 200, easing = 'swing', callback = $.noop, parameters = { height: height }, options; this.hide() .unwrap() .css({ height: curHeight, right: 'initial', position: 'initial' }); if (arguments.length >= 1) { options = arguments[0]; } else { options = {}; } /* for (var i in arguments) { switch (typeof arguments[i]) { case 'object': parameters = arguments[i]; parameters.height = height; break; case 'string': if (arguments[i] == 'slow' || arguments[i] == 'fast') duration = arguments[i]; else easing = arguments[i]; break; case 'number': duration = arguments[i]; break; case 'function': callback = arguments[i]; break; } } */ var new_opt = $.extend({}, options); new_opt.complete = function() { $(this).css('height', 'auto'); if ('complete' in options) { complete.options.call(this); } }; this.animate(parameters, options); /* this.animate(parameters, duration, easing, function() { $(this).css('height', 'auto'); callback.call(this, arguments); }); */ return this; }; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 522: /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2011-2014 Felix Gnass * Licensed under the MIT license */ /* Basic Usage: ============ $('#el').spin(); // Creates a default Spinner using the text color of #el. $('#el').spin({ ... }); // Creates a Spinner using the provided options. $('#el').spin(false); // Stops and removes the spinner. Using Presets: ============== $('#el').spin('small'); // Creates a 'small' Spinner using the text color of #el. $('#el').spin('large', '#fff'); // Creates a 'large' white Spinner. Adding a custom preset: ======================= $.fn.spin.presets.flower = { lines: 9 length: 10 width: 20 radius: 0 } $('#el').spin('flower', 'red'); */ (function(factory) { if (true) { // CommonJS factory(__webpack_require__(6), __webpack_require__(265)); } else if (typeof define == 'function' && define.amd) { // AMD, register as anonymous module define(['jquery', 'spin'], factory); } else { // Browser globals if (!window.Spinner) throw new Error('Spin.js not present'); factory(window.jQuery, window.Spinner); } })(function($, Spinner) { $.fn.spin = function(opts, color) { return this.each(function() { var $this = $(this), data = $this.data(); if (data.spinner) { data.spinner.stop(); delete data.spinner; } if (opts !== false) { opts = $.extend( { color: color || $this.css('color') }, $.fn.spin.presets[opts] || opts ); data.spinner = new Spinner(opts).spin(this); } }); }; $.fn.spin.presets = { tiny: { lines: 8, length: 2, width: 2, radius: 3 }, small: { lines: 8, length: 4, width: 3, radius: 5 }, large: { lines: 10, length: 8, width: 4, radius: 8 }, }; }); /***/ }), /***/ 523: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* WEBPACK VAR INJECTION */(function(ko, $) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery_rotate__ = __webpack_require__(524); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery_rotate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery_rotate__); ko.bindingHandlers.rotate = { init: function(element, valueAccessor) { var value = ko.unwrap(valueAccessor()); if (value !== null) $(element).rotate(value); }, update: function(element, valueAccessor) { var value = ko.unwrap(valueAccessor()); if (value !== null) $(element).rotate(value); }, }; ko.bindingHandlers.fadeVisible = { init: function(element, valueAccessor) { // Start visible/invisible according to initial value var shouldDisplay = ko.unwrap(valueAccessor()); $(element).toggle(shouldDisplay); }, update: function(element, valueAccessor) { // On update, fade in/out var shouldDisplay = ko.unwrap(valueAccessor()); console.log('Should display: ' + shouldDisplay); shouldDisplay ? $(element).fadeIn() : $(element).fadeOut(); }, }; ko.bindingHandlers.activateButton = { init: function(element, valueAccessor) { // Start visible/invisible according to initial value var shouldActivate = ko.unwrap(valueAccessor()); var value = ko.unwrap(shouldActivate); $(element) .toggleClass('disabled', !value) .attr('disabled', !value); }, update: function(element, valueAccessor) { // On update, fade in/out var shouldActivate = ko.unwrap(valueAccessor()); var value = ko.unwrap(shouldActivate); $(element) .toggleClass('disabled', !value) .attr('disabled', !value); }, }; /* Usage:
Loading...
*/ ko.bindingHandlers.asyncHtml = { init: function(element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); var parameters = value.params.concat([ function(data) { $(element).html(data); }, ]); value.source.apply(null, parameters); }, }; ko.bindingHandlers.foreachGroups = { init: function(element, valueAccessor) { var groupedItems, options = valueAccessor(); //create our own computed that transforms the flat array into rows/columns groupedItems = ko.computed({ read: function() { var index, length, group, result = [], count = +ko.utils.unwrapObservable(options.count) || 1, items = ko.utils.unwrapObservable(options.data); //create an array of arrays (rows/columns) for (index = 0, length = items.length; index < length; index++) { if (index % count === 0) { group = []; result.push(group); } group.push(items[index]); } return result; }, disposeWhenNodeIsRemoved: element, }); //use the normal foreach binding with our new computed ko.applyBindingsToNode(element, { foreach: groupedItems }); //make sure that the children of this element are not bound return { controlsDescendantBindings: true }; }, }; ko.extenders.trackChange = function(target, track) { if (track) { target.isDirty = ko.observable(false); target.originalValue = target(); target.subscribe(function(newValue) { // use != not !== so numbers will equate naturally target.isDirty(newValue != target.originalValue); }); } return target; }; ko.bindingHandlers.bsChecked = { init: function( element, valueAccessor, allBindingsAccessor, viewModel, bindingContext ) { var value = valueAccessor(); var newValueAccessor = function() { return { change: function() { value(element.value); }, }; }; ko.bindingHandlers.event.init( element, newValueAccessor, allBindingsAccessor, viewModel, bindingContext ); }, update: function( element, valueAccessor, allBindingsAccessor, viewModel, bindingContext ) { if ($(element).val() == ko.unwrap(valueAccessor())) { setTimeout(function() { $(element) .closest('.btn') .button('toggle'); }, 1); } }, }; ko.extenders.maxlength = function(target, maxlength) { var view = ko.dependentObservable({ read: target, write: function(value) { if (value.length <= maxlength) { target(value); } else { view.notifySubscribers(target()); } }, }); target.view = view; target.maxlength = maxlength; return target; }; /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(71), __webpack_require__(6))) /***/ }), /***/ 524: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** * jquery-rotate v0.1.0 * Very lightweight jquery rotate plugin using CSS 3 Transformation * https://github.com/schickling/jquery-rotate */ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = (function($) { $.fn.extend({ rotate: function(deg) { // cache dom element var $this = $(this); // make deg random if not set if (deg === null) { deg = Math.floor(Math.random() * 359); } // rotate dom element $this.css({ '-webkit-transform': 'rotate(' + deg + 'deg)', '-moz-transform': 'rotate(' + deg + 'deg)', '-ms-transform': 'rotate(' + deg + 'deg)', '-o-transform': 'rotate(' + deg + 'deg)', transform: 'rotate(' + deg + 'deg)', }); // make chainable return $this; }, }); }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 525: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { return { hms: function(deg) { var t, r = Math.floor(12 * deg / 180), ret = ''; ret = r + 'h'; deg = (12 * deg / 180 - r) * 60; t = Math.floor(deg); ret += t + 'm'; deg = (deg - t) * 60; ret += Math.floor(deg) + 's'; return ret; }, dms: function(deg) { var t, r = Math.floor(deg), ret = ''; ret = r + 'd'; deg = (deg - r) * 60; t = Math.floor(deg); ret += t + 'm'; deg = (deg - t) * 60; ret += Math.floor(deg) + 's'; return ret; }, }; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 78: /***/ (function(module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($) { var self = this; self.queryString = function (paramsArray) { var params = {}; for (var i = 0; i < paramsArray.length; ++i) { var param = paramsArray[i].split('=', 2); if (param.length !== 2) continue; params[param[0]] = decodeURIComponent(param[1].replace(/\+/g, ' ')); } return params; }(window.location.search.substr(1).split('&')); self.addNewState = function () { console.log(self.queryString); history.pushState({}, '', '?' + $.param(self.queryString)); }; return self; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }) },[520]); //# sourceMappingURL=galaxy_query.bundle.js.map