인프런 업로드

This commit is contained in:
2022-05-13 20:24:03 +09:00
parent 8352abf485
commit 9b39921a1a
13 changed files with 2272 additions and 1410 deletions

View File

@@ -0,0 +1,201 @@
button.code-button {
min-width: 82px !important;
}
.tooltip {
position: relative;
display: block;
}
[data-tooltip-text]:hover {
position: relative;
}
[data-tooltip-text]:after {
-webkit-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
-moz-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
background-color: rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
-moz-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
color: #ffffff;
font-size: 12px;
margin-bottom: 10px;
padding: 7px 12px;
position: absolute;
width: auto;
min-width: 50px;
max-width: 300px;
word-wrap: break-word;
z-index: 9999;
opacity: 0;
left: -9999px;
top: 90%;
content: attr(data-tooltip-text);
}
[data-tooltip-text]:hover:after {
top: 230%;
left: 0;
opacity: 1;
}
[data-tooltip-text]:hover {
position: relative;
}
[data-tooltip-text]:after {
-webkit-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
-moz-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
background-color: rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
-moz-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
color: #ffffff;
font-size: 12px;
margin-bottom: 10px;
padding: 7px 12px;
position: absolute;
width: auto;
min-width: 50px;
max-width: 300px;
word-wrap: break-word;
z-index: 9999;
opacity: 0;
left: -9999px;
top: -210% !important;
content: attr(data-tooltip-text);
}
[data-tooltip-text]:hover:after {
top: 130%;
left: 0;
opacity: 1;
}
#airing_list {
display: none;
}
.cut-text {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100%;
}
@media (min-width: 576px) {
.container {
max-width: 100%;
}
}
#screen_movie_list {
margin-top: 10px;
}
/* .spinner {*/
/* width: 40px;*/
/* height: 40px;*/
/* background-color: #333;*/
/* margin: 100px auto;*/
/* -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;*/
/* animation: sk-rotateplane 1.2s infinite ease-in-out;*/
/*}*/
/*@-webkit-keyframes sk-rotateplane {*/
/* 0% { -webkit-transform: perspective(120px) }*/
/* 50% { -webkit-transform: perspective(120px) rotateY(180deg) }*/
/* 100% { -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg) }*/
/*}*/
/*@keyframes sk-rotateplane {*/
/* 0% {*/
/* transform: perspective(120px) rotateX(0deg) rotateY(0deg);*/
/* -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)*/
/* } 50% {*/
/* transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);*/
/* -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)*/
/* } 100% {*/
/* transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);*/
/* -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);*/
/* }*/
/*}*/
.spinner {
width: 40px;
height: 40px;
position: relative;
margin: 100px auto;
}
.double-bounce1,
.double-bounce2 {
width: 100%;
height: 100%;
border-radius: 50%;
background-color: #333;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
-webkit-animation: sk-bounce 2s infinite ease-in-out;
animation: sk-bounce 2s infinite ease-in-out;
}
.double-bounce2 {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
@-webkit-keyframes sk-bounce {
0%,
100% {
-webkit-transform: scale(0);
}
50% {
-webkit-transform: scale(1);
}
}
@keyframes sk-bounce {
0%,
100% {
transform: scale(0);
-webkit-transform: scale(0);
}
50% {
transform: scale(1);
-webkit-transform: scale(1);
}
}
.badge-on-image {
position: absolute;
top: 2px;
/*bottom: 2px; !* position where you want it *!*/
right: 2px;
padding: 5px 12px;
}

File diff suppressed because it is too large Load Diff

399
static/js/inflearn_excel.js Executable file
View File

@@ -0,0 +1,399 @@
let current_data = "";
let current_airing_data = "";
let code = "";
let div_visible = false;
let total_page = "";
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
// console.log('current_airing_data', current_airing_data);
const get_excel_list = () => {
$.ajax({
url: "/" + package_name + "/ajax/excel_list",
type: "GET",
cache: false,
dataType: "json",
success: (ret) => {
if (ret.ret == "success" && ret.data != null) {
current_airing_data = ret;
total_page = ret.total_page;
console.log(ret)
if (current_airing_data !== "") {
make_airing_list(ret);
div_visible = true;
// console.log(div_visible)
}
} else {
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
};
$(document).on("click", "button.code-button", function (e) {
e.preventDefault();
// console.log('click')
// console.log('code to click:' + $(this).data("code"))
document.getElementById("code").value = $(this).data("code");
$("#code").val($(this).data("code"));
$("#airing_list").toggle();
code = document.getElementById("code").value;
document.getElementById("analysis_btn").click();
});
$(".code-button").tooltip();
$("body").on("click", "#go_inflearn_btn", function (e) {
e.preventDefault();
window.open(inflearn_url, "_blank");
});
function make_airing_list(data) {
let str = "";
let tmp = "";
tmp =
'<div id="exModal" class="form-inline" role="dialog" aria-hidden="true">';
tmp += "</div>";
str += m_hr_black();
// {#str += m_row_start(0);#}
// {##}
// {#str += m_row_end();#}
// {#str += m_hr_black();#}
str +=
'<div id="inner_airing" class="d-flex align-content-between flex-wrapd-flex align-content-between flex-wrap">';
for (i in data.episode) {
// {#str += m_row_start();#}
// {#tmp = '<div class="col-sm"><strong>' + data.episode[i].title+ '</strong>';#}
//
// {#tmp += '<br />'#}
// {#tmp += '' + data.episode[i].code + '</div>';#}
// {#str += m_col(12, tmp)#}
tmp =
'<div class="mx-1 mb-1"><button id="code_button" data-code="' +
data.episode[i].code +
'" type="button" class="btn btn-primary code-button bootstrap-tooltip" data-toggle="button" data-tooltip="true" aria-pressed="true" autocomplete="off" data-placement="top">' +
'<span data-tooltip-text="' +
data.episode[i].title +
'">' +
data.episode[i].code +
"</span></button></div>";
// {#if (i === 10) {#}
// {# tmp += '<div class="w-100"></div>'#}
str += tmp;
}
str += "</div>";
str += m_hr_black();
document.getElementById("airing_list").innerHTML = str;
}
function make_program(data) {
current_data = data;
// console.log('current_data:: ', data)
str = "";
tmp = '<div class="form-inline w-100">';
tmp += m_button("check_download_btn", "선택 다운로드 추가", []);
tmp += m_button("all_check_on_btn", "전체 선택", []);
tmp += m_button("all_check_off_btn", "전체 해제", []);
tmp +=
'&nbsp;&nbsp;&nbsp;<input id="new_title" name="new_title" class="form-control form-control-sm" value="' +
data.title +
'">';
tmp += "</div>";
tmp += '<div class="form-inline">';
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
// tmp +=
// '&nbsp;&nbsp;&nbsp;<input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
// data.season +
// '">';
// tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
// tmp += m_button("search_tvdb_btn", "TVDB", []);
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
tmp += "</div>";
tmp = m_button_group(tmp);
str += tmp;
// program
str += m_hr_black();
str += m_row_start(0);
tmp = "";
if (data.poster_url != null)
tmp = '<img src="' + data.poster_url + '" class="img-fluid">';
str += m_col(3, tmp);
tmp = "";
tmp += m_row_start(0);
tmp += m_col(3, "제목", "right");
tmp += m_col(9, data.title);
tmp += m_row_end();
tmp += m_row_start(0);
tmp += m_col(3, "시즌", "right");
tmp += m_col(9, data.season);
tmp += m_row_end();
for (i in data.detail) {
tmp += m_row_start(0);
key = Object.keys(data.detail[i])[0];
value = data.detail[i][key];
tmp += m_col(3, key, "right");
tmp += m_col(9, value);
tmp += m_row_end();
}
str += m_col(9, tmp);
str += m_row_end();
str += m_hr_black();
for (i in data.episode) {
str += m_row_start();
// tmp = '<img src="' + data.episode[i].image + '" class="img-fluid">'
// str += m_col(3, tmp)
tmp = "<strong>" + data.episode[i].title + "</strong>";
tmp += "<br>";
tmp += data.episode[i].filename + "<br><p></p>";
tmp += '<div class="form-inline">';
tmp +=
'<input id="checkbox_' +
data.episode[i].code +
'" name="checkbox_' +
data.episode[i].code +
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small">&nbsp;&nbsp;&nbsp;&nbsp;';
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
tmp += m_button("add_download", "다운로드 추가", [
{key: "idx", value: i},
]);
tmp += "</div>";
str += m_col(12, tmp);
str += m_row_end();
if (i != data.length - 1) str += m_hr(0);
}
document.getElementById("episode_list").innerHTML = str;
$('input[id^="checkbox_"]').bootstrapToggle();
}
$("body").on("click", "#all_check_on_btn", function (e) {
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("on");
});
$("body").on("click", "#all_check_off_btn", function (e) {
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("off");
});
$("body").on("click", "#search_tvdb_btn", function (e) {
e.preventDefault();
new_title = document.getElementById("new_title").value;
url = "https://www.thetvdb.com/search?query=" + new_title;
window.open(url, "_blank");
});
$("body").on("click", "#add_whitelist", function (e) {
e.preventDefault();
$.ajax({
url: "/" + package_name + "/ajax/add_whitelist",
type: "POST",
cache: false,
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>추가하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#apply_new_title_btn", function (e) {
e.preventDefault();
new_title = document.getElementById("new_title").value;
$.ajax({
url: "/" + package_name + "/ajax/apply_new_title",
type: "POST",
cache: false,
data: {new_title: new_title},
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
// console.log(ret)
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#apply_new_season_btn", function (e) {
e.preventDefault();
new_season = document.getElementById("new_season").value;
if ($.isNumeric(new_season) == false) {
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
type: "warning",
});
} else {
$.ajax({
url: "/" + package_name + "/ajax/apply_new_season",
type: "POST",
cache: false,
data: {new_season: new_season},
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
}
});
// 하나씩 다운로드 추가
$("body").on("click", "#add_download", function (e) {
e.preventDefault();
// code = $(this).data('code');
code = current_data.episode[$(this).data("idx")].code;
// console.log('code:: ', code)
let data = current_data.episode[$(this).data("idx")];
// console.log('data:: ', data)
$.ajax({
url: "/" + package_name + "/ajax/add_download",
type: "POST",
cache: false,
data: {code: code, data: JSON.stringify(data)},
dataType: "json",
success: function (data) {
// console.log('#add_queue_btn::data >>', data)
if (data.ret === "enqueue_db_append") {
$.notify("<strong>다운로드 작업을 추가 하였습니다.</strong>", {
type: "success",
});
} else if (data.ret === "enqueue_db_exist") {
$.notify("<strong>DB에 존재하는 에피소드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "db_completed") {
$.notify("<strong>DB에 완료 기록이 있습니다.</strong>", {
type: "warning",
});
} else if (data.ret === "fail") {
$.notify("<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>", {
type: "warning",
});
} else if (data.ret === "no_data") {
$.notify("<strong>잘못된 코드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "Debugging") {
$.notify("<strong>Debugging</strong>", {
type: "warning",
});
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#check_download_btn", function (e) {
e.preventDefault();
all = $('input[id^="checkbox_"]');
str = "";
for (i in all) {
if (all[i].checked) {
code = all[i].id.split("_")[1];
str += code + ",";
}
}
if (str == "") {
$.notify("<strong>선택하세요.</strong>", {
type: "warning",
});
return;
}
$.ajax({
url: "/" + package_name + "/ajax/add_queue_checked_list",
type: "POST",
cache: false,
data: {code: str},
dataType: "json",
success: function (data) {
if (data.ret == "success") {
$.notify("<strong>" + data.log + "개를 추가하였습니다.</strong>", {
type: "success",
});
} else {
$.notify("<strong>" + data.log + "</strong>", {
type: "warning",
});
}
},
});
});
$("#go_modal_airing").on("shown.bs.modal", function () {
// {#get_airing_list()#}
$("#exModal").trigger("focus");
});
$("#go_modal_airing").click(function (e) {
e.preventDefault();
// console.log('open modal')
$("#exModal").bootstrapToggle();
if (current_airing_data === "") {
get_airing_list();
}
$("#inner_airing").toggle();
$("#airing_list").toggle();
});
$("#go_modal_airing").attr("class", "btn btn-primary");
// {#$(function () {#}
// {# $('[data-tooltip="true"]').tooltip()#}
// {#});#}
// <!--{#-->
// <!--<script src="https://unpkg.com/@popperjs/core@2"></script>-->
// <!--#} {#-->
// <!--<script src="https://unpkg.com/tippy.js@6"></script>-->
// <!--#} {#-->
// <!--<script>-->
// <!-- // #}-->
// <!-- // {# tippy('.code-button',#}-->
// <!-- // {# { content: 'aaaa', // tooltip 내용#}-->
// <!-- // {# placement: 'top', // 상단 위치#}-->
// <!-- // {# trigger: 'hover', // :hover가 아닌 click시 노출#}-->
// <!-- // {# hideOnClick : 'toggle', // click시, toggle() 액션#}-->
// <!-- // {# animation: 'shift-away' // 아래에서 위로 올라오며 등장#}-->
// <!-- // {# })#}-->
// <!-- // {##}-->
// <!-- // {##}-->
// <!-- // {#-->
// <!--</script>-->
// <!--#}--

View File

@@ -5,428 +5,423 @@ let div_visible = false;
let total_page = "";
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
get: (searchParams, prop) => searchParams.get(prop),
});
// console.log('current_airing_data', current_airing_data);
const get_airing_list = () => {
$.ajax({
url: "/" + package_name + "/ajax/airing_list",
type: "GET",
cache: false,
dataType: "json",
success: (ret) => {
if (ret.ret == "success" && ret.episode != null) {
current_airing_data = ret;
total_page = ret.total_page;
// console.log(ret)
if (current_airing_data !== "") {
make_airing_list(ret);
div_visible = true;
// console.log(div_visible)
}
} else {
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
if (div_visible) {
// {#$('#airing_list').toggle()#}
}
};
// const get_airing_list = () => {
// $.ajax({
// url: "/" + package_name + "/ajax/airing_list",
// type: "GET",
// cache: false,
// dataType: "json",
// success: (ret) => {
// if (ret.ret == "success" && ret.episode != null) {
// current_airing_data = ret;
// total_page = ret.total_page;
// // console.log(ret)
// if (current_airing_data !== "") {
// make_airing_list(ret);
// div_visible = true;
// // console.log(div_visible)
// }
// } else {
// $.notify("<strong>분석 실패</strong><br>" + ret.log, {
// type: "warning",
// });
// }
// },
// });
//
// if (div_visible) {
// // {#$('#airing_list').toggle()#}
// }
// };
// console.log(div_visible)
$(document).on("click", "button.code-button", function (e) {
e.preventDefault();
// console.log('click')
// console.log('code to click:' + $(this).data("code"))
document.getElementById("code").value = $(this).data("code");
$("#code").val($(this).data("code"));
$("#airing_list").toggle();
code = document.getElementById("code").value;
document.getElementById("analysis_btn").click();
e.preventDefault();
// console.log('click')
// console.log('code to click:' + $(this).data("code"))
document.getElementById("code").value = $(this).data("code");
$("#code").val($(this).data("code"));
$("#airing_list").toggle();
code = document.getElementById("code").value;
document.getElementById("analysis_btn").click();
});
$(".code-button").tooltip();
$("body").on("click", "#analysis_btn", function (e) {
e.preventDefault();
if (document.getElementById("code").value !== "") {
code = document.getElementById("code").value;
}
// console.log('#analysis_btn >>> code::', code)
if (code === "") {
console.log("code 값을 입력해주세요.");
$.notify("<strong>code 값을 입력해주세요.</strong><br>");
return;
}
$.ajax({
url: "/" + package_name + "/ajax/analysis",
type: "POST",
cache: false,
data: { code: code },
dataType: "json",
success: function (ret) {
if (ret.ret == "success" && ret.data != null) {
make_program(ret.data);
} else {
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
type: "warning",
e.preventDefault();
if (document.getElementById("code").value !== "") {
code = document.getElementById("code").value;
}
// console.log('#analysis_btn >>> code::', code)
if (code === "") {
console.log("code 값을 입력해주세요.");
$.notify("<strong>code 값을 입력해주세요.</strong><br>");
return;
}
if (current_data === "" || current_data.data.code !== code) {
$.ajax({
url: "/" + package_name + "/ajax/analysis",
type: "POST",
cache: false,
data: {code: code},
dataType: "json",
success: function (ret) {
if (ret.ret == "success" && ret.data != null) {
console.log(ret)
// console.log('분석: %s', ret)
make_program(ret.data);
run_time = Math.floor(new Date().getTime() / 1000)
current_data = ret
} else {
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
}
},
});
} else {
console.log('과도한 사이트 조회 금지')
}
});
$("body").on("click", "#go_inflearn_btn", function (e) {
e.preventDefault();
window.open(inflearn_url, "_blank");
e.preventDefault();
window.open(inflearn_url, "_blank");
});
function make_airing_list(data) {
let str = "";
let tmp = "";
let str = "";
let tmp = "";
tmp =
'<div id="exModal" class="form-inline" role="dialog" aria-hidden="true">';
tmp += "</div>";
str += m_hr_black();
// {#str += m_row_start(0);#}
// {##}
// {#str += m_row_end();#}
// {#str += m_hr_black();#}
str +=
'<div id="inner_airing" class="d-flex align-content-between flex-wrapd-flex align-content-between flex-wrap">';
for (i in data.episode) {
// {#str += m_row_start();#}
// {#tmp = '<div class="col-sm"><strong>' + data.episode[i].title+ '</strong>';#}
//
// {#tmp += '<br />'#}
// {#tmp += '' + data.episode[i].code + '</div>';#}
// {#str += m_col(12, tmp)#}
tmp =
'<div class="mx-1 mb-1"><button id="code_button" data-code="' +
data.episode[i].code +
'" type="button" class="btn btn-primary code-button bootstrap-tooltip" data-toggle="button" data-tooltip="true" aria-pressed="true" autocomplete="off" data-placement="top">' +
'<span data-tooltip-text="' +
data.episode[i].title +
'">' +
data.episode[i].code +
"</span></button></div>";
// {#if (i === 10) {#}
// {# tmp += '<div class="w-100"></div>'#}
str += tmp;
}
str += "</div>";
str += m_hr_black();
'<div id="exModal" class="form-inline" role="dialog" aria-hidden="true">';
tmp += "</div>";
str += m_hr_black();
// {#str += m_row_start(0);#}
// {##}
// {#str += m_row_end();#}
// {#str += m_hr_black();#}
str +=
'<div id="inner_airing" class="d-flex align-content-between flex-wrapd-flex align-content-between flex-wrap">';
for (i in data.episode) {
// {#str += m_row_start();#}
// {#tmp = '<div class="col-sm"><strong>' + data.episode[i].title+ '</strong>';#}
//
// {#tmp += '<br />'#}
// {#tmp += '' + data.episode[i].code + '</div>';#}
// {#str += m_col(12, tmp)#}
tmp =
'<div class="mx-1 mb-1"><button id="code_button" data-code="' +
data.episode[i].code +
'" type="button" class="btn btn-primary code-button bootstrap-tooltip" data-toggle="button" data-tooltip="true" aria-pressed="true" autocomplete="off" data-placement="top">' +
'<span data-tooltip-text="' +
data.episode[i].title +
'">' +
data.episode[i].code +
"</span></button></div>";
// {#if (i === 10) {#}
// {# tmp += '<div class="w-100"></div>'#}
str += tmp;
}
str += "</div>";
str += m_hr_black();
document.getElementById("airing_list").innerHTML = str;
document.getElementById("airing_list").innerHTML = str;
}
function make_program(data) {
current_data = data;
// console.log('current_data:: ', data)
str = "";
tmp = '<div class="form-inline w-100">';
tmp += m_button("check_download_btn", "선택 다운로드 추가", []);
tmp += m_button("all_check_on_btn", "전체 선택", []);
tmp += m_button("all_check_off_btn", "전체 해제", []);
tmp +=
'&nbsp;&nbsp;&nbsp;<input id="new_title" name="new_title" class="form-control form-control-sm" value="' +
data.title +
'">';
tmp += "</div>";
tmp += '<div class="form-inline">';
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
tmp +=
'&nbsp;&nbsp;&nbsp;<input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
data.season +
'">';
tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
tmp += m_button("search_tvdb_btn", "TVDB", []);
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
tmp += "</div>";
tmp = m_button_group(tmp);
str += tmp;
// program
str += m_hr_black();
str += m_row_start(0);
tmp = "";
if (data.poster_url != null)
tmp = '<img src="' + data.poster_url + '" class="img-fluid">';
str += m_col(3, tmp);
tmp = "";
tmp += m_row_start(0);
tmp += m_col(3, "제목", "right");
tmp += m_col(9, data.title);
tmp += m_row_end();
tmp += m_row_start(0);
tmp += m_col(3, "시즌", "right");
tmp += m_col(9, data.season);
tmp += m_row_end();
for (i in data.detail) {
tmp += m_row_start(0);
key = Object.keys(data.detail[i])[0];
value = data.detail[i][key];
tmp += m_col(3, key, "right");
tmp += m_col(9, value);
tmp += m_row_end();
}
str += m_col(9, tmp);
str += m_row_end();
str += m_hr_black();
for (i in data.episode) {
str += m_row_start();
// tmp = '<img src="' + data.episode[i].image + '" class="img-fluid">'
// str += m_col(3, tmp)
tmp = "<strong>" + data.episode[i].title + "</strong>";
tmp += "<br>";
tmp += data.episode[i].filename + "<br><p></p>";
tmp += '<div class="form-inline">';
current_data = data;
// console.log('current_data:: ', data)
str = "";
tmp = '<div class="form-inline w-100">';
tmp += m_button("check_download_btn", "선택 다운로드 추가", []);
tmp += m_button("all_check_on_btn", "전체 선택", []);
tmp += m_button("all_check_off_btn", "전체 해제", []);
tmp +=
'<input id="checkbox_' +
data.episode[i].code +
'" name="checkbox_' +
data.episode[i].code +
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small">&nbsp;&nbsp;&nbsp;&nbsp;';
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
tmp += m_button("add_queue_btn", "다운로드 추가", [
{ key: "idx", value: i },
]);
'&nbsp;&nbsp;&nbsp;<input id="new_title" name="new_title" class="form-control form-control-sm" value="' +
data.title +
'">';
tmp += "</div>";
str += m_col(12, tmp);
tmp += '<div class="form-inline">';
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
// tmp +=
// '&nbsp;&nbsp;&nbsp;<input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
// data.season +
// '">';
// tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
// tmp += m_button("search_tvdb_btn", "TVDB", []);
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
tmp += "</div>";
tmp = m_button_group(tmp);
str += tmp;
// program
str += m_hr_black();
str += m_row_start(0);
tmp = "";
if (data.poster_url != null)
tmp = '<img src="' + data.poster_url + '" class="img-fluid">';
str += m_col(3, tmp);
tmp = "";
tmp += m_row_start(0);
tmp += m_col(3, "제목", "right");
tmp += m_col(9, data.title);
tmp += m_row_end();
tmp += m_row_start(0);
tmp += m_col(3, "시즌", "right");
tmp += m_col(9, data.season);
tmp += m_row_end();
for (i in data.detail) {
tmp += m_row_start(0);
key = Object.keys(data.detail[i])[0];
value = data.detail[i][key];
tmp += m_col(3, key, "right");
tmp += m_col(9, value);
tmp += m_row_end();
}
str += m_col(9, tmp);
str += m_row_end();
if (i != data.length - 1) str += m_hr(0);
}
document.getElementById("episode_list").innerHTML = str;
$('input[id^="checkbox_"]').bootstrapToggle();
str += m_hr_black();
for (i in data.episode) {
str += m_row_start();
// tmp = '<img src="' + data.episode[i].image + '" class="img-fluid">'
// str += m_col(3, tmp)
tmp = "<strong>" + data.episode[i].title + "</strong>";
tmp += "<br>";
tmp += data.episode[i].filename + "<br><p></p>";
tmp += '<div class="form-inline">';
tmp +=
'<input id="checkbox_' +
data.episode[i].data_id +
'" name="checkbox_' +
data.episode[i].data_id +
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small">&nbsp;&nbsp;&nbsp;&nbsp;';
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
tmp += m_button("add_download", "다운로드 추가", [
{key: "idx", value: i},
]);
tmp += "</div>";
str += m_col(12, tmp);
str += m_row_end();
if (i != data.length - 1) str += m_hr(0);
}
document.getElementById("episode_list").innerHTML = str;
$('input[id^="checkbox_"]').bootstrapToggle();
}
$("body").on("click", "#all_check_on_btn", function (e) {
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("on");
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("on");
});
$("body").on("click", "#all_check_off_btn", function (e) {
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("off");
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle("off");
});
$("body").on("click", "#search_tvdb_btn", function (e) {
e.preventDefault();
new_title = document.getElementById("new_title").value;
url = "https://www.thetvdb.com/search?query=" + new_title;
window.open(url, "_blank");
e.preventDefault();
const new_title = document.getElementById("new_title").value;
let url = "https://www.thetvdb.com/search?query=" + new_title;
window.open(url, "_blank");
});
$("body").on("click", "#add_whitelist", function (e) {
e.preventDefault();
$.ajax({
url: "/" + package_name + "/ajax/add_whitelist",
type: "POST",
cache: false,
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>추가하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
e.preventDefault();
$.ajax({
url: "/" + package_name + "/ajax/add_whitelist",
type: "POST",
cache: false,
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>추가하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#apply_new_title_btn", function (e) {
e.preventDefault();
new_title = document.getElementById("new_title").value;
$.ajax({
url: "/" + package_name + "/ajax/apply_new_title",
type: "POST",
cache: false,
data: { new_title: new_title },
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
// console.log(ret)
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
e.preventDefault();
const new_title = document.getElementById("new_title").value;
$.ajax({
url: "/" + package_name + "/ajax/apply_new_title",
type: "POST",
cache: false,
data: {new_title: new_title},
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
// console.log(ret)
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#apply_new_season_btn", function (e) {
e.preventDefault();
new_season = document.getElementById("new_season").value;
if ($.isNumeric(new_season) == false) {
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
type: "warning",
});
} else {
$.ajax({
url: "/" + package_name + "/ajax/apply_new_season",
type: "POST",
cache: false,
data: { new_season: new_season },
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
e.preventDefault();
const new_season = document.getElementById("new_season").value;
if ($.isNumeric(new_season) == false) {
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
}
});
} else {
$.ajax({
url: "/" + package_name + "/ajax/apply_new_season",
type: "POST",
cache: false,
data: {new_season: new_season},
dataType: "json",
success: function (ret) {
if (ret.ret) {
$.notify("<strong>적용하였습니다.</strong><br>", {
type: "success",
});
make_program(ret);
} else {
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
}
});
// 하나씩 다운로드 추가
$("body").on("click", "#add_queue_btn", function (e) {
e.preventDefault();
// code = $(this).data('code');
code = current_data.episode[$(this).data("idx")].code;
// console.log('code:: ', code)
let data = current_data.episode[$(this).data("idx")];
// console.log('data:: ', data)
$.ajax({
url: "/" + package_name + "/ajax/add_queue",
type: "POST",
cache: false,
data: { code: code, data: JSON.stringify(data) },
dataType: "json",
success: function (data) {
// console.log('#add_queue_btn::data >>', data)
if (data.ret === "enqueue_db_append") {
$.notify("<strong>다운로드 작업을 추가 하였습니다.</strong>", {
type: "success",
});
} else if (data.ret === "enqueue_db_exist") {
$.notify("<strong>DB에 존재하는 에피소드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "db_completed") {
$.notify("<strong>DB에 완료 기록이 있습니다.</strong>", {
type: "warning",
});
} else if (data.ret === "fail") {
$.notify("<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>", {
type: "warning",
});
} else if (data.ret === "no_data") {
$.notify("<strong>잘못된 코드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "Debugging") {
$.notify("<strong>Debugging</strong>", {
type: "warning",
});
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
$("body").on("click", "#add_download", function (e) {
e.preventDefault();
// code = $(this).data('code');
code = current_data.data.episode[$(this).data("idx")].code;
// console.log('code:: ', code)
let data = current_data.data.episode[$(this).data("idx")];
// console.log('data:: ', data)
$.ajax({
url: "/" + package_name + "/ajax/add_download",
type: "POST",
cache: false,
data: {code: code, data: JSON.stringify(data)},
dataType: "json",
success: function (data) {
// console.log('#add_queue_btn::data >>', data)
if (data.ret === "enqueue_db_append") {
$.notify("<strong>다운로드 작업을 추가 하였습니다.</strong>", {
type: "success",
});
} else if (data.ret === "enqueue_db_exist") {
$.notify("<strong>DB에 존재하는 에피소드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "db_completed") {
$.notify("<strong>DB에 완료 기록이 있습니다.</strong>", {
type: "warning",
});
} else if (data.ret === "fail") {
$.notify("<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>", {
type: "warning",
});
} else if (data.ret === "no_data") {
$.notify("<strong>잘못된 코드입니다.</strong>", {
type: "warning",
});
} else if (data.ret === "Debugging") {
$.notify("<strong>Debugging</strong>", {
type: "warning",
});
} else {
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
type: "warning",
});
}
},
});
});
$("body").on("click", "#check_download_btn", function (e) {
e.preventDefault();
all = $('input[id^="checkbox_"]');
str = "";
for (i in all) {
if (all[i].checked) {
code = all[i].id.split("_")[1];
str += code + ",";
e.preventDefault();
const checked_items = $('input[id^="checkbox_"]');
console.log(checked_items)
let str = "";
for (let i in checked_items) {
if (checked_items[i].checked) {
code = checked_items[i].id.split("_")[1];
str += code + ",";
}
}
}
if (str == "") {
$.notify("<strong>선택하세요.</strong>", {
type: "warning",
lecture_id = current_data.data.episode[0].item_id
console.log(`checked_items: ${checked_items}`)
console.log(str)
if (str === "") {
$.notify("<strong>선택하세요.</strong>", {
type: "warning",
});
return;
}
// return;
$.ajax({
url: "/" + package_name + "/ajax/add_queue_checked_list",
type: "POST",
cache: false,
data: {code: str, lecture_id: lecture_id},
dataType: "json",
success: function (data) {
if (data.ret == "success") {
$.notify("<strong>" + data.log + "개를 추가하였습니다.</strong>", {
type: "success",
});
} else {
$.notify("<strong>" + data.log + "</strong>", {
type: "warning",
});
}
},
});
return;
}
$.ajax({
url: "/" + package_name + "/ajax/add_queue_checked_list",
type: "POST",
cache: false,
data: { code: str },
dataType: "json",
success: function (data) {
if (data.ret == "success") {
$.notify("<strong>" + data.log + "개를 추가하였습니다.</strong>", {
type: "success",
});
} else {
$.notify("<strong>" + data.log + "</strong>", {
type: "warning",
});
}
},
});
});
$("#go_modal_airing").on("shown.bs.modal", function () {
// {#get_airing_list()#}
$("#exModal").trigger("focus");
// {#get_airing_list()#}
$("#exModal").trigger("focus");
});
$("#go_modal_airing").click(function (e) {
e.preventDefault();
// console.log('open modal')
$("#exModal").bootstrapToggle();
if (current_airing_data === "") {
get_airing_list();
}
$("#inner_airing").toggle();
$("#airing_list").toggle();
e.preventDefault();
// console.log('open modal')
$("#exModal").bootstrapToggle();
if (current_airing_data === "") {
get_airing_list();
}
$("#inner_airing").toggle();
$("#airing_list").toggle();
});
$("#go_modal_airing").attr("class", "btn btn-primary");
// {#$(function () {#}
// {# $('[data-tooltip="true"]').tooltip()#}
// {#});#}
// <!--{#-->
// <!--<script src="https://unpkg.com/@popperjs/core@2"></script>-->
// <!--#} {#-->
// <!--<script src="https://unpkg.com/tippy.js@6"></script>-->
// <!--#} {#-->
// <!--<script>-->
// <!-- // #}-->
// <!-- // {# tippy('.code-button',#}-->
// <!-- // {# { content: 'aaaa', // tooltip 내용#}-->
// <!-- // {# placement: 'top', // 상단 위치#}-->
// <!-- // {# trigger: 'hover', // :hover가 아닌 click시 노출#}-->
// <!-- // {# hideOnClick : 'toggle', // click시, toggle() 액션#}-->
// <!-- // {# animation: 'shift-away' // 아래에서 위로 올라오며 등장#}-->
// <!-- // {# })#}-->
// <!-- // {##}-->
// <!-- // {##}-->
// <!-- // {#-->
// <!--</script>-->
// <!--#}--