X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/4bf43ab9d4e6b724836724c1d514760d164df79a..6b22a6200e8f72d3260d292800a8786666623bfc:/Plugson/www/static/js/vtoy.js diff --git a/Plugson/www/static/js/vtoy.js b/Plugson/www/static/js/vtoy.js index aee3379..6871925 100644 --- a/Plugson/www/static/js/vtoy.js +++ b/Plugson/www/static/js/vtoy.js @@ -2,6 +2,13 @@ function ventoy_replace_slash(str) { var str1 = str.replace(/\\/g, '/'); var str2 = str1.replace(/\/\//g, '/'); + + if (str2 && str2.length > 0) { + if (str2.substr(-1) === "/") { + return str2.substr(0, str2.length - 1); + } + } + return str2; } @@ -429,10 +436,10 @@ var g_vtoy_cur_language_en = "STR_PATH_TOO_LONG": "The path exceeds the maximum supported length, please check!", "STR_INPUT_TOO_LONG": "The string exceeds the maximum supported length, please check!", - "STR_INVALID_FILE_PATH": "Invalid full file path, please check!", - "STR_INVALID_FILE_PATH1": "The 1st file path is invalid!", - "STR_INVALID_FILE_PATH2": "The 2nd file path is invalid!", - "STR_INVALID_NEW_FILE_PATH": "The full file path of new is invalid, please check!", + "STR_INVALID_FILE_PATH": "Invalid or nonexist full file path, please check!", + "STR_INVALID_FILE_PATH1": "The 1st file path is invalid or nonexist!", + "STR_INVALID_FILE_PATH2": "The 2nd file path is invalid or nonexist!", + "STR_INVALID_NEW_FILE_PATH": "The full file path of new is invalid or nonexist, please check!", "STR_INVALID_DIR_PATH": "Invalid directory path, please check!", "STR_INVALID_NUMBER": "Please input valid non-negative integer!", "STR_INVALID_AUTOSEL": "autosel exceeds the length of the list!", @@ -446,7 +453,7 @@ var g_vtoy_cur_language_en = "STR_SET_TIP_FOR_DIR": "Set Menu Tip For Directory", "STR_SET_INJECTION_FOR_FILE": "[image] Set injection for a file", "STR_SET_INJECTION_FOR_DIR": "[parent] Set the same injection for all the files under a directory.", - "STR_INVALID_ARCHIVE_PATH": "Invalid archive file path, please check!", + "STR_INVALID_ARCHIVE_PATH": "Invalid or nonexist archive file path, please check!", "STR_SET_PWD_FOR_FILE": "[file] Set password for a file.", "STR_SET_PWD_FOR_DIR": "[parent] Set the same password for all the files under a directory.", "STR_SET_AUTO_INSTALL_FOR_FILE": "[image] Set auto install template for a file", @@ -479,6 +486,8 @@ var g_vtoy_cur_language_en = "STR_SECURE_BOOT_ENABLE": "Enable", "STR_SECURE_BOOT_DISABLE": "Disable", "STR_SYNTAX_ERROR_TIP": "Syntax error detected in ventoy.json, so the configuration is not loaded!", + "STR_INVALID_CONFIG_TIP": "Invalid configuration detected in ventoy.json, so the configuration is not loaded!", + "STR_CONFIG_SAVE_ERROR_TIP": "Failed to write ventoy.json file. Check VentoyPlugson.log for more details!", "STR_XXX": "xxx" }; @@ -563,10 +572,10 @@ var g_vtoy_cur_language_cn = "STR_PATH_TOO_LONG": "路径超过最大支持长度,请检查!", "STR_INPUT_TOO_LONG": "字符串超过最大支持长度,请检查!", - "STR_INVALID_FILE_PATH": "文件路径不合法,请检查!", - "STR_INVALID_FILE_PATH1": "第1个文件路径不合法,请检查!", - "STR_INVALID_FILE_PATH2": "第2个文件路径不合法,请检查!", - "STR_INVALID_NEW_FILE_PATH": "new 文件路径不合法,请检查!", + "STR_INVALID_FILE_PATH": "文件路径不合法或不存在,请检查!", + "STR_INVALID_FILE_PATH1": "第1个文件路径不合法或不存在,请检查!", + "STR_INVALID_FILE_PATH2": "第2个文件路径不合法或不存在,请检查!", + "STR_INVALID_NEW_FILE_PATH": "new 文件路径不合法或不存在,请检查!", "STR_INVALID_DIR_PATH": "文件夹路径不合法,请检查!", "STR_INVALID_NUMBER": "请输入合法的非负整数!", "STR_INVALID_AUTOSEL": "autosel 的值超过了列表实际长度!", @@ -580,7 +589,7 @@ var g_vtoy_cur_language_cn = "STR_SET_TIP_FOR_DIR": "为目录设置菜单提示信息", "STR_SET_INJECTION_FOR_FILE": "[image] 为某一个文件设置注入", "STR_SET_INJECTION_FOR_DIR": "[parent] 为某个目录下的所有文件设置相同的注入", - "STR_INVALID_ARCHIVE_PATH": "Archive 文件路径非法,请检查!", + "STR_INVALID_ARCHIVE_PATH": "Archive 文件路径非法或不存在,请检查!", "STR_SET_PWD_FOR_FILE": "[file] 为指定文件设置密码", "STR_SET_PWD_FOR_DIR": "[parent] 为某个目录下的所有文件设置相同的密码", "STR_SET_AUTO_INSTALL_FOR_FILE": "[image] 为某个镜像文件设置自动安装脚本", @@ -613,7 +622,8 @@ var g_vtoy_cur_language_cn = "STR_SECURE_BOOT_ENABLE": "开启", "STR_SECURE_BOOT_DISABLE": "未开启", "STR_SYNTAX_ERROR_TIP": "ventoy.json 文件中存在语法错误,配置未加载!", - + "STR_INVALID_CONFIG_TIP": "ventoy.json 文件中存在错误配置,配置未加载!", + "STR_CONFIG_SAVE_ERROR_TIP": "ventoy.json 文件写入失败,详细信息请参考 VentoyPlugson.log 文件!", "STR_XXX": "xxx" @@ -896,6 +906,7 @@ function VtoyCommonChangeLanguage(newlang) { utfmaxlen: $.validator.format("The string exceeds the maximum supported length"), start_slash: $.validator.format("Must start with /"), noquotes: $.validator.format("Can not include double quotes"), + filenamepart:$.validator.format("As part of file name, can not include invalid characters"), printascii: $.validator.format("Can not include non-ascii characters.") }); @@ -941,6 +952,7 @@ function VtoyCommonChangeLanguage(newlang) { utfmaxlen: $.validator.format("超过最大长度"), start_slash: $.validator.format("必须以反斜杠 / 开头"), noquotes: $.validator.format("不能包含双引号"), + filenamepart:$.validator.format("作为文件名的一部分,不能包含特殊的符号"), printascii: $.validator.format("不能包含中文或其他非 ascii 字符。") }); @@ -1062,13 +1074,13 @@ var g_type_select_validator = $("#TypeSelectForm").validate({ function VtoySelectType(cb, para) { $('#TypeSelectForm #TypeSelForm_lang_1').text(g_vtoy_cur_language.STR_SELECT); - + if (g_current_language === 'en') { - $('#SetDirForm #SetDirForm_lang_2').text(" OK"); - $('#SetDirForm #SetDirForm_lang_3').text("Cancel"); + $('#TypeSelectForm #TypeSelForm_lang_2').text(" OK"); + $('#TypeSelectForm #TypeSelForm_lang_3').text("Cancel"); } else { - $('#SetDirForm #SetDirForm_lang_2').text("确定"); - $('#SetDirForm #SetDirForm_lang_3').text("取消"); + $('#TypeSelectForm #TypeSelForm_lang_2').text("确定"); + $('#TypeSelectForm #TypeSelForm_lang_3').text("取消"); } var $tbl = $("#id_type_select_table tbody"); @@ -1102,7 +1114,8 @@ var g_set_key_validator = $("#SetKeyForm").validate({ }, SetKeyValue : { required: true, - utfmaxlen: true + utfmaxlen: true, + filenamepart: true } }, @@ -1130,11 +1143,11 @@ function VtoySetKey(cb, para) { $('#SetKeyForm #SetKeyForm_lang_3').text(para.title2); if (g_current_language === 'en') { - $('#SetDirForm #SetDirForm_lang_4').text(" OK"); - $('#SetDirForm #SetDirForm_lang_5').text("Cancel"); + $('#SetKeyForm #SetKeyForm_lang_4').text(" OK"); + $('#SetKeyForm #SetKeyForm_lang_5').text("Cancel"); } else { - $('#SetDirForm #SetDirForm_lang_4').text("确定"); - $('#SetDirForm #SetDirForm_lang_5').text("取消"); + $('#SetKeyForm #SetKeyForm_lang_4').text("确定"); + $('#SetKeyForm #SetKeyForm_lang_5').text("取消"); } g_set_key_callback = cb; @@ -1392,15 +1405,15 @@ function VtoySetDirFile(cb, para) { $('#SetDirFileModal #SetDirFileForm_label2').text(para.label2); if (g_current_language === 'en') { - $('#SetDirFileModal #SetDirFileModal_ok').text(" OK"); - $('#SetDirFileModal #SetDirFileModal_cancel').text("Cancel"); + $('#SetDirFileModal #SetDirFileForm_ok').text(" OK"); + $('#SetDirFileModal #SetDirFileForm_cancel').text("Cancel"); $('#SetDirFileModal #id_note_dirfile_cn').hide(); $('#SetDirFileModal #id_note_dirfile_en').show(); } else { - $('#SetDirFileModal #SetDirFileModal_ok').text("确定"); - $('#SetDirFileModal #SetDirFileModal_cancel').text("取消"); + $('#SetDirFileModal #SetDirFileForm_ok').text("确定"); + $('#SetDirFileModal #SetDirFileForm_cancel').text("取消"); $('#SetDirFileModal #id_note_dirfile_en').hide(); $('#SetDirFileModal #id_note_dirfile_cn').show();