make_video_eng.html 41 KB

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