-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-old.html
172 lines (150 loc) · 6.43 KB
/
index-old.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>Subtitle Generator</title>
<link rel="stylesheet" href="vendor/bootstrap-5.3.0/css/bootstrap.css">
<script src="vendor/bootstrap-5.3.0/js/bootstrap.bundle.js"></script>
<link rel="stylesheet" href="lib/lyric-editor.css">
<script src="lib/script.js"></script>
<script src="lib/ajax.js"></script>
<link rel="stylesheet" href="lib/icon.css">
</head>
<body>
<div class="all">
<div class="container">
<div class="editor1">
<div class="row">
<div class="col col-7">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Timeline</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Raw</button>
</li>
</ul>
<div class="tab-content" id="srt-tab-content">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<!-- list begin -->
<div class="srt-list-wrapper">
<div class="srt-list-container">
</div>
</div>
<!-- list end -->
</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<div class="srt-raw">
<textarea class="srt-text-raw" spellcheck="false"></textarea>
</div>
</div>
</div>
</div>
<div class="col col-5">
<div class="player">
<div class="text-display-container">
<div class="text-display">
<div class="text-display-inner d-flex align-items-center justify-content-center"></div>
</div>
</div>
<div class="player-controller">
<button class="btn btn-secondary button-play-master">Play</button>
<button class="btn btn-secondary button-pause-master">Pause</button>
<button class="btn btn-secondary button-scroll-master">Scroll</button>
<button class="btn btn-secondary button-save-master">Save</button>
</div>
</div>
</div>
</div>
<!-- controller drag begin -->
<div class="srt-map">
<div class="srt-map-first-layer">
<div class="srt-time-position">
<div class="srt-time-position-inner">
<div class="srt-time-position-pointer" data-toggle="tooltip" data-placement="top" title="00:00:00"></div>
</div>
</div>
<div class="srt-timestamp">
<canvas class="srt-timeline-canvas"></canvas>
</div>
<div class="srt-edit-area">
<div class="srt-waveform">
<canvas class="srt-timeline-canvas-edit" height="64" width="100%"></canvas>
</div>
<div class="srt-map-srt-container">
</div>
</div>
</div>
</div>
<!-- controller drag end -->
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="deleteItem" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="deleteItemLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteItemLabel">Delete Text</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Are you sure you want to delete this one?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger delete">OK</button>
</div>
</div>
</div>
</div>
<?php
$pathSong = '2023-05-23-19-00-00.mp3';
$pathSrt = $pathSong.'.srt';
?>
<script>
let pathSong = '<?php echo $pathSong;?>';
let pathSrt = '<?php echo $pathSrt;?>';
let rawData = '';
</script>
<script>
let srt;
let myModal;
let idToDelete = -1;
window.onload = function () {
ajax.post('load.php', {path:pathSong}, function(rawData, status) {
if(status != 200 || rawData == '')
{
rawData = `00:00:00,100 --> 00:00:05,100
{type here}`;
}
srt = new SrtGenerator('.editor1', rawData, pathSong);
srt.onDeleteData = function(index, countData)
{
if(countData > 1)
{
idToDelete = index;
myModal = new bootstrap.Modal(document.querySelector('#deleteItem'), {
keyboard: false
});
myModal.show();
document.querySelector('#deleteItem .delete').addEventListener('click', function(){
srt.deleteData(idToDelete);
idToDelete = -1;
myModal.hide();
});
}
}
document.querySelector('.button-save-master').addEventListener('click', function(){
srt.updateData();
rawData = srt.getFinalResult();
ajax.post('save.php', {path:pathSong, data:rawData}, function(response, status){
});
});
}, true);
}
</script>
</body>
</html>