Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
Make UI a little more easily expandable.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmtracey committed Mar 22, 2017
1 parent 6f385c5 commit 5b24499
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions views/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<label for="jsonOutput" class="o-forms__label">JSON</label>
<input type="radio" name="radio" value="vtt" class="o-forms__radio" id="vttOutput"></input>
<label for="vttOutput" class="o-forms__label">VTT</label>
<input type="radio" name="radio" value="srt" class="o-forms__radio" id="srtOutput"></input>
<label for="srtOutput" class="o-forms__label">SRT</label>
</div>

<label for="languageSelection" class="o-forms__label">Language</label>
Expand All @@ -46,6 +48,7 @@
<div class="o-buttons__group alternativeResults" data-hidden="true">
<button class="o-buttons" aria-selected="false" data-format="json">JSON</button>
<button class="o-buttons" data-format="vtt">VTT</button>
<button class="o-buttons" data-format="srt">SRT</button>
</div>

<pre class="output"></pre>
Expand Down Expand Up @@ -143,7 +146,7 @@
function displayResults(data, outputType){
resultsOutput.textContent = outputType === 'json' ? JSON.stringify(data) : data.vtt;
resultsOutput.textContent = outputType === 'json' ? JSON.stringify(data) : data.output;
resultsHolder.dataset.hidden = "false";
}
Expand All @@ -162,15 +165,17 @@
if(res.status === 200){
if(outputType === 'vtt'){
if(outputType !== 'json'){
return res.text()
.then(function(VTT){
.then(function(data){
return {
finished : true,
vtt: VTT
output: data
};
})
;
} else {
return res.json();
}
Expand Down Expand Up @@ -317,7 +322,7 @@
console.log('Click');
checkJobStatus(currentJobID, 'vtt')
.then(function(data){
videoPreview.show(URL.createObjectURL(fileData), URL.createObjectURL(new File([data.vtt], 'track.vtt')));
videoPreview.show(URL.createObjectURL(fileData), URL.createObjectURL(new File([data.output], 'track.vtt')));
})
;
}, false);
Expand All @@ -328,9 +333,11 @@
if(currentJobID !== undefined && jobInProgress === false){
checkJobStatus(currentJobID, this.dataset.format)
const selectedOutput = this.dataset.format
checkJobStatus(currentJobID, selectedOutput)
.then(function(data){
displayResults(data, data.vtt !== undefined ? 'vtt' : 'json');
displayResults(data, data.output !== undefined ? selectedOutput : 'json');
})
;
Expand Down

0 comments on commit 5b24499

Please sign in to comment.