629 lines
25 KiB
HTML
629 lines
25 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
|
|
<link rel="stylesheet" href="{{ url_for('.static', filename='css/mobile_custom.css') }}"/>
|
|
<link rel="stylesheet" href="{{ url_for('.static', filename='css/' ~ arg['sub'] ~ '.css') }}"/>
|
|
|
|
<style>
|
|
body {
|
|
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4c1d95 100%) !important;
|
|
background-attachment: fixed;
|
|
color: #e0e7ff;
|
|
font-family: 'Inter', 'Noto Sans KR', sans-serif;
|
|
}
|
|
|
|
/* Layout Expansion */
|
|
#main_container, .container, .container-fluid, .content-cloak {
|
|
max-width: 100% !important;
|
|
padding-left: 15px !important;
|
|
padding-right: 15px !important;
|
|
margin: 0 auto !important;
|
|
}
|
|
|
|
.content-cloak { padding-top: 10px; }
|
|
|
|
/* Navigation (Tabs) Optimization */
|
|
ul.nav.nav-pills.bg-light {
|
|
background-color: rgba(30, 41, 59, 0.6) !important;
|
|
backdrop-filter: blur(10px);
|
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
border-radius: 50rem !important;
|
|
padding: 6px !important;
|
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
|
|
display: inline-flex !important;
|
|
gap: 4px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
ul.nav.nav-pills .nav-link {
|
|
color: #94a3b8 !important;
|
|
font-weight: 600 !important;
|
|
padding: 8px 20px !important;
|
|
border-radius: 50rem !important;
|
|
transition: all 0.3s ease !important;
|
|
}
|
|
|
|
ul.nav.nav-pills .nav-link:hover {
|
|
background-color: rgba(255, 255, 255, 0.1) !important;
|
|
color: #fff !important;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
ul.nav.nav-pills .nav-link.active {
|
|
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
|
|
color: #fff !important;
|
|
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
|
|
}
|
|
|
|
/* Search Container */
|
|
.search-container {
|
|
background: rgba(49, 46, 129, 0.4);
|
|
backdrop-filter: blur(10px);
|
|
border: 1px solid rgba(167, 139, 250, 0.1);
|
|
border-radius: 12px;
|
|
padding: 15px;
|
|
margin-top: 10px;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 15px;
|
|
align-items: center;
|
|
justify-content: space-between; /* Align groups to edges */
|
|
}
|
|
|
|
.search-group-left { display: flex; gap: 8px; flex: 1; min-width: 200px; }
|
|
.search-group-right { display: flex; gap: 8px; flex: 1.5; min-width: 320px; justify-content: flex-end; }
|
|
|
|
.custom-select { min-width: 100px; flex: 1; }
|
|
.custom-input { flex: 2; min-width: 150px; }
|
|
|
|
.custom-select, .custom-input {
|
|
background-color: rgba(30, 27, 75, 0.6) !important;
|
|
border: 1px solid rgba(167, 139, 250, 0.2) !important;
|
|
color: #e0e7ff !important;
|
|
border-radius: 8px !important;
|
|
padding: 0 12px !important;
|
|
height: 38px !important;
|
|
font-size: 13px !important;
|
|
}
|
|
.custom-select:focus, .custom-input:focus {
|
|
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3) !important;
|
|
border-color: #8b5cf6 !important;
|
|
}
|
|
|
|
/* Bootstrap Toggle Custom Styling (Match Request Page) */
|
|
.toggle.btn-success, .toggle.btn-success:hover {
|
|
background: linear-gradient(135deg, #f472b6 0%, #db2777 100%) !important;
|
|
border: none !important;
|
|
box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3) !important;
|
|
}
|
|
|
|
.toggle-on.btn-success {
|
|
background: transparent !important;
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
justify-content: center !important;
|
|
}
|
|
|
|
.toggle-off.btn-secondary {
|
|
background: rgba(30, 27, 75, 0.6) !important;
|
|
color: #94a3b8 !important;
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
justify-content: center !important;
|
|
}
|
|
|
|
.custom-btn {
|
|
border-radius: 8px !important;
|
|
border: none !important;
|
|
padding: 0 16px !important;
|
|
height: 38px !important;
|
|
font-weight: 600 !important;
|
|
display: flex; align-items: center; gap: 6px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-search {
|
|
background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
|
|
color: white !important;
|
|
}
|
|
.btn-search:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
|
|
|
|
.btn-reset {
|
|
background: rgba(139, 92, 246, 0.1);
|
|
color: #c4b5fd !important;
|
|
}
|
|
.btn-reset:hover { background: rgba(139, 92, 246, 0.2); color: white !important; }
|
|
|
|
/* List Styling */
|
|
#list_div { display: flex; flex-direction: column; gap: 8px; }
|
|
|
|
.item-row {
|
|
background: rgba(49, 46, 129, 0.25);
|
|
border: 1px solid rgba(167, 139, 250, 0.1);
|
|
border-radius: 12px;
|
|
padding: 12px;
|
|
display: flex; gap: 15px;
|
|
transition: all 0.2s;
|
|
position: relative; overflow: hidden;
|
|
}
|
|
.item-row:hover {
|
|
background: rgba(49, 46, 129, 0.45);
|
|
border-color: rgba(167, 139, 250, 0.35);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.poster-container {
|
|
width: 100px; height: 140px; flex-shrink: 0; border-radius: 8px; overflow: hidden; position: relative;
|
|
background: #1e1b4b;
|
|
}
|
|
.poster-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
|
|
.item-row:hover .poster-img { transform: scale(1.05); }
|
|
|
|
.episode-badge {
|
|
position: absolute; top: 0; left: 0;
|
|
background: rgba(139, 92, 246, 0.9);
|
|
color: white;
|
|
font-size: 10px; font-weight: 800;
|
|
padding: 2px 6px;
|
|
border-bottom-right-radius: 6px;
|
|
box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
|
|
z-index: 5;
|
|
}
|
|
|
|
.info-container { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
|
|
|
|
.item-title {
|
|
font-size: 16px; font-weight: 700; color: #fff;
|
|
margin-bottom: 6px; line-height: 1.3;
|
|
overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
|
|
line-clamp: 1;
|
|
}
|
|
|
|
.item-meta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
|
|
.meta-program { font-size: 13px; color: #a78bfa; font-weight: 600; display: flex; align-items: center; gap: 4px; }
|
|
.meta-date { font-size: 12px; color: #94a3b8; }
|
|
|
|
.filename-text {
|
|
font-size: 11px; color: #94a3b8; background: rgba(0,0,0,0.2); padding: 5px 10px; border-radius: 6px;
|
|
word-break: break-all; margin-bottom: 12px;
|
|
border: 1px solid rgba(255,255,255,0.05);
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
.action-btn {
|
|
padding: 6px 14px; font-size: 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
|
|
background: rgba(255,255,255,0.05); color: #c4b5fd; white-space: nowrap;
|
|
display: flex; align-items: center; gap: 6px; transition: all 0.2s;
|
|
}
|
|
.action-btn:hover { background: rgba(139, 92, 246, 0.2); color: white; border-color: rgba(139, 92, 246, 0.4); }
|
|
.action-btn.btn-play { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; border: none; font-weight: 700; }
|
|
|
|
/* Modal Styling */
|
|
.modal-content {
|
|
background: #1e1b4b; border-radius: 16px; border: 1px solid rgba(167, 139, 250, 0.2);
|
|
}
|
|
.modal-header { border-bottom: 1px solid rgba(167, 139, 250, 0.1); }
|
|
.modal-title { color: #e0e7ff; }
|
|
|
|
.status-badge {
|
|
font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 50rem;
|
|
text-transform: uppercase; letter-spacing: 0.5px;
|
|
}
|
|
.status-completed { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
|
|
.status-downloading { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
|
|
.status-wait { background: rgba(148, 163, 184, 0.2); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
|
|
.status-fail { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
|
|
|
|
/* Checkbox Styling */
|
|
.custom-checkbox-worker {
|
|
width: 22px; height: 22px; cursor: pointer;
|
|
background: rgba(167, 139, 250, 0.1); border: 2px solid rgba(167, 139, 250, 0.3);
|
|
border-radius: 6px; position: relative; transition: all 0.2s;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.custom-checkbox-worker:hover { background: rgba(167, 139, 250, 0.2); }
|
|
.custom-checkbox-worker.checked { background: #8b5cf6; border-color: #8b5cf6; }
|
|
.custom-checkbox-worker.checked::after {
|
|
content: '\f00c'; font-family: 'FontAwesome'; color: white; font-size: 12px;
|
|
}
|
|
|
|
.all-select-container {
|
|
display: flex; align-items: center; gap: 8px; font-size: 13px; color: #94a3b8;
|
|
cursor: pointer; padding: 4px 10px; border-radius: 8px; transition: all 0.2s;
|
|
}
|
|
.all-select-container:hover { background: rgba(255,255,255,0.05); color: #fff; }
|
|
|
|
.btn-delete-selected {
|
|
background: rgba(239, 68, 68, 0.1);
|
|
color: #fca5a5 !important;
|
|
}
|
|
.btn-delete-selected:hover { background: rgba(239, 68, 68, 0.2); color: #fff !important; }
|
|
|
|
/* Smooth Load */
|
|
.content-cloak, #menu_page_div { opacity: 0; transition: opacity 0.5s ease-out; }
|
|
.content-cloak.visible, #menu_page_div.visible { opacity: 1; }
|
|
|
|
/* Mobile Responsive */
|
|
@media (max-width: 768px) {
|
|
body {
|
|
padding-top: 10px !important;
|
|
overflow-x: hidden !important;
|
|
}
|
|
ul.nav.nav-pills.bg-light {
|
|
margin-top: 50px !important;
|
|
margin-bottom: 10px !important;
|
|
width: 100% !important;
|
|
display: flex !important;
|
|
border-radius: 12px !important;
|
|
}
|
|
ul.nav.nav-pills .nav-link {
|
|
padding: 6px 12px !important;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* Search Container Mobile Fix */
|
|
.search-container {
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
padding: 10px !important;
|
|
margin: 0 !important;
|
|
width: 100% !important;
|
|
box-sizing: border-box !important;
|
|
}
|
|
.search-group-left, .search-group-right {
|
|
width: 100% !important;
|
|
min-width: unset !important;
|
|
flex-wrap: wrap !important;
|
|
gap: 6px !important;
|
|
}
|
|
.search-group-right {
|
|
justify-content: flex-start !important;
|
|
}
|
|
|
|
/* Button Size Reduction */
|
|
.search-group-right .btn {
|
|
padding: 6px 10px !important;
|
|
font-size: 12px !important;
|
|
}
|
|
.btn-reset {
|
|
padding: 6px 8px !important;
|
|
}
|
|
.btn-reset i + span,
|
|
.btn-reset::after {
|
|
display: none !important;
|
|
}
|
|
|
|
/* Content Overflow Prevention */
|
|
.content-cloak, #form_search, #list_div, .item-row {
|
|
width: 100% !important;
|
|
max-width: 100% !important;
|
|
box-sizing: border-box !important;
|
|
overflow-x: hidden !important;
|
|
}
|
|
|
|
/* Item Row Fixes */
|
|
.item-row {
|
|
padding: 8px !important;
|
|
margin: 4px 0 !important;
|
|
}
|
|
.info-container {
|
|
overflow: hidden !important;
|
|
}
|
|
.item-title, .filename-text, .meta-program {
|
|
white-space: nowrap !important;
|
|
overflow: hidden !important;
|
|
text-overflow: ellipsis !important;
|
|
max-width: 100% !important;
|
|
}
|
|
|
|
/* Toggle and Action Buttons */
|
|
.item-actions {
|
|
flex-wrap: wrap !important;
|
|
gap: 6px !important;
|
|
}
|
|
.action-btn {
|
|
padding: 4px 8px !important;
|
|
font-size: 11px !important;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
|
|
|
|
<div class="content-cloak">
|
|
<form id="form_search" class="form-inline" style="text-align:left; width:100%;">
|
|
<div class="search-container">
|
|
<div class="search-group-left">
|
|
<select id="order" name="order" class="form-control custom-select">
|
|
<option value="desc">최근순</option>
|
|
<option value="asc">오래된 순</option>
|
|
</select>
|
|
<select id="option" name="option" class="form-control custom-select">
|
|
<option value="all">전체</option>
|
|
<option value="completed">완료</option>
|
|
</select>
|
|
</div>
|
|
<div class="search-group-right">
|
|
<input id="search_word" name="search_word" class="form-control custom-input" type="text" placeholder="애니라이프 검색..." aria-label="Search">
|
|
<button id="search" class="btn custom-btn btn-search"><i class="fa fa-search"></i> 검색</button>
|
|
<button id="delete_selected_btn" class="btn custom-btn btn-delete-selected" style="display:none;"><i class="fa fa-trash"></i> 선택 삭제</button>
|
|
<button id="reset_btn" class="btn custom-btn btn-reset"><i class="fa fa-refresh"></i> 초기화</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="d-flex justify-content-start align-items:center mb-3 px-1">
|
|
<div class="d-flex align-items-center gap-2">
|
|
<input type="checkbox" id="all_check_box" data-toggle="toggle" data-on="전체 선택" data-off="전체 선택" data-onstyle="success" data-offstyle="secondary" data-size="small">
|
|
</div>
|
|
</div>
|
|
|
|
<div id='page1'></div>
|
|
<div id="list_div"></div>
|
|
<div id='page2'></div>
|
|
</div>
|
|
|
|
<!-- DB Reset Confirmation Modal -->
|
|
<div class="modal fade animate__animated animate__fadeIn" id="db_reset_modal" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
<div class="modal-content" style="border-color: rgba(239, 68, 68, 0.3);">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title font-weight-bold text-danger"><i class="fa fa-trash mr-2"></i> DB 초기화 확인</h5>
|
|
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
|
</div>
|
|
<div class="modal-body text-center py-4">
|
|
<p class="mb-0" style="font-size: 1.1rem; color: #fecaca;">정말로 **모든** 다운로드 목록을 삭제하시겠습니까?</p>
|
|
<small class="text-muted">이 작업은 DB의 모든 기록을 삭제하며 복구할 수 없습니다.</small>
|
|
</div>
|
|
<div class="modal-footer" style="border-top: 1px solid rgba(167, 139, 250, 0.1);">
|
|
<button type="button" class="btn btn-secondary custom-btn" data-dismiss="modal" style="background: rgba(255,255,255,0.1); border: none;">취소</button>
|
|
<button type="button" id="confirm_db_reset_btn" class="btn btn-danger custom-btn" style="background: linear-gradient(135deg, #ef4444, #b91c1c); border: none;">전체 삭제 실행</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Delete Confirmation Modal -->
|
|
<div class="modal fade animate__animated animate__fadeIn" id="delete_modal" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title font-weight-bold"><i class="fa fa-warning text-warning mr-2"></i> 삭제 확인</h5>
|
|
<button type="button" class="close text-white" data-dismiss="modal"><span>×</span></button>
|
|
</div>
|
|
<div class="modal-body text-center py-4">
|
|
<p id="delete_modal_body_text" class="mb-0" style="font-size: 1.1rem; color: #cbd5e1;">정말로 이 항목을 삭제하시겠습니까?</p>
|
|
<small class="text-muted">이 작업은 되돌릴 수 없으며 원본 파일은 삭제되지 않습니다.</small>
|
|
</div>
|
|
<div class="modal-footer" style="border-top: 1px solid rgba(167, 139, 250, 0.1);">
|
|
<button type="button" class="btn btn-secondary custom-btn" data-dismiss="modal" style="background: rgba(255,255,255,0.1); border: none;">취소</button>
|
|
<button type="button" id="confirm_delete_btn" class="btn btn-danger custom-btn" style="background: linear-gradient(135deg, #ef4444, #dc2626); border: none;">삭제 실행</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="{{ url_for('.static', filename='js/sjva_global1.js') }}"></script>
|
|
<script src="{{ url_for('.static', filename='js/sjva_ui14.js') }}"></script>
|
|
|
|
<script type="text/javascript">
|
|
var package_name = "{{arg['package_name']}}";
|
|
var sub = "{{arg['sub']}}";
|
|
var current_data = null;
|
|
|
|
$(document).ready(function(){
|
|
setTimeout(function() { $('.content-cloak, #menu_page_div').addClass('visible'); }, 100);
|
|
global_sub_request_search('1');
|
|
});
|
|
|
|
function global_sub_request_search(page, move_top = true) {
|
|
var formData = get_formdata('#form_search')
|
|
formData += '&page=' + page;
|
|
$.ajax({
|
|
url: '/' + package_name + '/ajax/' + sub + '/web_list',
|
|
type: "POST",
|
|
cache: false,
|
|
data: formData,
|
|
dataType: "json",
|
|
success: function (data) {
|
|
current_data = data;
|
|
if (move_top) window.scrollTo(0,0);
|
|
make_list(data.list);
|
|
make_page_html(data.paging);
|
|
$('#all_check_box').bootstrapToggle('off');
|
|
update_batch_btn();
|
|
}
|
|
});
|
|
}
|
|
|
|
$("#search").click(function (e) {
|
|
e.preventDefault();
|
|
global_sub_request_search('1');
|
|
});
|
|
|
|
$("body").on('click', '#page', function (e) {
|
|
e.preventDefault();
|
|
global_sub_request_search($(this).data('page'));
|
|
});
|
|
|
|
$("#reset_btn").click(function (e) {
|
|
e.preventDefault();
|
|
// search_reset 기능 (필터 초기화)
|
|
$('#order').val('desc');
|
|
$('#option').val('all');
|
|
$('#search_word').val('');
|
|
global_sub_request_search('1');
|
|
|
|
// 사용자 요청에 따라 '초기화' 버튼이 DB 전체 삭제 기능도 포함하도록 모달 띄움
|
|
$('#db_reset_modal').modal('show');
|
|
});
|
|
|
|
$('#confirm_db_reset_btn').click(function(e) {
|
|
e.preventDefault();
|
|
$('#db_reset_modal').modal('hide');
|
|
$.ajax({
|
|
url: '/' + package_name + '/ajax/' + sub + '/db_delete',
|
|
type: "POST",
|
|
cache: false,
|
|
data: {day: 'all'},
|
|
dataType: "json",
|
|
success: function (data) {
|
|
if (data) {
|
|
$.notify('DB를 초기화하였습니다.', {type: 'success'});
|
|
global_sub_request_search('1');
|
|
} else {
|
|
$.notify('초기화 실패', {type: 'warning'});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
function make_list(data) {
|
|
str = '';
|
|
for (i in data) {
|
|
str += '<div class="item-row animate__animated animate__fadeInUp" style="animation-delay: ' + (i * 0.05) + 's;">';
|
|
|
|
// Poster
|
|
str += '<div class="poster-container">';
|
|
if (data[i].image_link) {
|
|
// Use proxy to bypass Referer restriction
|
|
var proxy_url = '/' + package_name + '/ajax/' + sub + '/proxy_image?url=' + encodeURIComponent(data[i].image_link);
|
|
str += '<img src="' + proxy_url + '" class="poster-img" loading="lazy" onerror="this.src=\'https://placehold.co/100x140?text=No+Image\'">';
|
|
}
|
|
str += '<div class="episode-badge">' + (data[i].episode_no || '?') + '화</div>';
|
|
str += '</div>';
|
|
|
|
// Info
|
|
str += '<div class="info-container">';
|
|
str += '<div class="item-title-row" style="display:flex; justify-content:space-between; align-items:center;">';
|
|
// Use episode_title if available, fallback to title
|
|
var display_title = data[i].episode_title || data[i].title;
|
|
str += '<div class="item-title" title="' + display_title + '">' + display_title + '</div>';
|
|
|
|
var status_cls = 'status-wait';
|
|
var status_kor = '대기';
|
|
if (data[i].status == 'completed') { status_cls = 'status-completed'; status_kor = '완료'; }
|
|
else if (data[i].status == 'downloading') { status_cls = 'status-downloading'; status_kor = '다운로드 중'; }
|
|
else if (data[i].status == 'fail') { status_cls = 'status-fail'; status_kor = '실패'; }
|
|
|
|
str += '<span class="status-badge ' + status_cls + '">' + status_kor + '</span>';
|
|
str += '</div>';
|
|
|
|
str += '<div class="item-meta-row">';
|
|
// Show Series Title from content_title or title
|
|
var series_title = data[i].content_title || data[i].title;
|
|
str += '<span class="meta-program" title="' + series_title + '"><i class="fa fa-tv"></i> ' + series_title + '</span>';
|
|
str += '<span class="meta-date"><i class="fa fa-clock-o"></i> ' + data[i].created_time + '</span>';
|
|
str += '</div>';
|
|
|
|
str += '<div class="filename-text" title="' + data[i].filename + '">';
|
|
str += '<i class="fa fa-file-movie-o mr-1"></i> ' + (data[i].filename || '파일명 생성 전');
|
|
str += '</div>';
|
|
|
|
// Actions
|
|
str += '<div class="item-actions">';
|
|
str += '<input type="checkbox" class="item-check-box" data-id="' + data[i].id + '" data-toggle="toggle" data-on="선택" data-off="-" data-onstyle="success" data-offstyle="secondary" data-size="small">';
|
|
if (data[i].status == 'completed') {
|
|
str += '<button id="merge_subtitle_btn" class="action-btn" data-id="' + data[i].id + '"><i class="fa fa-file-text-o"></i> 자막합침</button>';
|
|
}
|
|
str += '<button id="remove_btn" class="action-btn" data-id="' + data[i].id + '"><i class="fa fa-trash"></i> 삭제</button>';
|
|
str += '</div>';
|
|
|
|
str += '</div>'; // End Info
|
|
str += '</div>'; // End Row
|
|
}
|
|
if (str == '') str = '<div class="text-center p-5"><h4>결과가 없습니다.</h4></div>';
|
|
$("#list_div").html(str);
|
|
$('.item-check-box').bootstrapToggle();
|
|
}
|
|
|
|
var delete_id = null;
|
|
$("body").on('click', '#remove_btn', function (e) {
|
|
e.preventDefault();
|
|
delete_id = $(this).data('id');
|
|
$('#delete_modal_body_text').html('정말로 이 항목을 삭제하시겠습니까?');
|
|
$('#delete_modal').modal('show');
|
|
});
|
|
|
|
// Batch Selection Logic (Bootstrap Toggle)
|
|
$("body").on('change', '.item-check-box', function(e) {
|
|
update_batch_btn();
|
|
});
|
|
|
|
$('#all_check_box').change(function() {
|
|
var is_checked = $(this).prop('checked');
|
|
$('.item-check-box').bootstrapToggle(is_checked ? 'on' : 'off');
|
|
update_batch_btn();
|
|
});
|
|
|
|
function update_batch_btn() {
|
|
var count = $('.item-check-box:checked').length;
|
|
if (count > 0) {
|
|
$('#delete_selected_btn').show().html('<i class="fa fa-trash"></i> 선택 삭제 (' + count + ')');
|
|
} else {
|
|
$('#delete_selected_btn').hide();
|
|
}
|
|
}
|
|
|
|
$("#delete_selected_btn").click(function(e) {
|
|
e.preventDefault();
|
|
var ids = [];
|
|
$('.item-check-box:checked').each(function() {
|
|
ids.push($(this).data('id'));
|
|
});
|
|
|
|
if (ids.length > 0) {
|
|
delete_id = ids.join(',');
|
|
$('#delete_modal_body_text').html('선택한 <b>' + ids.length + '개</b>의 항목을 정말로 삭제하시겠습니까?');
|
|
$('#delete_modal').modal('show');
|
|
}
|
|
});
|
|
|
|
$('#confirm_delete_btn').click(function(e) {
|
|
e.preventDefault();
|
|
$('#delete_modal').modal('hide');
|
|
|
|
$.ajax({
|
|
url: '/' + package_name + '/ajax/' + sub + '/db_delete_item',
|
|
type: "POST",
|
|
cache: false,
|
|
data: {db_id: delete_id},
|
|
dataType: "json",
|
|
success: function (ret) {
|
|
if (ret) {
|
|
$.notify('삭제하였습니다.', {type: 'success'});
|
|
$('#all_check_box').bootstrapToggle('off');
|
|
update_batch_btn();
|
|
global_sub_request_search(current_data.paging.current_page, false);
|
|
} else {
|
|
$.notify('삭제 실패', {type: 'warning'});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$("body").on('click', '#merge_subtitle_btn', function (e) {
|
|
e.preventDefault();
|
|
var id = $(this).data('id');
|
|
$.ajax({
|
|
url: '/' + package_name + '/ajax/' + sub + '/command',
|
|
type: "POST",
|
|
cache: false,
|
|
data: {command: 'merge_subtitle', arg1: id},
|
|
dataType: "json",
|
|
success: function (data) {
|
|
if (data.ret == 'success') {
|
|
$.notify('자막 합성이 백그라운드로 시작되었습니다.', {type: 'success'});
|
|
} else {
|
|
$.notify('작업 실패: ' + data.log, {type: 'warning'});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
{% endblock %} |