|
|
(12 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| <html>
| | {{#ask: [[Doom II]]|?From Year}} |
| <script>
| |
| function make_page(crsf_token)
| |
| {
| |
| console.log(crsf_token);
| |
| }
| |
|
| |
| function upload_file()
| |
| {
| |
| let fileInput = document.getElementById("tt-input");
| |
| let license = "=={{int:license-header}}==\n{{Non-free game cover}}",
| |
|
| |
| api = new mw.Api();
| |
| let param = {
| |
| filename: fileInput.files[0].name,
| |
| format: "json",
| |
| ignorewarnings: 1,
| |
| text: license
| |
| };
| |
| api.upload(fileInput.files[0], param)
| |
| .done(function (data) {
| |
| console.log(data.upload.filename + " has sucessfully uploaded.");
| |
| api.getEditToken()
| |
| .done(function (data) {
| |
| make_page(data);
| |
| }).fail(function (data) {
| |
| // I DON't CARE
| |
| });
| |
| })
| |
| .fail(function (data) {
| |
| console.log(data);
| |
| });
| |
| }
| |
|
| |
|
| |
| window.addEventListener("load", () => {
| |
| let button = document.getElementById("tt-button");
| |
|
| |
| let upload_result = false;
| |
| button.addEventListener("click", () => {upload_file()});
| |
| }); | |
| </script>
| |
| | |
| <input type="file" id="tt-input"/>
| |
| <input type="button" id="tt-button" value="Upload" />
| |
| </html>
| |