1 <div class=
"box box-primary" id=
"control">
2 <div class=
"box-header">
3 <div class=
"col-sm-10" style=
"padding-top:8px;">
4 <i class=
"fa fa-retweet"> </i>
5 <h1 class=
"box-title" style=
"font-weight:bold;" id=
"id_h1_page_title">菜单别名插件
</h1>
8 <div class=
"col-sm-2" style=
"font-size:16px;padding-top:8px;">
9 <a id=
"id_a_official_doc" target=
"_blank" href=
"https://www.ventoy.net/en/plugin_bootconf_replace.html"><span class=
"fa fa-link"></span><span id=
"id_span_official_doc">官网文档
</span></a>
14 <div class=
"box-body">
15 <div class=
"nav-tabs-custom">
16 <ul class=
"nav nav-tabs" id=
"id_tab_conf_replace">
17 <li class=
""><a href=
"#tab_0" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold" >conf_replace
</a></li>
18 <li class=
""><a href=
"#tab_1" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold">conf_replace_legacy
</a></li>
19 <li class=
""><a href=
"#tab_2" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold">conf_replace_uefi
</a></li>
20 <li class=
""><a href=
"#tab_3" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold">conf_replace_ia32
</a></li>
21 <li class=
""><a href=
"#tab_4" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold">conf_replace_aa64
</a></li>
22 <li class=
""><a href=
"#tab_5" data-toggle=
"tab" aria-expanded=
"false" style=
"font-weight:bold">conf_replace_mips
</a></li>
26 <table id=
"id_conf_replace_tbl" class=
"table table-bordered">
29 <th style=
"width: 2%;">#
</th>
30 <th id=
"id_th_conf_path" style=
"width: 30%;"></th>
31 <th id=
"id_th_status" style=
"width: 5%;"></th>
32 <th id=
"id_th_conf_org" style=
"width: 20%;"></th>
33 <th id=
"id_th_conf_new" style=
"width: 30%;"></th>
34 <th id=
"id_th_status" style=
"width: 5%;"></th>
35 <th id=
"id_th_operation" style=
"width: 5%;"></th>
43 <script type=
"text/javascript">
45 function VtoyPageLanguageChange(newlang) {
46 VtoyCommonChangeLanguage(newlang);
47 $('h1[id=id_h1_page_title]').text(g_vtoy_cur_language.STR_PLUG_CONF_REPLACE);
49 $("span[id=id_span_file_exist]").each(function(){
50 $(this).text(g_vtoy_cur_language.STR_FILE_EXIST);
52 $("span[id=id_span_file_nonexist]").each(function(){
53 $(this).text(g_vtoy_cur_language.STR_FILE_NONEXIST);
55 $("span[id=id_span_file_fuzzy]").each(function(){
56 $(this).text(g_vtoy_cur_language.STR_FILE_FUZZY);
59 if (newlang === 'en') {
60 $('#id_th_conf_path').text('Absolute Path');
61 $('#id_th_conf_org').text('org');
62 $('#id_th_conf_new').text('new');
64 $('#id_th_conf_path').text('绝对路径');
65 $('#id_th_conf_org').text('org');
66 $('#id_th_conf_new').text('new');
71 function FillConfReplaceTable(data) {
72 var addbtn = ventoy_get_xslg_addbtn('ConfReplaceAddBtn');
73 var delbtn = ventoy_get_xslg_delbtn('ConfReplaceDelBtn');
75 var td1, td2, td3, td4, td5, td6, td7;
76 var $tbl = $("#id_conf_replace_tbl tbody");
79 for (var i =
0; i < data.length; i++) {
81 td1 = '
<td>' + (i +
1) + '
</td>';
82 td2 = '
<td>' + data[i].path + '
</td>';
83 td3 = '
<td>' + ventoy_get_status_line(
0, data[i].valid) + '
</td>';
84 td4 = '
<td>' + data[i].org + '
</td>';
85 td5 = '
<td>' + data[i].new + '
</td>';
86 td6 = '
<td>' + ventoy_get_status_line(
0, data[i].new_valid) + '
</td>';
87 td7 = '
<td>' + delbtn + '
</td>';
89 $tr = $('
<tr>' + td1 + td2 + td3 + td4 + td5 + td6 + td7 + '
</tr>');
91 $tr.data('path', data[i].path);
96 $tbl.append('
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td>' + addbtn + '
</td></tr>');
99 function VtoyFillCurrentPageItem(data) {
100 FillConfReplaceTable(data);
104 function OnClickMultiModeTab() {
105 var href = $(this).attr('href');
106 var index = parseInt(href.substr(
5,
1));
108 if (index <
0 || index
>= g_vtoy_data_default_index || current_tab_index === index) {
112 current_tab_index = index;
113 VtoyFillCurrentPageItem(m_data_conf_replace[index]);
120 var m_data_conf_replace;
121 var current_tab_index =
0;
122 callVtoySync({method : 'get_conf_replace'}, function(data) {
123 m_data_conf_replace = data;
126 var m_conf_replace_validator = $("#ConfReplaceForm").validate({
143 submitHandler: function(form) {
144 m_conf_iso_path = $('input:text[id=IsoPath]').val();
145 m_conf_org_path = $('input:text[id=OrgPath]').val();
146 m_conf_new_path = $('input:text[id=NewPath]').val();
148 if ((!m_conf_iso_path) || (!m_conf_org_path) || (!m_conf_new_path))
153 m_conf_iso_path = ventoy_replace_slash(m_conf_iso_path);
154 m_conf_new_path = ventoy_replace_slash(m_conf_new_path);
156 if (!ventoy_common_check_path(m_conf_iso_path)) {
157 Message.error(g_vtoy_cur_language.STR_INVALID_FILE_PATH);
161 if (!ventoy_common_check_path(m_conf_new_path)) {
162 Message.error(g_vtoy_cur_language.STR_INVALID_FILE_PATH);
167 method : 'check_path2',
170 path1: m_conf_iso_path,
173 path2: m_conf_new_path
174 }, function(retdata) {
175 if (retdata.exist1 !=
0 && retdata.exist2 !=
0) {
178 "path": m_conf_iso_path.substr(g_current_dir.length),
179 "valid": retdata.exist1,
180 "org": m_conf_org_path,
181 "new": m_conf_new_path.substr(g_current_dir.length),
186 if (m_conf_org_path.substr(
0,
8) === '/loader/') {
192 method : 'conf_replace_add',
193 index: current_tab_index,
199 m_data_conf_replace[current_tab_index].push(data);
200 FillConfReplaceTable(m_data_conf_replace[current_tab_index]);
201 Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
204 $("#ConfReplaceModal").modal('hide');
205 } else if (retdata.exist1 ===
0) {
206 Message.error(g_vtoy_cur_language.STR_INVALID_FILE_PATH);
208 Message.error(g_vtoy_cur_language.STR_INVALID_NEW_FILE_PATH);
214 $("#id_conf_replace_tbl").on('click', '.ConfReplaceAddBtn', function() {
215 if (g_current_language === 'en') {
216 $('#ConfReplaceForm #ConfReplaceForm_lang_1').text("ISO Path");
217 $('#ConfReplaceForm #ConfReplaceForm_lang_2').text(" OK");
218 $('#ConfReplaceForm #ConfReplaceForm_lang_3').text("Cancel");
219 $('#ConfReplaceForm #id_note_conf_cn').hide();
220 $('#ConfReplaceForm #id_note_conf_en').show();
222 $('#ConfReplaceForm #ConfReplaceForm_lang_1').text("ISO文件路径");
223 $('#ConfReplaceForm #ConfReplaceForm_lang_2').text("确定");
224 $('#ConfReplaceForm #ConfReplaceForm_lang_3').text("取消");
225 $('#ConfReplaceForm #id_note_conf_en').hide();
226 $('#ConfReplaceForm #id_note_conf_cn').show();
229 $('#ConfReplaceForm #id_span_conf_tip1').each(function() {
230 var tip = (g_current_os === 'windows') ? '\\ISO\\Ubuntu-
20.04-desktop-amd64.iso' : "/ISO/Ubuntu-
20.04-desktop-amd64.iso";
231 $(this).text(g_current_dir + tip);
234 $('#ConfReplaceForm #id_span_conf_tip2').each(function() {
235 var tip = (g_current_os === 'windows') ? '\\ISO\\Ubuntu-*****-desktop-amd64.iso' : "/ISO/Ubuntu-*****-desktop-amd64.iso";
236 $(this).text(g_current_dir + tip);
239 $('#ConfReplaceForm #id_span_conf_tip3').each(function() {
240 var tip = (g_current_os === 'windows') ? '\\ventoy\\grub_new.cfg' : "/ventoy/grub_new.cfg";
241 $(this).text(g_current_dir + tip);
244 m_conf_replace_validator.resetForm();
245 $("#ConfReplaceModal").modal();
248 $("#id_conf_replace_tbl").on('click', '.ConfReplaceDelBtn', function() {
249 var $tr = $(this).closest('tr');
250 var path = $tr.data('path');
251 var index = $tr.data('index');
254 method : 'conf_replace_del',
255 index: current_tab_index,
258 m_data_conf_replace[current_tab_index].splice(index,
1);
259 FillConfReplaceTable(m_data_conf_replace[current_tab_index]);
260 Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
265 $('#id_tab_conf_replace a[
href="#tab_0"]').click(OnClickMultiModeTab);
266 $('#id_tab_conf_replace a[
href="#tab_1"]').click(OnClickMultiModeTab);
267 $('#id_tab_conf_replace a[
href="#tab_2"]').click(OnClickMultiModeTab);
268 $('#id_tab_conf_replace a[
href="#tab_3"]').click(OnClickMultiModeTab);
269 $('#id_tab_conf_replace a[
href="#tab_4"]').click(OnClickMultiModeTab);
270 $('#id_tab_conf_replace a[
href="#tab_5"]').click(OnClickMultiModeTab);
272 $('#id_tab_conf_replace a[
href="#tab_0"]').tab('show');
273 VtoyFillCurrentPageItem(m_data_conf_replace[
0]);
274 VtoyPageLanguageChange(g_current_language);