*/
header('Content-Type: text/javascript');
-
define('JIRAFEAU_ROOT', dirname(__FILE__) . '/../');
require(JIRAFEAU_ROOT . 'lib/settings.php');
require(JIRAFEAU_ROOT . 'lib/functions.php');
require(JIRAFEAU_ROOT . 'lib/lang.php');
?>
+// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
+var web_root = "<?php echo $cfg['web_root']; ?>";
-function translate (expr)
-{
- var lang_array = <?php echo json_lang_generator() ?>;
- if (lang_array.hasOwnProperty(expr))
- return lang_array[expr];
- return expr;
+var lang_array = <?php echo json_lang_generator(null); ?>;
+var lang_array_fallback = <?php echo json_lang_generator("en"); ?>;
+
+function translate (expr) {
+ if (lang_array.hasOwnProperty(expr)) {
+ var e = lang_array[expr];
+ if (!isEmpty(e))
+ return e;
+ }
+ if (lang_array_fallback.hasOwnProperty(expr)) {
+ var e = lang_array_fallback[expr];
+ if (!isEmpty(e))
+ return e;
+ }
+ return "FIXME: " + expr;
}
function isEmpty(str) {
document.getElementById('uploading').style.display = 'none';
document.getElementById('upload').style.display = 'none';
document.getElementById('upload_finished').style.display = '';
- document.title = "<?php echo empty($cfg['title']) ? 'Jirafeau' : $cfg['title']; ?> - 100%";
+ document.title = "100% - <?php echo empty($cfg['title']) ? 'Jirafeau' : $cfg['title']; ?>";
// Download page
var download_link_href = 'f.php?h=' + reference;
if (!!document.getElementById('upload_finished_download_page'))
{
document.getElementById('upload_link').href = download_link_href;
+ document.getElementById('upload_link_text').innerHTML = web_root + download_link_href;
}
// Email link
var filename = document.getElementById('file_select').files[0].name;
- var b = encodeURIComponent("Download file \"" + filename + "\":") + "%0D";
- b += encodeURIComponent("<?php echo $cfg['web_root']; ?>" + download_link_href) + "%0D";
+ var b = encodeURIComponent("<?php echo t("DL"); ?> \"" + filename + "\":") + "%0D" + "%0A";
+ b += encodeURIComponent(web_root + download_link_href) + "%0D" + "%0A";
if (false == isEmpty(date))
{
- b += "%0D" + encodeURIComponent("This file will be available until " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D";
+ b += "%0D" + "%0A" + encodeURIComponent("<?php echo t("VALID_UNTIL"); ?>: " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D" + "%0A";
document.getElementById('upload_link_email').href = "mailto:?body=" + b + "&subject=" + encodeURIComponent(filename);
}
// Delete link
var delete_link_href = 'f.php?h=' + reference + '&d=' + delete_code;
document.getElementById('delete_link').href = delete_link_href;
+ document.getElementById('delete_link_text').innerHTML = web_root + delete_link_href;
// Validity date
if (isEmpty(date))
type.indexOf("video") > -1)
{
document.getElementById('preview_link').href = preview_link_href;
+ document.getElementById('preview_link_text').innerHTML = web_root + preview_link_href;
document.getElementById('upload_finished_preview').style.display = '';
}
}
direct_download_link_href += '&k=' + crypt_key;
}
document.getElementById('direct_link').href = direct_download_link_href;
+ document.getElementById('direct_link_text').innerHTML = web_root + direct_download_link_href;
// Hide preview and direct download link if password is set
if (document.getElementById('input_key').value.length > 0)
document.getElementById('uploaded_percentage').innerHTML = percentage;
document.getElementById('uploaded_speed').innerHTML = speed;
document.getElementById('uploaded_time').innerHTML = time_left;
- document.title = "<?php echo empty($cfg['title']) ? 'Jirafeau' : $cfg['title']; ?> - " + percentage;
+ document.title = percentage + " - <?php echo empty($cfg['title']) ? 'Jirafeau' : $cfg['title']; ?>";
}
function hide_upload_progression ()
}
if (time == 'month')
{
- d.setSeconds (d.getSeconds() + 2419200);
+ d.setSeconds (d.getSeconds() + 2592000);
return true;
}
if (time == 'quarter')
{
- d.setSeconds (d.getSeconds() + 7257600);
+ d.setSeconds (d.getSeconds() + 7776000);
return true;
}
if (time == 'year')
{
- d.setSeconds (d.getSeconds() + 29030400);
+ d.setSeconds (d.getSeconds() + 31536000);
return true;
}
return false;
function upload (max_size)
{
+ var one_time_checkbox = document.getElementById('one_time_download');
+ var one_time = one_time_checkbox !== null ? one_time_checkbox.checked : false;
if (check_html5_file_api ()
&& document.getElementById('file_select').files[0].size >= max_size)
{
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
- document.getElementById('one_time_download').checked,
+ one_time,
document.getElementById('upload_password').value
);
}
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
- document.getElementById('one_time_download').checked,
+ one_time,
document.getElementById('upload_password').value
);
}
if (s <= 1000)
{
res = s.toString();
- scale = "o/s";
+ scale = "Bit/s";
}
else if (s < 1000000)
{
res = Math.floor(s/100) / 10;
- scale = "Ko/s";
+ scale = "KBit/s";
}
else
{
res = Math.floor(s/100000) / 10;
- scale = "Mo/s";
+ scale = "Mbit/s";
}
if (res == 0)
return '';
function milliseconds_to_time_string (milliseconds)
{
function numberEnding (number) {
- return (number > 1) ? 's' : '';
+ return (number > 1) ? translate ('PLURAL_ENDING') : '';
}
var temp = Math.floor(milliseconds / 1000);
var years = Math.floor(temp / 31536000);
if (years) {
- return years + ' ' + translate ('year') + numberEnding(years);
+ return years + ' ' + translate ('YEAR') + numberEnding(years);
}
var days = Math.floor((temp %= 31536000) / 86400);
if (days) {
- return days + ' ' + translate ('day') + numberEnding(days);
+ return days + ' ' + translate ('DAY') + numberEnding(days);
}
var hours = Math.floor((temp %= 86400) / 3600);
if (hours) {
- return hours + ' ' + translate ('hour') + numberEnding(hours);
+ return hours + ' ' + translate ('HOUR') + numberEnding(hours);
}
var minutes = Math.floor((temp %= 3600) / 60);
if (minutes) {
- return minutes + ' ' + translate ('minute') + numberEnding(minutes);
+ return minutes + ' ' + translate ('MINUTE') + numberEnding(minutes);
}
var seconds = temp % 60;
if (seconds) {
- return seconds + ' ' + translate ('second') + numberEnding(seconds);
+ return seconds + ' ' + translate ('SECOND') + numberEnding(seconds);
}
- return translate ('less than a second');
+ return translate ('LESS_1_SEC');
}
function upload_time_estimation_time()
}
function addCopyListener(button_id, link_id) {
- document.getElementById(button_id)
+ if(document.getElementById(button_id)){
+ document.getElementById(button_id)
.addEventListener("click", function() {
copyLinkToClipboard(link_id);});
+ }
}
+// @license-end