Construct better URLs for "research" queries
And also prune some outdated entries from the search menus. The main thing is to properly and consistently segment names and URL-escape them. Closes #329.
This commit is contained in:
Родитель
7002b2a88f
Коммит
629040bc6e
|
@ -546,11 +546,25 @@ wwt.controllers.controller(
|
|||
$timeout(function () {
|
||||
$scope.scopePlace = found;
|
||||
$scope.drawCircleOverPlace($scope.scopePlace);
|
||||
$scope.scopePlaceNameForQueryString = placeNameForQueryString(found);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var placeNameForQueryString = function(item) {
|
||||
// Various "research" menus like to put an item's name into URL query
|
||||
// strings. Compute the proper (well, good-enough) representation. When
|
||||
// the name has multiple semicolon-separated identifiers, usually the
|
||||
// first one is a description of a particular image, and the subsequent
|
||||
// ones (if any) are names for the object.
|
||||
|
||||
var name_segments = item.get_name().split(';');
|
||||
var name_to_use = (name_segments.length > 1) ? name_segments[1] : name_segments[0];
|
||||
name_to_use = encodeURIComponent(name_to_use);
|
||||
return name_to_use.replace(/%20/g, '+');
|
||||
}
|
||||
|
||||
var trackConstellation = function () {
|
||||
$scope.formatted.Constellation = $scope.constellations.fullNames ? $scope.getFromEn($scope.constellations.fullNames[$rootScope.singleton.constellation]) : '...';
|
||||
}
|
||||
|
@ -1114,6 +1128,7 @@ wwt.controllers.controller(
|
|||
$scope.menuContext = item;
|
||||
$scope.propertyItem = item;
|
||||
$scope.propertyItem.isExploreTab = isExploreTab;
|
||||
$scope.menuContextNameForQueryString = placeNameForQueryString(item);
|
||||
};
|
||||
|
||||
$scope.showProperties = function () {
|
||||
|
|
|
@ -43,14 +43,11 @@
|
|||
<li><a href="javascript:void(0)"><span localize="Name"></span>: {{scopePlace.get_name()}}</a></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="javascript:void(0)" localize="Information"></a>
|
||||
<ul class="dropdown-menu" style="height:208px">
|
||||
<li><a href="//www.bing.com/search?q={{scopePlace.get_name().split(' ').join('+')}}" target="bing" localize="Look up on Bing"></a></li>
|
||||
<li><a href="//simbad.u-strasbg.fr/simbad/sim-id?Ident={{scopePlace.get_name().split(' ').join('+')}}" target="simbad" localize="Look up on SIMBAD"></a></li>
|
||||
<li><a href="//seds.org/~spider/ngc/ngc.cgi?{{scopePlace.get_name()}}" target="seds" localize="Look up on SEDS"></a></li>
|
||||
<li><a href="//en.wikipedia.org/wiki/{{scopePlace.get_name().split(' ').join('_')}}" target="wiki" localize="Look up on Wikipedia"></a></li>
|
||||
<li><a href="//adsabs.harvard.edu/cgi-bin/abs_connect?db_key=AST&sim_query=YES&object={{scopePlace.get_name().split(';')[0]}}" target="ads" localize="Look up publication on ADS"></a></li>
|
||||
<li><a href="//ned.ipac.caltech.edu/cgi-bin/nph-imgdata?objname={{scopePlace.get_name()}}" target="ned" localize="Look up on NED"></a></li>
|
||||
<li><a href="//cas.sdss.org/dr7/en/tools/quicklook/quickobj.asp?id={{scopePlace.get_name()}}" target="sdss" localize="Look up on SDSS"></a></li>
|
||||
<ul class="dropdown-menu" style="height:126px"> <!-- 28px per item + 2*7px top/bottom padding -->
|
||||
<li><a href="//wikipedia.org/wiki/Special:Search?search={{scopePlaceNameForQueryString}}" target="wikipedia" localize="Look up on Wikipedia"></a></li>
|
||||
<li><a href="//ui.adsabs.harvard.edu/search/q=object:%22{{scopePlaceNameForQueryString}}%22" target="ads" localize="Look up on SAO/NASA ADS"></a></li>
|
||||
<li><a href="//simbad.u-strasbg.fr/simbad/sim-id?Ident={{scopePlaceNameForQueryString}}" target="simbad" localize="Look up on SIMBAD"></a></li>
|
||||
<li><a href="//ned.ipac.caltech.edu/cgi-bin/nph-imgdata?objname={{scopePlaceNameForQueryString}}" target="ned" localize="Look up on NED"></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown-submenu">
|
||||
|
|
|
@ -5,14 +5,11 @@
|
|||
|
||||
<li class="dropdown-submenu">
|
||||
<a href="javascript:void(0)" localize="Information"></a>
|
||||
<ul class="dropdown-menu" style="height:208px">
|
||||
<li><a href="//www.bing.com/search?q={{menuContext.get_name().split(' ').join('+')}}" target="bing" localize="Look up on Bing"></a></li>
|
||||
<li><a href="//simbad.u-strasbg.fr/simbad/sim-id?Ident={{menuContext.get_name().split(' ').join('+')}}" target="simbad" localize="Look up on SIMBAD"></a></li>
|
||||
<li><a href="//seds.org/~spider/ngc/ngc.cgi?{{menuContext.get_name()}}" target="seds" localize="Look up on SEDS"></a></li>
|
||||
<li><a href="//en.wikipedia.org/wiki/{{menuContext.get_name().split(' ').join('_')}}" target="wiki" localize="Look up on Wikipedia"></a></li>
|
||||
<li><a href="//adsabs.harvard.edu/cgi-bin/abs_connect?db_key=AST&sim_query=YES&object={{menuContext.get_name().split(' ').split(';')[0]}}" target="wiki" localize="Look up publication on ADS"></a></li>
|
||||
<li><a href="//ned.ipac.caltech.edu/cgi-bin/nph-imgdata?objname={{menuContext.get_name()}}" target="ned" localize="Look up on NED"></a></li>
|
||||
<li><a href="//cas.sdss.org/dr7/en/tools/quicklook/quickobj.asp?id={{menuContext.get_name()}}" target="sdss" localize="Look up on SDSS"></a></li>
|
||||
<ul class="dropdown-menu" style="height:126px"> <!-- 28px per item + 2*7px top/bottom padding -->
|
||||
<li><a href="//wikipedia.org/wiki/Special:Search?search={{menuContextNameForQueryString}}" target="wikipedia" localize="Look up on Wikipedia"></a></li>
|
||||
<li><a href="//ui.adsabs.harvard.edu/search/q=object:%22{{menuContextNameForQueryString}}%22" target="ads" localize="Look up on SAO/NASA ADS"></a></li>
|
||||
<li><a href="//simbad.u-strasbg.fr/simbad/sim-id?Ident={{menuContextNameForQueryString}}" target="simbad" localize="Look up on SIMBAD"></a></li>
|
||||
<li><a href="//ned.ipac.caltech.edu/cgi-bin/nph-imgdata?objname={{menuContextNameForQueryString}}" target="ned" localize="Look up on NED"></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче