Skip to content

Commit

Permalink
Added TCGPlayer URL
Browse files Browse the repository at this point in the history
  • Loading branch information
suitangi committed Aug 13, 2024
1 parent eb2fc21 commit 6b8ff80
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 17 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ A Magic: The Gathering card art letter guessing game similar to Hangman. With da

[![Page Deployment](https://github.com/suitangi/Befuddle/actions/workflows/static.yml/badge.svg)](https://github.com/suitangi/Befuddle/actions/workflows/static.yml)

# Updating Befuddle
Run `node ./maintenance/update.js` from the root directory of the repo
© Ignatius Liu, 2024

The script accepts the following flags:
# Updating Befuddle
Run `node ./maintenance/update.js` from the root directory of the repo. The script accepts the following flags:
- `-nd` or `-nodownload`: Skips downloading the bulk data from Scryfall
- `-daily`: Adds 50 days to the Daily mode

Then commit the changes.
Then commit/push the changes.

# Todo:

Expand All @@ -33,8 +33,15 @@ Then commit the changes.
- For beta testing and for helping conceptualize the idea, the one an only [G-Jayakar](https://github.com/G-Jayakar).
- Beta testing and pro bug finder Ksax.

# Disclaimer and Credits
Portions of Befuddle are unofficial Fan Content permitted under the Wizards of the Coast Fan Content Policy. The literal and graphical information presented on this site about Magic: The Gathering, including card images, the mana symbols, is copyright Wizards of the Coast, LLC, a subsidiary of Hasbro, Inc. Befuddle is not produced by, endorsed by, supported by, or affiliated with Wizards of the Coast.

- Card Data and Images: [Scryfall](https://scryfall.com/)
- Font: [Wizards of the Coast](https://company.wizards.com/en)

# Changelog
```
8/12/2024: Card update; added TCGPlayer URL to Free Mode
7/31/2024: Trimmed card database; accents are no longer free and will correspond to letters
7/29/2024: Routine card update; a couple more new Dailies; added maintenance
6/3/2024: Routine card update; new Dailies
Expand Down
37 changes: 24 additions & 13 deletions scripts/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const canVibrate = window.navigator.vibrate;
const befuddleAppVersion = "2024.7.31";
const befuddleAppVersion = "2024.8.12";
const tcgSVG = '<svg class="tcg-svg" version="1.1" viewBox="0.0 0.0 144.0 120.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l144.0 0l0 120.0l-144.0 0l0 -120.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l144.0 0l0 120.0l-144.0 0z" fill-rule="evenodd"/><path fill="#ffffff" d="m3.6983974 43.321297l0 0c-2.0432932 -5.575428 0.84098935 -11.693382 6.4422255 -13.664833l40.56652 -14.278071l0 0c2.689808 -0.94672394 5.6592407 -0.79107285 8.255051 0.4327116c2.5958138 1.2237835 4.6053696 3.4154549 5.5865936 6.0928707l21.734444 59.30565c2.0432892 5.575424 -0.8409958 11.693382 -6.44223 13.664833l-40.56652 14.278069c-5.6012383 1.9714508 -11.798353 -0.95014954 -13.841646 -6.5255814z" fill-rule="evenodd"/><path stroke="#333333" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m3.6983974 43.321297l0 0c-2.0432932 -5.575428 0.84098935 -11.693382 6.4422255 -13.664833l40.56652 -14.278071l0 0c2.689808 -0.94672394 5.6592407 -0.79107285 8.255051 0.4327116c2.5958138 1.2237835 4.6053696 3.4154549 5.5865936 6.0928707l21.734444 59.30565c2.0432892 5.575424 -0.8409958 11.693382 -6.44223 13.664833l-40.56652 14.278069c-5.6012383 1.9714508 -11.798353 -0.95014954 -13.841646 -6.5255814z" fill-rule="evenodd"/><path fill="#ffffff" d="m79.253204 21.990696l0 0c2.013565 -5.6003723 8.205383 -8.563349 13.829811 -6.6179914l40.734505 14.089097l0 0c2.700943 0.93419456 4.9071503 2.8984814 6.1332703 5.460745c1.22612 2.5622635 1.3717194 5.512615 0.4047699 8.202007l-21.369644 59.435795c-2.013565 5.6003723 -8.205383 8.563347 -13.829819 6.6179886l-40.734497 -14.089096c-5.6244316 -1.9453583 -8.551613 -8.062378 -6.538044 -13.66275z" fill-rule="evenodd"/><path stroke="#333333" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m79.253204 21.990696l0 0c2.013565 -5.6003723 8.205383 -8.563349 13.829811 -6.6179914l40.734505 14.089097l0 0c2.700943 0.93419456 4.9071503 2.8984814 6.1332703 5.460745c1.22612 2.5622635 1.3717194 5.512615 0.4047699 8.202007l-21.369644 59.435795c-2.013565 5.6003723 -8.205383 8.563347 -13.829819 6.6179886l-40.734497 -14.089096c-5.6244316 -1.9453583 -8.551613 -8.062378 -6.538044 -13.66275z" fill-rule="evenodd"/><path fill="#ffffff" d="m36.106525 18.050085l0 0c0 -5.9491396 4.822731 -10.77187 10.77187 -10.77187l43.08618 0l0 0c2.8568802 0 5.5967484 1.1348906 7.616867 3.1550074c2.020111 2.0201178 3.1550064 4.759984 3.1550064 7.6168623l0 62.960197c0 5.949135 -4.822731 10.771866 -10.771873 10.771866l-43.08618 0c-5.9491386 0 -10.77187 -4.822731 -10.77187 -10.771866z" fill-rule="evenodd"/><path stroke="#333333" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m36.106525 18.050085l0 0c0 -5.9491396 4.822731 -10.77187 10.77187 -10.77187l43.08618 0l0 0c2.8568802 0 5.5967484 1.1348906 7.616867 3.1550074c2.020111 2.0201178 3.1550064 4.759984 3.1550064 7.6168623l0 62.960197c0 5.949135 -4.822731 10.771866 -10.771873 10.771866l-43.08618 0c-5.9491386 0 -10.77187 -4.822731 -10.77187 -10.771866z" fill-rule="evenodd"/><path fill="#333333" d="m79.776436 24.556463l-4.074669 14.430754l-3.3064575 -1.0685692l-1.3463058 14.468933l-3.5430756 -0.83686066l-5.1932907 21.343666l-3.7317772 -23.917072l4.118435 1.2251434l-2.120121 -15.0548935l5.1785316 1.0673485l-2.2834625 -15.851421z" fill-rule="evenodd"/><path stroke="#303030" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m79.776436 24.556463l-4.074669 14.430754l-3.3064575 -1.0685692l-1.3463058 14.468933l-3.5430756 -0.83686066l-5.1932907 21.343666l-3.7317772 -23.917072l4.118435 1.2251434l-2.120121 -15.0548935l5.1785316 1.0673485l-2.2834625 -15.851421z" fill-rule="evenodd"/></g></svg>';


//Helper: Get Query
function getParameterByName(name, url) {
Expand All @@ -12,17 +14,6 @@ function getParameterByName(name, url) {
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

//helper (mostly to clear listeners)
function recreateNode(el, withChildren) {
if (withChildren) {
el.parentNode.replaceChild(el.cloneNode(true), el);
} else {
var newEl = el.cloneNode(false);
while (el.hasChildNodes()) newEl.appendChild(el.firstChild);
el.parentNode.replaceChild(newEl, el);
}
}

//function to request random card data from scryfall api
function requestCard(id) {

Expand Down Expand Up @@ -123,6 +114,11 @@ function loadCard(data) {
window.mtgCard.name = data['name'];
window.mtgCard.colors = data['colors'];

if (window.game.mode == 'free') {
window.mtgCard.tcgLink =
decodeURIComponent(data['purchase_uris']['tcgplayer'].split('u=')[1]) +
'&sharedid=&irpid=5664169&irgwc=1&utm_source=impact&utm_medium=affiliate&utm_campaign=Suitangi';
}

if (multiFace.includes(window.mtgCard['layout'])) {
window.mtgCard.card_faces = [];
Expand Down Expand Up @@ -448,6 +444,13 @@ function gameLostFree() {
typeAnimated: true,
closeIcon: true,
buttons: {
tcg: {
text: `${tcgSVG}`,
btnClass: 'tcg-btn',
action: function() {
window.open(window.mtgCard.tcgLink, '_blank').focus();
}
},
link: {
text: "Share",
btnClass: 'btn-green',
Expand Down Expand Up @@ -709,6 +712,13 @@ function gameWinFree() {
typeAnimated: true,
closeIcon: true,
buttons: {
tcg: {
text: `${tcgSVG}`,
btnClass: 'tcg-btn',
action: function() {
window.open(window.mtgCard.tcgLink, '_blank').focus();
}
},
link: {
text: "Share",
btnClass: 'btn-green',
Expand Down Expand Up @@ -1707,7 +1717,8 @@ function loadGame() {
window.dailyList = data;
dailyCard(data);
})
.catch(function() {
.catch(function(e) {
console.log(e);
console.error('Could not fetch daily card list');
});
} else { //no need to re-fetch
Expand Down
14 changes: 14 additions & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,20 @@ body {
font-size: 17px;
}

.tcg-btn {
background-color: #20247a !important;
padding: 1px 9px !important;
}

.tcg-btn:hover {
background-color: #191b43 !important;
}

.tcg-svg {
width: 29px;
transform: translateY(3px);
}

.kofi-btn {
position: absolute;
background: none !important;
Expand Down

0 comments on commit 6b8ff80

Please sign in to comment.