MCPcopy Create free account
hub / github.com/Bistutu/FluentRead / setLanguage

Function setLanguage

userscripts.js:640–667  ·  view source on GitHub ↗
(lang)

Source from the content-addressed store, hash-verified

638 }
639 ,
640 setLanguage(lang) {
641 let args = lang === 'from' ? {
642 notion: "源",
643 inputValue: langManager.getFrom(),
644 inputOptions: langManager.from,
645 } : {
646 notion: "目标",
647 inputValue: langManager.getTo(),
648 inputOptions: langManager.to,
649 }
650 Swal.fire({
651 title: args.notion + '语言设置',
652 text: '请选择翻译' + args.notion + '语言',
653 input: 'select',
654 inputValue: args.inputValue,
655 inputOptions: args.inputOptions,
656 confirmButtonText: '保存并刷新页面',
657 cancelButtonText: '取消',
658 showCancelButton: true,
659 customClass: toastClass,
660 }).then(async (result) => {
661 if (result.isConfirmed) {
662 langManager.setFromTo(langManager.getFrom(), result.value);
663 toast.fire({icon: 'success', title: args.notion + '语言设置成功!'});
664 history.go(0); // 刷新页面
665 }
666 });
667 }
668 ,
669 update() {
670 // 跳转页面

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected