Commit 3f09fb9a authored by longpanda's avatar longpanda
Browse files

VentoyPlugson Update:

1. Add preview json feature
2. Add reset button
3. Add configuration active identifier for each tab
4. Bug fix
parent c87ad1d7
<div class="box box-primary" id="control">
<div class="box-header">
<div class="col-sm-10" style="padding-top:8px;">
<div class="col-sm-9" style="padding-top:8px;">
<i class="fa fa-commenting">&nbsp;&nbsp;</i>
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
</div>
<div class="col-sm-1" style="padding-top:2px;">
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
</div>
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_menutip.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
</div>
......@@ -373,6 +375,30 @@
$('#id_tab_menu_tip a[href="#tab_4"]').click(OnClickMultiModeTab);
$('#id_tab_menu_tip a[href="#tab_5"]').click(OnClickMultiModeTab);
function UpdateTabTitleIcon(data) {
CommonUpdateTabTitleIcon(data.exist_menu_tip, '#id_tab_menu_tip a[href="#tab_', 'menu_tip');
}
$('#id_btn_reset').click(function() {
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'menu_tip')}).on(function(e) {
if (e) {
callVtoySync({
method : 'tip_del',
index: current_tab_index,
path: g_del_all_path
}, function(data) {
});
m_data_tip[current_tab_index].left = m_data_tip[g_vtoy_data_default_index].left;
m_data_tip[current_tab_index].top = m_data_tip[g_vtoy_data_default_index].top;
m_data_tip[current_tab_index].color = m_data_tip[g_vtoy_data_default_index].color;
m_data_tip[current_tab_index].tips.length = 0;
VtoyFillCurrentPageItem(m_data_tip[g_vtoy_data_default_index]);
VtoySaveCurrentPage();
}
});
});
$('#id_tab_menu_tip a[href="#tab_0"]').tab('show');
VtoyFillCurrentPageItem(m_data_tip[0]);
VtoyPageLanguageChange(g_current_language);
......
<div class="box box-primary" id="control">
<div class="box-header">
<div class="col-sm-10" style="padding-top:8px;">
<div class="col-sm-9" style="padding-top:8px;">
<i class="glyphicon glyphicon-lock">&nbsp;</i>
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
</div>
<div class="col-sm-1" style="padding-top:2px;">
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
</div>
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_password.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
</div>
......@@ -234,7 +236,7 @@
}
current_tab_index = index;
VtoyFillCurrentPageItem(m_data_pwd[index].tips);
VtoyFillCurrentPageItem(m_data_pwd[index]);
}
function VtoyGetCurrentPageItem(data) {
......@@ -557,6 +559,27 @@ function VtoySetPassword(common, type, cb, data) {
$('#id_tab_password a[href="#tab_4"]').click(OnClickMultiModeTab);
$('#id_tab_password a[href="#tab_5"]').click(OnClickMultiModeTab);
function UpdateTabTitleIcon(data) {
CommonUpdateTabTitleIcon(data.exist_password, '#id_tab_password a[href="#tab_', 'password');
}
$('#id_btn_reset').click(function() {
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'password')}).on(function(e) {
if (e) {
callVtoySync({
method : 'password_del',
index: current_tab_index,
path: g_del_all_path
}, function(data) {
});
m_data_pwd[current_tab_index].list.length = 0;
VtoyFillCurrentPageItem(m_data_pwd[g_vtoy_data_default_index]);
VtoySaveCurrentPage();
}
});
});
$('#id_tab_password a[href="#tab_0"]').tab('show');
VtoyFillCurrentPageItem(m_data_pwd[0]);
VtoyPageLanguageChange(g_current_language);
......
<div class="box box-primary" id="control">
<div class="box-header">
<div class="col-sm-10" style="padding-top:8px;">
<div class="col-sm-9" style="padding-top:8px;">
<i class="fa fa-database">&nbsp;&nbsp;</i>
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>
</div>
<div class="col-sm-1" style="padding-top:2px;">
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
</div>
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_persistence.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
</div>
......@@ -510,7 +512,27 @@
$('#id_tab_persistence a[href="#tab_3"]').click(OnClickMultiModeTab);
$('#id_tab_persistence a[href="#tab_4"]').click(OnClickMultiModeTab);
$('#id_tab_persistence a[href="#tab_5"]').click(OnClickMultiModeTab);
function UpdateTabTitleIcon(data) {
CommonUpdateTabTitleIcon(data.exist_persistence, '#id_tab_persistence a[href="#tab_', 'persistence');
}
$('#id_btn_reset').click(function() {
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'persistence')}).on(function(e) {
if (e) {
callVtoySync({
method : 'persistence_del',
index: current_tab_index,
path: g_del_all_path
}, function(data) {
});
m_data_persistence[current_tab_index].length = 0;
VtoyFillCurrentPageItem(m_data_persistence[g_vtoy_data_default_index]);
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
}
});
});
$('#id_tab_persistence a[href="#tab_0"]').tab('show');
VtoyFillCurrentPageItem(m_data_persistence[0]);
VtoyPageLanguageChange(g_current_language);
......
<div class="box box-primary" id="control">
<div class="box-header">
<div class="col-sm-10" style="padding-top:8px;">
<div class="col-sm-9" style="padding-top:8px;">
<i class="fa fa-file-image-o">&nbsp;&nbsp;</i>
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">主题插件</h1>
</div>
<div class="col-sm-1" style="padding-top:2px;">
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
</div>
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/cn/plugin_theme.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
</div>
......@@ -513,6 +515,36 @@
$('#id_tab_theme a[href="#tab_4"]').click(OnClickMultiModeTab);
$('#id_tab_theme a[href="#tab_5"]').click(OnClickMultiModeTab);
function UpdateTabTitleIcon(data) {
CommonUpdateTabTitleIcon(data.exist_theme, '#id_tab_theme a[href="#tab_', 'theme');
}
$('#id_btn_reset').click(function() {
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'theme')}).on(function(e) {
if (e) {
callVtoySync({
method : 'theme_del_file',
index: current_tab_index,
path: g_del_all_path
}, function(data) {
});
callVtoySync({
method : 'theme_del_font',
index: current_tab_index,
path: g_del_all_path
}, function(data) {
});
m_data_theme[current_tab_index].filelist.length = 0;
m_data_theme[current_tab_index].fontslist.length = 0;
VtoyFillCurrentPageItem(m_data_theme[g_vtoy_data_default_index]);
VtoySaveCurrentPage();
}
});
});
$('#id_tab_theme a[href="#tab_0"]').tab('show');
VtoyFillCurrentPageItem(m_data_theme[0]);
VtoyPageLanguageChange(g_current_language);
......
......@@ -288,71 +288,6 @@ String.prototype.endsWith = function(str) {
return false;
}
window.Message = function() {
var _showMsg = function(type, msg, time) {
var o = {type : type, msg : msg };
if(time) {
o.time = time;
}
_show(o);
}
var _show = function(options) {
var ops = {
msg : "提示内容",
type: 'S',
time: 3000
};
$.extend(ops, options);
var msg_class = 'alert-success';
if('S' === ops.type || 's' === ops.type) {
msg_class = 'alert-success';
} else if ('E' === ops.type || 'e' === ops.type) {
msg_class = 'alert-danger';
} else if ('W' === ops.type || 'w' === ops.type) {
msg_class = 'alert-warning';
} else if ('I' === ops.type || 'i' === ops.type) {
msg_class = 'alert-info';
} else {
alert("未知的类型,请使用: w-警告;s-成功;e-失败;i-提示");
return;
}
var $messageContainer = $("#fcss_message");
if($messageContainer.length === 0) {
$messageContainer = $('<div id="fcss_message" style="position:fixed; left: 20%; right: 20%; top:0px; z-index:99999999"></div>');
$messageContainer.appendTo($('body'));
}
var $div = $('<div class="alert ' + msg_class + ' alert-dismissible fade in" role="alert" style="margin-bottom: 0; padding-top:10px; padding-bottom: 10px;"></div>');
var $btn = $('<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>');
$div.append($btn).append(ops.msg).appendTo($messageContainer);
setTimeout(function() {
$div.remove();
}, ops.time);
}
var _success = function(msg, time) {
_showMsg('s', msg, time);
}
var _error = function(msg, time) {
_showMsg('e', msg, time || 5000);
}
var _warn = function(msg, time) {
_showMsg('w', msg, time);
}
var _info = function(msg, time) {
_showMsg('i', msg, time);
}
return {
success : _success,
error : _error,
warn : _warn,
info : _info,
show : _show
}
}();
var g_vtoy_cur_language_en =
{
......@@ -376,6 +311,7 @@ var g_vtoy_cur_language_en =
"STR_OPT_SETTING": "Option Setting",
"STR_OPT_DESC": "Option Description",
"STR_EDIT": "Edit",
"STR_RESET": "Reset",
"STR_FILE": "File",
"STR_DIR": "Dir",
"STR_SAVE_TIP": "Data in current page has been modified. Do you want to save it?",
......@@ -489,6 +425,10 @@ var g_vtoy_cur_language_en =
"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_JSON_PREVIEW": "JSON Preview",
"STR_JSON_COPY_SUCCESS": "JSON Copy Success",
"STR_JSON_COPY_FAILED": "JSON Copy Failed",
"STR_XXX": "xxx"
};
......@@ -514,6 +454,7 @@ var g_vtoy_cur_language_cn =
"STR_OPT_SETTING": "选项设置",
"STR_OPT_DESC": "选项说明",
"STR_EDIT": "设置",
"STR_RESET": "重置",
"STR_FILE": "文件",
"STR_DIR": "目录",
"STR_SAVE_TIP": "当前页面数据已经修改,是否保存?",
......@@ -625,6 +566,9 @@ var g_vtoy_cur_language_cn =
"STR_INVALID_CONFIG_TIP": "ventoy.json 文件中存在错误配置,配置未加载!",
"STR_CONFIG_SAVE_ERROR_TIP": "ventoy.json 文件写入失败,详细信息请参考 VentoyPlugson.log 文件!",
"STR_JSON_PREVIEW": "JSON 预览",
"STR_JSON_COPY_SUCCESS": "JSON 内容复制成功",
"STR_JSON_COPY_FAILED": "JSON 内容复制失败",
"STR_XXX": "xxx"
};
......@@ -635,12 +579,45 @@ var g_current_language = 'cn';
var g_vtoy_cur_language = g_vtoy_cur_language_cn;
var g_vtoy_data_default_index = 6;
var g_bios_postfix = [ "", "_legacy", "_uefi", "_ia32", "_aa64", "_mips" ];
var g_del_all_path = '4119ae33-98ea-448e-b9c0-569aafcf1fb4';
var g_file_with_extra = false;
var g_dir_with_extra = false;
var g_file_fuzzy_match = 0;
var g_file_modal_callback;
var g_dir_modal_callback;
function GetResetTabConfigTipMsg(index, name) {
var msgstr;
if (g_current_language === 'en') {
msgstr = 'Are you sure to reset all the configurations on the <code>' + name + g_bios_postfix[index] + '</code> tab ?';
} else {
msgstr = '确认要重置 <code>' + name + g_bios_postfix[index] + '</code> 标签页下的所有配置?';
}
return msgstr;
}
function CommonUpdateTabTitleIcon(exists, id, name) {
var exspan = " <span id='tab_0_icon' class='fa fa-circle' style='color:red;'></span>";
for (var i = 0; i < g_vtoy_data_default_index; i++) {
var fid = id + i + '"]';
var oldhtml = $(fid).html();
var newhtml;
if (exists[i]) {
newhtml = name + g_bios_postfix[i] + exspan;
} else {
newhtml = name + g_bios_postfix[i];
}
if (newhtml != oldhtml) {
$(fid).html(newhtml);
}
}
}
function ventoy_file_submit(form, extra) {
var filepath = $("#FilePath").val();
var fileextra = $("#FileExtra").val();
......@@ -920,6 +897,8 @@ function VtoyCommonChangeLanguage(newlang) {
$(this).text(" Plugin Official Document");
});
$('#id_span_copy').text("Copy");
$('#id_span_preview').text("Preview");
$('#id_span_language').text("中文");
$("tr[id=tr_title_desc_cn]").each(function(){
......@@ -966,6 +945,8 @@ function VtoyCommonChangeLanguage(newlang) {
$(this).text(" 插件官网文档");
});
$('#id_span_copy').text("复制");
$('#id_span_preview').text("预览");
$('#id_span_language').text("English");
$("tr[id=tr_title_desc_cn]").each(function(){
......@@ -1002,7 +983,10 @@ function VtoyCommonChangeLanguage(newlang) {
$('#id_span_save').text(g_vtoy_cur_language.STR_SAVE);
$('#id_span_reset').text(g_vtoy_cur_language.STR_RESET);
$('#id_span_donation').text(g_vtoy_cur_language.STR_PLUG_DONATION);
$('span[id=id_btn_span_reset]').each(function(){
$(this).text(' ' + g_vtoy_cur_language.STR_RESET);
});
$("span[id=id_span_btn_add]").each(function(){
$(this).text(g_vtoy_cur_language.STR_ADD);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment