10

About

Spoilers get used pretty heavily on Puzzling.SE, and people have taken to using rot13 in comments (and chat) since there's no official spoiler mark-up outside of questions/answers. That's annoying, but this script will make your life easier.

rot13 at work

Features

  1. Add rot13 spoilers to comments
    • Whenever you're typing a comment, surround any text you want to be spoilered with rot13(<text to be spoilered>)
    • A ROT13 link will appear to the right (between the Add Comment button and the help link)
    • Clicking ROT13 will convert all rot13(...) text in your comment (obviously clicking again will convert back)
    • Post your comment as usual
  2. Automatically convert existing rot13 spoilers in comments
    • Any comments containing spoilers in the format rot13(<spoilered text>) will automatically get highlighted
    • Hover the highlight to see the unspoilered text in the tooltip
      • Edit (v1.5): "tooltip" is now an overlayed panel
    • Click the link to see the unspoilered text in an alert popup
    • Edit (v1.5): Click the highlight to pin the tooltip panel in place, click again to hide (allows copy/paste, etc)
    • Edit (v1.5): Handles nested parentheses in rot strings (thanks @GentlePurpleRain)
    • Edit (v1.5): Preserves (most) formatting in and around rot strings (including links)
    • Edit (v1.5): Supports fallback mode for non-"standard" rot strings (eg. rot13[...], (ROT13)..., Rot13:..., etc) which rots the entire comment
  3. Edit (v1.2): Both the above features now also work in SE chat rooms

(I left the encoding process fairly manual so as not to be potentially annoying when writing/editing comments)

Download/Source

View script source / Install / download

Platform

Tested with Greasemonkey in Firefox and with Tampermonkey in Chrome.

5
  • Wonderful! Though I wonder why not use a simple delimiter (like MathJax does) instead of having to type out rot13(...). How about something like, for example, !!...!! or >>...<<, etc. Commented Jun 14, 2018 at 7:47
  • 6
    @GaurangTandon - two reasons: 1) so people who haven't seen it before (and don't have the script) have some chance of recognising what it is, and 2) because rot13(...) is already the defacto standard used on puzzling.se.
    – Alconja
    Commented Jun 14, 2018 at 8:17
  • This makes dealing with all those rot13(Fcbvyre!) comments on Puzzling much easier, but I prefer to have the converted text replace the original instead of popping up in an alert(), so I replaced line # 82 with var link = `<a href="#" onclick="this.innerHTML = 'rot13(${text.replace(/\\/g, "\\\\").replace(/'/g, "\\'")})';return false;" title="${text}" >${found[0]}</a>`; Personally it still isn't perfect for me, so I may make more changes in the future, but I thought you and/or others might want to do this too, as the alert() really broke the flow of things for me.
    – 3D1T0R
    Commented Sep 14, 2018 at 21:48
  • @3D1T0R - you may be interested in the latest version which renders much nicer (no more alerts!).
    – Alconja
    Commented Mar 20, 2019 at 4:18
  • Links for test: chat and question
    – Pumbaa
    Commented Mar 9, 2023 at 21:06

0

You must log in to answer this question.

Browse other questions tagged .