Proper javascript translation

This commit is contained in:
Luc Didry 2015-10-02 21:55:42 +02:00
parent d52dd62326
commit 5237e74a40
4 changed files with 21 additions and 13 deletions

View File

@ -68,7 +68,7 @@ function spawnWebsocket() {
var pbd = document.getElementById('pbd');
pbd.setAttribute('class', '');
pbd.innerHTML = '<a href="'+URL.createObjectURL(blob)+'" class="btn btn-primary" download="'+data.name+'">Download</a>';
pbd.innerHTML = '<a href="'+URL.createObjectURL(blob)+'" class="btn btn-primary" download="'+data.name+'">'+i18n.download+'</a>';
ws.send('{"ended":true}');
} else {

View File

@ -26,7 +26,7 @@ function copyToClipboard(el) {
el.focus();
var len = el.value.length * 2;
el.setSelectionRange(0, len);
alert(hit);
alert(i18n.hit);
}
document.body.removeChild(textArea);
@ -60,7 +60,7 @@ function copyAllToClipboard() {
textArea.style.width = '';
textArea.style.height = '';
textArea.style.background = '#FFFFFF';
alert(hits);
alert(i18n.hits);
}
document.body.removeChild(textArea);
@ -140,6 +140,8 @@ function sliceAndUpload(randomkey, i, parts, j, delay, del_at_first_view, short)
i: i
};
data = JSON.stringify(data);
// Verify that we have a websocket and send json
if (window.ws.readyState === 3) {
window.ws = spawnWebsocket(function() {
window.ws.send(data+'XXMOJOXX'+JSON.stringify(encrypted));
@ -171,26 +173,26 @@ function updateProgressBar(data) {
d.innerHTML = '<div class="form-group"><label class="sr-only" for="'
+short
+'">'
+dltext
+i18n.dlText
+'</label><div class="input-group"><div class="input-group-addon"><a href="'
+url
+'" target="_blank"><span class="icon icon-download" title="'
+dltext
+i18n.dlText
+'"></span></a></div><input id="'
+short
+'" class="form-control link-input" value="'
+url
+'" readonly="" type="text" style="background-color: #FFF;"><a href="#" onclick="copyToClipboard(this);" class="input-group-addon" title="'
+cptext
+i18n.cpText
+'"><span class="icon icon-clipboard"></span></a></div></div>'
+'<div class="form-group"><label class="sr-only" for="delete-'
+short
+'">'
+del_text
+i18n.delText
+'</label><div class="input-group"><div class="input-group-addon"><a href="'
+del_url
+'" target="_blank"><span class="icon icon-trash" title="'
+del_text
+i18n.delText
+'"></span></a></div><input id="delete-'
+short
+'" class="form-control" value="'

View File

@ -60,11 +60,14 @@
</div>
%= javascript begin
var ws_url = '<%= url_for('upload')->to_abs() %>';
var hit = '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>';
var hits = '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>';
var dltext = '<%= l('Download link') %>';
var cptext = '<%= l('Copy to clipboard') %>';
var del_text = '<%= l('Deletion link') %>';
var i18n = {
cpText: '<%= l('Copy to clipboard') %>',
delText: '<%= l('Deletion link') %>',
dlText: '<%= l('Download link') %>',
download: '<%= l('Download') %>',
hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>',
hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>',
}
% end
%= javascript '/js/sjcl.js'
%= javascript '/js/lufi-up.js'

View File

@ -15,6 +15,9 @@
</div>
%= javascript begin
var ws_url = '<%= url_for('download')->to_abs() %>';
var i18n = {
download: '<%= l('Download') %>',
}
% end
%= javascript '/js/sjcl.js'
%= javascript '/js/lufi-down.js'