first commit
This commit is contained in:
3784
static/js/Sortable.js
Normal file
3784
static/js/Sortable.js
Normal file
File diff suppressed because it is too large
Load Diff
1
static/js/bootstrap-notify.min.js
vendored
Executable file
1
static/js/bootstrap-notify.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
6
static/js/bootstrap.min.js
vendored
Executable file
6
static/js/bootstrap.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
108
static/js/custom10.js
Executable file
108
static/js/custom10.js
Executable file
@@ -0,0 +1,108 @@
|
||||
$.notify({
|
||||
// options
|
||||
icon: 'glyphicon glyphicon-ok',
|
||||
title: 'SJVA',
|
||||
message: '',
|
||||
url: '',
|
||||
target: '_blank'
|
||||
},{
|
||||
// settings
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 10000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-{0}" role="alert">' +
|
||||
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
|
||||
'<span data-notify="icon"></span> ' +
|
||||
'<span data-notify="title" style="word-break:break-all;">{1}</span> ' +
|
||||
'<span data-notify="message" style="word-break:break-all;">{2}</span>' +
|
||||
'<div class="progress" data-notify="progressbar">' +
|
||||
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
||||
'</div>' +
|
||||
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
||||
'</div>'
|
||||
});
|
||||
|
||||
function duration_str(duration) {
|
||||
duration = duration / 100;
|
||||
var minutes = parseInt(duration / 60);
|
||||
var hour = parseInt(minutes / 60);
|
||||
var min = parseInt(minutes % 60);
|
||||
var sec = parseInt((duration/60 - parseInt(duration/60)) * 60);
|
||||
return pad(hour, 2) + ':' + pad(min, 2) + ':' + pad(sec,2);
|
||||
|
||||
}
|
||||
// 자리맞춤
|
||||
function pad(n, width) {
|
||||
n = n + '';
|
||||
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
|
||||
}
|
||||
|
||||
// jquery extend function
|
||||
// post로 요청하면서 리다이렉트
|
||||
// 푹 자동에서 푹 기본 검색할때 사용
|
||||
$.extend(
|
||||
{
|
||||
redirectPost: function(location, args)
|
||||
{
|
||||
var form = '';
|
||||
$.each( args, function( key, value ) {
|
||||
//console.log(key);
|
||||
//console.log(value);
|
||||
value = value.split('"').join('\"')
|
||||
form += '<input type="hidden" name="'+key+'" value="'+value+'">';
|
||||
});
|
||||
$('<form action="' + location + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
|
||||
}
|
||||
});
|
||||
|
||||
function get_formdata(form_id) {
|
||||
// on, off 일수도 있으니 모두 True, False로 통일하고
|
||||
// 밑에서는 False인 경우 값이 추가되지 않으니.. 수동으로 넣어줌
|
||||
var checkboxs = $(form_id + ' input[type=checkbox]');
|
||||
//for (var i in checkboxs) {
|
||||
for (var i =0 ; i < checkboxs.length; i++) {
|
||||
if ( $(checkboxs[i]).is(':checked') ) {
|
||||
$(checkboxs[i]).val('True');
|
||||
} else {
|
||||
$(checkboxs[i]).val('False');
|
||||
}
|
||||
}
|
||||
var formData = $(form_id).serialize();
|
||||
$.each($(form_id + ' input[type=checkbox]')
|
||||
.filter(function(idx) {
|
||||
return $(this).prop('checked') === false
|
||||
}),
|
||||
function(idx, el) {
|
||||
var emptyVal = "False";
|
||||
formData += '&' + $(el).attr('name') + '=' + emptyVal;
|
||||
}
|
||||
);
|
||||
formData = formData.replace("&global_scheduler=True", "")
|
||||
formData = formData.replace("&global_scheduler=False", "")
|
||||
formData = formData.replace("global_scheduler=True&", "")
|
||||
formData = formData.replace("global_scheduler=False&", "")
|
||||
return formData;
|
||||
}
|
||||
18209
static/js/hls.js
Executable file
18209
static/js/hls.js
Executable file
File diff suppressed because it is too large
Load Diff
5
static/js/popper.min.js
vendored
Executable file
5
static/js/popper.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
726
static/js/sjva_global1.js
Normal file
726
static/js/sjva_global1.js
Normal file
@@ -0,0 +1,726 @@
|
||||
$(document).ready(function(){
|
||||
var protocol = window.location.protocol;
|
||||
var socket = io.connect(protocol + "//" + document.domain + ":" + location.port + "/framework");
|
||||
//var socket = io.connect("http://" + document.domain + ":" + location.port + "/framework", {transports:['websocket']}, {'force new connection': true});
|
||||
socket.on('notify', function(data){
|
||||
$.notify({
|
||||
message : data['msg'],
|
||||
url: data['url'],
|
||||
target: '_self'
|
||||
},{
|
||||
type: data['type'],
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('modal', function(data){
|
||||
m_modal(data.data, data.title, false);
|
||||
});
|
||||
|
||||
socket.on('command_modal_add_text', function(data){
|
||||
document.getElementById("command_modal_textarea").innerHTML += data ;
|
||||
document.getElementById("command_modal_textarea").scrollTop = document.getElementById("command_modal_textarea").scrollHeight;
|
||||
});
|
||||
|
||||
socket.on('command_modal_show', function(data){
|
||||
command_modal_show(data)
|
||||
});
|
||||
|
||||
socket.on('command_modal_clear', function(data){
|
||||
document.getElementById("command_modal_textarea").innerHTML = ""
|
||||
});
|
||||
|
||||
socket.on('loading_hide', function(data){
|
||||
$('#loading').hide();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.loading').hide();
|
||||
//$('#modal_loading').hide();
|
||||
})
|
||||
.ajaxStart(function(){
|
||||
$('.loading').show();
|
||||
//$('#modal_loading').show();
|
||||
})
|
||||
.ajaxStop(function(){
|
||||
$('.loading').hide();
|
||||
//$('#modal_loading').hide();
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$("body").on('click', '#open_url_btn', function(e) {
|
||||
e.preventDefault();
|
||||
url = $(this).data('url')
|
||||
window.open(url, "_blank");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("body").on('click', '#global_link_btn', function(e) {
|
||||
e.preventDefault();
|
||||
url = $(this).data('url')
|
||||
window.open(url, "_blank");
|
||||
});
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 공용 버튼
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// global_cache_confirm_btn => global_offcloud_cache_confirm_btn
|
||||
$("body").on('click', '#global_offcloud_cache_confirm_btn', function(e){
|
||||
e.preventDefault();
|
||||
hash = $(this).data('hash');
|
||||
$.ajax({
|
||||
url: '/offcloud2/ajax/hash',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{hash:hash},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data == 'true') {
|
||||
$.notify('<strong>캐쉬 되어 있습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else if (data == 'false') {
|
||||
$.notify('<strong>캐쉬 되어 있지 않습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else if (data == 'fail') {
|
||||
$.notify('<strong>캐쉬 확인 실패</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
//$(location).attr('href', '/offcloud/cache?magnet=' + hash)
|
||||
});
|
||||
|
||||
//global_add_remote_btn -> global_offcloud_add_btn
|
||||
$("body").on('click', '#global_offcloud_add_btn', function(e) {
|
||||
e.preventDefault();
|
||||
hash = $(this).data('hash');
|
||||
$.ajax({
|
||||
url: '/offcloud2/ajax/add_remote',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {hash:hash},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
m_modal(data)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("body").on('click', '#global_downloader_add_btn', function(e){
|
||||
e.preventDefault();
|
||||
download_url = $(this).data('hash');
|
||||
$.ajax({
|
||||
url: '/downloader/ajax/add_download',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {download_url:download_url},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
show_result_add_download(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function command_modal_show(title) {
|
||||
ClientHeight = window.innerHeight
|
||||
document.getElementById("command_modal_title").innerHTML = title
|
||||
$("#command_modal").height(ClientHeight-100);
|
||||
$("#command_modal_textarea").height(ClientHeight-380);
|
||||
$("#command_modal").modal();
|
||||
}
|
||||
|
||||
|
||||
// 토렌트 프로그램에 다운로드 추가할 결과를 보여주는
|
||||
function show_result_add_download(data) {
|
||||
try {
|
||||
sub = ''
|
||||
program = '토렌트'
|
||||
if (data.default_torrent_program == '0') {
|
||||
program = '트랜스미션에 토렌트'
|
||||
sub = 'transmission'
|
||||
} else if (data.default_torrent_program == '1') {
|
||||
program = '다운로드스테이션에 토렌트'
|
||||
sub = 'downloadstation'
|
||||
} else if (data.default_torrent_program == '2') {
|
||||
program = '큐빗토렌트다에 토렌트'
|
||||
sub = 'qbittorrent'
|
||||
} else if (data.default_torrent_program == '3') {
|
||||
program = 'aria2에 토렌트'
|
||||
sub = 'aria2'
|
||||
}
|
||||
}
|
||||
catch {
|
||||
}
|
||||
if (data.ret == 'success') {
|
||||
$.notify({message:'<strong>'+ program +'를 추가하였습니다.</strong><br>클릭시 다운로드 상태창으로 이동', url:'/downloader/'+sub+'/status',
|
||||
target: '_self'}, {
|
||||
type: 'success',
|
||||
});
|
||||
} else if (data.ret == 'success2') {
|
||||
$.notify('<strong>일반 파일 다운로드를 시작하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else if (data.ret == 'fail') {
|
||||
$.notify('<strong>'+ program +' 추가에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>'+ program +' 추가 에러<br>'+data.error+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#global_torrent_info_btn', function(e) {
|
||||
e.preventDefault();
|
||||
hash = $(this).data('hash');
|
||||
$.ajax({
|
||||
url: '/torrent_info/ajax/torrent_info',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {hash:hash},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
m_modal(data, "토렌트 정보")
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function get_torrent_program_name(p) {
|
||||
if (p == '0') return '트랜스미션'
|
||||
else if (p == '1') return '다운로드스테이션'
|
||||
else if (p == '2') return '큐빗토렌트'
|
||||
else if (p == '3') return 'aria2'
|
||||
}
|
||||
|
||||
|
||||
function global_relay_test(remote) {
|
||||
$.ajax({
|
||||
url: '/' + 'gd_share_client' + '/ajax/'+'base'+'/relay_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {remote:remote},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
$.notify('<strong>릴레이 공유가 가능합니다.<strong>', {type: 'success'});
|
||||
}else {
|
||||
$.notify('<strong>설정이 잘못 되어 있습니다.</strong>', {type: 'warning'});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function global_send_command(command, data={}) {
|
||||
data['command'] = command;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/command',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:data,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
notify(data['msg'], data['ret']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function shutdown_confirm() {
|
||||
document.getElementById("confirm_title").innerHTML = "종료 확인";
|
||||
document.getElementById("confirm_body").innerHTML = "종료 하시겠습니까?";
|
||||
$('#confirm_button').attr('onclick', 'window.location.href = "/system/shutdown";');
|
||||
$("#confirm_modal").modal();
|
||||
}
|
||||
|
||||
$("#video_modal").on('hidden.bs.modal', function () {
|
||||
document.getElementById("video_modal_video").pause();
|
||||
//streaming_kill();
|
||||
});
|
||||
|
||||
$("#video_modal").on('click', '#trailer_close_btn', function(e){
|
||||
e.preventDefault();
|
||||
document.getElementById("video_modal_video").pause();
|
||||
//streaming_kill();
|
||||
});
|
||||
|
||||
function streaming_kill(command, data={}) {
|
||||
$.ajax({
|
||||
url: '/' + 'ffmpeg' + '/ajax/streaming_kill',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Global.. JS 파일로 뺄것
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// 파일 선택 모달 Start
|
||||
var select_local_file_modal_callback = null;
|
||||
|
||||
function m_select_local_file_modal(title, init_path, only_dir, func) {
|
||||
if (init_path == '' || init_path == null)
|
||||
init_path = '/';
|
||||
document.getElementById("select_local_file_modal_title").innerHTML = title;
|
||||
document.getElementById("select_local_file_modal_path").value = init_path;
|
||||
document.getElementById("select_local_file_modal_only_dir").value = only_dir;
|
||||
select_local_file_modal_callback = func;
|
||||
$("#select_local_file_modal").modal();
|
||||
listdir(init_path, only_dir);
|
||||
}
|
||||
|
||||
$("body").on('click', '#global_select_local_file_load_btn', function(e) {
|
||||
e.preventDefault();
|
||||
let current_path = $('#select_local_file_modal_path').val().trim();
|
||||
only_dir = $('#select_local_file_modal_only_dir').val().trim();
|
||||
listdir(current_path, only_dir);
|
||||
});
|
||||
|
||||
$("body").on('click', '#select_local_file_modal_confirm_btn', function(e) {
|
||||
e.preventDefault();
|
||||
if (select_local_file_modal_callback != null)
|
||||
select_local_file_modal_callback($('#select_local_file_modal_path').val().trim());
|
||||
$("#select_local_file_modal").modal('toggle');
|
||||
});
|
||||
|
||||
|
||||
let listdir = (path = '/', only_dir = true) => {
|
||||
$.ajax({
|
||||
url: `/global/ajax/listdir`,
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
data: {
|
||||
path: path,
|
||||
only_dir : only_dir
|
||||
},
|
||||
dataType: 'json'
|
||||
}).done((datas) => {
|
||||
console.log(datas)
|
||||
if (datas.length == 0) {
|
||||
return false;
|
||||
}
|
||||
let new_obj = ``;
|
||||
const path_spliter = (path.indexOf('/')>=0)?'/':'\\';
|
||||
$('#select_local_file_modal_list_group').empty();
|
||||
for (let dt of datas) {
|
||||
tmp = dt.split('|');
|
||||
new_obj += `<a href='#' class="list-group-item list-group-item-action item_path" data-value="${tmp[1]}">${tmp[0]}</a>`;
|
||||
}
|
||||
$('#select_local_file_modal_list_group').append(new_obj);
|
||||
$('.item_path').off('click').click((evt) => {
|
||||
|
||||
let new_path = '';
|
||||
/*
|
||||
if ($(evt.currentTarget).text() === '..'){
|
||||
let split_path = '';
|
||||
split_path = path.split(path_spliter);
|
||||
split_path.pop();
|
||||
new_path = split_path.join(path_spliter);
|
||||
if (new_path.length === 0){
|
||||
new_path = path_spliter
|
||||
}
|
||||
} else {
|
||||
//new_path = (path !== path_spliter) ? path + path_spliter + $(evt.currentTarget).text() : path + $(evt.currentTarget).text();
|
||||
new_path = $(evt.currentTarget).data('value');
|
||||
console.log(new_path)
|
||||
console.log(evt)
|
||||
|
||||
}
|
||||
*/
|
||||
new_path = $(evt.currentTarget).data('value');
|
||||
$('#select_local_file_modal_path').val(new_path);
|
||||
listdir(new_path, only_dir);
|
||||
|
||||
});
|
||||
}).fail((datas) => {
|
||||
$.notify('<strong>경로 읽기 실패</strong><br/>${add_path}', {type: 'danger'});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
// 파일 선택 모달 End
|
||||
|
||||
|
||||
// 사용 on / off
|
||||
$('#global_scheduler').change(function() {
|
||||
var ret = $(this).prop('checked');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/scheduler',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {scheduler : ret},
|
||||
dataType: "json",
|
||||
success: function (list) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#global_scheduler_sub').change(function() {
|
||||
var ret = $(this).prop('checked');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/scheduler',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {scheduler : ret, sub:sub},
|
||||
dataType: "json",
|
||||
success: function (list) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//설정 저장
|
||||
$("#global_setting_save_btn").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/setting_save',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>설정 저장에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function global_setting_save_function() {
|
||||
var formData = get_formdata('#setting');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/setting_save',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>설정 저장에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#global_one_execute_btn").click(function(e) {
|
||||
//$("body").on('click', '#one_execute_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/one_execute',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret=='scheduler' || ret=='thread') {
|
||||
$.notify('<strong>작업을 시작하였습니다. ('+ret+')</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else if (ret == 'is_running') {
|
||||
$.notify('<strong>작업중입니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>작업 시작에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#global_one_execute_sub_btn").click(function(e) {
|
||||
//$("body").on('click', '#one_execute_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/one_execute',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {sub:sub},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret=='scheduler' || ret=='thread') {
|
||||
$.notify('<strong>작업을 시작하였습니다. ('+ret+')</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else if (ret == 'is_running') {
|
||||
$.notify('<strong>작업중입니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>작업 시작에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#global_immediately_execute_sub_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/immediately_execute',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {sub:sub},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret.msg != null) notify(ret.msg, ret.ret);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#global_reset_db_btn', function(e){
|
||||
e.preventDefault();
|
||||
document.getElementById("confirm_title").innerHTML = "DB 삭제";
|
||||
document.getElementById("confirm_body").innerHTML = "전체 목록을 삭제 하시겠습니까?";
|
||||
$('#confirm_button').attr('onclick', "global_db_delete();");
|
||||
$("#confirm_modal").modal();
|
||||
return;
|
||||
});
|
||||
|
||||
function global_db_delete() {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/reset_db',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
$.notify('<strong>삭제하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>삭제에 실패하였습니다.</strong>',{
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("body").on('click', '#global_reset_db_sub_btn', function(e){
|
||||
e.preventDefault();
|
||||
document.getElementById("confirm_title").innerHTML = "DB 삭제";
|
||||
document.getElementById("confirm_body").innerHTML = "전체 목록을 삭제 하시겠습니까?";
|
||||
$('#confirm_button').attr('onclick', "global_db_delete_sub();");
|
||||
$("#confirm_modal").modal();
|
||||
return;
|
||||
});
|
||||
|
||||
function global_db_delete_sub() {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/reset_db',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {sub:sub},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
$.notify('<strong>삭제하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>삭제에 실패하였습니다.</strong>',{
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("body").on('click', '#global_json_btn', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
for (i in current_data.list) {
|
||||
if (current_data.list[i].id == id) {
|
||||
m_modal(current_data.list[i])
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on('click', '#global_reset_btn', function(e){
|
||||
e.preventDefault();
|
||||
document.getElementById("order").value = 'desc';
|
||||
document.getElementById("option").value = 'all';
|
||||
document.getElementById("search_word").value = '';
|
||||
global_sub_request_search('1')
|
||||
});
|
||||
|
||||
$("body").on('click', '#global_remove_btn', function(e) {
|
||||
e.preventDefault();
|
||||
id = $(this).data('id');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/'+sub+ '/db_remove',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {id:id},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
$.notify('<strong>삭제되었습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
global_sub_request_search(current_data.paging.current_page, false)
|
||||
} else {
|
||||
$.notify('<strong>삭제 실패</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function notify(msg, type) {
|
||||
$.notify('<strong>' + msg + '</strong>', {type: type});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function global_send_command2(command, arg1, arg2, arg3, modal_title, callback) {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/command',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{command:command, arg1:arg1, arg2:arg2, arg3},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret.msg != null) notify(ret.msg, ret.ret);
|
||||
if (ret.modal != null) m_modal(ret.modal, modal_title, false);
|
||||
if (ret.json != null) m_modal(ret.json, modal_title, true);
|
||||
if (callback != null) callback(ret);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//#######################################################
|
||||
//플러그인 - 모듈 - 서브 구조하에서 서브 관련 함수
|
||||
|
||||
function global_send_command_sub(command, arg1, arg2, arg3, modal_title, callback) {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/' + sub2 + '/command',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{command:command, arg1:arg1, arg2:arg2, arg3},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
console.log(ret);
|
||||
if (ret.msg != null) notify(ret.msg, ret.ret);
|
||||
if (ret.modal != null) m_modal(ret.modal, modal_title, false);
|
||||
if (ret.json != null) m_modal(ret.json, modal_title, true);
|
||||
if (callback != null) callback(ret);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("body").on('click', '#global_one_execute_sublogic_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/' + sub2 + '/one_execute',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret=='scheduler' || ret=='thread') {
|
||||
$.notify('<strong>작업을 시작하였습니다. ('+ret+')</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else if (ret == 'is_running') {
|
||||
$.notify('<strong>작업중입니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>작업 시작에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#global_immediately_execute_sublogic_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/' + sub2 + '/immediately_execute',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret.msg != null) notify(ret.msg, ret.ret);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#global_scheduler_sublogic').change(function() {
|
||||
var ret = $(this).prop('checked');
|
||||
$.ajax({
|
||||
url: '/'+package_name+'/ajax/' + sub + '/' + sub2 + '/scheduler',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {scheduler : ret},
|
||||
dataType: "json",
|
||||
success: function (list) {
|
||||
}
|
||||
});
|
||||
});
|
||||
183
static/js/sjva_ui14.js
Executable file
183
static/js/sjva_ui14.js
Executable file
@@ -0,0 +1,183 @@
|
||||
|
||||
|
||||
function m_row_start(padding='10', align='center') {
|
||||
var str = '<div class="row" style="padding-top: '+padding+'px; padding-bottom:'+padding+'px; align-items:'+align+';">';
|
||||
return str;
|
||||
}
|
||||
function m_row_start_hover(padding='10', align='center') {
|
||||
var str = '<div class="row my_hover" style="padding-top: '+padding+'px; padding-bottom:'+padding+'px; align-items:'+align+';">';
|
||||
return str;
|
||||
}
|
||||
function m_row_start_top(padding='10') {
|
||||
return m_row_start(padding, 'top');
|
||||
}
|
||||
function m_row_start_color(padding='10', align='center', color='') {
|
||||
var str = '<div class="row" style="padding-top: '+padding+'px; padding-bottom:'+padding+'px; align-items:'+align+'; background-color:'+color+'">';
|
||||
return str;
|
||||
}
|
||||
function m_row_start_color2(padding='10', align='center') {
|
||||
var str = '<div class="row bg-dark text-white" style="padding-top: '+padding+'px; padding-bottom:'+padding+'px; align-items:'+align+';">';
|
||||
return str;
|
||||
}
|
||||
|
||||
function m_row_end() {
|
||||
var str = '</div>';
|
||||
return str;
|
||||
}
|
||||
|
||||
//border
|
||||
function m_col(w, h, align='left') {
|
||||
var str = '<div class="col-sm-' + w + ' " style="text-align: '+align+'; word-break:break-all;">';
|
||||
str += h
|
||||
str += '</div>';
|
||||
return str
|
||||
}
|
||||
|
||||
function m_col2(w, h, align='left') {
|
||||
var str = '<div class="col-sm-' + w + ' " style="padding:5px; margin:0px; text-align: '+align+'; word-break:break-all;">';
|
||||
str += h
|
||||
str += '</div>';
|
||||
return str
|
||||
}
|
||||
|
||||
|
||||
function m_button_group(h) {
|
||||
var str = '<div class="btn-group btn-group-sm flex-wrap mr-2" role="group">';
|
||||
str += h
|
||||
str += '</div>';
|
||||
return str;
|
||||
}
|
||||
|
||||
function m_button(id, text, data) {
|
||||
var str = '<button id="'+id+'" name="'+id+'" class="btn btn-sm btn-outline-success" '
|
||||
for ( var i in data) {
|
||||
str += ' data-' + data[i].key + '="' + data[i].value+ '" '
|
||||
}
|
||||
str += '>' + text + '</button>';
|
||||
return str;
|
||||
}
|
||||
|
||||
function m_button2(id, text, data, outline_color) {
|
||||
var str = '<button id="'+id+'" name="'+id+'" class="btn btn-sm btn-outline-'+outline_color+'" '
|
||||
for ( var i in data) {
|
||||
str += ' data-' + data[i].key + '="' + data[i].value+ '" '
|
||||
}
|
||||
str += '>' + text + '</button>';
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function m_hr(margin='5') {
|
||||
var str = '<hr style="width: 100%; margin:'+margin+'px;" />';
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function m_hr_black() {
|
||||
var str = '<hr style="width: 100%; color: black; height: 2px; background-color:black;" />';
|
||||
return str;
|
||||
}
|
||||
// 체크박스는 자바로 하면 on/off 스크립트가 안먹힘.
|
||||
|
||||
|
||||
function m_modal(data='EMPTY', title='JSON', json=true) {
|
||||
document.getElementById("modal_title").innerHTML = title;
|
||||
if (json) {
|
||||
data = JSON.stringify(data, null, 2);
|
||||
}
|
||||
document.getElementById("modal_body").innerHTML = "<pre>"+ data + "</pre>";;
|
||||
$("#large_modal").modal();
|
||||
}
|
||||
|
||||
function m_tab_head(name, active) {
|
||||
if (active) {
|
||||
var str = '<a class="nav-item nav-link active" id="id_'+name+'" data-toggle="tab" href="#'+name+'" role="tab">'+name+'</a>';
|
||||
} else {
|
||||
var str = '<a class="nav-item nav-link" id="id_'+name+'" data-toggle="tab" href="#'+name+'" role="tab">'+name+'</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function m_tab_content(name, content, active) {
|
||||
if (active) {
|
||||
var str = '<div class="tab-pane fade show active" id="'+name+'" role="tabpanel" >';
|
||||
} else {
|
||||
var str = '<div class="tab-pane fade show" id="'+name+'" role="tabpanel" >';
|
||||
}
|
||||
str += content;
|
||||
str += '</div>'
|
||||
return str;
|
||||
}
|
||||
|
||||
function m_progress(id, width, label) {
|
||||
var str = '';
|
||||
str += '<div class="progress" style="height: 25px;">'
|
||||
str += '<div id="'+id+'" class="progress-bar" style="background-color:yellow;width:'+width+'%"></div>';
|
||||
str += '<div id="'+id+'_label" class="justify-content-center d-flex w-100 position-absolute" style="margin-top:2px">'+label+'</div>';
|
||||
str += '</div>'
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function m_progress2(id, width, label) {
|
||||
var str = '';
|
||||
str += '<div class="progress" style="height: 25px;">'
|
||||
str += '<div id="'+id+'" class="progress-bar" style="background-color:yellow;width:'+width+'%"></div>';
|
||||
str += '<div id="'+id+'_label" class="justify-content-center d-flex w-100 position-absolute" style="margin:0px; margin-top:2px">'+label+'</div>';
|
||||
str += '</div>'
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function make_page_html(data) {
|
||||
str = ' \
|
||||
<div class="d-inline-block"></div> \
|
||||
<div class="row mb-3"> \
|
||||
<div class="col-sm-12"> \
|
||||
<div class="btn-toolbar" style="justify-content: center;" role="toolbar" aria-label="Toolbar with button groups" > \
|
||||
<div class="btn-group btn-group-sm mr-2" role="group" aria-label="First group">'
|
||||
if (data.prev_page) {
|
||||
str += '<button id="page" data-page="' + (data.start_page-1) + '" type="button" class="btn btn-secondary">«</button>'
|
||||
}
|
||||
|
||||
for (var i = data.start_page ; i <= data.last_page ; i++) {
|
||||
str += '<button id="page" data-page="' + i +'" type="button" class="btn btn-secondary" ';
|
||||
if (i == data.current_page) {
|
||||
str += 'disabled';
|
||||
}
|
||||
str += '>'+i+'</button>';
|
||||
}
|
||||
if (data.next_page) {
|
||||
str += '<button id="page" data-page="' + (data.last_page+1) + '" type="button" class="btn btn-secondary">»</button>'
|
||||
}
|
||||
|
||||
str += '</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
'
|
||||
document.getElementById("page1").innerHTML = str;
|
||||
document.getElementById("page2").innerHTML = str;
|
||||
}
|
||||
|
||||
function use_collapse(div, reverse=false) {
|
||||
var ret = $('#' + div).prop('checked');
|
||||
if (reverse) {
|
||||
if (ret) {
|
||||
$('#' + div + '_div').collapse('hide')
|
||||
} else {
|
||||
$('#' + div + '_div').collapse('show')
|
||||
}
|
||||
} else {
|
||||
if (ret) {
|
||||
$('#' + div + '_div').collapse('show')
|
||||
} else {
|
||||
$('#' + div + '_div').collapse('hide')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
56
static/js/sjva_util1.js
Executable file
56
static/js/sjva_util1.js
Executable file
@@ -0,0 +1,56 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Util JS 파일로 뺄것
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function humanFileSize(bytes) {
|
||||
var thresh = 1024;
|
||||
if(Math.abs(bytes) < thresh) {
|
||||
return bytes + ' B';
|
||||
}
|
||||
var units = ['KB','MB','GB','TB','PB','EB','ZB','YB']
|
||||
var u = -1;
|
||||
do {
|
||||
bytes /= thresh;
|
||||
++u;
|
||||
} while(Math.abs(bytes) >= thresh && u < units.length - 1);
|
||||
return bytes.toFixed(1)+' '+units[u];
|
||||
}
|
||||
|
||||
function FormatNumberLength(num, length) {
|
||||
var r = "" + num;
|
||||
while (r.length < length) {
|
||||
r = "0" + r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function msToHMS( ms ) {
|
||||
// 1- Convert to seconds:
|
||||
var seconds = ms / 1000;
|
||||
// 2- Extract hours:
|
||||
var hours = parseInt( seconds / 3600 ); // 3,600 seconds in 1 hour
|
||||
seconds = seconds % 3600; // seconds remaining after extracting hours
|
||||
// 3- Extract minutes:
|
||||
var minutes = parseInt( seconds / 60 ); // 60 seconds in 1 minute
|
||||
// 4- Keep only seconds not extracted to minutes:
|
||||
seconds = seconds % 60;
|
||||
return (''+hours).padStart(2, "0")+":"+(''+minutes).padStart(2, "0")+":"+parseInt(seconds);
|
||||
}
|
||||
|
||||
|
||||
function color(text, color='red') {
|
||||
return '<span style="color:'+color+'; font-weight:bold">' + text + '</span>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
function text_color(text, color='red') {
|
||||
return '<span style="color:'+color+'; font-weight:bold">' + text + '</span>';
|
||||
}
|
||||
|
||||
|
||||
function make_log(key, value, left=2, right=10) {
|
||||
row = m_col(left, key, aligh='right');
|
||||
row += m_col(right, value, aligh='left');
|
||||
return row;
|
||||
}
|
||||
25
static/js/video.min.js
vendored
Executable file
25
static/js/video.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
15386
static/js/videojs-contrib-hls.js
Executable file
15386
static/js/videojs-contrib-hls.js
Executable file
File diff suppressed because it is too large
Load Diff
12
static/js/videojs-contrib-hls.min.js
vendored
Executable file
12
static/js/videojs-contrib-hls.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user