From 846ff82a06116a304f6e336f9d966b0f1e98d1e4 Mon Sep 17 00:00:00 2001 From: projectdx Date: Thu, 7 Apr 2022 23:15:32 +0900 Subject: [PATCH] anime-downloader bug fix 18. function fix --- .../anime_downloader_ohli24_request.html | 107 +++++++++++++----- 1 file changed, 77 insertions(+), 30 deletions(-) diff --git a/templates/anime_downloader_ohli24_request.html b/templates/anime_downloader_ohli24_request.html index 672e3d7..3f82b4c 100644 --- a/templates/anime_downloader_ohli24_request.html +++ b/templates/anime_downloader_ohli24_request.html @@ -20,34 +20,8 @@ get: (searchParams, prop) => searchParams.get(prop), }) - $(document).ready(function(){ - console.log(params.code) - if (params.code === '') { - - } else { - document.getElementById("code").value = params.code - {#document.getElementById("analysis_btn").click();#} - } - - if ( "{{arg['ohli24_current_code']}}" !== "") { - if (params.code === null || params.code === '') { - document.getElementById("code").value = "{{arg['ohli24_current_code']}}"; - } else { - - console.log('params code exist') - console.log(params.code) - document.getElementById("code").value = params.code - // document.getElementById("analysis_btn").click(); - } - // 값이 공백이 아니면 분석 버튼 계속 누름 - // {#document.getElementById("analysis_btn").click();#} - } - - - - // 분석 버튼 클릭시 호출 - $("body").on('click', '#analysis_btn', function(e){ - e.preventDefault(); + function analyze() { + // e.preventDefault(); const code = document.getElementById("code").value console.log(code) $.ajax({ @@ -58,7 +32,7 @@ dataType: "json", success: function (ret) { if (ret.ret === 'success' && ret.data != null) { - {#console.log(ret.code)#} + // {#console.log(ret.code)#} console.log(ret.data) make_program(ret.data) } else { @@ -66,7 +40,7 @@ } } }); - }); + } function make_program(data) { current_data = data; @@ -129,6 +103,79 @@ $('input[id^="checkbox_"]').bootstrapToggle() } + $(function () { + console.log(params.code) + if (params.code === '') { + + } else { + document.getElementById("code").value = params.code + // {#document.getElementById("analysis_btn").click();#} + } + + if ( "{{arg['ohli24_current_code']}}" !== "") { + if (params.code === null) { + console.log('params.code === null') + document.getElementById("code").value = "{{arg['ohli24_current_code']}}"; + + } else if(params.code === '') { + document.getElementById("code").value = "{{arg['ohli24_current_code']}}"; + } else { + + console.log('params code exist') + console.log(params.code) + document.getElementById("code").value = params.code + analyze() + // document.getElementById("analysis_btn").click(); + // $('#analysis_btn').trigger('click') + } + // 값이 공백이 아니면 분석 버튼 계속 누름 + // {#document.getElementById("analysis_btn").click();#} + } else { + + } + + + + }) + + $(document).ready(function(){ + + + // $('#analysis_btn').unbind("click").bind('click', function (e) { + // e.preventDefault(); + // e.stopPropagation() + // console.log('test') + // const code = document.getElementById("code").value + // console.log(code) + // }) + + // $("body").unbind('click', '#analysis_btn') + // 분석 버튼 클릭시 호출 + // $("body").on('click', '#analysis_btn', function(e){ + $("#analysis_btn").unbind("click").bind('click', function(e){ + e.preventDefault(); + e.stopPropagation() + const code = document.getElementById("code").value + console.log(code) + $.ajax({ + url: '/' + package_name + '/ajax/' + sub + '/analysis', + type: "POST", + cache: false, + data: {code:code}, + dataType: "json", + success: function (ret) { + if (ret.ret === 'success' && ret.data != null) { + {#console.log(ret.code)#} + console.log(ret.data) + make_program(ret.data) + } else { + $.notify('분석 실패
' + ret.log, {type: 'warning'}); + } + } + }); + }); + + $("body").on('click', '#go_ohli24_btn', function(e){ e.preventDefault(); window.open("{{arg['ohli24_url']}}", "_blank");