|
|
@ -154,36 +154,66 @@ thrimbletrimmerDownload = function() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
thrimbletrimmerManualLink = function() {
|
|
|
|
thrimbletrimmerManualLink = function() {
|
|
|
|
|
|
|
|
document.getElementById("ManualButton").disabled = true;
|
|
|
|
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
|
|
|
|
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
|
|
|
|
|
|
|
|
body = {link: document.getElementById("ManualLink").value};
|
|
|
|
|
|
|
|
if (!!user) {
|
|
|
|
|
|
|
|
body.token = user.getAuthResponse().id_token;
|
|
|
|
|
|
|
|
}
|
|
|
|
fetch("/thrimshim/manual-link/"+rowId, {
|
|
|
|
fetch("/thrimshim/manual-link/"+rowId, {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|
'Accept': 'application/json',
|
|
|
|
'Accept': 'application/json',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
|
|
body: JSON.stringify(body)
|
|
|
|
link: document.getElementById("ManualLink").value,
|
|
|
|
|
|
|
|
token: user.getAuthResponse().id_token
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(response => response.text().then(text => {
|
|
|
|
.then(response => { if (!response.ok) { throw Error(response.statusText); }; return response; })
|
|
|
|
if (!response.ok) {
|
|
|
|
.then(data => { console.log(data); setTimeout(() => { alert("Manual link set"); }, 500); })
|
|
|
|
error = response.statusText + ": " + text;
|
|
|
|
.catch(error => { console.log(error); alert(error); });
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
alert(error);
|
|
|
|
|
|
|
|
document.getElementById("ManualButton").disabled = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert("Manual link set to " + body.link);
|
|
|
|
|
|
|
|
setTimeout(() => window.location.href = '/thrimbletrimmer/dashboard.html'; }, 500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
thrimbletrimmerResetLink = function() {
|
|
|
|
thrimbletrimmerResetLink = function() {
|
|
|
|
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
|
|
|
|
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
|
|
|
|
if(confirm('Are you sure you want to reset this event?')) {
|
|
|
|
if(!confirm(
|
|
|
|
|
|
|
|
'Are you sure you want to reset this event? ' +
|
|
|
|
|
|
|
|
'This will set the row back to UNEDITED and forget about any video that already may exist. ' +
|
|
|
|
|
|
|
|
'It is intended as a last-ditch command to clear a malfunctioning cutter, ' +
|
|
|
|
|
|
|
|
'or if a video needs to be re-edited and replaced. ' +
|
|
|
|
|
|
|
|
'IT IS YOUR RESPONSIBILITY TO DEAL WITH ANY VIDEO THAT MAY HAVE ALREADY BEEN UPLOADED. '
|
|
|
|
|
|
|
|
)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("ResetButton").disabled = true;
|
|
|
|
|
|
|
|
body = {}
|
|
|
|
|
|
|
|
if (!!user) {
|
|
|
|
|
|
|
|
body.token = user.getAuthResponse().id_token;
|
|
|
|
|
|
|
|
}
|
|
|
|
fetch("/thrimshim/reset/"+rowId, {
|
|
|
|
fetch("/thrimshim/reset/"+rowId, {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|
'Accept': 'application/json',
|
|
|
|
'Accept': 'application/json',
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: JSON.stringify({token: user.getAuthResponse().id_token})
|
|
|
|
body: JSON.stringify(body)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(response => { if (!response.ok) { throw Error(response.statusText); }; return response; })
|
|
|
|
.then(response => response.text().then(text => {
|
|
|
|
.then(data => { console.log(data); setTimeout(() => { window.location.reload() }, 500); })
|
|
|
|
if (!response.ok) {
|
|
|
|
.catch(error => { console.log(error); alert(error); });
|
|
|
|
error = response.statusText + ": " + text;
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
alert(error);
|
|
|
|
|
|
|
|
document.getElementById("ResetButton").disabled = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert("Row has been reset. Reloading...");
|
|
|
|
|
|
|
|
setTimeout(() => window.location.reload(); }, 500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
};
|
|
|
|