From f3a00806984d5730cccde78cfbdc74083802c9fd Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 6 May 2023 00:45:25 +0300 Subject: [PATCH] remove useless tabs --- files/assets/js/admin/punish_modal.js | 4 ++-- files/assets/js/bottom.js | 6 +++--- files/assets/js/comments_v.js | 2 +- files/assets/js/core.js | 6 +++--- files/assets/js/emoji_modal.js | 2 +- files/assets/js/spider-with-bugs.js | 6 +++--- files/assets/js/submit.js | 2 +- files/classes/comment.py | 4 ++-- files/classes/submission.py | 2 +- files/helpers/actions.py | 6 +++--- files/helpers/alerts.py | 6 +++--- files/helpers/awards.py | 2 +- files/helpers/const_stateful.py | 2 +- files/helpers/cron.py | 2 +- files/helpers/media.py | 4 ++-- files/helpers/stats.py | 2 +- files/routes/admin.py | 6 +++--- files/routes/asset_submissions.py | 2 +- files/routes/awards.py | 8 ++++---- files/routes/comments.py | 2 +- files/routes/front.py | 2 +- files/routes/groups.py | 8 ++++---- files/routes/hats.py | 6 +++--- files/routes/notifications.py | 6 +++--- files/routes/oauth.py | 2 +- files/routes/search.py | 2 +- files/routes/users.py | 24 ++++++++++++------------ files/templates/contact.html | 2 +- files/templates/default.html | 4 ++-- files/templates/groups.html | 2 +- files/templates/sidebar_rDrama.html | 2 +- files/templates/submit.html | 2 +- files/templates/submit_emojis.html | 2 +- 33 files changed, 70 insertions(+), 70 deletions(-) diff --git a/files/assets/js/admin/punish_modal.js b/files/assets/js/admin/punish_modal.js index 26a171f1f6..9e9f47c484 100644 --- a/files/assets/js/admin/punish_modal.js +++ b/files/assets/js/admin/punish_modal.js @@ -1,6 +1,6 @@ function punishModal(t, kind, link, name, fullname) { const kind_title = kind.charAt(0).toUpperCase() + kind.slice(1) - + document.getElementById(`${kind}ModalTitle`).innerHTML = `${kind_title} @${name}`; document.getElementById(`${kind}_reason`).value = link; @@ -12,7 +12,7 @@ function punishModal(t, kind, link, name, fullname) { "days": document.getElementById(`${kind}_days`).value, "reason": document.getElementById(`${kind}_reason`).value } - + if (kind == "ban") { values["alts"] = document.getElementById(`${kind}_alts`).value; } diff --git a/files/assets/js/bottom.js b/files/assets/js/bottom.js index 00616be6e1..b2adfe0bb3 100644 --- a/files/assets/js/bottom.js +++ b/files/assets/js/bottom.js @@ -112,7 +112,7 @@ function disable_btn(t) { setTimeout(() => { t.disabled = true; }, 0.1); - + setTimeout(() => { t.classList.remove("disabled"); t.disabled = false; @@ -209,14 +209,14 @@ document.addEventListener("click", function (e) { if (!element.classList.contains("areyousure")) { document.querySelectorAll(".areyousure").forEach(i => { i.classList.remove("areyousure") - + if (i.dataset.oldvalue) i.value = i.dataset.oldvalue else i.innerHTML = i.dataset.oldhtml i.setAttribute("data-onclick", "areyousure(this)"); - + if (i.dataset.dismiss) i.removeAttribute("data-bs-dismiss") }); diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index d27720342a..561be9096f 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -243,7 +243,7 @@ function post_comment(fullname, hide){ const upload_prog = document.getElementById(`upload-prog-${fullname}`); xhr.upload.onprogress = (e) => {handleUploadProgress(e, upload_prog)}; - + xhr.setRequestHeader('xhr', 'xhr'); xhr.onload=function(){ upload_prog.classList.add("d-none") diff --git a/files/assets/js/core.js b/files/assets/js/core.js index a3fe2b149b..b8c7ccd477 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -460,7 +460,7 @@ let oldfiles = {}; function handle_files(input, newfiles) { if (!newfiles) return; - + const ta = input.parentElement.parentElement.parentElement.parentElement.querySelector('textarea.file-ta'); if (oldfiles[ta.id]) { @@ -596,7 +596,7 @@ function cancel_files(element) { function handleUploadProgress(e, upload_prog) { const bar = upload_prog.firstElementChild; const percentIndicator = upload_prog.lastElementChild; - + upload_prog.classList.remove("d-none") if (e.lengthComputable) { const progressPercent = Math.floor((e.loaded / e.total) * 100); @@ -634,7 +634,7 @@ document.querySelectorAll('form').forEach(form => { if (form.classList.contains('is-submitting')) { e.preventDefault(); } - + form.classList.add('is-submitting'); }); }); diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index f650e1cc0f..e2cd96bdb8 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -377,7 +377,7 @@ function populate_speed_emoji_modal(results, textbox) if(emoji.author !== undefined && emoji.author !== null) emoji_option_text.title += "\nauthor\t" + emoji.author - + if(emoji.count !== undefined) emoji_option_text.title += "\nused\t" + emoji.count; diff --git a/files/assets/js/spider-with-bugs.js b/files/assets/js/spider-with-bugs.js index 944c8e1fa7..b84914d7b1 100644 --- a/files/assets/js/spider-with-bugs.js +++ b/files/assets/js/spider-with-bugs.js @@ -804,7 +804,7 @@ var Bug = { if (!this.bug) { this.makeBug(); } - + if(!this.bug) return; this.stop(); @@ -855,7 +855,7 @@ var Bug = { if (!this.bug) { this.makeBug(); } - + if(!this.bug) return; this.stop(); @@ -949,7 +949,7 @@ var Bug = { rotationRate = this.random(0, 20, true), startTime = Date.now(), that = this; - + this.bug.classList.add('bug-dead'); this.dropTimer = requestAnimFrame(function(t) { diff --git a/files/assets/js/submit.js b/files/assets/js/submit.js index ccb1aad9e6..355485918c 100644 --- a/files/assets/js/submit.js +++ b/files/assets/js/submit.js @@ -15,7 +15,7 @@ for (const key of save_checked) { const element = document.getElementById(key) if (element) element.checked = (value == 'true') } - + } function savetext() { diff --git a/files/classes/comment.py b/files/classes/comment.py index acc1afd3d9..818786ba6d 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -99,7 +99,7 @@ def add_options(self, body, v): body += option_body return body - + class Comment(Base): __tablename__ = "comments" @@ -337,7 +337,7 @@ class Comment(Base): if body: if not (self.parent_submission and self.post.sub == 'chudrama'): body = censor_slurs(body, v) - + body = normalize_urls_runtime(body, v) if not v or v.controversial: captured = [] diff --git a/files/classes/submission.py b/files/classes/submission.py index 96c7acec5e..ce42e266fe 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -332,7 +332,7 @@ class Submission(Base): @lazy def realtitle(self, v): title = self.title_html - + if self.sub != 'chudrama': title = censor_slurs(title, v) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 4bbb9a8e54..a058dda672 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -119,10 +119,10 @@ def execute_snappy(post:Submission, v:User): group = g.db.query(Group).order_by(func.random()).first() group_members = group.member_ids - + if group.name == 'biofoids': mul = 10 else: mul = 5 - + g.db.query(User).filter(User.id.in_(group_members)).update({ User.coins: User.coins + mul }) cost = len(group_members) * mul @@ -561,7 +561,7 @@ def process_poll_options(v:User, target:Union[Submission, Comment]): body_html=body_html, exclusive=exclusive, ).first() - + if not existing: option = cls( parent_id=target.id, diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 3610510b09..1bc91d9b23 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -165,19 +165,19 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False): if not group: continue members = group.member_ids - notify_users - v.all_twoway_blocks - + notify_users.update(members) if ghost or v.id not in group.member_ids: if group.name == 'biofoids': mul = 10 else: mul = 5 - + cost += len(members) * mul if cost > v.coins: abort(403, f"You need {cost} coins to mention these ping groups!") g.db.query(User).filter(User.id.in_(members)).update({ User.coins: User.coins + mul }) - + v.charge_account('coins', cost) diff --git a/files/helpers/awards.py b/files/helpers/awards.py index fd96aa97fd..b121190cea 100644 --- a/files/helpers/awards.py +++ b/files/helpers/awards.py @@ -74,7 +74,7 @@ def award_timers(v, bot=False): v.bite = None badge = v.has_badge(168) if badge: g.db.delete(badge) - + v.house = v.old_house notify_if_not_bot(f"Your vampire status has ended. You're now back in House {v.old_house.replace(' Founder', '')}!") v.old_house = '' diff --git a/files/helpers/const_stateful.py b/files/helpers/const_stateful.py index 5f5dae5cc0..d2a7df1cf7 100644 --- a/files/helpers/const_stateful.py +++ b/files/helpers/const_stateful.py @@ -37,7 +37,7 @@ def _initialize_snappy_marseys_and_quotes(): global SNAPPY_MARSEYS, SNAPPY_QUOTES SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2] - + if IS_FISTMAS(): filename = f"snappy_fistmas_{SITE_NAME}.txt" else: diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 1cb6706693..b64eb7c770 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -119,7 +119,7 @@ def _generate_emojis_zip(): m = md5() with open('files/assets/emojis.zip', "rb") as f: data = f.read() - + m.update(data) cache.set('emojis_hash', m.hexdigest()) diff --git a/files/helpers/media.py b/files/helpers/media.py index 5ee455273c..0e45346f9e 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -57,7 +57,7 @@ def process_files(files, v, body, is_dm=False, dm_user=None): url = f'{SITE_FULL}{process_audio(file, v)}' else: abort(415) - + body = body.replace(f'[{file.filename}]', f' {url} ', 1) if is_dm: @@ -117,7 +117,7 @@ def convert_to_mp4(old, new, vid, db): if os.path.isfile(tmp): os.remove(tmp) abort(400) - + os.replace(tmp, new) os.remove(old) diff --git a/files/helpers/stats.py b/files/helpers/stats.py index a9972a0f41..d105a0002d 100644 --- a/files/helpers/stats.py +++ b/files/helpers/stats.py @@ -32,7 +32,7 @@ def chart(kind, site): num_of_weeks = int(time_diff / 604800) else: num_of_weeks = 30 - + chart_width = int(num_of_weeks/0.7) if kind == 'daily': diff --git a/files/routes/admin.py b/files/routes/admin.py index 4af4f642f1..ebfde3cc64 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -737,7 +737,7 @@ def admin_removed(v): listing = g.db.query(Submission).options(load_only(Submission.id)).join(Submission.author).filter( or_(Submission.is_banned==True, User.shadowbanned != None)) - + total = listing.count() listing = listing.order_by(Submission.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() listing = [x.id for x in listing] @@ -761,13 +761,13 @@ def admin_removed_comments(v): listing = g.db.query(Comment).options(load_only(Comment.id)).join(Comment.author).filter( or_(Comment.is_banned==True, User.shadowbanned != None)) - + total = listing.count() listing = listing.order_by(Comment.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() listing = [x.id for x in listing] comments = get_comments(listing, v=v) - + return render_template("admin/removed_comments.html", v=v, listing=comments, diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py index 02b5f5ae11..7a3a0fa6f7 100644 --- a/files/routes/asset_submissions.py +++ b/files/routes/asset_submissions.py @@ -180,7 +180,7 @@ def approve_emoji(v, name): badge_grant(badge_id=113, user=author) else: badge_grant(badge_id=112, user=author) - + cache.delete("emojis") diff --git a/files/routes/awards.py b/files/routes/awards.py index daf996e0ef..a2ab640813 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -227,12 +227,12 @@ def award_thing(v, thing_type, id): link_text_in_notif = thing.title msg = f"@{v.username} has given [{link_text_in_notif}]({thing.shortlink}) the {AWARDS[kind]['title']} Award" - + if kind == 'shit': msg += f" and has stolen from you {awarded_coins} coins as a result" elif awarded_coins: msg += f" and you have received {awarded_coins} coins as a result" - + msg += "!" if note: note = '\n\n> '.join(note.splitlines()) @@ -250,7 +250,7 @@ def award_thing(v, thing_type, id): link_text_in_notif = link else: link_text_in_notif = thing.title - + ban_reason = f'1-Day ban award used by @{v.username} on {link}' if not author.is_suspended: author.ban(reason=ban_reason, days=1) @@ -428,7 +428,7 @@ def award_thing(v, thing_type, id): else: if author.house.startswith("Vampire"): abort(400, f"{safe_username} is already a permanent vampire!") - + author.bite = int(time.time()) + 172800 author.old_house = author.house author.house = "Vampire" diff --git a/files/routes/comments.py b/files/routes/comments.py index b32f7b0349..cbaca5cf82 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -132,7 +132,7 @@ def comment(v:User): parent_user = parent if isinstance(parent, User) else parent.author posting_to_submission = isinstance(post_target, Submission) - + if not User.can_see(v, parent): abort(403) if not isinstance(parent, User) and parent.deleted_utc != 0: diff --git a/files/routes/front.py b/files/routes/front.py index 970621813b..c57bb7c9f0 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -203,7 +203,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0): total = comments.count() comments = sort_objects(sort, comments, Comment) - + comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() return [x.id for x in comments], total diff --git a/files/routes/groups.py b/files/routes/groups.py index c1d22bf96f..38a6a0c33c 100644 --- a/files/routes/groups.py +++ b/files/routes/groups.py @@ -103,7 +103,7 @@ def leave_group(v:User, group_name): send_notification(group.owner.id, text) g.db.delete(existing) - + return {"message": msg} return {"message": ''} @@ -142,10 +142,10 @@ def group_approve(v:User, group_name, user_id): group = g.db.get(Group, group_name) if not group: abort(404) - + if v.id != group.owner.id and v.admin_level < PERMS['MODS_EVERY_GROUP']: abort(403, f"Only the group owner (@{group.owner.username}) can approve applications!") - + application = g.db.query(GroupMembership).filter_by(user_id=user_id, group_name=group.name).one_or_none() if not application: abort(404, "There is no application to approve!") @@ -168,7 +168,7 @@ def group_reject(v:User, group_name, user_id): group = g.db.get(Group, group_name) if not group: abort(404) - + if v.id != group.owner.id and v.admin_level < PERMS['MODS_EVERY_GROUP']: abort(403, f"Only the group owner (@{group.owner.username}) can reject memberships!") diff --git a/files/routes/hats.py b/files/routes/hats.py index c0e1decafe..6608798ba3 100644 --- a/files/routes/hats.py +++ b/files/routes/hats.py @@ -38,12 +38,12 @@ def hats(v:User): hats = hats.order_by(key).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() elif sort == "owners": hat_count = {x[0]:x[1] for x in g.db.query(Hat.hat_id, func.count(Hat.hat_id)).group_by(Hat.hat_id).all()} - + if SITE == 'rdrama.net': hats = sorted(hats.all(), key=lambda x: hat_count[x[0].id] if x[0].id in hat_count else 0, reverse=True) else: hats = sorted(hats.all(), key=lambda x: hat_count[x.id] if x.id in hat_count else 0, reverse=True) - + firstrange = PAGE_SIZE * (page - 1) secondrange = firstrange + PAGE_SIZE hats = hats[firstrange:secondrange] @@ -163,7 +163,7 @@ def hat_owners(v:User, hat_id): users = g.db.query(User).join(Hat.owners).filter(Hat.hat_id == hat_id) total = users.count() - + users = users.order_by(Hat.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() return render_template("user_cards.html", diff --git a/files/routes/notifications.py b/files/routes/notifications.py index b9943ad416..422ce916e5 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -64,7 +64,7 @@ def notifications_modmail(v): sentto=MODMAIL_ID, level=1, ) - + total = comments.count() listing = comments.order_by(Comment.id.desc()).offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE).all() @@ -115,7 +115,7 @@ def notifications_messages(v:User): thread_order.c.top_comment_id == Comment.top_comment_id) # Clear notifications (used for unread indicator only) for all user messages. - + if not session.get("GLOBAL"): notifs_unread_row = g.db.query(Notification.comment_id).join(Comment).filter( Notification.user_id == v.id, @@ -350,7 +350,7 @@ def notifications(v:User): total.extend(c.replies2) for x in c.replies2: if x.replies2 == None: x.replies2 = [] - + count = 0 while count < 30 and c.parent_comment and (c.parent_comment.author_id == v.id or c.parent_comment.id in cids): count += 1 diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 539a79a684..646c462c13 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -90,7 +90,7 @@ def request_api_keys(v): for admin_id in admin_ids: notif = Notification(comment_id=new_comment.id, user_id=admin_id) g.db.add(notif) - + push_notif(admin_ids, 'New notification', body, f'{SITE_FULL}/comment/{new_comment.id}?read=true#context') return redirect('/settings/apps') diff --git a/files/routes/search.py b/files/routes/search.py index 2043956a2d..2ef2ea63f1 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -350,7 +350,7 @@ def searchmessages(v:User): comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() for x in comments: x.unread = True - + comments = [x.top_comment for x in comments] if v.client: return {"total":total, "data":[x.json(db=g.db) for x in comments]} diff --git a/files/routes/users.py b/files/routes/users.py index 52a398e368..10abdf20e8 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -46,9 +46,9 @@ def upvoters_downvoters(v, username, uid, cls, vote_cls, vote_dir, template, sta cls.author_id==id, vote_cls.user_id==uid, ) - + total = listing.count() - + listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() listing = [x.id for x in listing] @@ -112,9 +112,9 @@ def upvoting_downvoting(v, username, uid, cls, vote_cls, vote_dir, template, sta vote_cls.user_id==id, cls.author_id==uid, ) - + total = listing.count() - + listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() listing = [x.id for x in listing] @@ -174,7 +174,7 @@ def user_voted(v, username, cls, vote_cls, template, standalone): ) total = listing.count() - + listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() listing = [x.id for x in listing] @@ -1194,11 +1194,11 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone cls = Comment else: raise TypeError("Relationships supported is SaveRelationship, Subscription, CommentSaveRelationship") - + listing = g.db.query(query).join(join).filter(relationship_cls.user_id == v.id) - + total = listing.count() - + listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() ids = [x[0] for x in listing] @@ -1299,9 +1299,9 @@ def bid_list(v:User, bid): page = get_page() users = g.db.query(User).join(User.badges).filter(Badge.badge_id==bid) - + total = users.count() - + users = users.order_by(Badge.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() return render_template("user_cards.html", @@ -1469,9 +1469,9 @@ def users_list(v): page = get_page() users = g.db.query(User) - + total = users.count() - + users = users.order_by(User.id.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all() return render_template("user_cards.html", diff --git a/files/templates/contact.html b/files/templates/contact.html index 669ea3e8a2..fa5e636321 100644 --- a/files/templates/contact.html +++ b/files/templates/contact.html @@ -13,7 +13,7 @@ - + {{macros.file_input('file-uplod', False)}} diff --git a/files/templates/default.html b/files/templates/default.html index 5cbedfeb8f..190e7b6729 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -35,7 +35,7 @@ {% set banner_url = src %} {% else %} {% set path = "files/assets/images/" ~ SITE_NAME %} - + {%- if not v and os_path.exists(path ~ "/cached.webp") -%} {% set banner_url = 'cached.webp' | asset_siteimg %} {% elif os_path.exists(path ~ "/banners") -%} @@ -44,7 +44,7 @@ {% set banner_url = 'banner.webp' | asset_siteimg %} {% endif %} {% endif %} - +