| 123456789101112131415161718192021222324252627 |
- module.exports = require('./header.js') +`
- <form id="form" action="#" method="POST" enctype="multipart/form-data">
- <input type="file" id="fileInput" name="content" required />
- <div id="error" class="hidden"></div>
- <button class="g-recaptcha" data-sitekey="{reCaptcha_public}" data-callback="onSubmit" data-action="submit">Submit</button>
- </form>
- <script>
- function onSubmit(token) {
- $.ajax({
- type: 'POST',
- url: '#',
- data: new FormData(document.getElementById('form')),
- processData: false,
- contentType: false,
- success: data => {
- if (data.err) {
- $("#error").text("Error: " +data.err).removeClass("hidden");
- } else if (data.id) {
- $("#error").text("").addClass("hidden");
- document.location.href = "/x/" +data.id;
- }
- }
- });
- }
- </script>
- ` + require('./footer.js');
|