remotes/1693045480750635534/spooky-22
Aevann1 2021-08-11 22:11:55 +02:00
parent cbcc93a0d2
commit 8a75cd07a8
7 changed files with 111 additions and 7 deletions

View File

@ -22,6 +22,7 @@ class User(Base, Stndrd, Age_times):
id = Column(Integer, primary_key=True)
username = Column(String)
namecolor = Column(String, default='ff66ac')
background = Column(String)
customtitle = Column(String)
customtitleplain = Column(String)
titlecolor = Column(String, default='ff66ac')

View File

@ -22,6 +22,10 @@ COINS_NAME = environ.get("COINS_NAME").strip()
def settings_profile_post(v):
updated = False
if request.values.get("background", v.background) != v.background:
updated = True
v.background= request.values.get("background", None)
if request.values.get("slurreplacer", v.slurreplacer) != v.slurreplacer:
updated = True
v.slurreplacer = request.values.get("slurreplacer", None) == 'true'

View File

@ -1001,8 +1001,9 @@
</head>
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" style="overflow-x: hidden;">
<a href="https://secure.transequality.org/site/Donation2?df_id=1480"><img src="/assets/images/banner.png" width="100%"></a>
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/custombackgrounds/{{ v.background }}){% endif %} no-repeat center center fixed">
<a href="https://secure.transequality.org/site/Donation2?df_id=1480"><img src="/assets/images/banner.png" width="100%"></a>
{% include "header.html" %}

View File

@ -87,7 +87,7 @@
</script>
</head>
<body id="settings">
<body id="settings" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/custombackgrounds/{{ v.background }}){% endif %} no-repeat center center fixed">
{% include "header.html" %}
<!-- Page Content -->

View File

@ -57,7 +57,7 @@
</head>
<body id="settings-guild">
<body id="settings-guild" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/custombackgrounds/{{ v.background }}){% endif %} no-repeat center center fixed">
{% include "header.html" %}

View File

@ -77,9 +77,107 @@
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="theme">Website Backgrounds</label>
</div>
<div class="body w-lg-100">
<script>
function updatebgselection(){
var bgselector = document.getElementById("backgroundSelector");
var selection = bgselector.options[bgselector.selectedIndex].text;
//var paragraph = document.getElementById("testp");
//paragraph.innerHTML = selection;
const backgrounds = [
{
folder: "fantasy",
backgrounds:
[
"bg-1",
"bg-2",
"bg-3",
"bg-4",
]
},
{
folder: "solarpunk",
backgrounds:
[
"bg-1",
"bg-2",
"bg-3",
"bg-4",
"bg-5",
"bg-6",
"bg-7",
"bg-8",
"bg-9",
"bg-10",
"bg-11",
"bg-12",
"bg-13",
"bg-14",
"bg-15",
"bg-16",
"bg-17",
"bg-18",
"bg-19",
]
},
{
folder: "other",
backgrounds:
[
"bg-1",
"bg-2",
"bg-3",
"bg-4",
]
},
{
folder: "pixelart",
backgrounds:
[
"bg-1",
"bg-2",
"bg-3",
"bg-4",
"bg-5",
]
}
]
let bgContainer = document.getElementById(`bgcontainer`);
let str = '';
let bgsToDisplay = backgrounds[bgselector.selectedIndex].backgrounds;
let bgsDir = backgrounds[bgselector.selectedIndex].folder;
for (i=0; i < bgsToDisplay.length; i++) {
let onclickPost = bgsDir + "/" + bgsToDisplay[i];
str += `<button class="btn btn-secondary m-1 p-0" style="width:15rem; overflow: hidden;"><img style="padding:0.25rem; width: 15rem" src="/assets/images/custombackgrounds/${bgsDir}/${bgsToDisplay[i]}" alt="${bgsToDisplay[i]}-background" onclick="post('/settings/profile?background=${onclickPost}', function(){window.location.reload(true);})"/></button>`;
}
bgContainer.innerHTML = str;
}
</script>
<p>Change the background for the website.</p>
<div class="input-group mb2">
<select id='backgroundSelector' class="form-control" form="profile-settings" name="background" onchange="updatebgselection();">
{% for entry in ["fantasy", "solarpunk", "other", "pixelart"] %}
<option value="{{entry}}">
{{entry}}
</option>
{% endfor %}
</select>
</div>
<div class="d-flex mt-2">
<!--<input class="btn btn-primary ml-auto" value="Load Backgrounds" onclick="updatebgselection();">-->
<a class="btn btn-primary ml-auto" id="loadBackgrounds" href="javascript:void(0)" onclick="updatebgselection()">Load Backgrounds</a>
</div>
<div id="bgcontainer"></div>
</div>
</div>
</div>
<h2 class="h5">Profile Picture</h2>

View File

@ -286,7 +286,7 @@
</head>
<body id="submit">
<body id="submit" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/custombackgrounds/{{ v.background }}){% endif %} no-repeat center center fixed">
<!-- Navigation -->
{% include "header.html" %}