Compare commits
4 Commits
1c1d183dbe
...
cbe3a33311
Author | SHA1 | Date |
---|---|---|
Max Bradbury | cbe3a33311 | |
Max Bradbury | 3903e4e6be | |
Max Bradbury | 0e0c4a4a73 | |
Max Bradbury | eff32a6540 |
|
@ -1,8 +1,11 @@
|
|||
[package]
|
||||
name = "bitsy-merge"
|
||||
version = "0.71.0"
|
||||
name = "mixsy"
|
||||
description = "combine Bitsy games"
|
||||
version = "0.72.0"
|
||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
repository = "https://tinybird.dev/max/mixsy"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
|
3
build.sh
3
build.sh
|
@ -1,5 +1,6 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cargo build
|
||||
pug index.pug
|
||||
set -ex
|
||||
wasm-pack build --target web
|
||||
|
|
16
index.js
16
index.js
|
@ -8,12 +8,24 @@ async function run() {
|
|||
const output = document.getElementById('c');
|
||||
const merge_button = document.getElementById('merge');
|
||||
|
||||
function handleResult(inputElement, message) {
|
||||
console.log(message);
|
||||
let messageBox = inputElement.nextSibling;
|
||||
messageBox.innerText = message;
|
||||
messageBox.style.display = "block"
|
||||
setTimeout(() => {messageBox.style.display = "none"}, 4000);
|
||||
}
|
||||
|
||||
main.addEventListener('change', () => {
|
||||
console.debug(load_main(main.value));
|
||||
if (main.value) {
|
||||
handleResult(main, load_main(main.value));
|
||||
}
|
||||
});
|
||||
|
||||
additional.addEventListener('change', () => {
|
||||
console.debug(load_additional(additional.value));
|
||||
if (additional.value) {
|
||||
handleResult(additional, load_additional(additional.value));
|
||||
}
|
||||
});
|
||||
|
||||
function mix() {
|
||||
|
|
|
@ -3,6 +3,8 @@ html(lang="en-gb")
|
|||
head
|
||||
meta(content="text/html;charset=utf-8" http-equiv="Content-Type")
|
||||
title mixsy
|
||||
//- no favicon!! taken from: https://k1ss.org/blog/20191004a
|
||||
<link href=data:, rel=icon>
|
||||
style
|
||||
include style.css
|
||||
body
|
||||
|
@ -13,9 +15,11 @@ html(lang="en-gb")
|
|||
#main.square.left
|
||||
h2 main
|
||||
textarea#a(placeholder="Paste your main game data here...")
|
||||
p.result
|
||||
#additional.square.left
|
||||
h2 additional
|
||||
textarea#b(placeholder="Paste additional game data here...")
|
||||
p.result
|
||||
.row.middle
|
||||
img.centre(src="merge.png" alt="")
|
||||
button#merge.centre mix!
|
||||
|
|
|
@ -41,6 +41,11 @@ pub fn load_additional(game_data: String) -> String {
|
|||
#[wasm_bindgen]
|
||||
pub fn merge() -> String {
|
||||
let state = STATE.lock().unwrap();
|
||||
|
||||
if state.main.is_none() || state.additional.is_none() {
|
||||
return "".to_string();
|
||||
}
|
||||
|
||||
let mut main = state.main.clone().unwrap();
|
||||
let additional = state.additional.clone().unwrap();
|
||||
main.merge(additional);
|
||||
|
|
Loading…
Reference in New Issue