test_eng.html 40 KB

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