Started logs loading management

This commit is contained in:
unsettledgames 2021-04-27 13:00:43 +02:00
parent 079ea38e63
commit 855c125f8a
5 changed files with 26 additions and 6 deletions

View File

@ -15,11 +15,14 @@ console.log('Building Pixel Editor');
function copy_images(){ function copy_images(){
gulp.src('./images/*.png') // Icons
.pipe(gulp.dest(path.join(BUILDDIR, SLUG))); gulp.src('./images/*.png').pipe(gulp.dest(path.join(BUILDDIR, SLUG)));
// Splash images
gulp.src('./images/Splash images/*.png').pipe(gulp.dest(path.join(BUILDDIR, SLUG)));
}
gulp.src('./images/Splash images/*.png') function copy_logs() {
.pipe(gulp.dest(path.join(BUILDDIR, SLUG))); gulp.src('logs/*.html').pipe(gulp.dest(path.join(BUILDDIR, SLUG)));
} }
function render_js(){ function render_js(){
@ -59,4 +62,4 @@ function compile_page(){
// empty the build folder, or create it // empty the build folder, or create it
fs.rmdirSync(BUILDDIR, { recursive: true }); fs.rmdirSync(BUILDDIR, { recursive: true });
fs.mkdirSync(BUILDDIR); fs.mkdirSync(BUILDDIR);
gulp.parallel(copy_images, render_js, render_css, compile_page)(); gulp.parallel(copy_images, copy_logs, render_js, render_css, compile_page)();

14
js/_logs.js Normal file
View File

@ -0,0 +1,14 @@
var rawFile = new XMLHttpRequest();
rawFile.open("GET", '/pixel-editor/latestLog.html', false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
document.getElementById("latest-update").innerHTML = allText;
}
}
}
rawFile.send(null);

View File

@ -54,6 +54,7 @@
//=include _colorPicker.js //=include _colorPicker.js
//=include _paletteBlock.js //=include _paletteBlock.js
//=include _splashPage.js //=include _splashPage.js
//=include _logs.js
/**load file**/ /**load file**/
//=include _loadImage.js //=include _loadImage.js

1
logs/latestLog.html Normal file
View File

@ -0,0 +1 @@
<h1>Hello update</h1>

View File

@ -622,5 +622,6 @@
</script> </script>
<script src="/pixel-editor/pixel-editor.js"></script> <script src="/pixel-editor/pixel-editor.js"></script>
<script src="/reload/reload.js"></script> <script src="/reload/reload.js"></script>
<script src="/fs/fs.js"></script>
</body> </body>
</html> </html>