123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746 |
- <!DOCTYPE html>
- <html lang="zh-TW">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge, Chrome=1">
- <meta http-equiv="Cache-Control" content="no-cache">
- <title>AI Spokesgirl</title>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
- crossorigin="anonymous">
- <link rel="stylesheet"
- href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt"
- crossorigin="anonymous">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.min.css">
- <link rel="stylesheet" href="./styleMV.css">
- <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
- <title>AI Spokesgirl</title>
- <style>
- .input-sec {
- box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
- -webkit-box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
- position: relative;
- }
- .upload-cta {
- position: absolute;
- left: 0;
- top: 0;
- }
- .upload-cta.box-active {
- height: 80px;
- width: 80px;
- background-size: cover !important;
- background-repeat: no-repeat;
- border-radius: 1rem;
- }
- #msform .img-inputTest {
- text-align: end;
- }
- </style>
- </head>
- <body>
- <!-- ================================================================= -->
- <!-- navbar -->
- <nav class="navbar navbar-expand-lg navbar-light">
- <div class="container-fluid">
- <a class="navbar-brand" href="index.html">AI Spokesgirl</a>
- <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
- data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
- aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- <!-- <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
- <li class="nav-item">
- <a class="nav-link active" aria-current="page" href="pricing.html" set-lan="html:pricing">早鳥方案</a>
- </li>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
- 中/En
- </a>
- <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
- <li><button class="nav-link lan-swtich" aria-current="page" set-lan="html:en" onclick="changeLan(this)" value="en">English</button></li>
- <li><button class="nav-link lan-switch" aria-current="page" set-lan="html:zh" onclick="changeLan(this)" value="zh">中文</button></li>
- </ul>
- </li>
- <li class="nav-item">
- <a class="nav-link active btn-login" aria-current="page" href="login.html" set-lan="html:login">登入</a>
- </li>
- <li class="nav-item">
- <a class="nav-link btn-userProfile" aria-current="page" href="./user_profile2.html" set-lan="html:user_profile">會員資料</a>
- </li>
- <li class="nav-item">
- <a class="nav-link btn-logout" aria-current="page" set-lan="html:logout">登出</a>
- </li>
- </ul> -->
- </div>
- </div>
- </nav>
- <!-- ================================================================= -->
- <!-- ================================================================= -->
- <!-- content -->
- <div class="container-fluid px-0">
- <div class="container-fluid">
- <!-- <div id="mySidenav" class="sidenav">
- <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
- <h2 class="go_title" href="index.html"><a class="nav-link active" aria-current="page" href="index.html">AI Spokesgirl</a></h2>
- <ul class="nav-list">
- <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal" data-bs-target="#howto"><i class="fas fa-book-open me-2"></i><lan set-lan="html:usage_intro">使用說明</lan></li>
- <li class="nav-list-item pb-1" data-bs-toggle="modal" data-bs-target="#history" onclick="openNav()"><i class="fas fa-history me-2"></i><lan set-lan="html:history">歷史紀錄</lan></li>
- </ul>
- <p class="right-text text-white d-inline-block">Choozmo All Rights Reserved</p>
- </div> -->
- <div id="mySidenav" class="sidenav">
- <!-- <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a> -->
- <div class="sidenav-content">
- <div class="text-start mt-3">
- <h2 class="fw-bold ps-0" href="index.html"><a class="nav-link active ps-1" aria-current="page" href="index.html">AI Spokesgirl</a></h2>
- </div>
- <div class="userName"></div>
- <img class="user img-fluid rounded-circle" src="img/userimg.png" alt="">
- <p class="text-white my-3 text-center" set-lan="html:Createsthtoday">今天要做甚麼影片呢?</p>
- <div class="navbar-nav mb-2 mb-lg-0 px-3 pe-4">
- <a class="nav-link btn-gocreate text-white col btn-makev" aria-current="page" href="./make_video.html" >影片製作</a>
- <!-- <a class="nav-link btn-gocreate text-white col-6 btn-makelong" aria-current="page" href="./make_video_long.html" set-lan="html:make_video_long">長影片製作</a> -->
- </div>
- <!-- <div class="navbar-nav mb-2 mb-lg-0 px-3 pe-4">
- <a class="nav-link btn-gocreate text-white col-6 btn-makeppt" aria-current="page" href="./make_video_slide.html" set-lan="html:make_slides">投影片影片製作</a>
- <a class="nav-link btn-gocreate text-white col-6 btn-makeen" aria-current="page" href="./index_eng.html" set-lan="html:make_video_eng">純英文影片製作</a>
- </div> -->
- <hr>
- <ul class="nav-list ps-0">
- <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal" data-bs-target="#howto"><i
- class="fas fa-book-open me-2"></i>
- <lan set-lan="html:usage_intro">使用說明</lan>
- </li>
- <!-- <a style="text-decoration: none;color:white;" href="./user_profile2.html">
- <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal">
- <i class="fas fa-user me-2"></i>
- <lan set-lan="html:user_profile">會員資料</lan>
- </li>
- </a> -->
- <li class="nav-list-item pb-1" data-bs-toggle="modal" data-bs-target="#history" onclick="openNav()">
- <i class="fas fa-history me-2"></i>
- <lan set-lan="html:history">歷史紀錄</lan>
- </li>
- </ul>
- </div>
- <div class="right-text">
- <a target="_blank" href="http://www.choozmo.com/">| 官網 |</a>
- <a target="_blank" href="https://www.linkedin.com/company/choozmo/mycompany/"><img
- style="width: 20px;" src="img/linkedin-logo-copy.png" alt=""></a>
- <a target="_blank" href="https://www.facebook.com/choozmo/"><img style="width: 20px;"
- src="img/facebook_logos_PNG19753.png" alt=""></a>
- <a target="_blank" href="https://www.instagram.com/choozmo_cmm/"><img style="width: 20px;"
- src="img/IG.png" alt=""></a>
- <a target="_blank" href="https://line.me/R/ti/p/@choozmo?from=page"><img style="width: 20px;"
- src="img/LINE_logo.svg.png" alt=""></a>
- <a target="_blank" href="https://www.youtube.com/channel/UC2Qda9PhJWuiMTCZ-j7K_hg"><img
- style="width: 20px;" src="img/youtube.png" alt=""></a>
- <a target="_blank" href="https://twitter.com/ai_cmm"><img style="width: 20px;"
- src="img/twitter.png" alt=""></a>
- <p class="Reserved text-white text-start mt-3 ps-2">Choozmo All Rights Reserved</p>
- </div>
- </div>
- <!-- <span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ 過去紀錄</span> -->
- <div class="content ms-auto">
- <form id="msform">
- <div class="linker__box">
- <p set-lan="html:preview_videos">預覽影片</p>
- <i class="fas fa-link copy"></i>
- <a id='linker' style="display: none;" class="ms-2" set-lan="html:video_link">影片連結</a>
- </div>
- <!-- fieldsets -->
- <fieldset>
- <h3 class="fs-subtitle"><lan set-lan="html:video_title">標題</lan><img class="ms-1" src="img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="將作為影片的內嵌標題 The title of your video"></h3>
- <input id=title type="text" name='t1' class='title_new' value="" set-lan="placeholder:video_title" placeholder="標題"/> <br/>
- </fieldset>
- <fieldset>
- <h3 class="fs-subtitle"><lan set-lan="html:choose_character">選擇人物</lan><img class="ms-1" src="img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="將作為影片的講者 The spokesgirl of your video"></h3>
- <select id="avatar" class='avatar'>
- <option set-lan="html:p_choose_character" value="請選擇人物" selected="selected" disabled>>請選擇人物</option>
- <option value="7">Peggy</option>
- <option value="8">Stacy</option>
- <option value="10">Nina</option>
- <option value="11">Summer韓小夏</option>
- <option value="12">Jocelyn</option>
- <option value="13">Angela</option>
- <option value="15">Isabela</option>
- <option value="16">Sofia</option>
- <option value="17">Kristina</option>
- <option value="18">Paula</option>
- </select>
- <div class="d-flex row">
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Peggy" data-img="peggy">
- <div class="imgfr"><img src="img/peggy.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Peggy</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Stacy" data-img="stacy">
- <div class="imgfr"><img src="img/stacy.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Stacy</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Nina" data-img="nina">
- <div class="imgfr"><img src="img/nina.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Nina</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Summer韓小夏" data-img="summer韓小夏">
- <div class="imgfr"><img src="img/summer韓小夏.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Summer韓小夏</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Jocelyn" data-img="Jocelyn">
- <div class="imgfr"><img src="img/Jocelyn.png" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Jocelyn</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Angela" data-img="Angela">
- <div class="imgfr"><img src="img/Angela.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Angela</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Isabela" data-img="Isabela">
- <div class="imgfr"><img src="img/Isabela.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Isabela</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Sofia" data-img="Sofia">
- <div class="imgfr"><img src="img/Sofia.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Sofia</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Kristina" data-img="Kristina">
- <div class="imgfr"><img src="img/Kristina.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Kristina</h5>
- </div>
- </div>
- <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Paula" data-img="Paula">
- <div class="imgfr"><img src="img/Paula.webp" class="card-img-top" alt="..."></div>
- <div class="card-body">
- <h5 class="card-title">Paula</h5>
- </div>
- </div>
- </div>
- </fieldset>
- <fieldset id='imgSrc' style="box-shadow: none;-webkit-box-shadow: none; padding: 0;">
- <h3 class="fs-subtitle" style="display: inline-block;"><lan set-lan="html:content">內容素材</lan>
- <img class="ms-1" src="img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right"
- title="放入您的台詞及圖片,圖片僅接受png, jpg, mp4格式 Type in your content and images. Supported File Formats: png, jpg, mp4.">
- </h3><br/>
- <label for="myCheck" set-lan="html:add_eng">加入英文:</label>
- <input type="checkbox" id="multiLang" > <br/>
- <div class="img-inputTest mt-3">
-
- </div>
- <span class="addsec">+</span>
- <input id="checker" type="button" name="next" class="next action-button" set-lan="value:submit" value="送出" />
- <!-- <span class="draft-btn" data-bs-toggle="tooltip" data-bs-placement="right" title="儲存為草稿 Save as draft" set-lan="html:save_draft_btn">存為草稿</span> -->
- <h3 style="display: none;" class="fs-subtitle"><lan set-lan="html:processing_progress">處理進度</lan></h3>
- <div style="display: none;" id="myProgress">
- <div style="display: none;" id="myBar">0%</div>
- </div>
- </fieldset>
- </form>
- <!-- <div style="width: 80%;margin: 0 auto;"><iframe src="http://www.choozmo.com:8168/ai_anchor_video/16250306886652043.mp4" frameborder="0" style="width: 100%;height: 400px;"></iframe></div> -->
- </div>
-
- <div class="modal fade" tabindex="-1" id="howto" aria-labelledby="howto" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="staticBackdropLabel" set-lan="html:usage_intro">使用說明</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body">
- <div class="modal-terms">
- <ol class="ps-0">
- <li set-lan="html:one_line_to_one_img">1. 一句台詞請對應提供一個影像連結做為搭配</li>
- <li><lang set-lan="html:sup_img_profile">2. 影像連結檔案格式支援:</lang><stong class="strong">.png, jpg, .mp4</stong></li>
- <li set-lan="html:submit_to_wait">3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
- </ol>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal" tabindex="-1" id="history" aria-labelledby="history" aria-hidden="true">
- <div class="modal-dialog modal-dialog-scrollable">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="staticBackdropLabel" set-lang="html:history">歷史紀錄</h5>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body">
- <div class="modal-terms">
- <div class="loader"><img src="img/bx_loader.gif" alt=""></div>
- <ol class="ps-0 historyList">
- </ol>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal" tabindex="-1" id="avatarmega" aria-labelledby="history" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered">
- <div class="modal-content text-center">
- <div class="modal-body">
- <img class="modal-img" src="" alt="">
- <h5 class="modal-title mt-2"></h5>
- <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- ================================================================= -->
- <!-- ================================================================= -->
- <!-- footer -->
- <footer class="fixed-bottom text-center py-2">
- </footer>
- <!-- ================================================================= -->
-
- <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
- <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
- <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
- <script>
- const card = document.getElementsByClassName('card');
- var client_id = Date.now()
- var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
- var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
- return new bootstrap.Tooltip(tooltipTriggerEl)
- });
- var myModal = new bootstrap.Modal(document.getElementById('history'), {
- keyboard: false
- })
- var avatarModal = new bootstrap.Modal(document.getElementById('avatarmega'), {
- keyboard: false
- })
- var modalImg = document.querySelector("#avatarmega .modal-img");
- var modalTitle = document.querySelector("#avatarmega .modal-title");
- var avatarSelector = document.getElementById("avatar");
- avatarSelector.addEventListener('change', avatarChange);
- avatarChange();
- function addCardListener() {
- for (let i = 0; i < card.length; i++) {
- card[i].addEventListener('click', openavatarModel);
- }
- }
- addCardListener();
- function avatarChange() {
- var value = avatarSelector.options[avatarSelector.selectedIndex].text;
- for (let i = 0; i < card.length; i++) {
- card[i].classList.remove('active');
- if (card[i].dataset.avatar == value) {
- card[i].classList.add('active');
- }
- }
- }
- function openavatarModel() {
- console.log(this.dataset.img);
- modalImg.setAttribute("src", `img/${this.dataset.img}.webp`);
- modalTitle.textContent = `${this.dataset.avatar}`;
- avatarModal.show();
- }
- $('input[type=file]').on('change', prepareUpload);
- function prepareUpload(event) {
- files = event.target.files;
- var data = new FormData();
- console.log(files);
- //data.append('file', $('.img_up1').prop('files')[0]);
- data.append('file', files[0]);
- // append other variables to data if you want: data.append('field_name_x', field_value_x);
- //$(this).next().text('上傳中');
- console.log($(this).next());
- // $(this).next().html('<img src="img/Spinner-1s-181px.gif">');
- $.ajax({
- type: 'POST',
- processData: false, // important
- contentType: false, // important
- data: data,
- url: 'https://www.choozmo.com:8887/uploadfile',
- dataType: 'json',
- success: function (jsonData) {
- console.log(event.target.previousSibling);
- event.target.previousSibling.value = jsonData.msg;
- console.log(jsonData.msg);
- $(this).prev().val(jsonData.msg);
- const nextEl = event.target.nextSibling;
- nextEl.style.backgroundImage = `url(http://${jsonData.msg})`;
- // nextEl.style.backgroundImage = `url(https://cdn2.ettoday.net/images/6017/d6017847.jpg)`;
- // nextEl.nextSibling.classList.add('box-active');
- // nextEl.nextSibling.style.backgroundImage = `url(http://${jsonData.msg})`;
- //console.log($(this).next());
- // $(this).next().html('<img class="d-none"src="img/Spinner-1s-181px.gif">');
- $(this).html('');
- //$(this).next().text('上傳檔案');
- },
- error: function (error) {
- const nextEl = event.target.nextSibling;
- nextEl.style.backgroundImage = `url(./img/upload_img.png)`;
- $(this).html('');
- alert('圖片錯誤');
- }
- });
- }
- const button = document.querySelector('.next');
- $(".next").click(function () {
- button.setAttribute('disabled', '');
- setTimeout(function () {
- button.removeAttribute('disabled')
- }, 10000);
- avatar = $('.avatar').val();
- name_title = $('.title_new').val();
- txtARR = [];
- imgARR = [];
- var step;
- let contentIdx = document.querySelectorAll(".txtsrc").length;
- for (let i = 1; i < (contentIdx + 1); i++) {
- if ($(`.txtsrc${i}`).val() != "") {
- txtARR.push($(`.txtsrc${i}`).val())
- }
- }
- let imgIdx = document.querySelectorAll(".imgsrc").length;
- for (let i = 1; i < (imgIdx + 1); i++) {
- if ($(`.imgsrc${i}`).val() != "") {
- imgARR.push($(`.imgsrc${i}`).val())
- }
- }
- multiLang = 0;
- if ($('#multiLang').prop("checked")) {multiLang = 1;}
- dataOBJ = { "name": name_title, "text_content": txtARR, "image_urls": imgARR, "avatar": avatar,"multiLang":multiLang, "client_id": client_id }
- objstr = JSON.stringify(dataOBJ);
- console.log(dataOBJ);
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "https://www.choozmo.com:8887/make_anchor_video_noAuth2");
- xhr.setRequestHeader("accept", "application/json");
- xhr.setRequestHeader("Content-Type", "application/json");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- responseOBJ = JSON.parse(xhr.responseText)
- console.log(responseOBJ.msg);
- //let title = "資料已送出";
- let text;
- text = responseOBJ.msg.zh;
- Swal.fire({
- // title: title,
- icon: 'info',
- text: text,
- confirmButtonColor: '#3085d6',
- });
-
- }
- };
- var data = renderXHR_data(dataOBJ)
- console.log(data)
- result = xhr.send(objstr);
- });
-
- var loaded_data = ''
- function openNav() {
- document.getElementById("mySidenav").style.width = "250px";
- document.querySelector('.loader').style.display = "block";
- axios({
- method: 'post',
- url: 'https://www.choozmo.com:8887/history_input_noAuth',
- headers: {
- 'accept': 'application/json'
- },
- data: ''
- }).then(res => {
- console.log(res.data);
- loaded_data = res.data;
- var historyList = document.querySelector('.historyList');
- historyList.innerHTML = '';
- for (var obj of loaded_data) {
- var list = document.createElement('li');
- list.id = obj.id;
- // div-imgfr
- var divImgfr = document.createElement('div');
- divImgfr.classList.add('item_imgfr');
- var img = document.createElement('img');
- img.setAttribute('src', obj['image_urls'][0]);
- divImgfr.appendChild(img);
- // div-content
- var contentBox = document.createElement('div');
- contentBox.classList.add('content-box');
- var boxTitle = document.createElement('p');
- boxTitle.classList.add('box-title');
- boxTitle.textContent = obj.name;
- boxTitle.id = obj.id;
- console.log(loaded_data);
- boxTitle.setAttribute('onclick', `direct(${obj.id})`);
- var boxLink = document.createElement('span');
- boxLink.classList.add('box-link');
- boxLink.setAttribute("data-url", obj.link);
- boxLink.setAttribute('onclick', 'view()');
- boxLink.innerHTML = '<i class="fas fa-play-circle me-1"></i>觀看影片';
- contentBox.appendChild(boxTitle);
- contentBox.appendChild(boxLink);
- list.classList.add("historyList-item");
- list.setAttribute('onclick', `direct(${obj.id})`);
- list.appendChild(divImgfr);
- list.appendChild(contentBox);
- historyList.appendChild(list);
- }
- document.querySelector('.loader').style.display = "none";
-
- }).catch(err => {
- console.log(err);
- });
- }
- function closeNav() {
- document.getElementById("mySidenav").style.width = "250px";
- }
- function view() {
- event.stopPropagation();
- console.log(event.target);
- if (event.target.nodeName === 'I') {
- return;
- } else {
- window.open(`http://${event.target.dataset.url}`, '_blank');
- }
- }
- function renderXHR_data(jsonObj) {
- XHRstring = ''
- for (const [key, value] of Object.entries(jsonObj)) {
- console.log(value)
- if (typeof (value) == "object") {
- XHRstring += (key+'=['+value.join(',')+']&')
- }
- else {
- XHRstring += (key + '=' + value + '&')
- }
- }
- XHRstring = XHRstring.substring(0, XHRstring.length - 1);
- return XHRstring
- }
- function direct(id) {
- location.href = `make_video.html?id=${id}`;
- }
- function load_data(tid, loaded_data, draft = false) {
- if(!tid) {
- return;
- }
- var title = document.getElementById("title");
- var linker = document.getElementById("linker");
- myModal.hide();
- if(!draft) {
- linker.setAttribute('href', `http://${loaded_data.find(item => item.id == tid).link}`)
- linker.setAttribute('target', '_blank')
- $("#linker").html(`http://${loaded_data.find(item => item.id == tid).link}`)
- $("#linker").show();
- $(".linker__box").show();
- }
- console.log(loaded_data);
- let historyItem = loaded_data.filter(item => item.id == tid)[0];
- console.log(historyItem);
- if(draft) {
- $(".title_new").val(historyItem.title);
- $("#avatar").val(historyItem.avatar);
- } else {
- $(".title_new").val(loaded_data.find(item => item.id == tid).name);
- $("#avatar").val(historyItem.avatar);
- }
- let txtlength = historyItem.text_content.length;
- let imglength = historyItem.image_urls.length;
- console.log(txtlength);
- $('.img-inputTest').html('');
- for (let i = 0; i < txtlength; i++) {
- var input_sec = document.createElement('div');
- var img_box = document.createElement('div');
- input_sec.classList.add('input-sec', `input-sec${i+1}`, 'p-3', 'mb-3');
- img_box.classList.add('img-box');
- // text input
- var txtinput = document.createElement("input");
- txtinput.setAttribute('type', 'text');
- txtinput.setAttribute('name', `t${i+1}`);
- txtinput.classList.add('txtsrc', `txtsrc${i+1}`);
- txtinput.value = historyItem.text_content[i];
- txtinput.setAttribute('placeholder', `${i+1}`);
- input_sec.appendChild(txtinput);
- // img url input
- var imginput = document.createElement("input");
- imginput.setAttribute('type', 'text');
- imginput.setAttribute('name', `m${i+1}`);
- imginput.classList.add('imgsrc', `imgsrc${i+1}`);
- imginput.value = historyItem.image_urls[i];
- imginput.setAttribute('placeholder', 'https://example.com/4VKBo9w.png');
- img_box.appendChild(imginput);
- // img upload input
- var imgupload = document.createElement("input");
- imgupload.setAttribute('id', `img${i+1}`);
- imgupload.setAttribute('type', `file`);
- imgupload.classList.add('img_uploader', 'img_up');
- imgupload.style.display = "none";
- img_box.appendChild(imgupload);
- // img upload label
- var imguploadlabel = document.createElement("label");
- imguploadlabel.setAttribute('for', `img${i+1}`);
- imguploadlabel.classList.add('upload-btn');
- // imguploadlabel.textContent = '上傳圖片';
- imguploadlabel.setAttribute('set-lan', `html:upload_file`);
- imguploadlabel.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
- img_box.appendChild(imguploadlabel);
- imgupload.addEventListener('change', prepareUpload);
- // preview image
- // var imgPreBox = document.createElement("div");
- // imgPreBox.classList.add('upload-cta', 'box-active');
- // imgPreBox.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
- //img_box.appendChild(imgPreBox);
- input_sec.appendChild(img_box);
- document.querySelector('.img-inputTest').append(input_sec);
- }
- }
- getpathId();
- function getpathId(){
- let id = window.location.search.split('?').pop();
- return id.split('=')[1];
- }
- function getData() {
- axios({
- method: 'post',
- url: 'https://www.choozmo.com:8887/history_input_noAuth',
- headers: {
- 'accept': 'application/json'
- },
- data: ''
- }).then(res => {
- loaded_data = res.data;
- console.log(loaded_data);
- const id = getpathId();
- load_data(id, loaded_data);
- }).catch(err => {
- console.log(err);
- });
- }
- var subtitleInputs = document.querySelector(".subtitle-inputs");
- var imgInputs = document.querySelector(".img-inputs");
- let length = 3;
- function initial() {
- for (let i = 0; i < length; i++) {
- // rendertxtBlock(i + 1);
- //renderimgBlock(i + 1);
- renderInputSec(i+1) ;
- }
- console.log(document.querySelectorAll(".txtsrc").length + 1);
- }
- initial();
- getData();
- var addbtn = document.querySelector(".add");
- var addsecbtn = document.querySelector(".addsec");
- addsecbtn.addEventListener('click', addsecBlock);
- function addsecBlock() {
- let newsecIdx = document.querySelectorAll(".input-sec").length + 1;
- renderInputSec(newsecIdx);
- }
- function renderInputSec(i) {
- var input_sec = document.createElement('div');
- var img_box = document.createElement('div');
- input_sec.classList.add('input-sec', `input-sec${i}`, 'p-3', 'mb-3' ,'text-end');
- img_box.classList.add('img-box');
- // text input
- var txtinput = document.createElement("input");
- txtinput.setAttribute('type', 'text');
- txtinput.setAttribute('name', `t${i}`);
- txtinput.classList.add('txtsrc', `txtsrc${i}`);
- txtinput.value = "";
- txtinput.setAttribute('placeholder', `台詞`);
- input_sec.appendChild(txtinput);
- // img url input
- var imginput = document.createElement("input");
- imginput.setAttribute('type', 'text');
- imginput.setAttribute('name', `m${i}`);
- imginput.classList.add('imgsrc', `imgsrc${i}`);
- imginput.value = "";
- imginput.setAttribute('placeholder', 'https://example.com/4VKBo9w.png');
- img_box.appendChild(imginput);
- // img upload input
- var imgupload = document.createElement("input");
- imgupload.setAttribute('id', `img${i}`);
- imgupload.setAttribute('type', `file`);
- imgupload.classList.add('img_uploader', 'img_up');
- imgupload.style.display = "none";
- img_box.appendChild(imgupload);
- // img upload label
- var imguploadlabel = document.createElement("label");
- imguploadlabel.setAttribute('for', `img${i}`);
- imguploadlabel.classList.add('upload-btn');
- imguploadlabel.setAttribute('set-lan', `html:upload_file`);
- img_box.appendChild(imguploadlabel);
- imgupload.addEventListener('change', prepareUpload);
- // preview image
- // var imgPreBox = document.createElement("div");
- // imgPreBox.classList.add('upload-cta');
- // img_box.appendChild(imgPreBox);
- input_sec.appendChild(img_box);
- document.querySelector('.img-inputTest').append(input_sec);
- }
- </script>
- </body>
- </html>
|