mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 01:03:50 +02:00
Local avatar favs import, export and search
This commit is contained in:
131
html/src/app.js
131
html/src/app.js
@@ -19659,7 +19659,7 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.avatarDialogCommand = function (command) {
|
||||
var D = this.avatarDialog;
|
||||
@@ -27185,6 +27185,7 @@ speechSynthesis.getVoices();
|
||||
avatarIdList: new Set(),
|
||||
errors: '',
|
||||
avatarImportFavoriteGroup: null,
|
||||
avatarImportLocalFavoriteGroup: null,
|
||||
importProgress: 0,
|
||||
importProgressTotal: 0
|
||||
};
|
||||
@@ -27269,9 +27270,16 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.methods.selectAvatarImportGroup = function (group) {
|
||||
var D = this.avatarImportDialog;
|
||||
D.avatarImportLocalFavoriteGroup = null;
|
||||
D.avatarImportFavoriteGroup = group;
|
||||
};
|
||||
|
||||
$app.methods.selectAvatarImportLocalGroup = function (group) {
|
||||
var D = this.avatarImportDialog;
|
||||
D.avatarImportFavoriteGroup = null;
|
||||
D.avatarImportLocalFavoriteGroup = group;
|
||||
};
|
||||
|
||||
$app.methods.cancelAvatarImport = function () {
|
||||
var D = this.avatarImportDialog;
|
||||
D.loading = false;
|
||||
@@ -27279,10 +27287,10 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.methods.importAvatarImportTable = async function () {
|
||||
var D = this.avatarImportDialog;
|
||||
D.loading = true;
|
||||
if (!D.avatarImportFavoriteGroup) {
|
||||
if (!D.avatarImportFavoriteGroup && !D.avatarImportLocalFavoriteGroup) {
|
||||
return;
|
||||
}
|
||||
D.loading = true;
|
||||
var data = [...this.avatarImportTable.data].reverse();
|
||||
D.importProgressTotal = data.length;
|
||||
try {
|
||||
@@ -27291,7 +27299,17 @@ speechSynthesis.getVoices();
|
||||
break;
|
||||
}
|
||||
var ref = data[i];
|
||||
await this.addFavoriteAvatar(ref, D.avatarImportFavoriteGroup);
|
||||
if (D.avatarImportFavoriteGroup) {
|
||||
await this.addFavoriteAvatar(
|
||||
ref,
|
||||
D.avatarImportFavoriteGroup
|
||||
);
|
||||
} else if (D.avatarImportLocalFavoriteGroup) {
|
||||
this.addLocalAvatarFavorite(
|
||||
ref.id,
|
||||
D.avatarImportLocalFavoriteGroup
|
||||
);
|
||||
}
|
||||
removeFromArray(this.avatarImportTable.data, ref);
|
||||
D.avatarIdList.delete(ref.id);
|
||||
D.importProgress++;
|
||||
@@ -27310,9 +27328,11 @@ speechSynthesis.getVoices();
|
||||
$app.resetAvatarImport();
|
||||
$app.avatarImportDialog.visible = false;
|
||||
$app.avatarImportFavoriteGroup = null;
|
||||
$app.avatarImportLocalFavoriteGroup = null;
|
||||
|
||||
$app.avatarExportDialogVisible = false;
|
||||
$app.avatarExportFavoriteGroup = null;
|
||||
$app.avatarExportLocalFavoriteGroup = null;
|
||||
});
|
||||
|
||||
// #endregion
|
||||
@@ -27322,12 +27342,14 @@ speechSynthesis.getVoices();
|
||||
$app.data.avatarExportDialogVisible = false;
|
||||
$app.data.avatarExportContent = '';
|
||||
$app.data.avatarExportFavoriteGroup = null;
|
||||
$app.data.avatarExportLocalFavoriteGroup = null;
|
||||
|
||||
$app.methods.showAvatarExportDialog = function () {
|
||||
this.$nextTick(() =>
|
||||
adjustDialogZ(this.$refs.avatarExportDialogRef.$el)
|
||||
);
|
||||
this.avatarExportFavoriteGroup = null;
|
||||
this.avatarExportLocalFavoriteGroup = null;
|
||||
this.updateAvatarExportDialog();
|
||||
this.avatarExportDialogVisible = true;
|
||||
};
|
||||
@@ -27340,23 +27362,54 @@ speechSynthesis.getVoices();
|
||||
return str;
|
||||
};
|
||||
var lines = ['AvatarID,Name'];
|
||||
API.favoriteAvatarGroups.forEach((group) => {
|
||||
if (
|
||||
!this.avatarExportFavoriteGroup ||
|
||||
this.avatarExportFavoriteGroup === group
|
||||
) {
|
||||
$app.favoriteAvatars.forEach((ref) => {
|
||||
if (group.key === ref.groupKey) {
|
||||
lines.push(`${_(ref.id)},${_(ref.name)}`);
|
||||
}
|
||||
});
|
||||
if (this.avatarExportFavoriteGroup) {
|
||||
API.favoriteAvatarGroups.forEach((group) => {
|
||||
if (
|
||||
!this.avatarExportFavoriteGroup ||
|
||||
this.avatarExportFavoriteGroup === group
|
||||
) {
|
||||
$app.favoriteAvatars.forEach((ref) => {
|
||||
if (group.key === ref.groupKey) {
|
||||
lines.push(`${_(ref.id)},${_(ref.name)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (this.avatarExportLocalFavoriteGroup) {
|
||||
var favoriteGroup =
|
||||
this.localAvatarFavorites[this.avatarExportLocalFavoriteGroup];
|
||||
if (!favoriteGroup) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < favoriteGroup.length; ++i) {
|
||||
var ref = favoriteGroup[i];
|
||||
lines.push(`${_(ref.id)},${_(ref.name)}`);
|
||||
}
|
||||
} else {
|
||||
// export all
|
||||
this.favoriteAvatars.forEach((ref1) => {
|
||||
lines.push(`${_(ref1.id)},${_(ref1.name)}`);
|
||||
});
|
||||
for (var i = 0; i < this.localAvatarFavoritesList.length; ++i) {
|
||||
var avatarId = this.localAvatarFavoritesList[i];
|
||||
var ref2 = API.cachedAvatars.get(avatarId);
|
||||
if (typeof ref2 !== 'undefined') {
|
||||
lines.push(`${_(ref2.id)},${_(ref2.name)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.avatarExportContent = lines.join('\n');
|
||||
};
|
||||
|
||||
$app.methods.selectAvatarExportGroup = function (group) {
|
||||
this.avatarExportFavoriteGroup = group;
|
||||
this.avatarExportLocalFavoriteGroup = null;
|
||||
this.updateAvatarExportDialog();
|
||||
};
|
||||
|
||||
$app.methods.selectAvatarExportLocalGroup = function (group) {
|
||||
this.avatarExportLocalFavoriteGroup = group;
|
||||
this.avatarExportFavoriteGroup = null;
|
||||
this.updateAvatarExportDialog();
|
||||
};
|
||||
|
||||
@@ -28180,7 +28233,7 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.methods.isLocalUserVrcplusSupporter = function () {
|
||||
return API.currentUser.$isVRCPlus;
|
||||
}
|
||||
};
|
||||
|
||||
$app.data.localAvatarFavoriteGroups = [];
|
||||
$app.data.localAvatarFavoritesList = [];
|
||||
@@ -28485,6 +28538,52 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
$app.data.avatarFavoriteSearch = '';
|
||||
$app.data.avatarFavoriteSearchResults = [];
|
||||
|
||||
$app.methods.searchAvatarFavorites = function () {
|
||||
var search = this.avatarFavoriteSearch.toLowerCase();
|
||||
if (search.length < 3) {
|
||||
this.avatarFavoriteSearchResults = [];
|
||||
return;
|
||||
}
|
||||
|
||||
var results = [];
|
||||
for (var i = 0; i < this.localAvatarFavoriteGroups.length; ++i) {
|
||||
var group = this.localAvatarFavoriteGroups[i];
|
||||
if (!this.localAvatarFavorites[group]) {
|
||||
continue;
|
||||
}
|
||||
for (var j = 0; j < this.localAvatarFavorites[group].length; ++j) {
|
||||
var ref = this.localAvatarFavorites[group][j];
|
||||
if (!ref || !ref.id) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
ref.name.toLowerCase().includes(search) ||
|
||||
ref.authorName.toLowerCase().includes(search)
|
||||
) {
|
||||
results.push(ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.favoriteAvatars.length; ++i) {
|
||||
var ref = this.favoriteAvatars[i].ref;
|
||||
if (!ref) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
ref.name.toLowerCase().includes(search) ||
|
||||
ref.authorName.toLowerCase().includes(search)
|
||||
) {
|
||||
results.push(ref);
|
||||
}
|
||||
}
|
||||
|
||||
this.avatarFavoriteSearchResults = results;
|
||||
};
|
||||
|
||||
// #endregion
|
||||
// #region | Local Favorite Friends
|
||||
|
||||
|
||||
Reference in New Issue
Block a user