Mercurial Hosting > linkmystyle
view src/uploadcare/test2.html.luan @ 3:b016e4b7c8da default tip
add read_me
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 12 Jul 2025 12:51:36 -0600 |
parents | 8f4df159f06b |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local body_header = Shared.body_header or error() local footer = Shared.footer or error() return function() Io.stdout = Http.response.text_writer() %> <!doctype html> <html lang="en"> <head> <% head() %> <style> div[content] { margin-left: 3%; margin-right: 3%; } img { height: 100px; } </style> <script> 'use strict'; uploadcare.publicKey = '718cc25ec1508ca5801d'; // local uploadcare.doNotStore = true; uploadcare.cropprOptions = {}; function uploaded(uuid,filename) { let url = 'https://ucarecdn.com/' + uuid + '/-/quality/smart/'; // console.log(url); let a = document.querySelector('[content] a'); a.textContent = filename; a.href = url; document.querySelector('[content] img').src = url; } </script> </head> <body> <div full> <% body_header() %> <div content> <p>top</p> <p> <button onclick="uploadcare.upload(uploaded)">Upload File</button> </p> <p><a></a></p> <p><img></p> <p>bottom</p> </div> <% footer() %> </div> </body> </html> <% end