Merge branch 'bussy_refactor' of https://github.com/DrTransmisia/rDrama into frost

master
Aevann1 2022-05-05 23:12:07 +02:00
commit 79f3412aae
2 changed files with 92 additions and 89 deletions

View File

@ -47,15 +47,31 @@ def marseys(v):
marseys = g.db.query(Marsey).order_by(Marsey.count.desc())
return render_template("marseys.html", v=v, marseys=marseys)
@app.get("/marsey_list")
@cache.memoize(timeout=600, make_name=make_name)
@app.get("/marsey_list.json")
@cache.memoize(timeout=600)
def marsey_list():
if SITE_NAME == 'rDrama':
marseys = [f"{x.name} : {y} {x.tags}" for x, y in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())]
else:
marseys = [f"{x.name} : {x.tags}" for x in g.db.query(Marsey).order_by(Marsey.count.desc())]
# From database
emojis = [{
"name": emoij.name,
"author": author if SITE_NAME == 'rDrama' else "rDrama's chads",
# yikes, I don't really like this DB schema. Next time be better
"tags": emoij.tags.split(" ") + [emoij.name[len("marsey"):] if emoij.name.startswith("marsey") else emoij.name] + ([author] if SITE_NAME == 'rDrama' else []),
"count": emoij.count,
"class": "Marsey"
} for emoij, author in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())]
return str(marseys).replace("'",'"')
# Stastic shit
shit = open("files/assets/shit emojis.json", "r", encoding="utf-8")
emojis = emojis + json.load(shit)
shit.close()
if SITE_NAME == 'Cringetopia':
shit = open("files/assets/shit emojis.cringetopia.json", "r", encoding="utf-8")
emojis = emojis + json.load(shit)
shit.close()
# return str(marseys).replace("'",'"')
return jsonify(emojis)
@app.get('/rules')
@app.get('/sidebar')

View File

@ -1,49 +1,19 @@
<div id="form" class="d-none"></div>
<div class="modal fade" id="emojiModal" tabindex="-1" role="dialog" aria-labelledby="emojiModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered p-2 py-5 emoji-modal" role="document">
<style>
#emojiTabs {height: 80%;}
@media (max-height: 900px) {
#emojiTabs {height: 100%;}
#emojiModalInternalDivIDK {margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;}
}
</style>
<div id="emojiModalInternalDivIDK" class="modal-dialog modal-dialog-scrollable modal-dialog-centered p-2 py-5 emoji-modal" role="document">
<div class="modal-content" id="emojiTabs">
<div class="modal-header">
<div>
<ul class="nav nav-pills py-2">
<ul class="nav nav-pills py-2" id="emoji-modal-tabs">
<li class="nav-item">
<a class="nav-link active emojitab" data-bs-toggle="tab" href="#emoji-tab-favorite">Favorite</a>
</li>
{% if SITE_NAME == 'Cringetopia' %}
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-cringetopia">Cringetopia</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-marsey">Marsey</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-marseyalphabet">Marsey Alphabet</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-platy">Platy</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-wolf">Zombie Wolf</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-tay">Tay</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-classic">Classic</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-rage">Rage</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-wojak">Wojak</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-flags">Flags</a>
</li>
<li class="nav-item">
<a class="nav-link emojitab" data-bs-toggle="tab" href="#emoji-tab-misc">Misc</a>
<a class="nav-link active emojitab" data-class-name="favorite" data-bs-toggle="tab" href="#" onclick="switchEmojiTab(event)">⭐ Favorite ⭐</a>
</li>
</ul>
</div>
@ -52,51 +22,68 @@
</button>
</div>
<div class="px-3"><input autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.."></div>
<div class="px-3">
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search..">
</div>
<div class="px-3 d-flex flex-row">
<fieldset class="p-2">
<label for="emoji-algo">Search Algorithm</label>
<select id="emoji-algo">
<option value="binary" selected>Binary Search</option>
<option value="normal" title="YIKES" disabled>Complete (slower)</option>
</select>
</fieldset>
<fieldset class="p-2">
<label style="display: inline">Options:</legend>
<div style="display: inline" title="Makes the emoji larger">
<input type="checkbox" id="emoij-sel-0" value="#" class="emoij-suffix">
<label for="emoij-sel-0">Large</label>
</div>
<div style="display: inline" title="Mirror the emoji along the Y axis">
<input type="checkbox" id="emoij-sel-1" value="!" class="emoij-suffix">
<label for="emoij-sel-1">Mirror</label>
</div>
<div style="display: inline" title="Adds a hand that pats the emoji.&#10;Does not work with animated emoji">
<input type="checkbox" id="emoij-sel-2" value="pat" class="emoij-postfix">
<label for="emoij-sel-2">Pat</label>
</div>
</fieldset>
<!--
<fieldset class="p-2">
<label>marseyalphabet:</label>
<input type="text">
<button>generate!</button>
</fieldset>-->
</div>
<div style="overflow-y: scroll;">
<div class="modal-body p-0" id="emoji-modal-body">
<div id="emoji-tab-search"></div>
<div id="no-emojis-found"></div>
<div id="tab-content" class="tab-content">
<div class="tab-pane fade show active" id="emoji-tab-favorite">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_favorite"></div>
<div id="no-emojis-found" class="tab-content py-3 pl-2" hidden>
No results... Next time be better with your query. 💅
</div>
{% if SITE_NAME == 'Cringetopia' %}
<div class="tab-pane fade" id="emoji-tab-cringetopia">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_cringetopia"></div>
</div>
{% endif %}
<div class="tab-pane fade" id="emoji-tab-marsey">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_marsey"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-marseyalphabet">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_marseyalphabet"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-platy">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_platy"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-wolf">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_wolf"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-tay">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_tay"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-classic">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_classic"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-rage">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_rage"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-wojak">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_wojak"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-flags">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_flags"></div>
</div>
<div class="tab-pane fade" id="emoji-tab-misc">
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_misc"></div>
<div id="emojis-work" class="tab-content py-3 pl-2">
I am working as hard as I can, sweety... 🚴
</div>
<div id="tab-content" class="tab-content d-flex flex-wrap py-3 pl-2" hidden>
<style>
.emoji2 {
/*background: None!important;*/
width:60px;
height: 85px;
overflow: hidden;
border: none
}
</style>
<template id="emoij-button-template">
<button class="btn m-1 px-0 emoji2" data-bs-toggle="tooltip" delay:="0">
<img loading="lazy" width=50>
</button>
</template>
</div>
</div>
</div>