import_functions: add searchUrlFor() which returns an url for search of given entity

This commit is contained in:
Laurent Monin 2015-06-14 21:57:57 +02:00
parent 4bd4b74c7f
commit 1a07a75774

View file

@ -101,6 +101,17 @@ var MBReleaseImportHelper = (function() {
return '<a class="musicbrainz_import" href="//musicbrainz.org/search?' + params.join('&') + '">Search in MusicBrainz</a>';
}
function fnSearchUrlFor(type, what) {
type = type.replace('-', '_');
var params = [
'query=' + luceneEscape(what),
'type=' + type,
'indexed=1'
];
return '//musicbrainz.org/search?' + params.join('&');
}
// compute HTML of import form
function fnBuildFormHTML(parameters) {
@ -345,6 +356,7 @@ var MBReleaseImportHelper = (function() {
guessReleaseType: fnGuessReleaseType,
hmsToMilliSeconds: hmsToMilliSeconds,
ISO8601toMilliSeconds: fnISO8601toMilliSeconds,
searchUrlFor: fnSearchUrlFor,
URL_TYPES: url_types
};
})();