示例#1
0
			function bindTree(element) {
				$(element).find('LI A').on(options.folderEvent, function () {
					if ($(this).parent().hasClass('directory')) {
						if ($(this).parent().hasClass('collapsed')) {
							// Expand
							if (!options.multiFolder) {
								$(this).parent().parent().find('UL').slideUp({
									duration: options.collapseSpeed,
									easing: options.collapseEasing
								});
								$(this).parent().parent().find('LI.directory')
								  .removeClass('expanded')
								  .addClass('collapsed');
							}
							$(this).parent().find('UL').remove(); // cleanup
							showTree($(this).parent(), encodeURI($(this).attr('rel').match(/.*\//)));
							$(this).parent().removeClass('collapsed').addClass('expanded');
						} else {
							// Collapse
							$(this).parent().find('UL').slideUp({
								duration: options.collapseSpeed,
								easing: options.collapseEasing
							});
							$(this).parent().removeClass('expanded').addClass('collapsed');
						}
					} else {
						file($(this).attr('rel'));
					}
					return false;
				});
				// Prevent A from triggering the # on non-click events
				if (options.folderEvent.toLowerCase !== 'click') {
					$(element).find('LI A').on('click', function () {return false; });
				}
			}
示例#2
0
		$(this).each(function () {

			function showTree(element, dir) {
				$(element).addClass('wait');
				$('.filetree.start').remove();
				$.post(options.script, { dir: dir }, function (data) {
					$(element).find('.start').html('');
					$(element).removeClass('wait').append(data);
					if (options.root === dir) {
						$(element).find('UL:hidden').show();
					} else {
						$(element).find('UL:hidden').slideDown({
							duration: options.expandSpeed,
							easing: options.expandEasing
						});
					}
					bindTree(element);
				});
			}

			function bindTree(element) {
				$(element).find('LI A').on(options.folderEvent, function () {
					if ($(this).parent().hasClass('directory')) {
						if ($(this).parent().hasClass('collapsed')) {
							// Expand
							if (!options.multiFolder) {
								$(this).parent().parent().find('UL').slideUp({
									duration: options.collapseSpeed,
									easing: options.collapseEasing
								});
								$(this).parent().parent().find('LI.directory')
								  .removeClass('expanded')
								  .addClass('collapsed');
							}
							$(this).parent().find('UL').remove(); // cleanup
							showTree($(this).parent(), encodeURI($(this).attr('rel').match(/.*\//)));
							$(this).parent().removeClass('collapsed').addClass('expanded');
						} else {
							// Collapse
							$(this).parent().find('UL').slideUp({
								duration: options.collapseSpeed,
								easing: options.collapseEasing
							});
							$(this).parent().removeClass('expanded').addClass('collapsed');
						}
					} else {
						file($(this).attr('rel'));
					}
					return false;
				});
				// Prevent A from triggering the # on non-click events
				if (options.folderEvent.toLowerCase !== 'click') {
					$(element).find('LI A').on('click', function () {return false; });
				}
			}
			// Loading message
			$(this).html('<ul class="filetree start"><li class="wait">' + options.loadMessage + '<li></ul>');
			// Get the initial file list
			showTree($(this), encodeURI(options.root));
		});
示例#3
0
				$.post(options.script, { dir: dir }, function (data) {
					$(element).find('.start').html('');
					$(element).removeClass('wait').append(data);
					if (options.root === dir) {
						$(element).find('UL:hidden').show();
					} else {
						$(element).find('UL:hidden').slideDown({
							duration: options.expandSpeed,
							easing: options.expandEasing
						});
					}
					bindTree(element);
				});
		$(document).ready(function () {
			$('#' + profcolpick.id).spectrum({
				showInput: true,
				clickoutFiresChange: true,
				move: function (color) {
					profcolpick.value = color.toHexString();
				}
			});
		});
	_plotProfile: function (layer, httpRequest) {
		if (httpRequest.readyState === 4) {
			if (httpRequest.status === 200) {
				var json = JSON.parse(httpRequest.responseText),
				    yprof = json.profile,
				    layercontrol = layer._map._layerControl,
						popdiv = document.getElementById('leaflet-profile-plot');

				if (layercontrol) {
					layercontrol.addOverlay(layer, 'Image profile');
				}
				$(document).ready(function () {
					$.jqplot('leaflet-profile-plot', [yprof], {
						title: 'Image profile',
						axes: {
							xaxis: {
								label: 'position along line',
								labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
								pad: 1.0
							},
							yaxis: {
								label: 'pixel values',
								labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
								pad: 1.0
							}
						},
						cursor: {
							show: true,
							zoom: true
						},
						seriesDefaults: {
							lineWidth: 2.0,
							showMarker: false
						}
					});
				});

				popdiv.removeChild(popdiv.childNodes[0]);

				layer._popup.update();	// TODO: avoid private method
			}
		}
	}
示例#6
0
				$(element).find('LI A').on(options.folderEvent, function () {
					if ($(this).parent().hasClass('directory')) {
						if ($(this).parent().hasClass('collapsed')) {
							// Expand
							if (!options.multiFolder) {
								$(this).parent().parent().find('UL').slideUp({
									duration: options.collapseSpeed,
									easing: options.collapseEasing
								});
								$(this).parent().parent().find('LI.directory')
								  .removeClass('expanded')
								  .addClass('collapsed');
							}
							$(this).parent().find('UL').remove(); // cleanup
							showTree($(this).parent(), encodeURI($(this).attr('rel').match(/.*\//)));
							$(this).parent().removeClass('collapsed').addClass('expanded');
						} else {
							// Collapse
							$(this).parent().find('UL').slideUp({
								duration: options.collapseSpeed,
								easing: options.collapseEasing
							});
							$(this).parent().removeClass('expanded').addClass('collapsed');
						}
					} else {
						file($(this).attr('rel'));
					}
					return false;
				});
	_initDialog: function () {
		var className = this._className,
		    catalogs = [L.Catalog.TwoMASS, L.Catalog.SDSS, L.Catalog.PPMXL,
		                L.Catalog.Abell],
		    elem;

		// CDS catalog overlay
		elem = this._addDialogLine('<a id="logo-cds" ' +
		 'href="http://cds.u-strasbg.fr">&nbsp;</a> catalog:');
		var catcolpick = L.DomUtil.create('input', className + '-catalogs', elem);
		catcolpick.id = 'leaflet-catalog-colorpicker';
		catcolpick.type = 'text';
		catcolpick.value = 'yellow';
		$(document).ready(function () {
			$('#' + catcolpick.id).spectrum({
				showInput: true,
				clickoutFiresChange: true,
				move: function (color) {
					catcolpick.value = color.toHexString();
				}
			});
		});

		var catselect = L.DomUtil.create('select', className + '-catalogs', elem);
		var opt = document.createElement('option');
		opt.text = 'Choose catalog:';
		opt.disabled = true;
		opt.selected = true;
		catselect.add(opt, null);
		for (var c in catalogs) {
			opt = document.createElement('option');
			opt.text = catalogs[c].name;
			catselect.add(opt, null);
		}

		// Fix issue with collapsing dialog after selecting a catalog
		if (!L.Browser.android && this.options.collapsed) {
			L.DomEvent.on(catselect, 'mousedown', function () {
				L.DomEvent.off(this._container, 'mouseout', this._collapse, this);
				this.collapsedOff = true;
			}, this);

			L.DomEvent.on(this._container, 'mouseover', function () {
				if (this.collapsedOff) {
					L.DomEvent.on(this._container, 'mouseout', this._collapse, this);
					this.collapsedOff = false;
				}
			}, this);
		}

		var catbutton = L.DomUtil.create('input', className + '-catalogs', elem);
		catbutton.type = 'button';
		catbutton.value = 'Go';
		L.DomEvent.on(catbutton, 'click', function () {
			var	index = catselect.selectedIndex - 1;	// Ignore dummy 'Choose catalog' entry
			if (index >= 0) {
				var catalog = catalogs[index];
				catalog.color = catcolpick.value;
				catselect.selectedIndex = 0;
				this._getCatalog(catalog);
			}
		}, this);

		// Profile overlay
		elem = this._addDialogLine('Profile:');
		var profcolpick = L.DomUtil.create('input', className + '-profile', elem);
		profcolpick.id = 'leaflet-profile-colorpicker';
		profcolpick.type = 'text';
		profcolpick.value = 'magenta';
		$(document).ready(function () {
			$('#' + profcolpick.id).spectrum({
				showInput: true,
				clickoutFiresChange: true,
				move: function (color) {
					profcolpick.value = color.toHexString();
				}
			});
		});

		var profbutton1 = L.DomUtil.create('input', className + '-profile-start', elem);
		profbutton1.type = 'button';
		profbutton1.value = 'Start';
		L.DomEvent.on(profbutton1, 'click', function () {
			if (this._profileLine) {
				this._profileLine.spliceLatLngs(0, 1, this._map.getCenter());
				this._profileLine.redraw();
			} else {
				var map = this._map,
				 point = map.getCenter(),
				 line = this._profileLine = L.polyline([point, point], {
					color: profcolpick.value,
					weight: 7,
					opacity: 0.5
				});
				line.nameColor = profcolpick.value;
				line.addTo(map);
				map.on('drag', this._updateLine, this);
			}
		}, this);
		var profbutton2 = L.DomUtil.create('input', className + '-profile-end', elem);
		profbutton2.type = 'button';
		profbutton2.value = 'End';
		L.DomEvent.on(profbutton2, 'click', this._profileEnd, this);
	},