{"id":29,"date":"2010-11-27T22:31:21","date_gmt":"2010-11-27T22:31:21","guid":{"rendered":"http:\/\/boulderinformationservices.wordpress.com\/?p=29"},"modified":"2010-11-27T22:31:21","modified_gmt":"2010-11-27T22:31:21","slug":"how-to-format-spoilers","status":"publish","type":"post","link":"https:\/\/boulderinformationservices.com\/blog\/how-to-format-spoilers\/","title":{"rendered":"How to Format Spoilers"},"content":{"rendered":"<p>As a film critic and a UI programmer, I&#8217;ve long thought about the  perfect way to format spoilers. (A spoiler is some part of a movie  review that gives away a secret or a surprise.)<\/p>\n<p>In print, critics  give a written warning to readers that there are spoilers ahead. But on  the web, we have more options &#8212; we can format the spoiler text  differently to give a visual cue, or we can force the readers to do  something to reveal the spoiler such as rolling over, clicking, or  selecting hidden text.<\/p>\n<p>However, just because we <em>can<\/em> do something on the web doesn&#8217;t mean that we <em>should<\/em>.  Make the formatting too gimmicky and it distracts from the text. Make  the formatting too subtle and it just looks like a mistake.<\/p>\n<p>I&#8217;ve never been a big fan of the way the Internet Movie Database handles spoilers. Check out their page on \ufeff<a href=\"http:\/\/www.imdb.com\/title\/tt0167404\/\" target=\"_blank\" rel=\"noopener noreferrer\">The Six\ufeffth Sense<\/a> and look down at the &#8220;Plot Keywords&#8221;\ufeff section. You&#8217;ll notice a graphic that reads &#8220;Spoiler alert! Rollover or vote to view plot keywords!&#8221;<\/p>\n<div id=\"attachment_31\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2010\/11\/imdb_spoilers.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-31\" class=\"size-medium wp-image-31\" title=\"IMDB_spoilers\" src=\"http:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2010\/11\/imdb_spoilers.png?w=300\" alt=\"\" width=\"300\" height=\"77\" srcset=\"https:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2010\/11\/imdb_spoilers.png 479w, https:\/\/boulderinformationservices.com\/blog\/wp-content\/uploads\/2010\/11\/imdb_spoilers-300x77.png 300w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-31\" class=\"wp-caption-text\">IMDB covers spoilers with graphical text<\/p><\/div>\n<p>I think completely covering the text is overkill.  For some movies, plot keywords really are spoilers, but much of the time  they aren&#8217;t. Plus, the graphical text looks different from the rest of  the surrounding text, which makes the page look more haphazard. In  short, it wasn&#8217;t good enough for me, so I decided to stick with the  conventions of print, and just use my words to warn readers about  spoilers.<\/p>\n<p>But I changed my mind when I saw what Bryant Frazer did on Deep Focus. His \ufeff<a href=\"http:\/\/www.deep-focus.com\/dfweblog\/2010\/09\/enter_the_void.html\" target=\"_blank\" rel=\"noopener noreferrer\">review of Enter the Void<\/a>\ufeff  has a section labeled &#8220;spoiler territory.&#8221; I like it because you can  still read it without using your mouse. I like that it&#8217;s easy to spot  where the spoilers are without having to skim the text. I like that it&#8217;s  not too gimmicky &#8212; it&#8217;s just a box with a gray background &#8212; and the  focus remains on the review and not the interface. So I decided to  borrow his idea.<\/p>\n<p>The UI programmer in me had a few things I  wanted to change. On Deep Focus, the words &#8220;spoiler territory&#8221; are part  of the text of the article. I wanted the formatting to be entirely CSS.  To that end, I used the :after pseudo-tag to label my spoilers section  like so:<\/p>\n<pre>.spoilers:after {content: \"Spoilers ahead\"; position: absolute; top: 0; left: 0; ... }<\/pre>\n<p>I  also thought the words &#8220;Spoilers ahead&#8221; should be more prominent than  the spoiler text, lest a casual reader miss the warning. On Deep Focus,  the small red words are less prominent than the spoiler text.<\/p>\n<p>Finally, I thought that if someone wanted to read the entire  review, spoilers be damned, it should be easy to remove the formatting  and format the text the same way as the rest of the review.<\/p>\n<p>After  some tinkering, I came up with a simple rollover effect that changed the  default grayed-out view of the spoiler text to a plain view of the  text. Because I didn&#8217;t want the text to &#8220;jump&#8221; as you moved your mouse, I  decided to keep the margins of the spoiler text when changing between  states.<\/p>\n<p>You can see an example of the new Movie Habit spoiler text on \ufeff<a href=\"http:\/\/www.moviehabit.com\/review.php?story=con_ju10\" target=\"_blank\" rel=\"noopener noreferrer\">Robert Denerstein&#8217;s review of Conviction<\/a>\ufeff.<\/p>\n<p>Now, to add a spoiler section to a review, I need only wrap the spoiler text in<\/p>\n<pre>&lt;div class=\"spoilers\"&gt;...&lt;\/div&gt;<\/pre>\n<p>No JavaScript, no server code, just plain CSS and one HTML tag. Perfect.<\/p>\n<p>The  only reason I might eventually add a little JavaScript would be to  allow mobile-device readers such as iPads to click (or tap) to change  the state, since they don&#8217;t have a &#8220;hover&#8221; state.<\/p>\n<p>&#8230; And in case you want to steal my idea, here&#8217;s the CSS I used:<\/p>\n<pre>.spoilers {background-color: #D1D2D4; padding: 1em 1em 0 ; position: relative;}\n.spoilers * {opacity: 0.25; }\n.spoilers:after {content: \"Spoilers ahead\"; display: block; opacity: 1; color: #000; font-weight: bold; position: absolute; top: 0; left: 0;}\n.spoilers:hover, .spoiled {background-color: inherit; }\n.spoilers:hover *, .spoiled * {opacity: 1;}\n.spoilers:hover:after, .spoiled:after {opacity: .25; }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As a film critic and a UI programmer, I&#8217;ve long thought about the perfect way to format spoilers. (A spoiler is some part of a movie review that gives away a secret or a surprise.) In print, critics give a &hellip; <a href=\"https:\/\/boulderinformationservices.com\/blog\/how-to-format-spoilers\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,15,16],"tags":[27],"_links":{"self":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts\/29"}],"collection":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boulderinformationservices.com\/blog\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}