forked from wilsonlmh/fiveLoadSub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
2785 lines (2478 loc) · 144 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
fiveLoadSub v1.3.2 (c) 2015 by Wilson Luniz @ Previous Production Macau. Licensed under the GPLv3 license
See http://github.com/wilsonlmh/fiveLoadSub/ for license and more info
-->
<!--
Some code documentation:
MVC concept:
Model -> Proto${modelname}
View/ViewController -> UI
Controller -> Background
-->
<!doctype html>
<html>
<script>
//Static Define Variables
var $__VERSION = '1.3.3';
var $__UPDATEURL = 'http://github.com/wilsonlmh/fiveLoadSub/archive/dist.zip';
var $__CHECKURL = 'rawgit.com/wilsonlmh/fiveLoadSub/dist/version'; //without http://
</script>
<head>
<meta charset="UTF-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="keywords" content="fiveLoadSub,subtitle,Subtitling,SRT,SBV,FLS" />
<meta name="description" content="Open source web-based subtitling software" />
<meta name="author" content="Wilson Luniz" />
<meta name="copyright" content="(c)Wilson Luniz @ Previous Production Macau. This software release under GPLv3. Some of component may follow other license." />
<title>fiveLoadSub</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
background: #565656;
overflow: hidden;
}
a:link {
color: inherit;
text-decoration: none;
}
a:hover {
color: inherit;
text-decoration: none;
}
a:active {
color: inherit;
text-decoration: none;
}
a {
color: inherit;
text-decoration: none;
}
#mainContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#headerFrame {
width: 100%;
background: #333;
height: 90px;
color: #FFF;
text-align: center;
float: left;
padding-top: 5px;
padding-bottom: 5px;
}
#ribbonToggleDiv {
display: block;
line-height: 120px;
text-align: right;
vertical-align: bottom;
float: right;
}
#videoFrame {
background: #000;
width: 50%;
border: 1px solid #666;
float: left;
position: relative;
}
#verticalDragDiv {
display: block;
width: 100%;
float: left;
height: 1px;
padding: 0;
margin: 0;
color: white;
background: white;
}
#verticalDragLine {
width: 100%;
height: 1px;
opacity: 0;
padding: 0;
margin: 0;
color: white;
background: white;
}
#horizontalDragDiv {
width: 1px;
height: 50px;
display: inline-block;
float: left;
padding: 0;
margin: 0;
color: white;
background: white;
}
#horizontalDragLine {
width: 1px;
height: 50px;
opacity: 0;
display: inline-block;
float: left;
padding: 0;
margin: 0;
color: white;
background: white;
}
#subtitleFrame {
border: 1px solid #666;
float: left;
overflow: hidden;
}
#subtitleToolbar {
float: left;
width: 100%;
background: #CDCDCD;
min-height: 24px;
padding-top: 10px;
padding-bottom: 10px;
font-weight: bold;
}
#subtitleTextArea {
width: 100%;
padding: 0;
margin: 0;
border: 0px;
resize: none;
overflow-y: hidden;
overflow-x: scroll;
background: #565656;
word-wrap: off;
color: white;
}
#subtitleTextArea::-webkit-input-placeholder {
font-size: 36px;
}
#subtitleTextArea::-moz-placeholder {
font-size: 36px;
}
#waveformFrame {
float: left;
width: 100%;
padding: 0;
margin: 0;
border-top: 1px solid #666;
height: 100%;
background: #144F3D;
color: #FFF;
}
.imgButton {
float: left;
text-align: center;
min-width: 130px;
padding: 0;
border: 0;
margin-left: 5px;
margin-right: 5px;
}
.imgButton img {
text-align: center;
}
.imgButton br {}
.imgButton:hover {
opacity: 0.7;
}
.imgButton:active {
opacity: 1;
filter: brightness(50%);
-webkit-filter: brightness(50%);
-moz-filter: brightness(50%);
filter: url(#brightness);
}
.selected_li {
background: #F99;
}
.subtitle_li {
list-style: none;
text-align: center;
color: #FFF;
}
#subtitleLineCount {
float: left;
width: 50px;
background: #000;
color: #FFF;
}
.subtitleElements {
font-size: 12px;
margin: 0;
padding: 0;
border: 0;
line-height: 1.5;
}
#subtitleFormContainer {
width: 100%;
margin: 0;
padding: 0;
border: 0;
overflow-y: scroll;
overflow-x: hidden;
float: left;
white-space: nowrap;
}
#subtitleOverlay {
float: left;
color: #FFF;
position: absolute;
background-color: rgba(0, 0, 0, 0.5);
bottom: 50px;
left: 5%;
min-height: 20px;
text-align: center;
width: 90%;
font-size: 1.8vw;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
</style>
<style>
/*Pin Tabs*/
/* Tabbed example */
div.pinTabs {
min-height: 7em;
/* No height: can grow if :target doesn't work */
position: relative;
/* Establish a containing block */
line-height: 1;
/* Easier to calculate with */
z-index: 0
}
/* So that we can put other things behind */
div.pinTabs > div {
display: inline
}
/* We want the buttons all on one line */
div.pinTabs > div > a {
color: black;
/* Looks more like a button than a link */
background: #CCC;
/* Active tabs are light gray */
padding: 0.2em;
/* Some breathing space */
border: 0.1em outset #BBB;
/* Make it look like a button */
border-bottom: 0.1em solid #CCC
}
/* Visually connect tab and tab body */
div.pinTabs > div:not(:target) > a {
border-bottom: none;
/* Make the bottom border disappear */
background: #EEE;
}
/* Inactive tabs are dark gray */
div.pinTabs > div:target > a,
/* Apply to the targeted item or... */
:target #default2 > a {
/* ... to the default item */
border-bottom: 0.1em solid #FFF;
/* Visually connect tab and tab body */
background: #FFF;
}
/* Active tab is light gray */
div.pinTabs > div > div {
background: #FFF;
border-top: 0.1em solid #BBB;
/* Light gray */
z-index: -2;
/* Behind, because the borders overlap */
left: 0;
top: 1.3em;
/* The top needs some calculation... */
right: 0;
/* Scroll bar if needed */
padding: 0.3em;
}
div.pinTabs > div:not(:target) > div {
/* Protect CSS1 & CSS2 browsers */
position: absolute;
visibility: hidden;
}
/* All these DIVs overlap */
div.pinTabs > div:target > div,
:target .default2 > div {
position: absolute;
/* All these DIVs overlap */
z-index: -1;
}
/* Raise it above the others */
div.pinTabs:target {
outline: none
}
</style>
<style>
/* Save Dialog Style*/
.promptDialog {
display: inline-block;
background-color: #FFF;
box-shadow: 4px 4px 12px -2px rgba(20%, 20%, 20%, 0.5);
border: #999 1px solid;
border-radius: 10px;
overflow: hidden;
vertical-align: middle;
line-height: normal;
padding: 0px;
padding-bottom: 10px;
min-width: 360px;
min-height: 150px;
}
#convertDialog {
min-width: 800px;
min-height: 600px;
}
#convertDialogContainer {
z-index: 100;
}
#saveDialogContainer {
z-index: 90;
}
.dialogContainer {
display: none;
line-height: 100vh;
width: 100%;
margin: 0;
padding: 0;
height: 100%;
position: fixed;
top: 0;
left: 0;
text-align: center;
background-color: rgba(0, 0, 0, 0.3);
z-index: 10;
}
.saveDialogChoiceBox {
display: inline-block;
border: #CCC 1px solid;
height: 100px;
width: 100px;
font-size: 45px;
overflow: hidden;
text-align: center;
line-height: 90px;
padding: 0;
margin: 5px;
vertical-align: central;
}
.saveDialogChoiceBox:hover {
background-color: #EEE;
}
.saveDialogChoiceBox:active {
background-color: #CCC;
}
.selectedSaveDialogChoiceBox {
background-color: #CCC;
}
</style>
<!-- Including -->
<script src="./inc/wavesurfer.min.js"></script>
<script src="./inc/wavesurfer.timeline.min.js"></script>
<script src="./inc/wavesurfer.regions.min.js"></script>
<script src="./inc/jszip.min.js"></script>
<script src="./inc/keypress-2.1.4.min.js"></script>
<script src="./inc/videoControl/richVideoControl.standalone.js"></script>
<script>
//Hacks, non-standard things
var __hack = {
isOpera: (!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0 || false),
isFirefox: (typeof InstallTrigger !== 'undefined'),
isSafari: (Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 || false),
isChrome: (!!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0 || false)),
isIE: (false || !!document.documentMode),
safari: {
download: {},
downloader: {}
},
chrome: {},
firefox: {},
};
if (__hack.isSafari) {
var imported = document.createElement('script');
imported.src = getFile('./inc/encoding-indexes.min.js');
document.head.appendChild(imported);
delete imported;
var imported = document.createElement('script');
imported.src = getFile('./inc/encoding.min.js');
document.head.appendChild(imported);
delete imported;
}
</script>
<script>
//functions from internet
function textareaScrollTo(line) {
var ta = document.getElementById("subtitleTextArea");
var lineHeight = ta.scrollHeight / (document.getElementById("subtitleTextArea").value.split('\n').length + 1);
var jump = Math.round(line * lineHeight - (document.getElementById("subtitleFormContainer").clientHeight / 2));
document.getElementById("subtitleFormContainer").scrollTop = jump;
}
function _string2ArrayBuffer(str) {
var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char
var bufView = new Uint16Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
function _arrayBuffer2String(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
var _appendBuffer = function (buffer1, buffer2) {
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
tmp.set(new Uint8Array(buffer1), 0);
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
return tmp.buffer;
};
function _zeroPad(num, places) {
var zero = places - num.toString().length + 1;
return Array(+(zero > 0 && zero)).join("0") + num;
}
function _makeTextFile(text, type) {
type = type || 'utf-8';
if (text) {
var textEncoder = {};
var prefixBuffer;
switch (type) {
case 'utf-16':
prefixBuffer = new Uint8Array([255, 254]); //magic of UTF-16:0xFFFE
textEncoder = new TextEncoder('UTF-16');
break;
default:
prefixBuffer = new Uint8Array([239, 187, 191]); //magic of UTF-18:0xEFBBBF
textEncoder = new TextEncoder('UTF-8');
}
var arrayBuffer = textEncoder.encode(text);
arrayBuffer = _appendBuffer(prefixBuffer, arrayBuffer);
var downloadBlob = new Blob([arrayBuffer], {
type: "text/plain"
});
return window.URL.createObjectURL(downloadBlob);
} else {
return false;
}
}
function _arrayBufferToBase64(arrayBuffer, type) {
var type = type || "utf-8";
switch (type) {
case 'utf-8':
var append = new Uint8Array([239, 187, 191]);
arrayBuffer = _appendBuffer(append, arrayBuffer);
break;
case 'utf-16':
var append = new Uint8Array([255, 254]);
arrayBuffer = _appendBuffer(append, arrayBuffer);
break;
default:
var append = new Uint8Array([239, 187, 191]);
arrayBuffer = _appendBuffer(append, arrayBuffer);
}
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
var byteRemainder = byteLength % 3
var mainLength = byteLength - byteRemainder
var a, b, c, d
var chunk
// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
// Combine the three bytes into a single integer
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]
// Use bitmasks to extract 6-bit segments from the triplet
a = (chunk & 16515072) >> 18 // 16515072 = (2^6 - 1) << 18
b = (chunk & 258048) >> 12 // 258048 = (2^6 - 1) << 12
c = (chunk & 4032) >> 6 // 4032 = (2^6 - 1) << 6
d = chunk & 63 // 63 = 2^6 - 1
// Convert the raw binary segments to the appropriate ASCII encoding
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]
}
// Deal with the remaining bytes and padding
if (byteRemainder == 1) {
chunk = bytes[mainLength]
a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2
// Set the 4 least significant bits to zero
b = (chunk & 3) << 4 // 3 = 2^2 - 1
base64 += encodings[a] + encodings[b] + '=='
} else if (byteRemainder == 2) {
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]
a = (chunk & 64512) >> 10 // 64512 = (2^6 - 1) << 10
b = (chunk & 1008) >> 4 // 1008 = (2^6 - 1) << 4
// Set the 2 least significant bits to zero
c = (chunk & 15) << 2 // 15 = 2^4 - 1
base64 += encodings[a] + encodings[b] + encodings[c] + '='
}
return base64
}
function ajax$load(url, callback, method) {
method = method || 'GET';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
callback(xhttp);
};
xhttp.open(method, url, true);
xhttp.send();
}
</script>
<!-- Updater Code Block -->
<script>
function com$checkUpdate() {
var chkProtocol = 'http://';
if (window.location.protocol == "https:") {
chkProtocol = 'https://';
}
ajax$load(chkProtocol + $__CHECKURL, function (e) {
if (e.readyState == 4 && e.status == 200) {
var searchRegex = new RegExp('__fls_v' + $__VERSION.replace(/\./gi, "\\\."));
var searchLine = e.responseText.split('\n')[0];
var searchResult = searchLine.search(searchRegex);
if (searchResult == -1) {
//Update needed
if (confirm('New version ' + searchLine.substr(searchResult + 7, searchLine.length) + ' released, download now?')) {
var tmpAnchorDOM = document.createElement('a');
tmpAnchorDOM.href = $__UPDATEURL;
tmpAnchorDOM.click();
}
}
}
});
}
function com$replaceVersionString(prefix) {
prefix = prefix || "";
//magic: __$VERSION$__
document.documentElement.innerHTML.replace(/\_\_\$VERSION\$\_\_/g, prefix + $__VERSION.toString());
}
</script>
<!-- Localize Code Block -->
<script>
function _GET(val) {
var result = undefined,
tmp = [];
location.search
//.replace ( "?", "" )
// this is better, there might be a question mark inside
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === val) result = decodeURIComponent(tmp[1]);
});
return result;
}
function parseLocalizeTable(csv) {
var lines = csv.split("\n");
var result = {};
var headers = lines[0].split(",");
for (var i = 1; i < lines.length; i++) {
var currentline = lines[i].split(",");
for (var j = 1; j < currentline.length; j++) {
result[headers[j]] = result[headers[j]] || {};
result[headers[j]][currentline[0]] = currentline[j];
}
}
return result;
}
function parseLocalizeAlias(csv) {
var lines = csv.split("\n");
var result = {};
for (var i = 1; i < lines.length; i++) {
var currentline = lines[i].split(",");
currentline[1] = currentline[1] || "";
result[currentline[0]] = currentline[1];
}
return result;
}
var localize = {
prefix: 'fiveLoadSub',
tableCSV: 'nth,en-us,zh-hk,zh-cn,fr\r\nmenu.importVideo,Import Video,\u532F\u5165\u5F71\u7247,\u5BFC\u5165\u5F71\u7247,Importer la Vid\u00E9o\r\nmenu.importSubtitle,Import Sub,\u532F\u5165\u5B57\u5E55/\u6587\u5B57,\u5BFC\u5165\u5B57\u5E55/\u6587\u672C,Importer des Sous-titres\r\nmenu.conversion,Conversion Tools,\u8F49\u63DB\u5DE5\u5177,\u8F6C\u6362\u5DE5\u5177,Outils de conversion\r\nmenu.saveSubtitle,Save Subtitle,\u5132\u5B58\u5B57\u5E55,\u5BFC\u51FA\u5B57\u5E55,Enregistrer des Sous-titres\r\nmenu.settings,Settings,\u8A2D\u5B9A,\u8BBE\u7F6E,Param\u00E8tres\r\nmenu.help,Help,\u8AAA\u660E,\u8BF4\u660E,Aide\r\nmenu.donation,Donation,\u8D0A\u52A9,\u8D5E\u52A9,Donation\r\nvideoPlayer.dropFileHere,Drop video here,\u62D6\u62FD\u5F71\u7247\u6216\u97F3\u983B\u5230\u6B64,\u62D6\u62FD\u5F71\u7247\u6216\u97F3\u9891\u5230\u6B64,D\u00E9poser la vid\u00E9o ici\r\ntextEditor.fontSize,Font Size,\u5B57\u9AD4\u5927\u5C0F,\u5B57\u4F53\u5927\u5C0F,Taille de police\r\ntextEditor.placeHolder,Paste text here,\u5728\u6B64\u8CBC\u4E0A\u6587\u5B57,\u5728\u6B64\u8D34\u4E0A\u6587\u5B57,Coller le texte ici\r\nsaveDialog.title,Select format to save,\u9078\u64C7\u5B58\u5132\u683C\u5F0F,\u9009\u62E9\u5BFC\u51FA\u683C\u5F0F,s\u00E9lectionner le format d\'enregistrement\r\nsaveDialog.xmlInputLabel.fcpx,Choose Final Cut Pro X Title Template(.fcpxml),\u532F\u5165Final Cut Pro X\u6A19\u984C\u6A23\u5F0F(.fcpxml),\u5BFC\u5165Final Cut Pro X\u6807\u9898\u6837\u5F0F(.fcpxml),Choisir Final Cut Pro X Titre Template (.fcpxml)\r\nsaveDialog.xmlInputLabel.fcp7,Choose Final Cut Pro 7 Title Template(.xml),\u532F\u5165Final Cut Pro 7\u6A19\u984C\u6A23\u5F0F(.xml),\u5BFC\u5165Final Cut Pro 7\u6807\u9898\u6837\u5F0F(.xml),Choisir Final Cut Pro 7 Titre Template(.xml)\r\nsaveDialog.xmlInputLabel.premiere,Choose Adobe Premiere Title Template(.prtl),\u532F\u5165Adobe Premiere\u6A19\u984C\u6A23\u5F0F(.prtl),\u5BFC\u5165Adobe Premiere\u6807\u9898\u6837\u5F0F(.prtl),Choisir Adobe Premiere Titre Template(.prtl)\r\nsaveDialog.xmlInfo.fillLabel,Fill some info of your video,\u8ACB\u8F38\u5165\u5F71\u7247\u7684\u8CC7\u8A0A,\u8BF7\u8F93\u5165\u5F71\u7247\u5C5E\u6027,Remplissez quelques informations de votre vid\u00E9o\r\nsaveDialog.xmlInfo.width,Width,\u5BEC\u5EA6,\u5BBD\u5EA6,Largeur\r\nsaveDialog.xmlInfo.height,Height,\u9AD8\u5EA6,\u9AD8\u5EA6,Hauteur\r\nsaveDialog.xmlInfo.frameRate,Frame Rate,\u5E40\u901F,\u5E27\u901F\u7387,Fr\u00E9quence Image\r\nsaveDialog.copyFromHereLabel,Copy from here,\u7531\u6B64\u5FA9\u5236,\u7531\u6B64\u590D\u5236,Copier d\'ici\r\nsaveDialog.cacnel,Cacnel,\u53D6\u6D88,\u53D6\u6D88,Annuler\r\nsaveDialog.saveAs,Save As...,\u5B58\u5132...,\u5BFC\u51FA...,Enregistrer\r\nsaveDialog.safariPrompt.fcp7,Press \u2318+S and save as 1.xml in the next page!,\u5728\u4E0B\u4E00\u9801\u6309\u2318+S\u5132\u5B58\u70BA1.xml !,\u5728\u4E0B\u4E00\u9875\u6309\u2318+S\u4FDD\u5B58\u4E3A1.xml !,Appuyez sur \u2318 + S et enregistrer en tant que 1.xml dans la page suivante!\r\nsaveDialog.safariPrompt.fcpx,Press \u2318+S and save as 1.fcpxml in the next page!,\u5728\u4E0B\u4E00\u9801\u6309\u2318+S\u5132\u5B58\u70BA1.fcpxml !,\u5728\u4E0B\u4E00\u9875\u6309\u2318+S\u4FDD\u5B58\u4E3A1.fcpxml !,Appuyez sur \u2318 + S et enregistrer en tant que 1.fcpxml dans la page suivante!\r\nsaveDialog.safariPrompt.pr,Press \u2318+S and save as 1.zip in the next page!,\u5728\u4E0B\u4E00\u9801\u6309\u2318+S\u5132\u5B58\u70BA1.zip !,\u5728\u4E0B\u4E00\u9875\u6309\u2318+S\u4FDD\u5B58\u4E3A1.zip! ,Appuyez sur \u2318 + S et enregistrer en tant que 1.zip dans la page suivante!\r\nconvertDialog.title,Convert Tools,\u8F49\u63DB\u5DE5\u5177,\u8F6C\u6362\u5DE5\u5177,Outil de conversion\r\nconvertDialog.OK,OK,\u78BA\u5B9A,\u786E\u5B9A,OK\r\nconvertDialog.cancel,Cancel,\u53D6\u6D88,\u53D6\u6D88,Annuler\r\nconvertDialog.selection.removeEmptyLines,Remove empty lines,\u79FB\u9664\u7A7A\u884C,\u79FB\u9664\u7A7A\u884C,Supprimer les lignes vides\r\nconvertDialog.selection.splitSpaces,Split lines by spaces,\u5C07\u7A7A\u683C\u8F49\u63DB\u70BA\u5206\u884C,\u5C06\u7A7A\u683C\u8F6C\u6362\u4E3A\u5206\u884C,S\u00E9parer les lignes par des espaces\r\nconvertDialog.selection.removePunctuations,Remove punctuations(and turn comma,periods etc. to space),\u79FB\u9664\u6A19\u9EDE\u7B26\u865F(\u4E26\u628A\u9017\u865F\u53E5\u865F\u7B49\u8B8A\u70BA\u7A7A\u683C),\u79FB\u9664\u6807\u70B9\u7B26\u53F7(\u5E76\u628A\u9017\u53F7\u53E5\u53F7\u7B49\u53D8\u4E3A\u7A7A\u683C),\"Retirer les ponctuations (et changer des virgules, des points etc. \u00E0 des espaces)\"\r\nconvertDialog.selection.splitPunctuations,Remove punctuations(and turn comma,periods etc. to new line),\u79FB\u9664\u6A19\u9EDE\u7B26\u865F(\u4E26\u628A\u9017\u865F\u53E5\u865F\u7B49\u8B8A\u70BA\u63DB\u884C),\u79FB\u9664\u6807\u70B9\u7B26\u53F7(\u5E76\u628A\u9017\u53F7\u53E5\u53F7\u7B49\u53D8\u4E3A\u63DB\u884C),\"Retirer les ponctuations (et changer des virgules, des points etc. \u00E0 une nouvelle ligne)\"\r\nconvertDialog.selection.removeQuotes,Remove Quotes,\u79FB\u9664\u5F15\u865F,\u79FB\u9664\u5F15\u53F7,Supprimer les guillemets\r\nconvertDialog.selection.charsetImportFile,Import subtitle\/text file to convert,\u532F\u5165\u6587\u5B57\u6216\u5B57\u5E55\u6A94\u6848\u8F49\u63DB,\u5BFC\u5165\u6587\u672C\u6216\u5B57\u5E55\u6863\u6848\u8F6C\u6362,Importer des sous-titres \/ fichier texte \u00E0 convertir\r\nconvertDialog.selection.charsetTo,Convert To,\u8F49\u63DB\u70BA\u7DE8\u78BC,\u8F6C\u6362\u4E3A\u7F16\u7801,Convertir \u00E0\r\nconvertDialog.original,Original,\u539F\u683C\u5F0F,\u539F\u683C\u5F0F,Format d\'origine\r\nconvertDialog.conversionPreview,Conversion Preview,\u8F49\u63DB\u9810\u89BD,\u8F6C\u6362\u9884\u89C8,Pr\u00E9visualiser la conversion\r\nconvertDialog.tabLabel.text,Text Tool,\u6587\u5B57\u5DE5\u5177,\u6587\u672C\u5DE5\u5177,Outil de Texte\r\nconvertDialog.tabLabel.subtitle,Subtitle Conversion,\u5B57\u5E55\u683C\u5F0F\u8F49\u63DB,\u5B57\u5E55\u683C\u5F0F\u8F6C\u6362,Conversion des Sous-titres\r\nconvertDialog.tabLabel.charset,Charset Conversion,\u6587\u5B57\u7DE8\u78BC\u8F49\u63DB,\u6587\u672C\u7F16\u7801\u8F6C\u6362,Conversion de jeux de caract\u00E8res\r\napp.exitConfirmMsg,Save before leave or changes will lost!,\u96E2\u958B\u524D\u4EFB\u4F55\u672A\u5132\u5B58\u4E4B\u8B8A\u66F4\u5C07\u6D41\u5931,\u79BB\u5F00\u524D\u4EFB\u4F55\u672A\u4FDD\u5B58\u4E4B\u53D8\u66F4\u5C06\u6D41\u5931,Enregistrer avant de quitter sinon les modifications non enregistr\u00E9es seront perdues !',
aliasCSV: 'code,alias,name\r\naf,,afrikaans\r\naf-za,,afrikaans (south africa)\r\nar,ar,arabic\r\nar-ae,ar,arabic (u.a.e.)\r\nar-bh,ar,arabic (bahrain)\r\nar-dz,ar,arabic (algeria)\r\nar-eg,ar,arabic (egypt)\r\nar-iq,ar,arabic (iraq)\r\nar-jo,ar,arabic (jordan)\r\nar-kw,ar,arabic (kuwait)\r\nar-lb,ar,arabic (lebanon)\r\nar-ly,ar,arabic (libya)\r\nar-ma,ar,arabic (morocco)\r\nar-om,ar,arabic (oman)\r\nar-qa,ar,arabic (qatar)\r\nar-sa,ar,arabic (saudi arabia)\r\nar-sy,ar,arabic (syria)\r\nar-tn,ar,arabic (tunisia)\r\nar-ye,ar,arabic (yemen)\r\naz,,azeri (latin)\r\naz-az,,azeri (latin) (azerbaijan)\r\naz-az,,azeri (cyrillic) (azerbaijan)\r\nbe,be,belarusian\r\nbe-by,be,belarusian (belarus)\r\nbg,,bulgarian\r\nbg-bg,,bulgarian (bulgaria)\r\nbs-ba,,bosnian (bosnia and herzegovina)\r\nca,,catalan\r\nca-es,,catalan (spain)\r\ncs,,czech\r\ncs-cz,,czech (czech republic)\r\ncy,,welsh\r\ncy-gb,,welsh (united kingdom)\r\nda,,danish\r\nda-dk,,danish (denmark)\r\nde,de,german\r\nde-at,de,german (austria)\r\nde-ch,de,german (switzerland)\r\nde-de,de,german (germany)\r\nde-li,de,german (liechtenstein)\r\nde-lu,de,german (luxembourg)\r\ndv,,divehi\r\ndv-mv,,divehi (maldives)\r\nel,,greek\r\nel-gr,,greek (greece)\r\nen,en-us,english\r\nen-au,en-us,english (australia)\r\nen-bz,en-us,english (belize)\r\nen-ca,en-us,english (canada)\r\nen-cb,en-us,english (caribbean)\r\nen-gb,en-us,english (united kingdom)\r\nen-ie,en-us,english (ireland)\r\nen-jm,en-us,english (jamaica)\r\nen-nz,en-us,english (new zealand)\r\nen-ph,en-us,english (republic of the philippines)\r\nen-tt,en-us,english (trinidad and tobago)\r\nen-us,en-us,english (united states)\r\nen-za,en-us,english (south africa)\r\nen-zw,en-us,english (zimbabwe)\r\neo,,esperanto\r\nes,es,spanish\r\nes-ar,es,spanish (argentina)\r\nes-bo,es,spanish (bolivia)\r\nes-cl,es,spanish (chile)\r\nes-co,es,spanish (colombia)\r\nes-cr,es,spanish (costa rica)\r\nes-do,es,spanish (dominican republic)\r\nes-ec,es,spanish (ecuador)\r\nes-es,es,spanish (castilian)\r\nes-es,es,spanish (spain)\r\nes-gt,es,spanish (guatemala)\r\nes-hn,es,spanish (honduras)\r\nes-mx,es,spanish (mexico)\r\nes-ni,es,spanish (nicaragua)\r\nes-pa,es,spanish (panama)\r\nes-pe,es,spanish (peru)\r\nes-pr,es,spanish (puerto rico)\r\nes-py,es,spanish (paraguay)\r\nes-sv,es,spanish (el salvador)\r\nes-uy,es,spanish (uruguay)\r\nes-ve,es,spanish (venezuela)\r\net,,estonian\r\net-ee,,estonian (estonia)\r\neu,,basque\r\neu-es,,basque (spain)\r\nfa,,farsi\r\nfa-ir,,farsi (iran)\r\nfi,,finnish\r\nfi-fi,,finnish (finland)\r\nfo,,faroese\r\nfo-fo,,faroese (faroe islands)\r\nfr,fr,french\r\nfr-be,fr,french (belgium)\r\nfr-ca,fr,french (canada)\r\nfr-ch,fr,french (switzerland)\r\nfr-fr,fr,french (france)\r\nfr-lu,fr,french (luxembourg)\r\nfr-mc,fr,french (principality of monaco)\r\ngl,,galician\r\ngl-es,,galician (spain)\r\ngu,,gujarati\r\ngu-in,,gujarati (india)\r\nhe,,hebrew\r\nhe-il,,hebrew (israel)\r\nhi,,hindi\r\nhi-in,,hindi (india)\r\nhr,,croatian\r\nhr-ba,,croatian (bosnia and herzegovina)\r\nhr-hr,,croatian (croatia)\r\nhu,,hungarian\r\nhu-hu,,hungarian (hungary)\r\nhy,,armenian\r\nhy-am,,armenian (armenia)\r\nid,,indonesian\r\nid-id,,indonesian (indonesia)\r\nis,,icelandic\r\nis-is,,icelandic (iceland)\r\nit,it,italian\r\nit-ch,it,italian (switzerland)\r\nit-it,it,italian (italy)\r\nja,,japanese\r\nja-jp,,japanese (japan)\r\nka,,georgian\r\nka-ge,,georgian (georgia)\r\nkk,,kazakh\r\nkk-kz,,kazakh (kazakhstan)\r\nkn,,kannada\r\nkn-in,,kannada (india)\r\nko,ko,korean\r\nko-kr,ko,korean (korea)\r\nkok,,konkani\r\nkok-in,,konkani (india)\r\nky,,kyrgyz\r\nky-kg,,kyrgyz (kyrgyzstan)\r\nlt,,lithuanian\r\nlt-lt,,lithuanian (lithuania)\r\nlv,,latvian\r\nlv-lv,,latvian (latvia)\r\nmi,,maori\r\nmi-nz,,maori (new zealand)\r\nmk,,fyro macedonian\r\nmk-mk,,fyro macedonian (former yugoslav republic of macedonia)\r\nmn,,mongolian\r\nmn-mn,,mongolian (mongolia)\r\nmr,,marathi\r\nmr-in,,marathi (india)\r\nms,ms,malay\r\nms-bn,ms,malay (brunei darussalam)\r\nms-my,ms,malay (malaysia)\r\nmt,,maltese\r\nmt-mt,,maltese (malta)\r\nnb,,norwegian (bokm?l)\r\nnb-no,,norwegian (bokm?l) (norway)\r\nnl,,dutch\r\nnl-be,,dutch (belgium)\r\nnl-nl,,dutch (netherlands)\r\nnn-no,,norwegian (nynorsk) (norway)\r\nns,,northern sotho\r\nns-za,,northern sotho (south africa)\r\npa,,punjabi\r\npa-in,,punjabi (india)\r\npl,,polish\r\npl-pl,,polish (poland)\r\nps,,pashto\r\nps-ar,,pashto (afghanistan)\r\npt,pt,portuguese\r\npt-br,pt,portuguese (brazil)\r\npt-pt,pt,portuguese (portugal)\r\nqu,,quechua\r\nqu-bo,,quechua (bolivia)\r\nqu-ec,,quechua (ecuador)\r\nqu-pe,,quechua (peru)\r\nro,,romanian\r\nro-ro,,romanian (romania)\r\nru,,russian\r\nru-ru,,russian (russia)\r\nsa,,sanskrit\r\nsa-in,,sanskrit (india)\r\nse,,sami (northern)\r\nse-fi,,sami (northern) (finland)\r\nse-fi,,sami (skolt) (finland)\r\nse-fi,,sami (inari) (finland)\r\nse-no,,sami (northern) (norway)\r\nse-no,,sami (lule) (norway)\r\nse-no,,sami (southern) (norway)\r\nse-se,,sami (northern) (sweden)\r\nse-se,,sami (lule) (sweden)\r\nse-se,,sami (southern) (sweden)\r\nsk,,slovak\r\nsk-sk,,slovak (slovakia)\r\nsl,,slovenian\r\nsl-si,,slovenian (slovenia)\r\nsq,,albanian\r\nsq-al,,albanian (albania)\r\nsr-ba,,serbian (latin) (bosnia and herzegovina)\r\nsr-ba,,serbian (cyrillic) (bosnia and herzegovina)\r\nsr-sp,,serbian (latin) (serbia and montenegro)\r\nsr-sp,,serbian (cyrillic) (serbia and montenegro)\r\nsv,,swedish\r\nsv-fi,,swedish (finland)\r\nsv-se,,swedish (sweden)\r\nsw,,swahili\r\nsw-ke,,swahili (kenya)\r\nsyr,,syriac\r\nsyr-sy,,syriac (syria)\r\nta,,tamil\r\nta-in,,tamil (india)\r\nte,,telugu\r\nte-in,,telugu (india)\r\nth,,thai\r\nth-th,,thai (thailand)\r\ntl,,tagalog\r\ntl-ph,,tagalog (philippines)\r\ntn,,tswana\r\ntn-za,,tswana (south africa)\r\ntr,,turkish\r\ntr-tr,,turkish (turkey)\r\ntt,,tatar\r\ntt-ru,,tatar (russia)\r\nts,,tsonga\r\nuk,,ukrainian\r\nuk-ua,,ukrainian (ukraine)\r\nur,,urdu\r\nur-pk,,urdu (islamic republic of pakistan)\r\nuz,uz,uzbek (latin)\r\nuz-uz,uz,uzbek (latin) (uzbekistan)\r\nuz-uz,uz,uzbek (cyrillic) (uzbekistan)\r\nvi,,vietnamese\r\nvi-vn,,vietnamese (viet nam)\r\nxh,,xhosa\r\nxh-za,,xhosa (south africa)\r\nzh,zh-hk,chinese\r\nzh-cn,zh-hk,chinese (s)\r\nzh-hk,zh-tw,chinese (hong kong)\r\nzh-mo,zh-hk,chinese (macau)\r\nzh-sg,zh-cn,chinese (singapore)\r\nzh-tw,zh-hk,chinese (t)\r\nzu,,zulu\r\nzu-za,,zulu (south africa)',
table: {},
alias: {},
currentLanguage: (_GET('lang') || navigator.language || navigator.userLanguage || "en-US").toLocaleLowerCase(),
failBackLanguage: ('en-US').toLocaleLowerCase(),
}
localize.table = parseLocalizeTable(localize.tableCSV.replace(/\r/, ''));
localize.alias = parseLocalizeAlias(localize.aliasCSV.replace(/\r/, ''));
var stopMonitorMainScrolling = false;
var lastMainScrollTo = 0;
var slide3Stop = false;
function localizedText(str) {
str = str || "";
result = "";
if (str != "") {
if (localize.table != {}) {
if ((localize.currentLanguage in localize.table) && (typeof localize.table[localize.currentLanguage][str] != "undefined")) {
result = localize.table[localize.currentLanguage][str];
} else if ((localize.alias[localize.currentLanguage] in localize.table) && (typeof localize.table[localize.alias[localize.currentLanguage]][str] != "undefined")) {
result = localize.table[localize.alias[localize.currentLanguage]][str];
} else if ((localize.alias[localize.alias[localize.currentLanguage]] in localize.table) && (typeof localize.table[localize.alias[localize.alias[localize.currentLanguage]]][str] != "undefined")) {
result = localize.table[localize.alias[localize.alias[localize.currentLanguage]]][str];
} else {
result = localize.table[localize.failBackLanguage][str];
}
}
}
return result;
}
function replaceLocalizedText() {
var doc = document.body;
for (key in localize.table["en-us"]) {
doc.innerHTML = doc.innerHTML.replace(new RegExp('\{' + localize.prefix + '_' + key + '\}', 'g'), localizedText(key));
}
}
</script>
<script>
//Object definition
function currentStatusObject() {
this.videoFile = "";
this.videoIsPlaying = false,
this.lineNo = 0;
this.buttonMapping = [];
this.savedChanges = false;
this.disableWaveformSeekEvent = false;
this.disableVideoSeekEvent = false;
this.timerID = 0;
this.saveFormat = "";
this.subtitleTextAreaLock = false;
this.editHistory = []; //Store 100 step of history
this.editHistoryIndex = -1; //Index number starting from 0, sames as the array index
this.UI = {
horizontalDragRatio: 1.0,
verticalDragRatio: 1.0,
videoWaveHeightRatio: 0.0,
dragging: false
}
this.convertDialog = {
lastSelection: 'format',
}
}
function settingsObject() {
//Cmd+Z and Shift+Cmd+Z will be hard-coded
function keyboardSettingsObject() {
this.sortSubtitle = "Command+/";
this.play = "Command+Enter";
this.lockTextarea = "Command+Shift+L";
this.gotoFirstLine = "Command+[";
this.goBackFiveSeconds = "Command+,";
this.goForwardFiveSeconds = "Command+.";
this.zoomInWaveform = "=";
this.zoomOutWaveform = "-";
this.zoomFullWaveform = "Command+0";
this.settings = "Command+,";
this.importText = "Command+Shift+T";
this.importVideo = "Command+Shift+I";
this.exportSubtitle = "Command+E";
this.timecodeNext = "Space";
this.timecodeIn = "Command+Left";
this.timecodeOut = "Command+Right";
this.timecodePeriod = "~";
this.gotoNextLine = "Command+Down";
this.gotoPreviousLine = "Command+Up";
}
this.key = new keyboardSettingsObject(); //key must be an object without methods/sub/functions because it's going to be store into localstorage using JSON.stringify()
this.init = function () {
var store = localStorage.getItem("info.luniz.fiveLoadSub-settings.key");
if (store != null) {
if (JSON.stringify(store) != JSON.stringify(this.key)) {
this.key = store;
}
}
};
this.save = function () {
var store = JSON.stringify(this.key);
return localStorage.setItem("info.luniz.fiveLoadSub-settings.key", store);
};
}
function bufferObject() {
this.subtitleOverlayContent = "";
}
function timeCodeObject() {
this.h = 0;
this.m = 0;
this.s = 0;
this.f = 0;
this.empty = true;
this.strVal = function () {
var result = "[" + _zeroPad(this.h, 2) + ":" + _zeroPad(this.m, 2) + ":" + _zeroPad(this.s, 2) + "." + _zeroPad(this.f, 2) + "]";
if (this.empty) {
result = "";
}
return result;
};
this.totalFrames = function (frameRate) {
var result = 0;
frameRate = frameRate || 30;
result = Math.round((this.f / 30) * frameRate) + this.s * frameRate + this.m * 60 * frameRate + this.h * 3600 * frameRate;
return result;
}
this.parseFromString = function (str) {
if ((str.charAt(0) == "[") && (str.charAt(3) == ":") && (str.charAt(6) == ":") && (str.charAt(9) == ".") && (str.charAt(12) == "]") &&
(/^\d+$/.test(str.charAt(1))) && (/^\d+$/.test(str.charAt(2))) && (/^\d+$/.test(str.charAt(4))) && (/^\d+$/.test(str.charAt(5))) && (/^\d+$/.test(str.charAt(7))) && (/^\d+$/.test(str.charAt(8))) && (/^\d+$/.test(str.charAt(10))) && (/^\d+$/.test(str.charAt(11)))) {
this.h = parseInt(str.charAt(1) + str.charAt(2));
this.m = parseInt(str.charAt(4) + str.charAt(5));
this.s = parseInt(str.charAt(7) + str.charAt(8));
this.f = parseInt(str.charAt(10) + str.charAt(11));
this.empty = false;
return true;
} else {
this.empty = true;
return false;
}
}
}
function subtitleLineObject() {
this.begin = new timeCodeObject();
this.text = "";
this.end = new timeCodeObject();
this.empty = true;
this.parseFromString = function (str) {
var result = false;
if ((str.length > 13) && (str.length <= 26)) {
this.text = str.substring(13, str.length);
result = this.begin.parseFromString(str.substr(0, 13));
} else if (str.length > 26) {
this.text = str.substring(13, str.length - 13);
if (!this.end.parseFromString(str.substr(str.length - 13, 13))) {
this.text = str.substring(13, str.length);
}
result = this.begin.parseFromString(str.substr(0, 13));
} else {
this.text = str;
}
this.empty = !result;
return result;
}
this.strVal = function () {
var result = "";
result += this.begin.strVal();
result += this.text;
result += this.end.strVal();
return result;
}
}
function subtitleDocObject() {
//This is the object to handle the whole subtitle document inside textarea.
//It also responsable to import/export/output/convert other format and provide a indexed sequeuence for displaying overlay subtitle.
//Basicly it will skip any line that is invalid(maybe still editing).
function prXmlObject() {
var video = {
frameRate: 25,
isNtsc: false,
width: 0,
height: 0,
totalFrames: 0,
timeCodeString: "00:00:00:00"
};
this.xml = "";
this.prtl = "";
this.prtlFiles = [];
this.download = "";
var ready = false;
var xmlHead = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xmeml><xmeml version="4"><project><name>fiveLoadSubImport</name><children><sequence id="fiveLoadSubImport" TL.SQAudioVisibleBase="0" TL.SQVideoVisibleBase="0" TL.SQVisibleBaseTime="0" TL.SQHideShyTracks="0" Monitor.ProgramZoomIn="0" MZ.WorkInPoint="0"><uuid>{uuid}</uuid><duration>{video.totalFrames}</duration><rate><timebase>{video.frameRate}</timebase><ntsc>{video.isNtsc}</ntsc></rate><name>fiveLoadSubImport</name><media><video><format><samplecharacteristics><rate><timebase>{video.frameRate}</timebase><ntsc>{video.isNtsc}</ntsc></rate><width>{video.width}</width><height>{video.height}</height><anamorphic>FALSE</anamorphic><pixelaspectratio>square</pixelaspectratio><fielddominance>lower</fielddominance><colordepth>24</colordepth></samplecharacteristics></format>';
var xmlFooter = '</video></media><timecode><rate><timebase>{video.frameRate}</timebase><ntsc>{video.isNtsc}</ntsc></rate><string>{video.timeCodeString}</string><frame>0</frame><displayformat>NDF</displayformat></timecode></sequence></children></project></xmeml>';
this.get = function (str) {
return video[str];
}
this.updatePrtl = function () {
var templateInput = document.getElementById('templateInput');
var reader = new FileReader();
reader.onload = function () {
this.prtl = reader.result;
subtitleDocument.prXml.prtl = this.prtl;
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(this.prtl, 'text/xml');
video.width = xmlDoc.getElementsByTagName('pXPIXELS')[0].innerHTML || '0';
video.width = parseInt(video.width);
video.height = xmlDoc.getElementsByTagName('pYLINES')[0].innerHTML || '0';
video.height = parseInt(video.height);
video.aspectRatio = xmlDoc.getElementsByTagName('pSCREENAR')[0].innerHTML || '1';
video.aspectRatio = parseInt(video.aspectRatio);
video.width = video.width * video.aspectRatio;
document.getElementById('saveDialogXml_width').value = video.width;
document.getElementById('saveDialogXml_height').value = video.height;
}
reader.readAsText(templateInput.files[0]);
video.totalFrames = subtitleDocument.endding.totalFrames();
if (video.totalFrames > 0) {
video.totalFrames = video.totalFrames + 900 * video.frameRate;
}
}
this.updateConfig = function () {
var width = parseInt(document.getElementById('saveDialogXml_width').value);
var height = parseInt(document.getElementById('saveDialogXml_height').value);
var frameRate = parseInt(document.getElementById('saveDialogXml_frameRate').value);
if (width > 0) {
video.width = width;
}
if (height > 0) {
video.height = height;
}
if (frameRate > 0) {
video.frameRate = frameRate;
}
if ((video.frameRate == 15) || (video.frameRate == 24) || (video.frameRate == 30) || (video.frameRate == 60)) {
video.timeCodeString = "00;00;00;00";
video.isNtsc = true;
} else {
video.timeCodeString = "00:00:00:00";
video.isNtsc = false;
}
video.totalFrames = subtitleDocument.endding.totalFrames();
if (video.totalFrames > 0) {
video.totalFrames = video.totalFrames + 900 * video.frameRate;
}
}
this.genXML = function () {
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
xmlHead = xmlHead.replace(/\{video\.frameRate\}/gi, video.frameRate.toString());
xmlHead = xmlHead.replace(/\{video\.isNtsc\}/gi, video.isNtsc.toString());
xmlHead = xmlHead.replace(/\{video\.width\}/gi, video.width.toString());
xmlHead = xmlHead.replace(/\{video\.height\}/gi, video.height.toString());
xmlHead = xmlHead.replace(/\{video\.totalFrames\}/gi, video.totalFrames.toString());
xmlHead = xmlHead.replace(/\{video\.timeCodeString\}/gi, video.timeCodeString);
xmlHead = xmlHead.replace(/\{uuid\}/gi, guid());
xmlFooter = xmlFooter.replace(/\{video\.frameRate\}/gi, video.frameRate.toString());
xmlFooter = xmlFooter.replace(/\{video\.isNtsc\}/gi, video.isNtsc.toString());
xmlFooter = xmlFooter.replace(/\{video\.width\}/gi, video.width.toString());
xmlFooter = xmlFooter.replace(/\{video\.height\}/gi, video.height.toString());
xmlFooter = xmlFooter.replace(/\{video\.totalFrames\}/gi, video.totalFrames.toString());
xmlFooter = xmlFooter.replace(/\{video\.timeCodeString\}/gi, video.timeCodeString.toString());
this.xml = xmlHead;
this.xml += '{subtitleTracksReplacement}';
this.xml += xmlFooter;
return this.xml;
}
}
function fcp7XmlObject() {
this.input = "";
this.inputDoc = {};
this.inputItem = {};
this.output = "";
this.outputDoc = {};
this.download = '';
var outputTemplate = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE xmeml><xmeml version="5"><sequence id="fiveLoadSub Import"><uuid>{uuid}</uuid><updatebehavior>add</updatebehavior><name>fiveLoadSub Import</name><duration>{video.totalFrames}</duration><rate><ntsc>{video.isNtsc}</ntsc><timebase>{video.frameRate}</timebase></rate><timecode><rate><ntsc>{video.isNtsc}</ntsc><timebase>{video.frameRate}</timebase></rate><string>{video.timeCodeString}</string><frame>0</frame><source>source</source><displayformat>NDF</displayformat></timecode><in>-1</in><out>-1</out><media><video><format><samplecharacteristics><width>{video.width}</width><height>{video.height}</height><anamorphic>FALSE</anamorphic><pixelaspectratio>Square</pixelaspectratio><fielddominance>upper</fielddominance><rate><ntsc>{video.isNtsc}</ntsc><timebase>{video.frameRate}</timebase></rate><colordepth>24</colordepth><codec><name>Apple ProRes 422</name><appspecificdata><appname>Final Cut Pro</appname><appmanufacturer>Apple Inc.</appmanufacturer><appversion>7.0</appversion><data><qtcodec><codecname>Apple ProRes 422</codecname><codectypename>Apple ProRes 422</codectypename><codectypecode>apcn</codectypecode><codecvendorcode>appl</codecvendorcode><spatialquality>1024</spatialquality><temporalquality>0</temporalquality><keyframerate>0</keyframerate><datarate>0</datarate></qtcodec></data></appspecificdata></codec></samplecharacteristics><appspecificdata><appname>Final Cut Pro</appname><appmanufacturer>Apple Inc.</appmanufacturer><appversion>7.0</appversion><data><fcpimageprocessing><useyuv>TRUE</useyuv><usesuperwhite>FALSE</usesuperwhite><rendermode>Float10BPP</rendermode></fcpimageprocessing></data></appspecificdata></format><track><enabled>TRUE</enabled><locked>FALSE</locked></track></video></media></sequence></xmeml>';
var parser = new DOMParser();
var video = {
width: 0,
height: 0,
frameRate: 0,
isNtsc: false,
timeCodeString: "00:00:00:00",
totalFrames: 0
};
this.loadInput = function () {
var templateInput = document.getElementById('templateInput');
var reader = new FileReader();
reader.onload = function () {
subtitleDocument.fcp7Xml.input = reader.result;
subtitleDocument.fcp7Xml.inputDoc = parser.parseFromString(subtitleDocument.fcp7Xml.input, 'text/xml');
if (subtitleDocument.fcp7Xml.inputDoc) {
video.width = parseInt(subtitleDocument.fcp7Xml.inputDoc.getElementsByTagName('samplecharacteristics')[0].getElementsByTagName('width')[0].innerHTML);
video.height = parseInt(subtitleDocument.fcp7Xml.inputDoc.getElementsByTagName('samplecharacteristics')[0].getElementsByTagName('height')[0].innerHTML);
video.frameRate = parseInt(subtitleDocument.fcp7Xml.inputDoc.getElementsByTagName('samplecharacteristics')[0].getElementsByTagName('timebase')[0].innerHTML);
document.getElementById('saveDialogXml_width').value = video.width;
document.getElementById('saveDialogXml_height').value = video.height;