Mercurial Hosting > freedit
diff src/site.js @ 46:289718f121e4
use bbcode editor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 14 Nov 2022 18:43:38 -0700 |
parents | 0c1b820fff34 |
children | 78b2d6995244 |
line wrap: on
line diff
--- a/src/site.js Sun Nov 13 22:07:18 2022 -0700 +++ b/src/site.js Mon Nov 14 18:43:38 2022 -0700 @@ -31,42 +31,3 @@ err += '\nstack = ' + error.stack; ajax( '/error_log.js', 'err='+encodeURIComponent(err) ); }; - -function upload(input,callback) { - let file = input.files[0]; - input.value = null; - let request = new XMLHttpRequest(); - let url = 'https://upload.uploadcare.com/base/'; - request.open( 'POST', url ); - request.onload = function() { - if( request.status !== 200 ) { - let err = 'ajax failed: ' + request.status; - if( request.responseText ) { - err += '\n' + request.responseText; - document.write('<pre>'+request.responseText+'</pre>'); - } - console.log(err); - ajax( '/error_log.js', 'err='+encodeURIComponent(err) ); - return; - } - let response = JSON.parse(request.responseText); - let filename = file.name; - let url = 'https://ucarecdn.com/' + response.file + '/' + filename; - callback(input,url,filename); - }; - let formData = new FormData(); - formData.append( 'UPLOADCARE_PUB_KEY', 'fe3d30f3088a50941d45' ); - formData.append( 'file', file ); - request.send(formData); -} - -function fileButtonClick(button) { - button.parentNode.querySelector('input[type="file"]').click(); -} - -function fixTextarea(textarea) { - let height = textarea.scrollHeight; - if( height > textarea.clientHeight ) { - textarea.style.height = height + "px"; - } -}