|
@@ -183,17 +183,17 @@ function prepareUpload(event) {
|
|
|
}
|
|
|
const nextEl = event.target.nextSibling;
|
|
|
nextEl.innerHTML = '';
|
|
|
- nextEl.textContent = '上傳檔案';
|
|
|
- nextEl.nextSibling.classList.add('box-active');
|
|
|
- nextEl.nextSibling.style.backgroundImage = `url(http://${jsonData.msg})`;
|
|
|
-
|
|
|
+ // nextEl.textContent = '上傳檔案';
|
|
|
+ nextEl.style.backgroundImage = `url(http://${jsonData.msg})`;
|
|
|
//console.log($(this).next());
|
|
|
//$(this).next().html('上傳檔案');
|
|
|
//$(this).next().text('上傳檔案');
|
|
|
+ $(this).html('');
|
|
|
},
|
|
|
error: function (error) {
|
|
|
- event.target.nextSibling.innerHTML = '';
|
|
|
- event.target.nextSibling.textContent = '上傳檔案';
|
|
|
+ const nextEl = event.target.nextSibling;
|
|
|
+ nextEl.style.backgroundImage = `url(./img/upload_img.png)`;
|
|
|
+ $(this).html('');
|
|
|
alert('圖片錯誤');
|
|
|
}
|
|
|
});
|
|
@@ -374,7 +374,7 @@ function get_jwt_token(){
|
|
|
}
|
|
|
|
|
|
function direct(id) {
|
|
|
- location.href = `make_video.html?id=${id}`;
|
|
|
+ location.href = `make_video2.html?id=${id}`;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -405,15 +405,16 @@ function load_data(tid, loaded_data, draft = false) {
|
|
|
|
|
|
let txtlength = historyItem.text_content.length;
|
|
|
let imglength = historyItem.image_urls.length;
|
|
|
+ let flag = txtlength >= imglength ? txtlength : imglength;
|
|
|
|
|
|
//subtitleInputs.innerHTML = '';
|
|
|
// imgInputs.innerHTML = '';
|
|
|
$('.img-inputTest').html('');
|
|
|
- for (let i = 0; i < txtlength; i++) {
|
|
|
+ for (let i = 0; i < flag; i++) {
|
|
|
var input_sec = document.createElement('div');
|
|
|
var img_box = document.createElement('div');
|
|
|
|
|
|
- input_sec.classList.add('input-sec', `input-sec${i+1}`, 'p-3', 'mb-3');
|
|
|
+ input_sec.classList.add('input-sec', `input-sec${i+1}`, 'p-3', 'mb-3', 'text-end');
|
|
|
img_box.classList.add('img-box');
|
|
|
|
|
|
// text input
|
|
@@ -423,7 +424,6 @@ function load_data(tid, loaded_data, draft = false) {
|
|
|
txtinput.classList.add('txtsrc', `txtsrc${i+1}`);
|
|
|
txtinput.value = historyItem.text_content[i];
|
|
|
txtinput.setAttribute('placeholder', `${i+1}`);
|
|
|
- txtinput.style.width = "100%";
|
|
|
input_sec.appendChild(txtinput);
|
|
|
|
|
|
// img url input
|
|
@@ -432,6 +432,9 @@ function load_data(tid, loaded_data, draft = false) {
|
|
|
imginput.setAttribute('name', `m${i+1}`);
|
|
|
imginput.classList.add('imgsrc', `imgsrc${i+1}`);
|
|
|
imginput.value = historyItem.image_urls[i];
|
|
|
+ if(!historyItem.image_urls[i]) {
|
|
|
+ imginput.value = "";
|
|
|
+ }
|
|
|
imginput.setAttribute('placeholder', 'https://example.com/4VKBo9w.png');
|
|
|
img_box.appendChild(imginput);
|
|
|
|
|
@@ -447,17 +450,16 @@ function load_data(tid, loaded_data, draft = false) {
|
|
|
var imguploadlabel = document.createElement("label");
|
|
|
imguploadlabel.setAttribute('for', `img${i+1}`);
|
|
|
imguploadlabel.classList.add('upload-btn');
|
|
|
- imguploadlabel.textContent = '上傳圖片';
|
|
|
+ // imguploadlabel.textContent = '上傳圖片';
|
|
|
imguploadlabel.setAttribute('set-lan', `html:upload_file`);
|
|
|
+ if(!historyItem.image_urls[i]) {
|
|
|
+ imguploadlabel.style.backgroundImage = `url(static/img/upload_img.png)`;
|
|
|
+ } else {
|
|
|
+ imguploadlabel.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
|
|
|
+ }
|
|
|
img_box.appendChild(imguploadlabel);
|
|
|
imgupload.addEventListener('change', prepareUpload);
|
|
|
|
|
|
- // preview image
|
|
|
- var imgPreBox = document.createElement("div");
|
|
|
- imgPreBox.classList.add('upload-cta', 'box-active');
|
|
|
- imgPreBox.style.backgroundImage = `url(${historyItem.image_urls[i]})`;
|
|
|
-
|
|
|
- img_box.appendChild(imgPreBox);
|
|
|
input_sec.appendChild(img_box);
|
|
|
document.querySelector('.img-inputTest').append(input_sec);
|
|
|
}
|
|
@@ -610,7 +612,7 @@ function renderInputSec(i) {
|
|
|
var input_sec = document.createElement('div');
|
|
|
var img_box = document.createElement('div');
|
|
|
|
|
|
- input_sec.classList.add('input-sec', `input-sec${i}`, 'p-3', 'mb-3');
|
|
|
+ input_sec.classList.add('input-sec', `input-sec${i}`, 'p-3', 'mb-3', 'text-end');
|
|
|
img_box.classList.add('img-box');
|
|
|
|
|
|
// text input
|
|
@@ -620,7 +622,6 @@ function renderInputSec(i) {
|
|
|
txtinput.classList.add('txtsrc', `txtsrc${i}`);
|
|
|
txtinput.value = "";
|
|
|
txtinput.setAttribute('placeholder', `台詞`);
|
|
|
- txtinput.style.width = "100%";
|
|
|
input_sec.appendChild(txtinput);
|
|
|
|
|
|
// img url input
|
|
@@ -644,16 +645,11 @@ function renderInputSec(i) {
|
|
|
var imguploadlabel = document.createElement("label");
|
|
|
imguploadlabel.setAttribute('for', `img${i}`);
|
|
|
imguploadlabel.classList.add('upload-btn');
|
|
|
- imguploadlabel.textContent = '上傳圖片';
|
|
|
+ // imguploadlabel.textContent = '上傳圖片';
|
|
|
imguploadlabel.setAttribute('set-lan', `html:upload_file`);
|
|
|
img_box.appendChild(imguploadlabel);
|
|
|
imgupload.addEventListener('change', prepareUpload);
|
|
|
|
|
|
- // preview image
|
|
|
- var imgPreBox = document.createElement("div");
|
|
|
- imgPreBox.classList.add('upload-cta');
|
|
|
- img_box.appendChild(imgPreBox);
|
|
|
-
|
|
|
input_sec.appendChild(img_box);
|
|
|
document.querySelector('.img-inputTest').append(input_sec);
|
|
|
}
|