]> nmode's Git Repositories - Rnaught/blobdiff - inst/web/www/script.js
Update web app entry point
[Rnaught] / inst / web / www / script.js
diff --git a/inst/web/www/script.js b/inst/web/www/script.js
new file mode 100644 (file)
index 0000000..30066d1
--- /dev/null
@@ -0,0 +1,21 @@
+$(document).ready(() => {
+  // Enable tooltips.
+  $('[data-bs-toggle="tooltip"]').tooltip();
+
+  // Toggle the text in the bulk data help button.
+  $('#data-format-toggle').on('click', event => {
+    btn = $(event.target);
+    show_format = 'Show required format';
+    btn.text(btn.text() === show_format ? 'Hide required format' : show_format);
+  });
+
+  // Trigger the file selector via a custom button.
+  $('#data-upload-select').on('click', () => {
+    $('#data_upload').trigger('click');
+  });
+
+  // Display the name of the uploaded file.
+  $('#data_upload').on('change', event => {
+    $('#data-upload-name').attr('placeholder', event.target.files[0].name);
+  });
+});