you need to win all the pawns to win the game
kings are not royal
-https://www.chessvariants.com/diffmove.dir/balaklava.html
-
Rampage Chess: Any Unit May move to any empty square that is guarded. A King cannot make a special move to get out of check.
+https://www.chessvariants.com/rules/pacifist-chess (1 et 2, utilisant somme values ou nb pièces)
+
Swap chess: Friendly pieces may swap places
https://www.chessvariants.com/crossover.dir/koopachess.html
--- /dev/null
+<template lang="pug">
+div
+ input#modalBio.modal(type="checkbox")
+ div#bioDiv(
+ role="dialog"
+ data-checkbox="modalBio"
+ )
+ .card
+ div(v-if="st.user.id == id")
+ h3.section(@click="modeEdit = !modeEdit") Click to edit
+ textarea(
+ v-if="userBio !== undefined"
+ v-show="modeEdit"
+ v-model="userBio"
+ )
+ button#submitBtn(@click="sendBio()") Submit
+ div(
+ v-if="userBio !== undefined"
+ v-html="userBio"
+ @click="modeEdit = !modeEdit"
+ )
+ #dialog.text-center {{ st.tr[infoMsg] }}
+ span.clickable(@click="showBio()") {{ name }}
+</template>
+
+<script>
+import { store } from "@/store";
+import { ajax } from "@/utils/ajax";
+import { processModalClick } from "@/utils/modalClick.js";
+export default {
+ name: "my-user-bio",
+ props: ["id", "name"],
+ data: function() {
+ return {
+ st: store.state,
+ userBio: undefined,
+ infoMsg: "",
+ modeEdit: false
+ };
+ },
+ mounted: function() {
+ document.getElementById("bioDiv")
+ .addEventListener("click", processModalClick);
+ },
+ methods: {
+ showBio: function() {
+ this.infoMsg = "";
+ document.getElementById("modalBio").checked = true;
+ if (this.userBio === undefined) {
+ ajax(
+ "/userbio",
+ "GET",
+ {
+ data: { id: this.id },
+ success: (res) => {
+ this.userBio = res.bio;
+ }
+ }
+ );
+ }
+ },
+ sendBio: function() {
+ ajax(
+ "/userbio",
+ "PUT",
+ {
+ data: { bio: this.userBio },
+ success: () => {
+ this.infoMsg = this.st.tr["Modifications applied!"];
+ }
+ }
+ );
+ }
+ }
+};
+</script>
+
+<style lang="sass" scoped>
+[type="checkbox"].modal+div .card
+ max-width: 768px
+ max-height: 100%
+
+#submitBtn
+ width: 50%
+ margin: 0 auto
+
+#dialog
+ padding: 5px
+ color: blue
+</style>
name: localStorage.getItem("myname") || "", //"" for "anonymous"
email: "", //unknown yet
notify: false, //email notifications
- newsRead: localStorage.getItem("newsRead") || 0,
sid: mysid
};
// Slow verification through the server:
localStorage.removeItem("myname");
this.state.user.email = json.email;
this.state.user.notify = json.notify;
- if (!!json.newsRead && json.newsRead > this.state.user.newsRead)
- this.state.user.newsRead = json.newsRead;
});
// Settings initialized with values from localStorage
const getItemDefaultTrue = (item) => {
"Who's there?": "Who's there?",
With: "With",
with: "with",
- "Write news": "Write news",
"Wrong time control": "Wrong time control",
"Your message": "Your message",
"Who's there?": "¿Quién está ahí?",
With: "Con",
with: "con",
- "Write news": "Escribir una news",
"Wrong time control": "Cadencia errónea",
"Your message": "Tu mensaje",
"Who's there?": "Qui est là ?",
With: "Avec",
with: "avec",
- "Write news": "Écrire une news",
"Wrong time control": "Cadence erronée",
"Your message": "Votre message",
--- /dev/null
+import { ChessRules } from "@/base_rules";
+
+// Plan : garder intact isAttacked,
+// ajouter "guarded" qui somme les attaques blanches et soustrait les attaques noires sur une case
+// (regarder toutes directions, OK)
+// --> boulot à faire sur chaque case vide, après chaque getPotentialMoves()
+// --> sauf si le roi est en échec (avant de jouer).
+
+export class RampageRules extends ChessRules {
+};
v-for="sid in Object.keys(people)"
v-if="!!people[sid].name"
)
- span {{ people[sid].name }}
+ UserBio(:id="people[sid].id" :name="people[sid].name")
button.player-action(
v-if="isGamer(sid)"
@click="watchGame(sid)"
import { getRandString, shuffle, randInt } from "@/utils/alea";
import { getDiagram } from "@/utils/printDiagram";
import Chat from "@/components/Chat.vue";
+import UserBio from "@/components/UserBio.vue";
import GameList from "@/components/GameList.vue";
import ChallengeList from "@/components/ChallengeList.vue";
import { GameStorage } from "@/utils/gameStorage";
name: "my-hall",
components: {
Chat,
+ UserBio,
GameList,
ChallengeList
},
sessionToken varchar,
created datetime,
notify boolean,
- newsRead datetime
+ bio text default ''
);
create table Problems (
* sessionToken: token in cookies for authentication
* notify: boolean (send email notifications for corr games)
* created: datetime
- * newsRead: datetime
+ * bio: text
*/
const UserModel = {
});
},
+ getBio: function(id) {
+ db.serialize(function() {
+ const query =
+ "SELECT bio " +
+ "FROM Users " +
+ "WHERE id = " + id;
+ db.get(query, cb);
+ });
+ },
+
/////////
// MODIFY
});
},
- setNewsRead: function(id) {
+ setBio: function(id, bio) {
db.serialize(function() {
const query =
"UPDATE Users " +
- "SET newsRead = " + Date.now() + " " +
+ "SET bio = ? " +
"WHERE id = " + id;
- db.run(query);
+ db.run(query, bio);
});
},
const genToken = require("../utils/tokenGenerator");
const access = require("../utils/access");
const params = require("../config/parameters");
+const sanitizeHtml = require('sanitize-html');
+
+router.get("/userbio", access.ajax, (req,res) => {
+ const uid = req.query["id"];
+ if (!!(uid.toString().match(/^[0-9]+$/))) {
+ UserModel.getBio(uid, (err, bio) => {
+ res.json(bio);
+ });
+ }
+});
+
+router.put('/userbio', access.logged, access.ajax, (req,res) => {
+ const bio = sanitizeHtml(req.body.bio);
+ UserModel.setBio(req.userId, bio);
+ res.json({});
+});
router.post('/register', access.unlogged, access.ajax, (req,res) => {
const name = req.body.name;
name: user.name,
email: user.email,
id: user.id,
- notify: user.notify,
- newsRead: user.newsRead
+ notify: user.notify
});
};
const anonymous = {
name: "",
email: "",
id: 0,
- notify: false,
- newsRead: 0
+ notify: false
};
if (!req.cookies.token) callback(anonymous);
else if (req.cookies.token.match(/^[a-z0-9]+$/)) {
const ids = req.query["ids"];
// NOTE: slightly too permissive RegExp
if (ids.match(/^([0-9]+,?)+$/)) {
- UserModel.getByIds(ids, (err,users) => {
- res.json({users:users});
+ UserModel.getByIds(ids, (err, users) => {
+ res.json({ users:users });
});
}
});
}
});
-// Special route to update newsRead timestamp:
-router.put('/newsread', access.logged, access.ajax, (req,res) => {
- UserModel.setNewsRead(req.userId);
- res.json({});
-});
-
// Authentication-related methods:
// to: object user (to who we send an email)