mgoncharov's blog

By mgoncharov, history, 7 years ago, In English

demo

If you read editorial after solving one of the archived problems and don't want to spoil unsolved ones, you might find this custom javascript extension snippet useful:

$(function() {
if ($("a.tag:contains('editorial'),a.tag:contains('tutorial')").length === 0) return;
$(".content h2, .content h3").each(function(a,b) {
  var <span class="tex-span"><i>h</i> = </span>(b);
  var $t = $h.nextUntil('h2, h3');
  $h.after("<a href='#' class='show-spoiler'>show</a>");
  var $l = $h.next('.show-spoiler');
  $l.click(function() {
    $t.css('visibility', 'visible');
    $l.remove();
    return false;
  });
  $t.css('visibility', 'hidden');
});
})

I have not tested it on each and every editorial ^_^ upd1: fixed issue with picking 'editorial' links from new's block

  • Vote: I like it
  • +109
  • Vote: I do not like it

| Write comment?
»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Cool! I also did something like this some time ago: Unspoil. It's just a simple bookmarklet, so it should work on more browsers, and doesn't need any extensions. :)

(All the heavy work is being done by spoiler alert, so credits goes to them)