Skip to content
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
35 changes: 33 additions & 2 deletions src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Sidebar = NAMESPACE({
tabs: null,
$my_avatar: null,
userlist: new StatusDisplay(0, null),
linkify_messages: false,

normal_open: false,
fullscreen_open: false,
Expand Down Expand Up @@ -233,8 +234,13 @@ const Sidebar = NAMESPACE({
link.href = "#user/"+comment.createUserId
link.firstChild.src = Draw.avatar_url(author)
link.lastChild.textContent = name

d.append(comment.text.replace(/\n/g, " "))
let content = d.lastChild
content.setAttribute("page", comment.contentId)
if (Sidebar.linkify_messages) {
content.href = "#page/"+comment.contentId
}
content.setAttribute('aria-disabled', String(!Sidebar.linkify_messages))
content.append(comment.text.replace(/\n/g, " "))

return d
}.bind(𐀶`
Expand All @@ -243,6 +249,8 @@ const Sidebar = NAMESPACE({
<img class='item avatar' width=100 height=100>
<span class='textItem entity-title pre'></span>
</a>:&#32;
<a class='sidebar-message-content'>
</a>
</div>
`),

Expand Down Expand Up @@ -279,3 +287,26 @@ Object.defineProperty(window, 'log', {
})

do_when_ready(x=>Sidebar.onload())

Settings.add({
name: 'linkify_sidebar_messages', label: 'Linkify Sidebar Messages',
type: 'select',
options: ['no', 'yes'],
update(value) {
do_when_ready(() => {
Sidebar.linkify_messages = (value === 'yes')
const contents = document.querySelectorAll('#\\$sidebarBottom .sidebar-message-content')
if (Sidebar.linkify_messages) {
contents.forEach(c => {
c.setAttribute('href', `#page/${c.getAttribute("page")}`)
c.setAttribute('aria-disabled', "false")
})
} else {
contents.forEach(c => {
c.removeAttribute('href')
c.setAttribute('aria-disabled', "true")
})
}
})
},
})
3 changes: 3 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,9 @@ activity-users {
overflow-y: scroll;
width: 100%;
}
#\$sidebarBottom .sidebar-message-content {
color: var(--T-color);
}

/* contain */
#\$sidebarBottom,
Expand Down