Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changes to accommodate [icon] syntax #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions web/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,19 @@ body.whitemode .next:hover {
}

}

/*class icon for in-line images*/
.icon {
height: 1.2em;
/*width: 1.2em; /*remove to accept unconventional rectangle icon?*/
margin: -0.2em 0;
vertical-align: middle
/*This is a tweaked version of height/margin for near-perfect fitting of Font Awesome's placement and size.
height: 1em; margin: -0.06em 0 0.21em 0;*/
}

/*Icon Nightmode*/
body.nightmode .nighticon {
-webkit-filter: invert(100%);
filter: invert(100%);
}
4 changes: 4 additions & 0 deletions web/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ function replaceBbCode(msg) {
.replace(/\[\/i\]/g, '</i>')
.replace(/\u2022([\s\S]*)/, '<ul>•$1</ul>')
.replace(/\u2022([^\u2022]*)/g, '<li>$1</li>')
.replace(/\[icon\=(.*?)\](.*?)\[\/icon\]/g, '<img src="$1" alt="$2" class="icon">') //trying to include syntax for in-line images
.replace(/\[texticon\=(.*?)\](.*?)\[\/icon\]/g, '<img src="$1" alt="$2" class="icon nighticon">') //trying to include syntax for nightmode in-line images
.replace(/\[p\]/g, '<p>') //EXPERIMENTAL PARAGRAPH. For the purpose of inserting it into a text variable: ${[p]Standalone paragraph[/p] [n/][n/]Without the big linebreaks}
.replace(/\[\/p\]/g, '</p>') //SAME AS ABOVE
}

function println(msg, parent) {
Expand Down