optional desktop app update

This commit is contained in:
anständig 2022-05-09 10:58:25 -05:00
parent 5fe7f37b57
commit 02aeb3316f
6 changed files with 4323 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -1,6 +1,7 @@
<html>
<head>
<title>chessn't</title>
<link rel="icon" href="icon.png">
<style>
html,
body {
@ -100,7 +101,7 @@ body::-webkit-scrollbar {
//board
var boardMain =
[
[{},{},{},{},{'piece':'bridger','icon':'br+','loc':{'z':0}},{},{},{'piece':'bridger','icon':'br+','loc':{'z':0}},{}],
[{},{},{},{},{'piece':'bridger','icon':'br+','color':'white','loc':{'z':0}},{},{},{'piece':'rook','icon':'r','color':'white','loc':{'z':0}},{}],
[{},{},{},{},{},{},{},{},{}],
[{},{},{},{},{},{},{},{},{}],
[{},{},{},{},{},{},{},{},{}],
@ -209,6 +210,7 @@ body::-webkit-scrollbar {
let piece = board[row][col]
switch(piece.piece){
case'rook':
/*
for(let c in board[row]){ //sides
let elem = document.getElementById(row+c)//maybe change to string
if(board[row][c]!='temp'&&board[row][c]!=''&&row+''+c!=row+''+col){
@ -223,7 +225,40 @@ body::-webkit-scrollbar {
elem.addEventListener('click', function(){ move(row,col,r,col,z,z) } )
}
}
*/
for(let r = row;r!=board.length;r++){
let elem = document.getElementById(r+''+col)
if(board[r][col]!=null&&board[r][col].color==board[row][col].color&&r+''+col!=row+''+col){break}
if(elem!=null&&[r][col]!='temp'&&board[r][col]!=''&&r+''+col!=row+''+col){
elem.style.backgroundColor=highlight1
elem.addEventListener('click', function(){ move(row,col,r,col,z,z) } )
}
}
for(let r = row;r!=-1;r--){
let elem = document.getElementById(r+''+col)
if(elem!=null&&board[r][col].color==board[row][col].color&&r+''+col!=row+''+col){break}
if(elem!=null&&[r][col]!='temp'&&board[r][col]!=''&&r+''+col!=row+''+col){
elem.style.backgroundColor=highlight1
elem.addEventListener('click', function(){ move(row,col,r,col,z,z) } )
}
}
for(let c = col;c!=board[row].length;c++){
let elem = document.getElementById(row+''+c)
if(board[row][c].color==board[row][col].color&&row+''+c!=row+''+col){break}
if(elem!=null&&[row][c]!='temp'&&board[row][c]!=''&&row+''+c!=row+''+col){
elem.style.backgroundColor=highlight1
elem.addEventListener('click', function(){ move(row,col,row,c,z,z) } )
}
}
for(let c = col;c!=-1;c--){
let elem = document.getElementById(row+''+c)
if(board[row][c].color==board[row][col].color&&row+''+c!=row+''+col){break}
if(elem!=null&&[row][c]!='temp'&&board[row][c]!=''&&row+''+c!=row+''+col){
elem.style.backgroundColor=highlight1
elem.addEventListener('click', function(){ move(row,col,row,c,z,z) } )
}
}
//console.log(row + ''+board.length)
break;
case'bridger':
elem = document.getElementById(row+1+''+col)//maybe change to string

18
index.js Normal file
View File

@ -0,0 +1,18 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true,
icon: __dirname + '/icon.png',
frame: false
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})

4244
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "chessnt",
"version": "1.0.0",
"description": "[view it here](https://squiresgrant.github.io/chessnt/)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/squiresgrant/chessnt.git"
},
"author": "grant squires",
"license": "ISC",
"bugs": {
"url": "https://github.com/squiresgrant/chessnt/issues"
},
"homepage": "https://github.com/squiresgrant/chessnt#readme",
"dependencies": {
"electron": "^18.2.0"
}
}