Files
youtube-dl/lib/system/templates/system_plugin_list.html

133 lines
3.5 KiB
HTML
Raw Normal View History

2022-10-02 20:18:05 +09:00
{% extends "base.html" %}
{% block content %}
<div>
2022-10-11 16:46:05 +09:00
{{ macros.m_hr_head_top() }}
{{ macros.m_row_start('0') }}
{{ macros.m_col_wide(1, macros.m_strong('Idx'), 'center') }}
{{ macros.m_col_wide(2, macros.m_strong('Title')) }}
{{ macros.m_col_wide(2, macros.m_strong('Package Name')) }}
{{ macros.m_col_wide(1, macros.m_strong('Dev.')) }}
{{ macros.m_col_wide(1, macros.m_strong('Version')) }}
{{ macros.m_col_wide(5, macros.m_strong('Description')) }}
{{ macros.m_row_end() }}
{{ macros.m_hr_head_bottom() }}
<div id="plugin_list_div"></div>
2022-10-10 11:40:10 +09:00
</div>
2022-10-02 20:18:05 +09:00
<script type="text/javascript">
$(document).ready(function(){
2022-10-10 11:40:10 +09:00
globalSendCommand('get_plugin_list', null, null, null, null, function(data){
make_plugin_list(data.data);
2022-10-02 20:18:05 +09:00
});
});
2022-10-10 11:40:10 +09:00
function make_plugin_list(data) {
current_data = data;
console.log(data);
str = ''
console.log(data)
for (i in data) {
console.log(data[i]);
str += m_row_start();
str += m_col_wide(1, (parseInt(i)+1), 'center')
if (data[i].title == null) {
str += m_col_wide(2, '');
str += m_col_wide(2, data[i].package_name);
str += m_col_wide(5, '');
tmp = m_button_small('uninstall_btn', '삭제', [{'key':'package_name', 'value':data[i].package_name}]);
} else {
str += m_col_wide(2, data[i].title);
str += m_col_wide(2, data[i].package_name);
str += m_col_wide(1, data[i].developer);
str += m_col_wide(1, data[i].version);
if (data[i].loading == false) {
tmp = data[i].description + '<br>' + text_color('[로딩 실패] ') + data[i].status;
str += m_col_wide(3, tmp);
2022-10-02 20:18:05 +09:00
} else {
2022-10-10 11:40:10 +09:00
str += m_col_wide(3, data[i].description);
2022-10-02 20:18:05 +09:00
}
2022-10-10 11:40:10 +09:00
2022-10-02 20:18:05 +09:00
tmp = ''
2022-10-10 11:40:10 +09:00
tmp += m_button_small('globalOpenBtn', '홈페이지', [{'key':'url', 'value':data[i].home}], 'primary');
tmp += m_button_small('uninstall_btn', '삭제', [{'key':'package_name', 'value':data[i].package_name}, {'key':'title', 'value':data[i].title}]);
tmp += m_button_small('json_btn', 'JSON', [{'key':'idx', 'value':i}], 'info');
2022-10-02 20:18:05 +09:00
}
2022-10-10 11:40:10 +09:00
tmp = m_button_group(tmp)
str += m_col_wide(2, tmp, 'right')
2022-10-02 20:18:05 +09:00
str += m_row_end();
if (i != current_data.length -1) str += m_hr(0);
}
document.getElementById("plugin_list_div").innerHTML = str;
}
2022-10-10 11:40:10 +09:00
$("body").on('click', '#json_btn', function(e){
e.preventDefault();
item_id = $(this).data('idx');
m_modal(current_data[item_id]);
});
2022-10-02 20:18:05 +09:00
2022-10-10 11:40:10 +09:00
$("body").on('click', '#uninstall_btn', function(e){
e.preventDefault();
$("#confirm_title").html("삭제 확인");
$("#confirm_body").html($(this).data('title') + " 플러그인을 삭제 하시겠습니까?");
package_name = $(this).data('package_name');
$('#confirm_button').attr('onclick', "javascript:uninstall(package_name);");
$("#confirm_modal").modal();
2022-10-02 20:18:05 +09:00
});
2022-10-10 11:40:10 +09:00
function uninstall(package_name) {
globalSendCommand('uninstall', package_name, null, null, null, function(ret) {
});
}
2022-10-02 20:18:05 +09:00
$("body").on('click', '#plugin_uninstall_btn', function(e){
e.preventDefault();
plugin_name = $(this).data('plugin_name')
$.ajax({
url: '/' + package_name + '/ajax/plugin_uninstall',
type: "POST",
cache: false,
data:{plugin_name:plugin_name},
success: function (data) {
if (data == 'success') {
$.notify('<strong>재시작시 적용됩니다.</strong>', {
type: 'success'
});
} else {
$.notify('<strong>실패하였습니다.</strong>', {
type: 'warning'
});
}
}
});
});
</script>
{% endblock %}