js fixes
parent
c7783d4496
commit
8362a4c497
File diff suppressed because one or more lines are too long
|
@ -54,19 +54,19 @@ function buildRouletteTable() {
|
|||
html += `
|
||||
<div class="roulette-table-row">
|
||||
<div style="flex: 1"></div>
|
||||
<div id="LINE_BET#1" onclick="placeChip('LINE_BET', '1')" class="roulette-table-1to1">Line 1</div>
|
||||
<div id="LINE_BET#2" onclick="placeChip('LINE_BET', '2')" class="roulette-table-1to1">Line 2</div>
|
||||
<div id="LINE_BET#3" onclick="placeChip('LINE_BET', '3')" class="roulette-table-1to1">Line 3</div>
|
||||
<div id="LINE_BET#4" onclick="placeChip('LINE_BET', '4')" class="roulette-table-1to1">Line 4</div>
|
||||
<div id="LINE_BET#5" onclick="placeChip('LINE_BET', '5')" class="roulette-table-1to1">Line 5</div>
|
||||
<div id="LINE_BET#6" onclick="placeChip('LINE_BET', '6')" class="roulette-table-1to1">Line 6</div>
|
||||
<div id="LINE_BET#1" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '1')" class="roulette-table-1to1">Line 1</div>
|
||||
<div id="LINE_BET#2" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '2')" class="roulette-table-1to1">Line 2</div>
|
||||
<div id="LINE_BET#3" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '3')" class="roulette-table-1to1">Line 3</div>
|
||||
<div id="LINE_BET#4" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '4')" class="roulette-table-1to1">Line 4</div>
|
||||
<div id="LINE_BET#5" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '5')" class="roulette-table-1to1">Line 5</div>
|
||||
<div id="LINE_BET#6" data-nonce="${nonce}" data-onclick="placeChip('LINE_BET', '6')" class="roulette-table-1to1">Line 6</div>
|
||||
<div style="flex: 1"></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// First Column
|
||||
html += "<div class=\"roulette-table-row\">";
|
||||
html += `<div id="STRAIGHT_UP_BET#37" onclick="placeChip('STRAIGHT_UP_BET', '37')" class="roulette-table-number roulette-table-number__green">00</div>`
|
||||
html += `<div id="STRAIGHT_UP_BET#37" data-nonce="${nonce}" data-onclick="placeChip('STRAIGHT_UP_BET', '37')" class="roulette-table-number roulette-table-number__green">00</div>`
|
||||
for (let i = 1; i < 13; i++) {
|
||||
const correctNumber = CELL_TO_NUMBER_LOOKUP[i];
|
||||
const isRed = reds.includes(correctNumber);
|
||||
|
@ -79,7 +79,7 @@ function buildRouletteTable() {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
html += `<div id="COLUMN_BET#3" class="roulette-table-column" onclick="placeChip('COLUMN_BET', '3')">Col 3</div>`;
|
||||
html += `<div id="COLUMN_BET#3" class="roulette-table-column" data-nonce="${nonce}" data-onclick="placeChip('COLUMN_BET', '3')">Col 3</div>`;
|
||||
html += "</div>";
|
||||
|
||||
// Second Column
|
||||
|
@ -97,12 +97,12 @@ function buildRouletteTable() {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
html += `<div id="COLUMN_BET#2" class="roulette-table-column" onclick="placeChip('COLUMN_BET', '2')">Col 2</div>`;
|
||||
html += `<div id="COLUMN_BET#2" class="roulette-table-column" data-nonce="${nonce}" data-onclick="placeChip('COLUMN_BET', '2')">Col 2</div>`;
|
||||
html += "</div>";
|
||||
|
||||
// Third Column
|
||||
html += "<div class=\"roulette-table-row\">";
|
||||
html += `<div id="STRAIGHT_UP_BET#0" onclick="placeChip('STRAIGHT_UP_BET', '0')" class="roulette-table-number roulette-table-number__green">0</div>`
|
||||
html += `<div id="STRAIGHT_UP_BET#0" data-nonce="${nonce}" data-onclick="placeChip('STRAIGHT_UP_BET', '0')" class="roulette-table-number roulette-table-number__green">0</div>`
|
||||
for (let i = 25; i < 37; i++) {
|
||||
const correctNumber = CELL_TO_NUMBER_LOOKUP[i];
|
||||
const isRed = reds.includes(correctNumber);
|
||||
|
@ -115,26 +115,26 @@ function buildRouletteTable() {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
html += `<div id="COLUMN_BET#1" class="roulette-table-column" onclick="placeChip('COLUMN_BET', '1')">Col 1</div>`;
|
||||
html += `<div id="COLUMN_BET#1" class="roulette-table-column" data-nonce="${nonce}" data-onclick="placeChip('COLUMN_BET', '1')">Col 1</div>`;
|
||||
html += "</div>";
|
||||
|
||||
// Line Bets and 1:1 Bets
|
||||
html += `
|
||||
<div class="roulette-table-row">
|
||||
<div style="flex: 1"></div>
|
||||
<div id="DOZEN_BET#1" class="roulette-table-line" onclick="placeChip('DOZEN_BET', '1')">1st12</div>
|
||||
<div id="DOZEN_BET#2" class="roulette-table-line" onclick="placeChip('DOZEN_BET', '2')">2nd12</div>
|
||||
<div id="DOZEN_BET#3" class="roulette-table-line" onclick="placeChip('DOZEN_BET', '3')">3rd12</div>
|
||||
<div id="DOZEN_BET#1" class="roulette-table-line" data-nonce="${nonce}" data-onclick="placeChip('DOZEN_BET', '1')">1st12</div>
|
||||
<div id="DOZEN_BET#2" class="roulette-table-line" data-nonce="${nonce}" data-onclick="placeChip('DOZEN_BET', '2')">2nd12</div>
|
||||
<div id="DOZEN_BET#3" class="roulette-table-line" data-nonce="${nonce}" data-onclick="placeChip('DOZEN_BET', '3')">3rd12</div>
|
||||
<div style="flex: 1"></div>
|
||||
</div>
|
||||
<div class="roulette-table-row">
|
||||
<div style="flex: 1"></div>
|
||||
<div id="HIGH_LOW_BET#LOW" class="roulette-table-1to1" onclick="placeChip('HIGH_LOW_BET', 'LOW')">1:18</div>
|
||||
<div id="EVEN_ODD_BET#EVEN" class="roulette-table-1to1" onclick="placeChip('EVEN_ODD_BET', 'EVEN')">EVEN</div>
|
||||
<div id="RED_BLACK_BET#RED" class="roulette-table-1to1" onclick="placeChip('RED_BLACK_BET', 'RED')" style="background-color: red">RED</div>
|
||||
<div id="RED_BLACK_BET#BLACK" class="roulette-table-1to1" onclick="placeChip('RED_BLACK_BET', 'BLACK')" style="background-color: black">BLACK</div>
|
||||
<div id="EVEN_ODD_BET#ODD" class="roulette-table-1to1" onclick="placeChip('EVEN_ODD_BET', 'ODD')">ODD</div>
|
||||
<div id="HIGH_LOW_BET#HIGH" class="roulette-table-1to1" onclick="placeChip('HIGH_LOW_BET', 'HIGH')">19:36</div>
|
||||
<div id="HIGH_LOW_BET#LOW" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('HIGH_LOW_BET', 'LOW')">1:18</div>
|
||||
<div id="EVEN_ODD_BET#EVEN" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('EVEN_ODD_BET', 'EVEN')">EVEN</div>
|
||||
<div id="RED_BLACK_BET#RED" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('RED_BLACK_BET', 'RED')" style="background-color: red">RED</div>
|
||||
<div id="RED_BLACK_BET#BLACK" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('RED_BLACK_BET', 'BLACK')" style="background-color: black">BLACK</div>
|
||||
<div id="EVEN_ODD_BET#ODD" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('EVEN_ODD_BET', 'ODD')">ODD</div>
|
||||
<div id="HIGH_LOW_BET#HIGH" class="roulette-table-1to1" data-nonce="${nonce}" data-onclick="placeChip('HIGH_LOW_BET', 'HIGH')">19:36</div>
|
||||
<div style="flex: 1"></div>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -133,9 +133,9 @@ async function searchGifs(searchTerm) {
|
|||
|
||||
container.innerHTML = '';
|
||||
|
||||
backBtn.innerHTML = '<button class="btn btn-link pl-0 pr-3" id="gifs-back-btn" onclick="getGifs()"><i class="fas fa-long-arrow-left text-muted ml-3"></i></button>';
|
||||
backBtn.innerHTML = `<button class="btn btn-link pl-0 pr-3" id="gifs-back-btn" data-nonce="${nonce}" data-onclick="getGifs()"><i class="fas fa-long-arrow-left text-muted ml-3"></i></button>`;
|
||||
|
||||
cancelBtn.innerHTML = '<button class="btn btn-link pl-3 pr-0" id="gifs-cancel-btn" onclick="getGifs()"><i class="fas fa-times text-muted"></i></button>';
|
||||
cancelBtn.innerHTML = `<button class="btn btn-link pl-3 pr-0" id="gifs-cancel-btn" data-nonce="${nonce}" data-onclick="getGifs()"><i class="fas fa-times text-muted"></i></button>`;
|
||||
|
||||
let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48");
|
||||
let data = await response.json()
|
||||
|
|
|
@ -89,7 +89,7 @@ function updatebgselection(){
|
|||
let bgsDir = backgrounds[bgselector.selectedIndex].folder;
|
||||
for (i=0; i < bgsToDisplay.length; i++) {
|
||||
let onclickPost = bgsDir + "/" + bgsToDisplay[i];
|
||||
str += `<button class="btn btn-secondary bg-button"><img class='bg-image' src="/i/backgrounds/${bgsDir}/${bgsToDisplay[i]}?v=2000" alt="${bgsToDisplay[i]}-background" onclick="post('/settings/personal?background=${onclickPost}')"></button>`;
|
||||
str += `<button class="btn btn-secondary bg-button"><img class='bg-image' src="/i/backgrounds/${bgsDir}/${bgsToDisplay[i]}?v=2000" alt="${bgsToDisplay[i]}-background" data-nonce="${nonce}" data-onclick="post('/settings/personal?background=${onclickPost}')"></button>`;
|
||||
}
|
||||
bgContainer.innerHTML = str;
|
||||
}
|
||||
|
|
|
@ -280,9 +280,9 @@ class Comment(Base):
|
|||
if v:
|
||||
sub = self.post.sub
|
||||
if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): body += ' disabled '
|
||||
body += f''' onchange="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"'''
|
||||
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"'''
|
||||
else:
|
||||
body += f''' onchange="poll_vote_no_v()"'''
|
||||
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_no_v()"'''
|
||||
|
||||
body += f'''><label class="custom-control-label" for="comment-{o.id}">{o.body_html}<span class="presult-{self.id}'''
|
||||
if not self.total_poll_voted(v): body += ' d-none'
|
||||
|
|
|
@ -283,7 +283,7 @@ class Submission(Base):
|
|||
|
||||
for o in self.options:
|
||||
if o.exclusive > 1:
|
||||
body += f'''<div class="custom-control mt-2"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" onchange="bet_vote(this,'{o.id}')"'''
|
||||
body += f'''<div class="custom-control mt-2"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" data-nonce="{{g.nonce}}" data-onclick="bet_vote(this,'{o.id}')"'''
|
||||
if o.voted(v): body += " checked "
|
||||
if not (v and v.coins >= POLL_BET_COINS) or self.total_bet_voted(v): body += " disabled "
|
||||
|
||||
|
@ -297,7 +297,7 @@ class Submission(Base):
|
|||
body += " - <b>WINNER!</b>"
|
||||
|
||||
if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']:
|
||||
body += f'''<button class="btn btn-primary distribute" data-areyousure="postToastReload(this,'/distribute/{o.id}')" onclick="areyousure(this)">Declare winner</button>'''
|
||||
body += f'''<button class="btn btn-primary distribute" data-areyousure="postToastReload(this,'/distribute/{o.id}')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)">Declare winner</button>'''
|
||||
body += "</div>"
|
||||
else:
|
||||
input_type = 'radio' if o.exclusive else 'checkbox'
|
||||
|
@ -307,9 +307,9 @@ class Submission(Base):
|
|||
if v:
|
||||
sub = self.sub
|
||||
if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): body += ' disabled '
|
||||
body += f''' onchange="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'post')"'''
|
||||
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'post')"'''
|
||||
else:
|
||||
body += f''' onchange="poll_vote_no_v()"'''
|
||||
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_no_v()"'''
|
||||
|
||||
body += f'''><label class="custom-control-label" for="post-{o.id}">{o.body_html}<span class="presult-{self.id}'''
|
||||
if not self.total_poll_voted(v): body += ' d-none'
|
||||
|
|
|
@ -405,7 +405,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
|
|||
sanitized = sanitized.replace('\n','')
|
||||
|
||||
if showmore and len(sanitized) > 3500:
|
||||
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized, count=1)
|
||||
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" data-nonce="{{g.nonce}}" data-onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized, count=1)
|
||||
|
||||
return sanitized.strip()
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{# <script defer src="{{'event/js/neko.js'|asset}}"></script> #}
|
||||
{% if request.path == '/' %}
|
||||
<script defer src="{{'event/js/snow.js'|asset}}"></script>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue