make_video.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <!DOCTYPE html>
  2. <html lang="zh-TW">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge, Chrome=1">
  7. <meta http-equiv="Cache-Control" content="no-cache">
  8. <title>AI Spokesgirl</title>
  9. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
  10. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
  11. crossorigin="anonymous">
  12. <link rel="stylesheet"
  13. href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt"
  14. crossorigin="anonymous">
  15. <link rel="preconnect" href="https://fonts.googleapis.com">
  16. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  17. <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
  18. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
  19. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.min.css">
  20. <link rel="stylesheet" href="./styleMV.css">
  21. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  22. <title>AI Spokesgirl</title>
  23. <style>
  24. .input-sec {
  25. box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
  26. -webkit-box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
  27. position: relative;
  28. }
  29. .upload-cta {
  30. position: absolute;
  31. left: 0;
  32. top: 0;
  33. }
  34. .upload-cta.box-active {
  35. height: 80px;
  36. width: 80px;
  37. background-size: cover !important;
  38. background-repeat: no-repeat;
  39. border-radius: 1rem;
  40. }
  41. #msform .img-inputTest {
  42. text-align: end;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <!-- ================================================================= -->
  48. <!-- navbar -->
  49. <nav class="navbar navbar-expand-lg navbar-light">
  50. <div class="container-fluid">
  51. <a class="navbar-brand" href="index.html">AI Spokesgirl</a>
  52. <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
  53. data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
  54. aria-label="Toggle navigation">
  55. <span class="navbar-toggler-icon"></span>
  56. </button>
  57. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  58. <!-- <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
  59. <li class="nav-item">
  60. <a class="nav-link active" aria-current="page" href="pricing.html" set-lan="html:pricing">早鳥方案</a>
  61. </li>
  62. <li class="nav-item dropdown">
  63. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
  64. 中/En
  65. </a>
  66. <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
  67. <li><button class="nav-link lan-swtich" aria-current="page" set-lan="html:en" onclick="changeLan(this)" value="en">English</button></li>
  68. <li><button class="nav-link lan-switch" aria-current="page" set-lan="html:zh" onclick="changeLan(this)" value="zh">中文</button></li>
  69. </ul>
  70. </li>
  71. <li class="nav-item">
  72. <a class="nav-link active btn-login" aria-current="page" href="login.html" set-lan="html:login">登入</a>
  73. </li>
  74. <li class="nav-item">
  75. <a class="nav-link btn-userProfile" aria-current="page" href="./user_profile2.html" set-lan="html:user_profile">會員資料</a>
  76. </li>
  77. <li class="nav-item">
  78. <a class="nav-link btn-logout" aria-current="page" set-lan="html:logout">登出</a>
  79. </li>
  80. </ul> -->
  81. </div>
  82. </div>
  83. </nav>
  84. <!-- ================================================================= -->
  85. <!-- ================================================================= -->
  86. <!-- content -->
  87. <div class="container-fluid px-0">
  88. <div class="container-fluid">
  89. <!-- <div id="mySidenav" class="sidenav">
  90. <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
  91. <h2 class="go_title" href="index.html"><a class="nav-link active" aria-current="page" href="index.html">AI Spokesgirl</a></h2>
  92. <ul class="nav-list">
  93. <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>
  94. <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>
  95. </ul>
  96. <p class="right-text text-white d-inline-block">Choozmo All Rights Reserved</p>
  97. </div> -->
  98. <div id="mySidenav" class="sidenav">
  99. <!-- <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a> -->
  100. <div class="sidenav-content">
  101. <div class="text-start mt-3">
  102. <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>
  103. </div>
  104. <div class="userName"></div>
  105. <img class="user img-fluid rounded-circle" src="img/userimg.png" alt="">
  106. <p class="text-white my-3 text-center" set-lan="html:Createsthtoday">今天要做甚麼影片呢?</p>
  107. <div class="navbar-nav mb-2 mb-lg-0 px-3 pe-4">
  108. <a class="nav-link btn-gocreate text-white col btn-makev" aria-current="page" href="./make_video.html" >影片製作</a>
  109. <!-- <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> -->
  110. </div>
  111. <!-- <div class="navbar-nav mb-2 mb-lg-0 px-3 pe-4">
  112. <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>
  113. <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>
  114. </div> -->
  115. <hr>
  116. <ul class="nav-list ps-0">
  117. <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal" data-bs-target="#howto"><i
  118. class="fas fa-book-open me-2"></i>
  119. <lan set-lan="html:usage_intro">使用說明</lan>
  120. </li>
  121. <!-- <a style="text-decoration: none;color:white;" href="./user_profile2.html">
  122. <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal">
  123. <i class="fas fa-user me-2"></i>
  124. <lan set-lan="html:user_profile">會員資料</lan>
  125. </li>
  126. </a> -->
  127. <li class="nav-list-item pb-1" data-bs-toggle="modal" data-bs-target="#history" onclick="openNav()">
  128. <i class="fas fa-history me-2"></i>
  129. <lan set-lan="html:history">歷史紀錄</lan>
  130. </li>
  131. </ul>
  132. </div>
  133. <div class="right-text">
  134. <a target="_blank" href="http://www.choozmo.com/">| 官網 |</a>
  135. <a target="_blank" href="https://www.linkedin.com/company/choozmo/mycompany/"><img
  136. style="width: 20px;" src="img/linkedin-logo-copy.png" alt=""></a>
  137. <a target="_blank" href="https://www.facebook.com/choozmo/"><img style="width: 20px;"
  138. src="img/facebook_logos_PNG19753.png" alt=""></a>
  139. <a target="_blank" href="https://www.instagram.com/choozmo_cmm/"><img style="width: 20px;"
  140. src="img/IG.png" alt=""></a>
  141. <a target="_blank" href="https://line.me/R/ti/p/@choozmo?from=page"><img style="width: 20px;"
  142. src="img/LINE_logo.svg.png" alt=""></a>
  143. <a target="_blank" href="https://www.youtube.com/channel/UC2Qda9PhJWuiMTCZ-j7K_hg"><img
  144. style="width: 20px;" src="img/youtube.png" alt=""></a>
  145. <a target="_blank" href="https://twitter.com/ai_cmm"><img style="width: 20px;"
  146. src="img/twitter.png" alt=""></a>
  147. <p class="Reserved text-white text-start mt-3 ps-2">Choozmo All Rights Reserved</p>
  148. </div>
  149. </div>
  150. <!-- <span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; 過去紀錄</span> -->
  151. <div class="content ms-auto">
  152. <form id="msform">
  153. <div class="linker__box">
  154. <p set-lan="html:preview_videos">預覽影片</p>
  155. <i class="fas fa-link copy"></i>
  156. <a id='linker' style="display: none;" class="ms-2" set-lan="html:video_link">影片連結</a>
  157. </div>
  158. <!-- fieldsets -->
  159. <fieldset>
  160. <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>
  161. <input id=title type="text" name='t1' class='title_new' value="" set-lan="placeholder:video_title" placeholder="標題"/> <br/>
  162. </fieldset>
  163. <fieldset>
  164. <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>
  165. <select id="avatar" class='avatar'>
  166. <option set-lan="html:p_choose_character" value="請選擇人物" selected="selected" disabled>>請選擇人物</option>
  167. <option value="7">Peggy</option>
  168. <option value="8">Stacy</option>
  169. <option value="10">Nina</option>
  170. <option value="11">Summer韓小夏</option>
  171. <option value="12">Jocelyn</option>
  172. <option value="13">Angela</option>
  173. <option value="15">Isabela</option>
  174. <option value="16">Sofia</option>
  175. <option value="17">Kristina</option>
  176. <option value="18">Paula</option>
  177. </select>
  178. <div class="d-flex row">
  179. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Peggy" data-img="peggy">
  180. <div class="imgfr"><img src="img/peggy.webp" class="card-img-top" alt="..."></div>
  181. <div class="card-body">
  182. <h5 class="card-title">Peggy</h5>
  183. </div>
  184. </div>
  185. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Stacy" data-img="stacy">
  186. <div class="imgfr"><img src="img/stacy.webp" class="card-img-top" alt="..."></div>
  187. <div class="card-body">
  188. <h5 class="card-title">Stacy</h5>
  189. </div>
  190. </div>
  191. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Nina" data-img="nina">
  192. <div class="imgfr"><img src="img/nina.webp" class="card-img-top" alt="..."></div>
  193. <div class="card-body">
  194. <h5 class="card-title">Nina</h5>
  195. </div>
  196. </div>
  197. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Summer韓小夏" data-img="summer韓小夏">
  198. <div class="imgfr"><img src="img/summer韓小夏.webp" class="card-img-top" alt="..."></div>
  199. <div class="card-body">
  200. <h5 class="card-title">Summer韓小夏</h5>
  201. </div>
  202. </div>
  203. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Jocelyn" data-img="Jocelyn">
  204. <div class="imgfr"><img src="img/Jocelyn.png" class="card-img-top" alt="..."></div>
  205. <div class="card-body">
  206. <h5 class="card-title">Jocelyn</h5>
  207. </div>
  208. </div>
  209. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Angela" data-img="Angela">
  210. <div class="imgfr"><img src="img/Angela.webp" class="card-img-top" alt="..."></div>
  211. <div class="card-body">
  212. <h5 class="card-title">Angela</h5>
  213. </div>
  214. </div>
  215. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Isabela" data-img="Isabela">
  216. <div class="imgfr"><img src="img/Isabela.webp" class="card-img-top" alt="..."></div>
  217. <div class="card-body">
  218. <h5 class="card-title">Isabela</h5>
  219. </div>
  220. </div>
  221. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Sofia" data-img="Sofia">
  222. <div class="imgfr"><img src="img/Sofia.webp" class="card-img-top" alt="..."></div>
  223. <div class="card-body">
  224. <h5 class="card-title">Sofia</h5>
  225. </div>
  226. </div>
  227. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Kristina" data-img="Kristina">
  228. <div class="imgfr"><img src="img/Kristina.webp" class="card-img-top" alt="..."></div>
  229. <div class="card-body">
  230. <h5 class="card-title">Kristina</h5>
  231. </div>
  232. </div>
  233. <div class="card item col-6 col-sm-4 col-md-3 col-lg-2" data-avatar="Paula" data-img="Paula">
  234. <div class="imgfr"><img src="img/Paula.webp" class="card-img-top" alt="..."></div>
  235. <div class="card-body">
  236. <h5 class="card-title">Paula</h5>
  237. </div>
  238. </div>
  239. </div>
  240. </fieldset>
  241. <fieldset id='imgSrc' style="box-shadow: none;-webkit-box-shadow: none; padding: 0;">
  242. <h3 class="fs-subtitle" style="display: inline-block;"><lan set-lan="html:content">內容素材</lan>
  243. <img class="ms-1" src="img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right"
  244. title="放入您的台詞及圖片,圖片僅接受png, jpg, mp4格式 Type in your content and images. Supported File Formats: png, jpg, mp4.">
  245. </h3><br/>
  246. <label for="myCheck" set-lan="html:add_eng">加入英文:</label>
  247. <input type="checkbox" id="multiLang" > <br/>
  248. <div class="img-inputTest mt-3">
  249. </div>
  250. <span class="addsec">+</span>
  251. <input id="checker" type="button" name="next" class="next action-button" set-lan="value:submit" value="送出" />
  252. <!-- <span class="draft-btn" data-bs-toggle="tooltip" data-bs-placement="right" title="儲存為草稿 Save as draft" set-lan="html:save_draft_btn">存為草稿</span> -->
  253. <h3 style="display: none;" class="fs-subtitle"><lan set-lan="html:processing_progress">處理進度</lan></h3>
  254. <div style="display: none;" id="myProgress">
  255. <div style="display: none;" id="myBar">0%</div>
  256. </div>
  257. </fieldset>
  258. </form>
  259. <!-- <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> -->
  260. </div>
  261. <div class="modal fade" tabindex="-1" id="howto" aria-labelledby="howto" aria-hidden="true">
  262. <div class="modal-dialog">
  263. <div class="modal-content">
  264. <div class="modal-header">
  265. <h5 class="modal-title" id="staticBackdropLabel" set-lan="html:usage_intro">使用說明</h5>
  266. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  267. </div>
  268. <div class="modal-body">
  269. <div class="modal-terms">
  270. <ol class="ps-0">
  271. <li set-lan="html:one_line_to_one_img">1. 一句台詞請對應提供一個影像連結做為搭配</li>
  272. <li><lang set-lan="html:sup_img_profile">2. 影像連結檔案格式支援:</lang><stong class="strong">.png, jpg, .mp4</stong></li>
  273. <li set-lan="html:submit_to_wait">3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
  274. </ol>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. <div class="modal" tabindex="-1" id="history" aria-labelledby="history" aria-hidden="true">
  281. <div class="modal-dialog modal-dialog-scrollable">
  282. <div class="modal-content">
  283. <div class="modal-header">
  284. <h5 class="modal-title" id="staticBackdropLabel" set-lang="html:history">歷史紀錄</h5>
  285. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  286. </div>
  287. <div class="modal-body">
  288. <div class="modal-terms">
  289. <div class="loader"><img src="img/bx_loader.gif" alt=""></div>
  290. <ol class="ps-0 historyList">
  291. </ol>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. <div class="modal" tabindex="-1" id="avatarmega" aria-labelledby="history" aria-hidden="true">
  298. <div class="modal-dialog modal-dialog-centered">
  299. <div class="modal-content text-center">
  300. <div class="modal-body">
  301. <img class="modal-img" src="" alt="">
  302. <h5 class="modal-title mt-2"></h5>
  303. <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. <!-- ================================================================= -->
  311. <!-- ================================================================= -->
  312. <!-- footer -->
  313. <footer class="fixed-bottom text-center py-2">
  314. </footer>
  315. <!-- ================================================================= -->
  316. <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
  317. <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
  318. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
  319. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
  320. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
  321. <script>
  322. const card = document.getElementsByClassName('card');
  323. var client_id = Date.now()
  324. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  325. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  326. return new bootstrap.Tooltip(tooltipTriggerEl)
  327. });
  328. var myModal = new bootstrap.Modal(document.getElementById('history'), {
  329. keyboard: false
  330. })
  331. var avatarModal = new bootstrap.Modal(document.getElementById('avatarmega'), {
  332. keyboard: false
  333. })
  334. var modalImg = document.querySelector("#avatarmega .modal-img");
  335. var modalTitle = document.querySelector("#avatarmega .modal-title");
  336. var avatarSelector = document.getElementById("avatar");
  337. avatarSelector.addEventListener('change', avatarChange);
  338. avatarChange();
  339. function addCardListener() {
  340. for (let i = 0; i < card.length; i++) {
  341. card[i].addEventListener('click', openavatarModel);
  342. }
  343. }
  344. addCardListener();
  345. function avatarChange() {
  346. var value = avatarSelector.options[avatarSelector.selectedIndex].text;
  347. for (let i = 0; i < card.length; i++) {
  348. card[i].classList.remove('active');
  349. if (card[i].dataset.avatar == value) {
  350. card[i].classList.add('active');
  351. }
  352. }
  353. }
  354. function openavatarModel() {
  355. console.log(this.dataset.img);
  356. modalImg.setAttribute("src", `img/${this.dataset.img}.webp`);
  357. modalTitle.textContent = `${this.dataset.avatar}`;
  358. avatarModal.show();
  359. }
  360. $('input[type=file]').on('change', prepareUpload);
  361. function prepareUpload(event) {
  362. files = event.target.files;
  363. var data = new FormData();
  364. console.log(files);
  365. //data.append('file', $('.img_up1').prop('files')[0]);
  366. data.append('file', files[0]);
  367. // append other variables to data if you want: data.append('field_name_x', field_value_x);
  368. //$(this).next().text('上傳中');
  369. console.log($(this).next());
  370. // $(this).next().html('<img src="img/Spinner-1s-181px.gif">');
  371. $.ajax({
  372. type: 'POST',
  373. processData: false, // important
  374. contentType: false, // important
  375. data: data,
  376. url: 'https://www.choozmo.com:8887/uploadfile',
  377. dataType: 'json',
  378. success: function (jsonData) {
  379. console.log(event.target.previousSibling);
  380. event.target.previousSibling.value = jsonData.msg;
  381. console.log(jsonData.msg);
  382. $(this).prev().val(jsonData.msg);
  383. const nextEl = event.target.nextSibling;
  384. nextEl.style.backgroundImage = `url(http://${jsonData.msg})`;
  385. // nextEl.style.backgroundImage = `url(https://cdn2.ettoday.net/images/6017/d6017847.jpg)`;
  386. // nextEl.nextSibling.classList.add('box-active');
  387. // nextEl.nextSibling.style.backgroundImage = `url(http://${jsonData.msg})`;
  388. //console.log($(this).next());
  389. // $(this).next().html('<img class="d-none"src="img/Spinner-1s-181px.gif">');
  390. $(this).html('');
  391. //$(this).next().text('上傳檔案');
  392. },
  393. error: function (error) {
  394. const nextEl = event.target.nextSibling;
  395. nextEl.style.backgroundImage = `url(./img/upload_img.png)`;
  396. $(this).html('');
  397. alert('圖片錯誤');
  398. }
  399. });
  400. }
  401. const button = document.querySelector('.next');
  402. $(".next").click(function () {
  403. button.setAttribute('disabled', '');
  404. setTimeout(function () {
  405. button.removeAttribute('disabled')
  406. }, 10000);
  407. avatar = $('.avatar').val();
  408. name_title = $('.title_new').val();
  409. txtARR = [];
  410. imgARR = [];
  411. var step;
  412. let contentIdx = document.querySelectorAll(".txtsrc").length;
  413. for (let i = 1; i < (contentIdx + 1); i++) {
  414. if ($(`.txtsrc${i}`).val() != "") {
  415. txtARR.push($(`.txtsrc${i}`).val())
  416. }
  417. }
  418. let imgIdx = document.querySelectorAll(".imgsrc").length;
  419. for (let i = 1; i < (imgIdx + 1); i++) {
  420. if ($(`.imgsrc${i}`).val() != "") {
  421. imgARR.push($(`.imgsrc${i}`).val())
  422. }
  423. }
  424. multiLang = 0;
  425. if ($('#multiLang').prop("checked")) {multiLang = 1;}
  426. dataOBJ = { "name": name_title, "text_content": txtARR, "image_urls": imgARR, "avatar": avatar,"multiLang":multiLang, "client_id": client_id }
  427. objstr = JSON.stringify(dataOBJ);
  428. console.log(dataOBJ);
  429. var xhr = new XMLHttpRequest();
  430. xhr.open("POST", "https://www.choozmo.com:8887/make_anchor_video_noAuth2");
  431. xhr.setRequestHeader("accept", "application/json");
  432. xhr.setRequestHeader("Content-Type", "application/json");
  433. xhr.onreadystatechange = function () {
  434. if (xhr.readyState === 4) {
  435. responseOBJ = JSON.parse(xhr.responseText)
  436. console.log(responseOBJ.msg);
  437. //let title = "資料已送出";
  438. let text;
  439. text = responseOBJ.msg.zh;
  440. Swal.fire({
  441. // title: title,
  442. icon: 'info',
  443. text: text,
  444. confirmButtonColor: '#3085d6',
  445. });
  446. }
  447. };
  448. var data = renderXHR_data(dataOBJ)
  449. console.log(data)
  450. result = xhr.send(objstr);
  451. });
  452. var loaded_data = ''
  453. function openNav() {
  454. document.getElementById("mySidenav").style.width = "250px";
  455. document.querySelector('.loader').style.display = "block";
  456. axios({
  457. method: 'post',
  458. url: 'https://www.choozmo.com:8887/history_input_noAuth',
  459. headers: {
  460. 'accept': 'application/json'
  461. },
  462. data: ''
  463. }).then(res => {
  464. console.log(res.data);
  465. loaded_data = res.data;
  466. var historyList = document.querySelector('.historyList');
  467. historyList.innerHTML = '';
  468. for (var obj of loaded_data) {
  469. var list = document.createElement('li');
  470. list.id = obj.id;
  471. // div-imgfr
  472. var divImgfr = document.createElement('div');
  473. divImgfr.classList.add('item_imgfr');
  474. var img = document.createElement('img');
  475. img.setAttribute('src', obj['image_urls'][0]);
  476. divImgfr.appendChild(img);
  477. // div-content
  478. var contentBox = document.createElement('div');
  479. contentBox.classList.add('content-box');
  480. var boxTitle = document.createElement('p');
  481. boxTitle.classList.add('box-title');
  482. boxTitle.textContent = obj.name;
  483. boxTitle.id = obj.id;
  484. console.log(loaded_data);
  485. boxTitle.setAttribute('onclick', `direct(${obj.id})`);
  486. var boxLink = document.createElement('span');
  487. boxLink.classList.add('box-link');
  488. boxLink.setAttribute("data-url", obj.link);
  489. boxLink.setAttribute('onclick', 'view()');
  490. boxLink.innerHTML = '<i class="fas fa-play-circle me-1"></i>觀看影片';
  491. contentBox.appendChild(boxTitle);
  492. contentBox.appendChild(boxLink);
  493. list.classList.add("historyList-item");
  494. list.setAttribute('onclick', `direct(${obj.id})`);
  495. list.appendChild(divImgfr);
  496. list.appendChild(contentBox);
  497. historyList.appendChild(list);
  498. }
  499. document.querySelector('.loader').style.display = "none";
  500. }).catch(err => {
  501. console.log(err);
  502. });
  503. }
  504. function closeNav() {
  505. document.getElementById("mySidenav").style.width = "250px";
  506. }
  507. function view() {
  508. event.stopPropagation();
  509. console.log(event.target);
  510. if (event.target.nodeName === 'I') {
  511. return;
  512. } else {
  513. window.open(`http://${event.target.dataset.url}`, '_blank');
  514. }
  515. }
  516. function renderXHR_data(jsonObj) {
  517. XHRstring = ''
  518. for (const [key, value] of Object.entries(jsonObj)) {
  519. console.log(value)
  520. if (typeof (value) == "object") {
  521. XHRstring += (key+'=['+value.join(',')+']&')
  522. }
  523. else {
  524. XHRstring += (key + '=' + value + '&')
  525. }
  526. }
  527. XHRstring = XHRstring.substring(0, XHRstring.length - 1);
  528. return XHRstring
  529. }
  530. function direct(id) {
  531. location.href = `make_video.html?id=${id}`;
  532. }
  533. function load_data(tid, loaded_data, draft = false) {
  534. if(!tid) {
  535. return;
  536. }
  537. var title = document.getElementById("title");
  538. var linker = document.getElementById("linker");
  539. myModal.hide();
  540. if(!draft) {
  541. linker.setAttribute('href', `http://${loaded_data.find(item => item.id == tid).link}`)
  542. linker.setAttribute('target', '_blank')
  543. $("#linker").html(`http://${loaded_data.find(item => item.id == tid).link}`)
  544. $("#linker").show();
  545. $(".linker__box").show();
  546. }
  547. console.log(loaded_data);
  548. let historyItem = loaded_data.filter(item => item.id == tid)[0];
  549. console.log(historyItem);
  550. if(draft) {
  551. $(".title_new").val(historyItem.title);
  552. $("#avatar").val(historyItem.avatar);
  553. } else {
  554. $(".title_new").val(loaded_data.find(item => item.id == tid).name);
  555. $("#avatar").val(historyItem.avatar);
  556. }
  557. let txtlength = historyItem.text_content.length;
  558. let imglength = historyItem.image_urls.length;
  559. console.log(txtlength);
  560. $('.img-inputTest').html('');
  561. for (let i = 0; i < txtlength; i++) {
  562. var input_sec = document.createElement('div');
  563. var img_box = document.createElement('div');
  564. input_sec.classList.add('input-sec', `input-sec${i+1}`, 'p-3', 'mb-3');
  565. img_box.classList.add('img-box');
  566. // text input
  567. var txtinput = document.createElement("input");
  568. txtinput.setAttribute('type', 'text');
  569. txtinput.setAttribute('name', `t${i+1}`);
  570. txtinput.classList.add('txtsrc', `txtsrc${i+1}`);
  571. txtinput.value = historyItem.text_content[i];
  572. txtinput.setAttribute('placeholder', `${i+1}`);
  573. input_sec.appendChild(txtinput);
  574. // img url input
  575. var imginput = document.createElement("input");
  576. imginput.setAttribute('type', 'text');
  577. imginput.setAttribute('name', `m${i+1}`);
  578. imginput.classList.add('imgsrc', `imgsrc${i+1}`);
  579. imginput.value = historyItem.image_urls[i];
  580. imginput.setAttribute('placeholder', 'https://example.com/4VKBo9w.png');
  581. img_box.appendChild(imginput);
  582. // img upload input
  583. var imgupload = document.createElement("input");
  584. imgupload.setAttribute('id', `img${i+1}`);
  585. imgupload.setAttribute('type', `file`);
  586. imgupload.classList.add('img_uploader', 'img_up');
  587. imgupload.style.display = "none";
  588. img_box.appendChild(imgupload);
  589. // img upload label
  590. var imguploadlabel = document.createElement("label");
  591. imguploadlabel.setAttribute('for', `img${i+1}`);
  592. imguploadlabel.classList.add('upload-btn');
  593. // imguploadlabel.textContent = '上傳圖片';
  594. imguploadlabel.setAttribute('set-lan', `html:upload_file`);
  595. imguploadlabel.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
  596. img_box.appendChild(imguploadlabel);
  597. imgupload.addEventListener('change', prepareUpload);
  598. // preview image
  599. // var imgPreBox = document.createElement("div");
  600. // imgPreBox.classList.add('upload-cta', 'box-active');
  601. // imgPreBox.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
  602. //img_box.appendChild(imgPreBox);
  603. input_sec.appendChild(img_box);
  604. document.querySelector('.img-inputTest').append(input_sec);
  605. }
  606. }
  607. getpathId();
  608. function getpathId(){
  609. let id = window.location.search.split('?').pop();
  610. return id.split('=')[1];
  611. }
  612. function getData() {
  613. axios({
  614. method: 'post',
  615. url: 'https://www.choozmo.com:8887/history_input_noAuth',
  616. headers: {
  617. 'accept': 'application/json'
  618. },
  619. data: ''
  620. }).then(res => {
  621. loaded_data = res.data;
  622. console.log(loaded_data);
  623. const id = getpathId();
  624. load_data(id, loaded_data);
  625. }).catch(err => {
  626. console.log(err);
  627. });
  628. }
  629. var subtitleInputs = document.querySelector(".subtitle-inputs");
  630. var imgInputs = document.querySelector(".img-inputs");
  631. let length = 3;
  632. function initial() {
  633. for (let i = 0; i < length; i++) {
  634. // rendertxtBlock(i + 1);
  635. //renderimgBlock(i + 1);
  636. renderInputSec(i+1) ;
  637. }
  638. console.log(document.querySelectorAll(".txtsrc").length + 1);
  639. }
  640. initial();
  641. getData();
  642. var addbtn = document.querySelector(".add");
  643. var addsecbtn = document.querySelector(".addsec");
  644. addsecbtn.addEventListener('click', addsecBlock);
  645. function addsecBlock() {
  646. let newsecIdx = document.querySelectorAll(".input-sec").length + 1;
  647. renderInputSec(newsecIdx);
  648. }
  649. function renderInputSec(i) {
  650. var input_sec = document.createElement('div');
  651. var img_box = document.createElement('div');
  652. input_sec.classList.add('input-sec', `input-sec${i}`, 'p-3', 'mb-3' ,'text-end');
  653. img_box.classList.add('img-box');
  654. // text input
  655. var txtinput = document.createElement("input");
  656. txtinput.setAttribute('type', 'text');
  657. txtinput.setAttribute('name', `t${i}`);
  658. txtinput.classList.add('txtsrc', `txtsrc${i}`);
  659. txtinput.value = "";
  660. txtinput.setAttribute('placeholder', `台詞`);
  661. input_sec.appendChild(txtinput);
  662. // img url input
  663. var imginput = document.createElement("input");
  664. imginput.setAttribute('type', 'text');
  665. imginput.setAttribute('name', `m${i}`);
  666. imginput.classList.add('imgsrc', `imgsrc${i}`);
  667. imginput.value = "";
  668. imginput.setAttribute('placeholder', 'https://example.com/4VKBo9w.png');
  669. img_box.appendChild(imginput);
  670. // img upload input
  671. var imgupload = document.createElement("input");
  672. imgupload.setAttribute('id', `img${i}`);
  673. imgupload.setAttribute('type', `file`);
  674. imgupload.classList.add('img_uploader', 'img_up');
  675. imgupload.style.display = "none";
  676. img_box.appendChild(imgupload);
  677. // img upload label
  678. var imguploadlabel = document.createElement("label");
  679. imguploadlabel.setAttribute('for', `img${i}`);
  680. imguploadlabel.classList.add('upload-btn');
  681. imguploadlabel.setAttribute('set-lan', `html:upload_file`);
  682. img_box.appendChild(imguploadlabel);
  683. imgupload.addEventListener('change', prepareUpload);
  684. // preview image
  685. // var imgPreBox = document.createElement("div");
  686. // imgPreBox.classList.add('upload-cta');
  687. // img_box.appendChild(imgPreBox);
  688. input_sec.appendChild(img_box);
  689. document.querySelector('.img-inputTest').append(input_sec);
  690. }
  691. </script>
  692. </body>
  693. </html>