czx
This commit is contained in:
parent
8c1ac90b10
commit
0677106b21
10 changed files with 24 additions and 31 deletions
|
@ -48,30 +48,21 @@ function popovertrigger() {
|
||||||
popovertrigger()
|
popovertrigger()
|
||||||
|
|
||||||
function popclick(author) {
|
function popclick(author) {
|
||||||
let popfix = document.getElementById("popover-fix")
|
popover = document.getElementsByClassName("popover")[0]
|
||||||
if (popfix) document.body.removeChild(popfix);
|
|
||||||
|
|
||||||
var popover_old = document.getElementsByClassName("popover")[0];
|
|
||||||
var popover_new = document.createElement("DIV");
|
|
||||||
popover_new.innerHTML = popover_old.outerHTML;
|
|
||||||
popover_new.id = "popover-fix";
|
|
||||||
|
|
||||||
let badges = ''
|
let badges = ''
|
||||||
for (const x of author["badges"]) {
|
for (const x of author["badges"]) {
|
||||||
badges += `<img alt="badge" width="32" loading="lazy" src="${x}">`
|
badges += `<img alt="badge" width="32" loading="lazy" src="${x}">`
|
||||||
}
|
}
|
||||||
popover_new.getElementsByClassName('pop-banner')[0].src = author["bannerurl"]
|
popover.getElementsByClassName('pop-banner')[0].src = author["bannerurl"]
|
||||||
popover_new.getElementsByClassName('pop-picture')[0].src = author["profile_url"]
|
popover.getElementsByClassName('pop-picture')[0].src = author["profile_url"]
|
||||||
popover_new.getElementsByClassName('pop-username')[0].innerHTML = author["username"]
|
popover.getElementsByClassName('pop-username')[0].innerHTML = author["username"]
|
||||||
popover_new.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"]
|
popover.getElementsByClassName('pop-bio')[0].innerHTML = author["bio_html"]
|
||||||
popover_new.getElementsByClassName('pop-postcount')[0].innerHTML = author["post_count"]
|
popover.getElementsByClassName('pop-postcount')[0].innerHTML = author["post_count"]
|
||||||
popover_new.getElementsByClassName('pop-commentcount')[0].innerHTML = author["comment_count"]
|
popover.getElementsByClassName('pop-commentcount')[0].innerHTML = author["comment_count"]
|
||||||
popover_new.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"]
|
popover.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"]
|
||||||
popover_new.getElementsByClassName('pop-viewmore')[0].href = author["url"]
|
popover.getElementsByClassName('pop-viewmore')[0].href = author["url"]
|
||||||
popover_new.getElementsByClassName('pop-badges')[0].innerHTML = badges
|
popover.getElementsByClassName('pop-badges')[0].innerHTML = badges
|
||||||
|
|
||||||
document.body.appendChild(popover_new);
|
|
||||||
document.body.removeChild(popover_old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("click", function(){
|
document.addEventListener("click", function(){
|
||||||
|
|
|
@ -34,7 +34,7 @@ class OauthApp(Base):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def permalink(self): return f"/admin/app/{self.id}"
|
def permalink(self): return f"{SITE_FULL}/admin/app/{self.id}"
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def idlist(self, page=1):
|
def idlist(self, page=1):
|
||||||
|
|
|
@ -233,10 +233,10 @@ class Comment(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def permalink(self):
|
def permalink(self):
|
||||||
if self.post and self.post.club: return f"/comment/{self.id}?context=9#context"
|
if self.post and self.post.club: return f"{SITE_FULL}/comment/{self.id}?context=9#context"
|
||||||
|
|
||||||
if self.post: return f"{self.post.permalink}/{self.id}?context=9#context"
|
if self.post: return f"{SITE_FULL}{self.post.permalink}/{self.id}?context=9#context"
|
||||||
else: return f"/comment/{self.id}?context=9#context"
|
else: return f"{SITE_FULL}/comment/{self.id}?context=9#context"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -108,7 +108,7 @@ class ModAction(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def permalink(self):
|
def permalink(self):
|
||||||
return f"/log/{self.id}"
|
return f"{SITE_FULL}/log/{self.id}"
|
||||||
|
|
||||||
ACTIONTYPES={
|
ACTIONTYPES={
|
||||||
"grant_awards": {
|
"grant_awards": {
|
||||||
|
|
|
@ -197,7 +197,7 @@ class Submission(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def permalink(self):
|
def permalink(self):
|
||||||
if self.club: return f"/post/{self.id}"
|
if self.club: return f"{SITE_FULL}/post/{self.id}"
|
||||||
|
|
||||||
output = self.title.lower()
|
output = self.title.lower()
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class Submission(Base):
|
||||||
|
|
||||||
if not output: output = '-'
|
if not output: output = '-'
|
||||||
|
|
||||||
return f"/post/{self.id}/{output}"
|
return f"{SITE_FULL}/post/{self.id}/{output}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -313,7 +313,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def url(self):
|
def url(self):
|
||||||
return f"/@{self.username}"
|
return f"{SITE_FULL}/@{self.username}"
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<User(id={self.id})>"
|
return f"<User(id={self.id})>"
|
||||||
|
|
|
@ -61,5 +61,7 @@ def error_500(e):
|
||||||
def allow_nsfw():
|
def allow_nsfw():
|
||||||
session["over_18"] = int(time.time()) + 3600
|
session["over_18"] = int(time.time()) + 3600
|
||||||
redir = request.values.get("redir")
|
redir = request.values.get("redir")
|
||||||
if redir and redir.startswith(SITE_FULL) or redir.startswith('/'): return redirect(redir)
|
if redir:
|
||||||
|
if redir.startswith(SITE_FULL): return redirect(redir)
|
||||||
|
if redir.startswith('/'): return redirect(f'{SITE_FULL}{redir}')
|
||||||
return redirect(f'{SITE_FULL}/')
|
return redirect(f'{SITE_FULL}/')
|
|
@ -666,7 +666,7 @@ def u_username(username, v=None):
|
||||||
|
|
||||||
|
|
||||||
if username != u.username:
|
if username != u.username:
|
||||||
return redirect(request.full_path.replace(username, u.username))
|
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
|
||||||
|
|
||||||
if u.reserved:
|
if u.reserved:
|
||||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"}
|
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"}
|
||||||
|
|
|
@ -908,7 +908,7 @@
|
||||||
|
|
||||||
{% include "expanded_image_modal.html" %}
|
{% include "expanded_image_modal.html" %}
|
||||||
|
|
||||||
<script src="/static/assets/js/comments+submission_listing.js?a=220"></script>
|
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
|
||||||
<script src="/static/assets/js/comments.js?a=221"></script>
|
<script src="/static/assets/js/comments.js?a=221"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -694,5 +694,5 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="/static/assets/js/clipboard.js?a=220"></script>
|
<script src="/static/assets/js/clipboard.js?a=220"></script>
|
||||||
<script src="/static/assets/js/comments+submission_listing.js?a=220"></script>
|
<script src="/static/assets/js/comments+submission_listing.js?a=221"></script>
|
||||||
<script src="/static/assets/js/submission_listing.js?a=220"></script>
|
<script src="/static/assets/js/submission_listing.js?a=220"></script>
|
Loading…
Add table
Add a link
Reference in a new issue