& > #leftMenu
margin-top: 42px
padding-bottom: 5px
+ & > a
+ text-decoration: none
+ color: #2c3e50
+ &.router-link-exact-active
+ color: #42b983
& > #rightMenu
padding-top: 5px
border-top: 1px solid darkgrey
color: red
&:link, &:visited, &:hover
color: red
-
-// Styles for diagrams and board (partial).
-// TODO: where to put that ?
-
-.light-square-diag
- background-color: #e5e5ca
-
-.dark-square-diag
- background-color: #6f8f57
-
-div.board
- user-select: none
- float: left
- height: 0
- display: inline-block
- position: relative
-
-div.board5
- width: 20%
- padding-bottom: 20%
-
-div.board8
- width: 12.5%
- padding-bottom: 12.5%
-
-div.board9
- width: 11.1%
- padding-bottom: 11.1%
-
-div.board10
- width: 10%
- padding-bottom: 10%
-
-div.board11
- width: 9.09%
- padding-bottom: 9.09%
-
-div.board12
- width: 8.33%
- padding-bottom: 8.33%
-
-img.piece
- width: 100%
-
-img.piece, img.mark-square, img.circle-square
- max-width: 100%
- height: auto
- display: block
-
-img.mark-square
- opacity: .7
- width: 76%
- position: absolute
- top: 12%
- left: 12%
-
-img.circle-square
- opacity: 0.7
- width: 100%
- position: absolute
- top: 0
- left: 0
-
-.in-shadow
- filter: brightness(50%)
</style>
</script>
<style lang="sass" scoped>
+@import "@/styles/_board_squares_img.sass";
+
// NOTE: no variants with reserve of size != 8
.game.reserve-div
margin-bottom: 18px
background-color: #9f9fff
.dark-square.chesstempo.highlight-dark
background-color: #557fff
-
</style>
+++ /dev/null
-@import "./styles/_variables.scss";
-https://css-tricks.com/how-to-import-a-sass-file-into-every-vue-component-in-an-app/
---> Stop duplicating CSS
--- /dev/null
+// Styles for diagrams and board (partial).
+
+.light-square-diag
+ background-color: #e5e5ca
+
+.dark-square-diag
+ background-color: #6f8f57
+
+div.board
+ user-select: none
+ float: left
+ height: 0
+ display: inline-block
+ position: relative
+
+div.board5
+ width: 20%
+ padding-bottom: 20%
+
+div.board8
+ width: 12.5%
+ padding-bottom: 12.5%
+
+div.board9
+ width: 11.1%
+ padding-bottom: 11.1%
+
+div.board10
+ width: 10%
+ padding-bottom: 10%
+
+div.board11
+ width: 9.09%
+ padding-bottom: 9.09%
+
+div.board12
+ width: 8.33%
+ padding-bottom: 8.33%
+
+img.piece
+ width: 100%
+
+img.piece, img.mark-square, img.circle-square
+ max-width: 100%
+ height: auto
+ display: block
+
+img.mark-square
+ opacity: .7
+ width: 76%
+ position: absolute
+ top: 12%
+ left: 12%
+
+img.circle-square
+ opacity: 0.7
+ width: 100%
+ position: absolute
+ top: 0
+ left: 0
+
+.in-shadow
+ filter: brightness(50%)
--- /dev/null
+figure.diagram-container
+ margin: 15px 0 15px 0
+ text-align: center
+ width: 100%
+ display: block
+ .diagram
+ display: block
+ width: 50%
+ min-width: 240px
+ margin-left: auto
+ margin-right: auto
+ .diag12
+ float: left
+ width: 40%
+ margin-left: calc(10% - 20px)
+ margin-right: 40px
+ @media screen and (max-width: 630px)
+ float: none
+ margin: 0 auto 10px auto
+ .diag22
+ float: left
+ width: 40%
+ margin-right: calc(10% - 20px)
+ @media screen and (max-width: 630px)
+ float: none
+ margin: 0 auto
+ figcaption
+ display: block
+ clear: both
+ padding-top: 5px
+ font-size: 0.8em
+
+p.boxed
+ background-color: #FFCC66
+ padding: 5px
+
+.bigfont
+ font-size: 1.2em
+
+.bold
+ font-weight: bold
+
+.stageDelimiter
+ color: purple
+
+// To show (new) pieces, and/or there values...
+figure.showPieces > img
+ width: 50px
+
+figure.showPieces > figcaption
+ color: #6C6C6C
+
+.section-title
+ padding: 0
+
+.section-title > h4
+ padding: 5px
+
+ol, ul:not(.browser-default)
+ padding-left: 20px
+
+ul:not(.browser-default)
+ margin-top: 5px
+
+ul:not(.browser-default) > li
+ list-style-type: disc
+
+table
+ margin: 15px auto
+
+.italic
+ font-style: italic
+
+img.img-center
+ display: block
+ margin: 0 auto 15px auto
};
</script>
+<!-- Not scoped, because code is injected -->
<style lang="sass">
#links
margin: var(--universal-margin);
<template lang="pug">
main
+ input#modalRules.modal(type="checkbox")
+ div#rulesDiv(
+ role="dialog"
+ data-checkbox="modalRules"
+ )
+ .card
+ label.modal-close(for="modalRules")
+ h4#variantNameInAnalyze(@click="gotoRules()") {{ game.vname }}
+ div(v-html="rulesContent")
.row
.col-sm-12
.text-center
<script>
import BaseGame from "@/components/BaseGame.vue";
+import { processModalClick } from "@/utils/modalClick";
+import { replaceByDiag } from "@/utils/printDiagram";
import { store } from "@/store";
export default {
name: "my-analyse",
data: function() {
return {
st: store.state,
+ rulesContent: "",
gameRef: {
vname: "",
fen: ""
created: function() {
this.initFromUrl();
},
+ mounted: function() {
+ document.getElementById("rulesDiv")
+ .addEventListener("click", processModalClick);
+ },
methods: {
alertAndQuit: function(text, wrongVname) {
// Soon after component creation, st.tr might be uninitialized.
else this.loadGame(orientation);
})
.catch((err) => { this.alertAndQuit("Mispelled variant name", true); });
+ this.rulesContent =
+ require(
+ "raw-loader!@/translations/rules/" +
+ this.gameRef.vname + "/" +
+ this.st.lang + ".pug"
+ )
+ // Next two lines fix a weird issue after last update (2019-11)
+ .replace(/\\n/g, " ")
+ .replace(/\\"/g, '"')
+ .replace('module.exports = "', "")
+ .replace(/"$/, "")
+ .replace(/(fen:)([^:]*):/g, replaceByDiag);
+ },
+ gotoRules: function() {
+ this.$router.push("/variants/" + this.gameRef.vname);
},
loadGame: function(orientation) {
this.game.vname = this.gameRef.vname;
};
</script>
-<style lang="sass" scoped=true>
+<style lang="sass">
+@import "@/styles/_board_squares_img.sass"
+@import "@/styles/_rules.sass"
+</style>
+
+<style lang="sass" scoped>
+h4#variantNameInAnalyze
+ cursor: pointer
+ text-align: center
+ text-decoration: underline
+ font-weight: bold
+
+#rulesDiv > .card
+ padding: 5px 0
+ max-width: 50%
+ max-height: 100%
+ @media screen and (max-width: 1500px)
+ max-width: 67%
+ @media screen and (max-width: 1024px)
+ max-width: 85%
+ @media screen and (max-width: 767px)
+ max-width: 100%
+
input#fen
// Use a Monospace font for input FEN width adjustment
font-family: "Fira Code"
await import("@/variants/" + game.vname + ".js")
.then((vModule) => {
window.V = vModule[game.vname + "Rules"];
- // (AJAX) Request to get rules content (plain text, HTML)
- this.rulesContent =
- require(
- "raw-loader!@/translations/rules/" +
- game.vname + "/" +
- this.st.lang + ".pug"
- )
- // Next two lines fix a weird issue after last update (2019-11)
- .replace(/\\n/g, " ")
- .replace(/\\"/g, '"')
- .replace('module.exports = "', "")
- .replace(/"$/, "")
- .replace(/(fen:)([^:]*):/g, replaceByDiag);
this.loadGame(game, callback);
});
+ // (AJAX) Request to get rules content (plain text, HTML)
+ this.rulesContent =
+ require(
+ "raw-loader!@/translations/rules/" +
+ game.vname + "/" +
+ this.st.lang + ".pug"
+ )
+ // Next two lines fix a weird issue after last update (2019-11)
+ .replace(/\\n/g, " ")
+ .replace(/\\"/g, '"')
+ .replace('module.exports = "', "")
+ .replace(/"$/, "")
+ .replace(/(fen:)([^:]*):/g, replaceByDiag);
},
// 3 cases for loading a game:
// - from indexedDB (running or completed live game I play)
#rulesDiv > .card
padding: 5px 0
- max-width: 75%
+ max-width: 50%
max-height: 100%
+ @media screen and (max-width: 1500px)
+ max-width: 67%
@media screen and (max-width: 1024px)
max-width: 85%
@media screen and (max-width: 767px)
</style>
<style lang="sass">
-// TODO: next is duplicated from Rules/. Merge ? How ? ...
-
-figure.diagram-container
- margin: 15px 0 15px 0
- text-align: center
- width: 100%
- display: block
- .diagram
- display: block
- width: 50%
- min-width: 240px
- margin-left: auto
- margin-right: auto
- .diag12
- float: left
- width: 40%
- margin-left: calc(10% - 20px)
- margin-right: 40px
- @media screen and (max-width: 630px)
- float: none
- margin: 0 auto 10px auto
- .diag22
- float: left
- width: 40%
- margin-right: calc(10% - 20px)
- @media screen and (max-width: 630px)
- float: none
- margin: 0 auto
- figcaption
- display: block
- clear: both
- padding-top: 5px
- font-size: 0.8em
-
-p.boxed
- background-color: #FFCC66
- padding: 5px
-
-.bigfont
- font-size: 1.2em
-
-.bold
- font-weight: bold
-
-.stageDelimiter
- color: purple
-
-// To show (new) pieces, and/or there values...
-figure.showPieces > img
- width: 50px
-
-figure.showPieces > figcaption
- color: #6C6C6C
-
-.section-title
- padding: 0
-
-.section-title > h4
- padding: 5px
-
-ol, ul:not(.browser-default)
- padding-left: 20px
-
-ul:not(.browser-default)
- margin-top: 5px
-
-ul:not(.browser-default) > li
- list-style-type: disc
-
-table
- margin: 15px auto
-
-.italic
- font-style: italic
-
-img.img-center
- display: block
- margin: 0 auto 15px auto
+@import "@/styles/_rules.sass"
+@import "@/styles/_board_squares_img.sass"
</style>
};
</script>
-<style lang="sass">
+<style lang="sass" scoped>
.active
color: #42a983
};
</script>
-<style lang="sass">
+<style lang="sass" scoped>
[type="checkbox"].modal+div .card
max-width: 767px
max-height: 100%
color: darkblue
padding: 0 5px 0 var(--universal-margin)
+.margintop
+ margin-top: 25px
+ border-top: 1px solid grey
+@media screen and (max-width: 767px)
+ .margintop
+ margin-top: 10px
+</style>
+
+<style lang="sass">
.news
padding-top: 10px
& > .dev-buttons
display: block
margin-top: 10px
content: " "
-
-.margintop
- margin-top: 25px
- border-top: 1px solid grey
-@media screen and (max-width: 767px)
- .margintop
- margin-top: 10px
</style>
};
</script>
-<!-- NOTE: not scoped here, because HTML is injected (TODO) -->
+<!-- NOTE: not scoped here, because HTML is injected -->
<style lang="sass">
-h4#variantName
- text-align: center
- font-weight: bold
+@import "@/styles/_board_squares_img.sass"
+@import "@/styles/_rules.sass"
+</style>
-figure.diagram-container
- margin: 15px 0 15px 0
+<style lang="sass" scoped>
+h4#variantName
text-align: center
- width: 100%
- display: block
- .diagram
- display: block
- width: 50%
- min-width: 240px
- margin-left: auto
- margin-right: auto
- .diag12
- float: left
- width: 40%
- margin-left: calc(10% - 20px)
- margin-right: 40px
- @media screen and (max-width: 630px)
- float: none
- margin: 0 auto 10px auto
- .diag22
- float: left
- width: 40%
- margin-right: calc(10% - 20px)
- @media screen and (max-width: 630px)
- float: none
- margin: 0 auto
- figcaption
- display: block
- clear: both
- padding-top: 5px
- font-size: 0.8em
-
-p.boxed
- background-color: #FFCC66
- padding: 5px
-
-.bigfont
- font-size: 1.2em
-
-.bold
font-weight: bold
-
-.stageDelimiter
- color: purple
-
-// To show (new) pieces, and/or there values...
-figure.showPieces > img
- width: 50px
-
-figure.showPieces > figcaption
- color: #6C6C6C
-
-.section-title
- padding: 0
-
-.section-title > h4
- padding: 5px
-
-ol, ul:not(.browser-default)
- padding-left: 20px
-
-ul:not(.browser-default)
- margin-top: 5px
-
-ul:not(.browser-default) > li
- list-style-type: disc
-
-table
- margin: 15px auto
-
-.italic
- font-style: italic
-
-img.img-center
- display: block
- margin: 0 auto 15px auto
</style>