-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
84 lines (69 loc) · 3.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" type="text/css" href="reset.css"/>
<title>Create Subtitles</title>
</head>
<body>
<div id="divmain">
<h1 class="c1">CREATE SUBTITLES</h1>
<p id="welcome">Welcome to Create Subtitles. By Matheus Junqueira.<br>More informations on <a href="https://www.github.com/mydaegon">github.com/mydaegon</a><br>Minutes, seconds and hundredths must have 2 numbers. (Ex.: For 2 seconds, use 02).</p>
<form id="form">
<p>Insert text to add here</p><br>
<textarea name="" id="sub" cols="30" rows="4" placeholder="Insert text here"></textarea>
<br>
<p class="a">Insert text start time</p><br>
<input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="3" id="min" placeholder="Minute" size="6">
<label> <strong>:</strong> </label><input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="2" id="sec" placeholder="Second" size="6">
<label> <strong>,</strong> </label><input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="2" id="hun" placeholder="Hundredth" size="6">
<br>
<p class="a">Insert text end time</p><br>
<input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="3" id="minend" placeholder="Minute" size="6">
<label> <strong>:</strong> </label><input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="2" id="secend" placeholder="Second" size="6">
<label> <strong>,</strong> </label><input type="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57" maxlength="2" id="hunend" placeholder="Hundredth" size="6">
<br>
<br>
<br>
<label> </label> <button onclick="AddToSRT()" type="submit"> Add </button>
</form>
<br>
<h3 class="c1">Your .SRT Subtitle</h3>
<br>
<p id="SRT"></p>
<input type="text" id="namesrt" placeholder="Subtitle's Name" size="14">
<button onclick="CTF()">Download</button>
</div>
</body>
<script src="FileSaver.js"></script>
<script language="Javascript">
var Num = 0;
var Tex = "";
console.log(legenda);
function CTF(){
var name = document.getElementById("namesrt").value;
var blob = new Blob([Tex],
{
type: "text/plain;charset=utf-8"
}
);
saveAs(blob, name + ".srt");
}
function AddToSRT(){
var sub = document.getElementById('sub').value;
var min = document.getElementById("min").value;
var sec = document.getElementById("sec").value;
var hun = document.getElementById("hun").value;
var min_end = document.getElementById("minend").value;
var sec_end = document.getElementById("secend").value;
var hun_end = document.getElementById("hunend").value;
var newTxt = "00:" + min + ":" + sec + "," + hun + "0" +" --> " + "00:" + min_end + ":" + sec_end + "," + hun_end + "0";
Num++;
document.getElementById("SRT").innerHTML += Num + '<br>' + newTxt + '<br>' + sub + '<br>' + '<br>';
Tex += Num + '\r\n' + newTxt + '\r\n' + sub + '\r\n' + '\r\n';
event.preventDefault();
}
</script>
</html>