forked from rDrama/rDrama
casino + style shit
parent
554c53633c
commit
0c32d56cd6
|
@ -1,64 +1,9 @@
|
|||
class LiteYTEmbed extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.videoId = this.getAttribute('videoid');
|
||||
|
||||
let playBtnEl = this.querySelector('.lty-playbtn');
|
||||
this.playLabel = (playBtnEl && playBtnEl.textContent.trim()) || this.getAttribute('playlabel') || 'Play';
|
||||
if (!this.style.backgroundImage) {
|
||||
this.style.backgroundImage = `url("https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg")`;
|
||||
}
|
||||
if (!playBtnEl) {
|
||||
playBtnEl = document.createElement('button');
|
||||
playBtnEl.type = 'button';
|
||||
playBtnEl.classList.add('lty-playbtn');
|
||||
this.append(playBtnEl);
|
||||
}
|
||||
if (!playBtnEl.textContent) {
|
||||
const playBtnLabelEl = document.createElement('span');
|
||||
playBtnLabelEl.className = 'lyt-visually-hidden';
|
||||
playBtnLabelEl.textContent = this.playLabel;
|
||||
playBtnEl.append(playBtnLabelEl);
|
||||
}
|
||||
this.addEventListener('pointerover', LiteYTEmbed.warmConnections, {once: true});
|
||||
this.addEventListener('click', this.addIframe);
|
||||
}
|
||||
static addPrefetch(kind, url, as) {
|
||||
const linkEl = document.createElement('link');
|
||||
linkEl.rel = kind;
|
||||
linkEl.href = url;
|
||||
if (as) {
|
||||
linkEl.as = as;
|
||||
}
|
||||
document.head.append(linkEl);
|
||||
}
|
||||
static warmConnections() {
|
||||
if (LiteYTEmbed.preconnected) return;
|
||||
|
||||
LiteYTEmbed.addPrefetch('preconnect', 'https://www.youtube-nocookie.com');
|
||||
LiteYTEmbed.addPrefetch('preconnect', 'https://www.google.com');
|
||||
LiteYTEmbed.addPrefetch('preconnect', 'https://googleads.g.doubleclick.net');
|
||||
LiteYTEmbed.addPrefetch('preconnect', 'https://static.doubleclick.net');
|
||||
|
||||
LiteYTEmbed.preconnected = true;
|
||||
}
|
||||
|
||||
addIframe() {
|
||||
if (this.classList.contains('lyt-activated')) return;
|
||||
this.classList.add('lyt-activated');
|
||||
|
||||
const params = new URLSearchParams(this.getAttribute('params') || []);
|
||||
params.append('autoplay', '1');
|
||||
|
||||
const iframeEl = document.createElement('iframe');
|
||||
iframeEl.width = 560;
|
||||
iframeEl.height = 315;
|
||||
iframeEl.sandbox = 'allow-scripts allow-same-origin allow-popups';
|
||||
iframeEl.title = this.playLabel;
|
||||
iframeEl.allow = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';
|
||||
iframeEl.allowFullscreen = true;
|
||||
iframeEl.src = `https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${params.toString()}`;
|
||||
this.append(iframeEl);
|
||||
iframeEl.focus();
|
||||
}
|
||||
}
|
||||
customElements.define('lite-youtube', LiteYTEmbed);
|
||||
class LiteYTEmbed extends HTMLElement{connectedCallback(){this.videoId=this.getAttribute('videoid');let playBtnEl=this.querySelector('.lty-playbtn');this.playLabel=(playBtnEl&&playBtnEl.textContent.trim())||this.getAttribute('playlabel')||'Play';if(!this.style.backgroundImage){this.style.backgroundImage=`url("https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg")`}
|
||||
if(!playBtnEl){playBtnEl=document.createElement('button');playBtnEl.type='button';playBtnEl.classList.add('lty-playbtn');this.append(playBtnEl)}
|
||||
if(!playBtnEl.textContent){const playBtnLabelEl=document.createElement('span');playBtnLabelEl.className='lyt-visually-hidden';playBtnLabelEl.textContent=this.playLabel;playBtnEl.append(playBtnLabelEl)}
|
||||
this.addEventListener('pointerover',LiteYTEmbed.warmConnections,{once:!0});this.addEventListener('click',this.addIframe)}
|
||||
static addPrefetch(kind,url,as){const linkEl=document.createElement('link');linkEl.rel=kind;linkEl.href=url;if(as){linkEl.as=as}
|
||||
document.head.append(linkEl)}
|
||||
static warmConnections(){if(LiteYTEmbed.preconnected)return;LiteYTEmbed.addPrefetch('preconnect','https://www.youtube-nocookie.com');LiteYTEmbed.addPrefetch('preconnect','https://www.google.com');LiteYTEmbed.addPrefetch('preconnect','https://googleads.g.doubleclick.net');LiteYTEmbed.addPrefetch('preconnect','https://static.doubleclick.net');LiteYTEmbed.preconnected=!0}
|
||||
addIframe(){if(this.classList.contains('lyt-activated'))return;this.classList.add('lyt-activated');const params=new URLSearchParams(this.getAttribute('params')||[]);params.append('autoplay','1');const iframeEl=document.createElement('iframe');iframeEl.width=560;iframeEl.height=315;iframeEl.sandbox='allow-scripts allow-same-origin allow-popups';iframeEl.title=this.playLabel;iframeEl.allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';iframeEl.allowFullscreen=!0;iframeEl.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${params.toString()}`;this.append(iframeEl);iframeEl.focus()}}
|
||||
customElements.define('lite-youtube',LiteYTEmbed)
|
File diff suppressed because one or more lines are too long
|
@ -49,8 +49,8 @@ def save_game_state(game, new_state):
|
|||
|
||||
def get_active_game(gambler):
|
||||
game = g.db.query(Casino_Game) \
|
||||
.filter(Casino_Game.active == True and
|
||||
Casino_Game.kind == 'blackjack' and
|
||||
.filter(Casino_Game.active == True,
|
||||
Casino_Game.kind == 'blackjack',
|
||||
Casino_Game.user_id == gambler.id).first()
|
||||
|
||||
if game:
|
||||
|
@ -142,7 +142,7 @@ def deal_blackjack_game(gambler, wager_value, currency):
|
|||
|
||||
|
||||
def gambler_hit(gambler):
|
||||
game, game_state = get_active_game(gambler.id)
|
||||
game, game_state = get_active_game(gambler)
|
||||
|
||||
if game:
|
||||
player = game_state['player']
|
||||
|
@ -174,7 +174,7 @@ def gambler_hit(gambler):
|
|||
|
||||
|
||||
def gambler_stayed(gambler):
|
||||
game, game_state = get_active_game(gambler.id)
|
||||
game, game_state = get_active_game(gambler)
|
||||
|
||||
if game:
|
||||
player = game_state['player']
|
||||
|
@ -211,7 +211,7 @@ def gambler_stayed(gambler):
|
|||
|
||||
|
||||
def gambler_doubled_down(gambler):
|
||||
game, game_state = get_active_game(gambler.id)
|
||||
game, game_state = get_active_game(gambler)
|
||||
|
||||
if game and not game_state['doubled_down']:
|
||||
currency_value = getattr(gambler, game.currency, 0)
|
||||
|
@ -234,7 +234,7 @@ def gambler_doubled_down(gambler):
|
|||
|
||||
|
||||
def gambler_purchased_insurance(gambler):
|
||||
game, game_state = get_active_game(gambler.id)
|
||||
game, game_state = get_active_game(gambler)
|
||||
|
||||
if game and not game_state['insurance']:
|
||||
insurance_cost = game.wager / 2
|
||||
|
|
|
@ -123,8 +123,131 @@
|
|||
Blackjack
|
||||
<hr style="flex: 1; margin-left: 1rem" />
|
||||
</div>
|
||||
<div>Give us a moment to fix things.</div>
|
||||
<div class="casino-block-inner">
|
||||
<div class="casino-block-left">
|
||||
<!-- Game -->
|
||||
<div class="casino-block-game">
|
||||
<div class="casino-game">
|
||||
<div style="flex: 1">
|
||||
<div class="blackjack-table">
|
||||
<div style="display: flex; align-items: center">
|
||||
<small style="margin-right: 0.5rem">Dealer</small>
|
||||
<hr style="flex: 1" />
|
||||
</div>
|
||||
<div class="hand" id="casinoBlackjackDealerHand">
|
||||
<div class="playing-card" data-who="dealer"></div>
|
||||
<div class="playing-card" data-who="dealer"></div>
|
||||
<div class="playing-card" data-who="dealer"></div>
|
||||
<div class="playing-card" data-who="dealer"></div>
|
||||
<div class="playing-card" data-who="dealer"></div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="hand" id="casinoBlackjackPlayerHand">
|
||||
<div class="playing-card" data-who="player"></div>
|
||||
<div class="playing-card" data-who="player"></div>
|
||||
<div class="playing-card" data-who="player"></div>
|
||||
<div class="playing-card" data-who="player"></div>
|
||||
<div class="playing-card" data-who="player"></div>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<hr style="flex: 1; margin-right: 0.5rem" />
|
||||
<small>Player</small>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
id="casinoBlackjackResult"
|
||||
class="casino-blackjack-outcome"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bet -->
|
||||
<div class="casino-block-bet">
|
||||
<div id="casinoBlackjackWager" class="lottery-page--stat">
|
||||
<div class="lottery-page--stat-keys" style="margin-right: 1rem">
|
||||
<div>Enter Bet</div>
|
||||
<div>
|
||||
<input
|
||||
id="casinoBlackjackBet"
|
||||
class="form-control"
|
||||
autocomplete="off"
|
||||
value="100"
|
||||
min="100"
|
||||
step="1"
|
||||
aria-label="Bet"
|
||||
name="casinoBlackjackBet"
|
||||
type="number"
|
||||
style="flex: 1; max-width: 200px; text-align: right"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lottery-page--stat-values">
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="casinoBlackjackCurrency"
|
||||
id="casinoBlackjackCurrencyDramacoin"
|
||||
value="dramacoin"
|
||||
checked
|
||||
/>
|
||||
<label
|
||||
class="form-check-label"
|
||||
for="casinoBlackjackCurrencyDramacoin"
|
||||
>
|
||||
<img
|
||||
src="/i/rDrama/coins.webp?v=3009"
|
||||
alt="coin"
|
||||
width="40"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="bottom"
|
||||
title="Dramacoin"
|
||||
aria-label="Dramacoin"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="radio"
|
||||
name="casinoBlackjackCurrency"
|
||||
id="casinoBlackjackCurrencyMarseybux"
|
||||
value="marseybux"
|
||||
/>
|
||||
<label
|
||||
class="form-check-label"
|
||||
for="casinoBlackjackCurrencyMarseybux"
|
||||
>
|
||||
<img
|
||||
src="/i/marseybux.webp?v=2000"
|
||||
alt="marseybux"
|
||||
width="40"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="bottom"
|
||||
title="Marseybux"
|
||||
aria-label="Marseybux"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="casinoBlackjackActions" class="casino-blackjack-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-success lottery-page--action"
|
||||
id="casinoBlackjackDeal"
|
||||
style="width: 100%"
|
||||
onclick="dealBlackjack()"
|
||||
>
|
||||
Deal
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="casino-lottery">{% include "lottery.html" %}</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue