Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Various style and bug fixes (#11)
Browse files Browse the repository at this point in the history
* Don't apply text colour to tags or buttons

* Also replace the header logo

* Stop throwing errors if we're not on the chat page (room/user info etc)

* Fix styling on image upload buttons

* Fixes #13, which this PR introduced...
  • Loading branch information
xbenjii authored and MadaraUchiha committed Jul 20, 2019
1 parent 7a7dc96 commit af888a5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
5 changes: 4 additions & 1 deletion scss/chat.important.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ div#starred-posts {
background-color: #000;
background-image: $bg-pattern;
color: #ddd;
.wmd-mini-button {
color: #ddd;
}
}

body.outside #container,
Expand Down Expand Up @@ -177,6 +180,6 @@ body.moderator-room {
display: none;
}

a {
a:not(.button, .tag, .wmd-mini-button) {
color: #38aff9;
}
3 changes: 3 additions & 0 deletions src/modules/CodeModeEditorModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class CodeModeEditorModule {
private select?: HTMLSelectElement;
private btnSubmit = document.querySelector<HTMLButtonElement>('#sayit-button')!;
public init() {
if(!this.input) {
return;
}
this.codeMirror = CodeMirror(el => {
el.hidden = true;
this.input.insertAdjacentElement('beforebegin', el);
Expand Down
3 changes: 3 additions & 0 deletions src/modules/EmojiTranslatorModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { emojiData } from "../utils/emojiData";
export class EmojiTranslatorModule {
public init() {
const input = document.getElementById("input") as HTMLTextAreaElement;
if(!input) {
return;
}
input.addEventListener("keyup", event => {
const { selectionStart, selectionEnd } = input;
if (event.which !== 32) return;
Expand Down
24 changes: 13 additions & 11 deletions src/modules/ThemeDomManipulationModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ const DARK_THEME_SO_LOGO_BASE64 =

export class ThemeDomManipulationModule {
public init() {
const container = document.getElementById("footer-logo");
if (!container) {
return;
}
const link = container.querySelector<HTMLAnchorElement>("a");
const img = container.querySelector<HTMLImageElement>("img");
const containers = document.querySelectorAll<HTMLElement>("#footer-logo, #header-logo");
this.replaceLogos([...containers]);
}
private replaceLogos(containers: HTMLElement[]) {
for(const container of containers) {
const link = container.querySelector<HTMLAnchorElement>("a");
const img = container.querySelector<HTMLImageElement>("img");

if (!link || !img) {
return;
}
if (link.href.includes("stackoverflow")) {
img.src = DARK_THEME_SO_LOGO_BASE64;
if (!link || !img) {
return;
}
if (link.href.includes("stackoverflow")) {
img.src = DARK_THEME_SO_LOGO_BASE64;
}
}
}
}

0 comments on commit af888a5

Please sign in to comment.