casino + style shit

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-05 01:15:37 +02:00
parent 554c53633c
commit 0c32d56cd6
71 changed files with 1722 additions and 4267 deletions

View File

@ -12,8 +12,8 @@ popClickBadgeTemplateDOM.loading = "lazy";
popClickBadgeTemplateDOM.alt = "badge";
/**
* @param {MouseEvent} e
*/
* @param {MouseEvent} e
*/
function popclick(e) {
// We let through those methods
if(e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)

View File

@ -267,9 +267,9 @@ emojiRequest.onload = async (e) => {
}
/**
*
* @param {Event} e
*/
*
* @param {Event} e
*/
function switchEmojiTab(e)
{
const className = e.currentTarget.dataset.className;
@ -315,9 +315,9 @@ async function start_search() {
}
/**
* Add the selected emoji to the targeted text area
* @param {Event} event
*/
* Add the selected emoji to the targeted text area
* @param {Event} event
*/
function emojiAddToInput(event)
{
// This should not happen if used properly but whatever

View File

@ -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

View File

@ -278,7 +278,7 @@ class Comment(Base):
@property
def json(self):
if self.is_banned:
data= {'is_banned': True,
data = {'is_banned': True,
'ban_reason': self.ban_reason,
'id': self.id,
'post': self.post.id if self.post else 0,
@ -286,7 +286,7 @@ class Comment(Base):
'parent': self.parent_fullname
}
elif self.deleted_utc:
data= {'deleted_utc': self.deleted_utc,
data = {'deleted_utc': self.deleted_utc,
'id': self.id,
'post': self.post.id if self.post else 0,
'level': self.level,
@ -296,7 +296,7 @@ class Comment(Base):
flags = {}
for f in self.flags: flags[f.user.username] = f.reason
data= {
data = {
'id': self.id,
'level': self.level,
'author_name': self.author_name,

View File

@ -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

View File

@ -94,9 +94,9 @@ def build_url_re(tlds, protocols):
"""
return re.compile(
r"""\(* # Match any opening parentheses.
\b(?<![@.])(?:(?:{0}):/{{0,3}}(?:(?:\w+:)?\w+@)?)? # http://
([\w-]+\.)+(?:{1})(?:\:[0-9]+)?(?!\.\w)\b # xx.yy.tld(:##)?
r"""\(*# Match any opening parentheses.
\b(?<![@.])(?:(?:{0}):/{{0,3}}(?:(?:\w+:)?\w+@)?)?# http://
([\w-]+\.)+(?:{1})(?:\:[0-9]+)?(?!\.\w)\b# xx.yy.tld(:##)?
(?:[/?][^#\s\{{\}}\|\\\^\[\]`<>"]*)?
# /path/zz (excluding "unsafe" chars from RFC 1738,
# except for ~, which happens in practice)

View File

@ -68,8 +68,8 @@ def chart(kind, site):
signup_chart.grid(), posts_chart.grid(), comments_chart.grid()
signup_chart.plot (daily_times, daily_signups, color='red')
posts_chart.plot (daily_times, post_stats, color='blue')
signup_chart.plot(daily_times, daily_signups, color='red')
posts_chart.plot(daily_times, post_stats, color='blue')
comments_chart.plot(daily_times, comment_stats, color='purple')
signup_chart.set_ylim(ymin=0)

View File

@ -333,7 +333,7 @@ def sign_up_post(v):
password=request.values.get("password"),
email=email,
referred_by=ref_id or None,
ban_evade = int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(session.get("history", []))).all() if x)),
ban_evade =int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(session.get("history", []))).all() if x)),
profileurl=profileurl
)

View File

@ -716,7 +716,7 @@ def settings_name_change(v):
search_name = new_name.replace('\\', '').replace('_','\_').replace('%','')
x= g.db.query(User).filter(
x = g.db.query(User).filter(
or_(
User.username.ilike(search_name),
User.original_username.ilike(search_name)

View File

@ -849,7 +849,7 @@ def is_available(name):
name2 = name.replace('\\', '').replace('_','\_').replace('%','')
x= g.db.query(User).filter(
x = g.db.query(User).filter(
or_(
User.username.ilike(name2),
User.original_username.ilike(name2)

View File

@ -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>
<div class="casino-lottery">{% include "lottery.html" %}</div>
{% endblock %}