restrict search to picture/sound in tutorials. fixes #39

This commit is contained in:
Peli de Halleux 2015-02-17 12:01:35 -08:00
Родитель 1655727913
Коммит 477f96bfd7
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -4274,6 +4274,7 @@ module TDev
Calculator.searchTip(elt("apiSearchBox"), <AST.GlobalDef>fw)
this.searchApi.prepopulate = fw.getName()
this.searchApi.artKind = fw.getKind();
TheEditor.stepTutorial.expectingSearch = 1;
return;
}

Просмотреть файл

@ -37,6 +37,7 @@ module TDev
private toCodeBtn:HTMLElement;
public visible = false;
public prepopulate: string;
public artKind: Kind; // restricting to picture or sounds
private doInsertOnDismissing = false;
private dismissDiv = div("apiDismiss");
@ -209,6 +210,7 @@ module TDev
public dismissing()
{
this.artKind = null;
if (this.doInsertOnDismissing) {
this.doInsertOnDismissing = false;
return super.onEnter();
@ -569,14 +571,16 @@ module TDev
this.setChildren([<HTMLElement>div("navMessage", msg)].concat(this.htmlEntries))
}
private searchAzureSearchArtAsync(terms: string, itemCount: number, type: string = undefined) {
private searchAzureSearchArtAsync(terms: string, itemCount: number, kind: string = undefined) {
if (!this.autoUpdate.resultsCurrent(terms)) {
return Promise.as();
}
if (!kind && this.artKind) kind = this.artKind.getName().toLowerCase();
var uploadPicBtn, uploadSndBtn;
this.progressBar.start();
return Meta.searchArtAsync(terms, type, 0).then(arts => {
return Meta.searchArtAsync(terms, kind, 0).then(arts => {
this.progressBar.stop();
if (!this.autoUpdate.resultsCurrent(terms)) {
return;