Mercurial Hosting > freedit
changeset 40:1ac7aee13eca
test cleanup
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 31 Oct 2022 14:06:58 -0600 |
parents | 3354d4ac89f8 |
children | acb730710328 |
files | src/test/sceditor.html src/test/sceditor.html.luan src/test/tiny.html src/test/upload.html src/test/upload.js |
diffstat | 5 files changed, 69 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/sceditor.html Mon Oct 31 14:06:58 2022 -0600 @@ -0,0 +1,36 @@ +<!doctype html> +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="http://sceditor.reactionary.software/themes/default.css" /> + <style> + div.sceditor-container input[type="text"] { + width: 300px; + } + </style> + <script src="http://sceditor.reactionary.software/sceditor.js"></script> + <script src="http://sceditor.reactionary.software/formats/bbcode.js"></script> + <script src="http://sceditor.reactionary.software/icons/material.js"></script> + <script> + sceditor.icons.icons.strike = '<path d="M23,12V14H18.61C19.61,16.14 19.56,22 12.38,22C4.05,22.05 4.37,15.5 4.37,15.5L8.34,15.55C8.37,18.92 11.5,18.92 12.12,18.88C12.76,18.83 15.15,18.84 15.34,16.5C15.42,15.41 14.32,14.58 13.12,14H1V12H23M19.41,7.89L15.43,7.86C15.43,7.86 15.6,5.09 12.15,5.08C8.7,5.06 9,7.28 9,7.56C9.04,7.84 9.34,9.22 12,9.88H5.71C5.71,9.88 2.22,3.15 10.74,2C19.45,0.8 19.43,7.91 19.41,7.89Z" />'; + + function init() { + sceditor.create('textarea', { + toolbar: 'source|link,image,youtube|code,bold,italic,underline,strike,superscript,size,color|quote,orderedlist,bulletlist', + autoExpand: true, + resizeMaxHeight: -1, + //resizeEnabled: false, + width: '100%', + height: 100, + //emoticonsEnabled: false, + }); + } + </script> + </head> + <body onload="init()"> + <p> + <a href="https://www.sceditor.com/">SCEditor</a> + </p> + <textarea></textarea> + </body> +</html>
--- a/src/test/sceditor.html.luan Mon Aug 15 13:49:57 2022 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local Io = require "luan:Io.luan" -local Http = require "luan:http/Http.luan" - - -local base_url = "http://localhost:8081" - -return function() - Io.stdout = Http.response.text_writer() -%> -<!doctype html> -<html> - <head> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link rel="stylesheet" href="<%=base_url%>/themes/default.css" /> - <style> - div.sceditor-container input[type="text"] { - width: 300px; - } - </style> - <script src="<%=base_url%>/sceditor.js"></script> - <script src="<%=base_url%>/formats/bbcode.js"></script> - <script src="<%=base_url%>/icons/material.js"></script> - <script> - sceditor.icons.icons.strike = '<path d="M23,12V14H18.61C19.61,16.14 19.56,22 12.38,22C4.05,22.05 4.37,15.5 4.37,15.5L8.34,15.55C8.37,18.92 11.5,18.92 12.12,18.88C12.76,18.83 15.15,18.84 15.34,16.5C15.42,15.41 14.32,14.58 13.12,14H1V12H23M19.41,7.89L15.43,7.86C15.43,7.86 15.6,5.09 12.15,5.08C8.7,5.06 9,7.28 9,7.56C9.04,7.84 9.34,9.22 12,9.88H5.71C5.71,9.88 2.22,3.15 10.74,2C19.45,0.8 19.43,7.91 19.41,7.89Z" />'; - - function init() { - sceditor.create('textarea', { - toolbar: 'source|link,image,youtube|code,bold,italic,underline,strike,superscript,size,color|quote,orderedlist,bulletlist', - autoExpand: true, - resizeMaxHeight: -1, - //resizeEnabled: false, - width: '100%', - height: 100, - //emoticonsEnabled: false, - }); - } - </script> - </head> - <body onload="init()"> - <p> - <a href="https://www.sceditor.com/">SCEditor</a> - </p> - <textarea></textarea> - </body> -</html> -<% -end
--- a/src/test/tiny.html Mon Aug 15 13:49:57 2022 -0600 +++ b/src/test/tiny.html Mon Oct 31 14:06:58 2022 -0600 @@ -2,7 +2,7 @@ <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> - <script src="/site.js"></script> + <script src="upload.js"></script> <script src="http://tinymce.luan.software/tinymce.min.js" xreferrerpolicy="origin"></script> <style> input[type="file"] {
--- a/src/test/upload.html Mon Aug 15 13:49:57 2022 -0600 +++ b/src/test/upload.html Mon Oct 31 14:06:58 2022 -0600 @@ -5,7 +5,7 @@ <style> @import "/site.css"; </style> - <script src="/site.js"></script> + <script src="upload.js"></script> <script> function uploaded(input,url,filename) { console.log(url);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/upload.js Mon Oct 31 14:06:58 2022 -0600 @@ -0,0 +1,31 @@ +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(); +}