Add contact links to mod and other capcode posts.

This commit is contained in:
ccd0 2019-06-23 11:17:16 -07:00
parent 4004b5c84f
commit 086175a668
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,34 @@
ModContact =
init: ->
return unless Site.software is 'yotsuba' and g.VIEW in ['index', 'thread']
Callbacks.Post.push
name: 'Mod Contact Links'
cb: @node
node: ->
return if @isClone or !ModContact.specific[@info.capcode]
links = $.el 'span', className: 'contact-links brackets-wrap'
$.extend links, ModContact.template(@info.capcode)
$.after @nodes.capcode, links
if (moved = @info.comment.match /This thread was moved to >>>\/(\w+)\//) and ModContact.moveNote[moved[1]]
moveNote = $.el 'div', className: 'move-note'
$.extend moveNote, ModContact.moveNote[moved[1]]
$.add @nodes.post, moveNote
template: (capcode) ->
<%= html(
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a>&{ModContact.specific[capcode]()}'
) %>
specific:
Mod: -> <%= html(' <a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a>') %>
Manager: -> ModContact.specific.Mod()
Developer: -> <%= html(' <a href="https://github.com/4chan" target="_blank">github</a>') %>
Admin: -> <%= html(' <a href="https://twitter.com/hiroyuki_ni" target="_blank">twitter</a>') %>
moveNote:
qa: <%= html(
'Moving a thread to /qa/ does not imply mods will read it. If you wish to contact mods, use ' +
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a><span class="invisible"> (https://www.4chan.org/feedback)</span> or ' +
'<a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a><span class="invisible"> (https://www.4chan-x.net/4chan-irc.html)</span>.'
) %>

View File

@ -2405,3 +2405,14 @@ a:only-of-type > .remove {
:root.gallery-open.fixed #header-bar:not(.autohide) #shortcuts .fa::before {
visibility: hidden;
}
/* Mod Contact Links */
.contact-links {
margin-left: 2px;
}
.move-note > a {
text-decoration: underline;
}
.invisible {
font-size: 0;
}

View File

@ -603,6 +603,7 @@ Main =
['Banner', Banner]
['Flash Features', Flash]
['Reply Pruning', ReplyPruning]
['Mod Contact Links', ModContact]
<% if (readJSON('/.tests_enabled')) { %>
['Build Test', Build.Test]
<% } %>