Skip to content

Commit

Permalink
Merge pull request #6 from Jarvl/dracula-flow
Browse files Browse the repository at this point in the history
Add dracula flow
  • Loading branch information
Jarvl authored Feb 19, 2024
2 parents 725e17c + 3fa41e9 commit c87d7a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
- name: Build application
run: npm run build

- name: Replace dracula js file
run: |
curl ${{ secrets.DRACULA_URL }} > public/js/dracula.js
# See: https://github.com/orgs/community/discussions/25768#discussioncomment-3249186
- name: Set lowercase image name env var
run: |
Expand Down
11 changes: 4 additions & 7 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var pieceValues = {
[game.QUEEN]: 9,
[game.KING]: 1000,
}
var gameStarted = false;

// TODO: not fully working? I dont think it's calculating the piece values correctly. All board values are -1 when a rook/knight/etc. could be taken by white next turn
var getBoardValue = function(move) {
Expand Down Expand Up @@ -120,15 +119,13 @@ var onDrop = function (source, target) {
removeGreySquares();

displayMoveHistory(game.history());
if (!gameStarted) {
setSubtitle("Walked along the sand dunes of the Sahara desert for forty days and forty nights with nothing but a pack of Newports and a fifth of henny. I really do this shit.");
gameStarted = true;
}
setSubtitle();
window.setTimeout(makeBestMove, 1000);
};

var setSubtitle = function(text) {
document.getElementById("subtitle").textContent = text;
var setSubtitle = function() {
var draculaLine = window.draculaFlowLines[Math.floor(Math.random()*window.draculaFlowLines.length)]
document.getElementById("subtitle").textContent = draculaLine;
}

var onSnapEnd = function () {
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h1>Chess</h1>
<script src="https://unpkg.com/@chrisoakman/[email protected]/dist/chessboard-1.0.0.min.js"
integrity="sha384-8Vi8VHwn3vjQ9eUHUxex3JSN/NFqUg3QbPyX8kWyb93+8AC/pPWTzj+nHtbC5bxD"
crossorigin="anonymous"></script>
<script src="js/dracula.js?v=1"></script>
<script src="js/bundle.js?v=hXQCliWSIfOVCpFdslPMr3iMuSvTZelc"></script>
</body>
</html>
1 change: 1 addition & 0 deletions public/js/dracula.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.draculaFlowLines = ["I'm him. I've been him. I will continue to be him."];

0 comments on commit c87d7a8

Please sign in to comment.