X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/6d6c111b80ad13201b7acd7c2f5b8fd6d160e11b..1581d41cc21d3ec5609fe3d2c1e6acec2b348170:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index 14fad1d..1114dfd 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -321,6 +321,11 @@ function add_time_string_to_date(d, time) d.setSeconds (d.getSeconds() + 604800); return true; } + if (time == 'fortnight') + { + d.setSeconds (d.getSeconds() + 1209600); + return true; + } if (time == 'month') { d.setSeconds (d.getSeconds() + 2592000); @@ -591,14 +596,14 @@ function async_upload_end (code) req.send (form); } -function upload (max_size) +function upload (max_chunk_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 ()) { async_upload_start ( - max_size, + max_chunk_size, document.getElementById('file_select').files[0], document.getElementById('select_time').value, document.getElementById('input_key').value, @@ -784,4 +789,34 @@ function addCopyListener(button_id, link_id) { copyLinkToClipboard(link_id);}); } } + +function set_dark_mode() { + let steel_sheet = ""; + let shortcut_icon = ""; + document.getElementById('stylesheet').href = steel_sheet; + document.getElementById('shortcut_icon').href = steel_sheet; +} + +function set_light_mode() { + let steel_sheet = ""; + let shortcut_icon = ""; + document.getElementById('stylesheet').href = steel_sheet; + document.getElementById('shortcut_icon').href = steel_sheet; +} + +function color_scheme_preferences() { + + let dark_mode_steel_sheet = "" + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + set_dark_mode(); + } else { + set_light_mode(); + } + + // When user change its preference + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', lightMode => { + lightMode.matches ? set_dark_mode() : set_light_mode(); + }); +} + // @license-end