1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

support multiple uploads, fix go-bindata generation via makefile

This commit is contained in:
John Nguyen 2022-05-29 00:35:01 +08:00
parent a58f4ca346
commit c7e6297077
3 changed files with 353 additions and 987 deletions

View File

@ -10,10 +10,12 @@ build: server/bindata.go
STATICFILES := $(wildcard static/*)
TEMPLATES := $(wildcard templates/*)
.PHONY: server/bindata.go
server/bindata.go: $(STATICFILES) $(TEMPLATES)
go-bindata -pkg server -tags '!debug' -o server/bindata.go static/... templates/...
go fmt
.PHONY: server/bindata-debug.go
server/bindata-debug.go: $(STATICFILES) $(TEMPLATES)
go-bindata -pkg server -tags 'debug' -o server/bindata-debug.go -debug static/... templates/...
go fmt

File diff suppressed because one or more lines are too long

View File

@ -371,9 +371,11 @@ function onUploadFinished(file) {
if (file.type.startsWith("image")) {
prefix = '!';
}
console.log(file.xhr);
var extraText = prefix+'['+file.xhr.getResponseHeader("Location").split('filename=')[1]+'](' +
file.xhr.getResponseHeader("Location") +
')';
')\n\n';
$('#userInput').val(
textBefore +
@ -382,7 +384,7 @@ function onUploadFinished(file) {
);
// Select the newly-inserted link
$('#userInput').prop('selectionStart', cursorPos);
$('#userInput').prop('selectionStart', cursorPos + extraText.length);
$('#userInput').prop('selectionEnd', cursorPos + extraText.length);
$('#userInput').trigger('keyup'); // trigger a save
}