Skip to content

Commit

Permalink
Update base.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Nov 19, 2024
1 parent 66b0f68 commit b493994
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/static/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,23 @@ function FetchBuiltinRecipesXml() {

//自动触发和用户浏览器同样语种的选项
var langItem;
var langEnItem = langPick.find("option[value='en']");
if (hasUserLangRss) {
langItem = langPick.find("option[value='{0}']".format(userLang));
langItem.prependTo(langPick);
} else if (hasEnRss) { //如果有英语则选择英语源
langItem = langPick.find("option[value='en']");
langItem = langEnItem;
} else { //最后只能选择第一个语言
langItem = $("#language_pick").children().first();
}
if (langItem) {
langItem.prependTo(langPick); //英语或浏览器语言置顶
langItem.attr("selected", true);
langItem.trigger('change');
}
if (langEnItem) {
langEnItem.prependTo(langPick); //英语置顶
}
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log("Failed to fetch '/recipes/builtin_recipes.xml': " + errorThrown);
});
Expand Down

0 comments on commit b493994

Please sign in to comment.