From 086175a668d55d6b01d6308f5ba5e4983318924d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 23 Jun 2019 11:17:16 -0700 Subject: [PATCH] Add contact links to mod and other capcode posts. --- src/Miscellaneous/ModContact.coffee | 34 +++++++++++++++++++++++++++++ src/css/style.css | 11 ++++++++++ src/main/Main.coffee | 1 + 3 files changed, 46 insertions(+) create mode 100644 src/Miscellaneous/ModContact.coffee diff --git a/src/Miscellaneous/ModContact.coffee b/src/Miscellaneous/ModContact.coffee new file mode 100644 index 000000000..43faeec73 --- /dev/null +++ b/src/Miscellaneous/ModContact.coffee @@ -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( + 'feedback&{ModContact.specific[capcode]()}' + ) %> + + specific: + Mod: -> <%= html(' IRC') %> + Manager: -> ModContact.specific.Mod() + Developer: -> <%= html(' github') %> + Admin: -> <%= html(' twitter') %> + + moveNote: + qa: <%= html( + 'Moving a thread to /qa/ does not imply mods will read it. If you wish to contact mods, use ' + + 'feedback or ' + + 'IRC.' + ) %> diff --git a/src/css/style.css b/src/css/style.css index a4ce4b90f..26c98e1b2 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -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; +} diff --git a/src/main/Main.coffee b/src/main/Main.coffee index c52f44d0d..3d95f1f5d 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -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] <% } %>