From: Marius Gavrilescu Date: Thu, 6 Aug 2015 09:48:08 +0000 (+0300) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=ae7dfc94a272a943e52957c4bffabecfbceb9b19;hp=5776eb1224280d006eda895436aeff574311366c;p=gruntmaster-page.git Merge branch 'master' into newmc --- diff --git a/js/10-modal.js b/js/10-modal.js index d930f44..acee78b 100644 --- a/js/10-modal.js +++ b/js/10-modal.js @@ -1,8 +1,8 @@ -let modal, backdrop, hiding; +let modal, hiding; function show_modal () { modal.classList.remove('hidden'); - backdrop.classList.remove('hidden'); + q('.backdrop').classList.remove('hidden'); setTimeout(function (){ document.body.classList.add('modal-open'); }, 20); @@ -14,7 +14,6 @@ function hide_modal () { $(function() { modal = q('.modal'); - backdrop = q('.backdrop'); $(modal).on('transitionend', el => { if(!document.body.classList.contains('modal-open')) modal.classList.add('hidden'); diff --git a/js/90-themes.js b/js/90-themes.js index 50834da..5196574 100644 --- a/js/90-themes.js +++ b/js/90-themes.js @@ -3,6 +3,8 @@ function set_style(name, trans){ document.body.classList.add('transition-color'); setTimeout(() => document.body.classList.remove('transition-color'), 1000); } + if(q('html').className == name) + return; q('html').className = name; localStorage.setItem("theme", name); $(function() { diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 2ccbeb5..4872da5 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -98,11 +98,10 @@ sub dispatch_request{ response_filter { my ($r) = @_; return $r if ref $r ne 'Plack::App::Gruntmaster::Response'; - my $vary = 'X-Static'; - $vary .= ', Authorization' if $privacy eq 'private'; - my @hdrs = ('X-Forever' => 1, 'Cache-Control' => "$privacy, max-age=$r->{maxage}", Vary => $vary); + my @hdrs = ('X-Forever' => 1, 'Cache-Control' => "$privacy, max-age=$r->{maxage}"); + push @hdrs, Vary => 'Authorization' if $privacy eq 'private'; return [200, ['Content-Type' => 'application/json; charset=utf-8', @hdrs], [encode_json $r->{params}]] if $format eq 'json'; - my $ret = render $r->{template}, 'en', title => $r->{title}, %{$r->{params}}, maybe static => $env->{HTTP_X_STATIC}; + my $ret = render $r->{template}, 'en', title => $r->{title}, %{$r->{params}}; [200, ['Content-Type' => 'text/html; charset=utf-8', @hdrs], [encode 'UTF-8', $ret]] }, }, @@ -167,7 +166,7 @@ sub dispatch_request{ sub (/) { redispatch_to '/index' }, sub (/favicon.ico) { redirect '/static/favicon.ico' }, - sub (/:article) { [200, ['Content-Type' => 'text/html; charset=utf-8', 'Cache-Control' => 'public, max-age=3600', 'X-Forever' => 1, Vary => 'X-Static'], [render_article $_{article}, 'en', maybe static => $env->{HTTP_X_STATIC}]] } + sub (/:article) { [200, ['Content-Type' => 'text/html; charset=utf-8', 'Cache-Control' => 'public, max-age=3600', 'X-Forever' => 1], [render_article $_{article}, 'en']] } }, sub (POST) { diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index b23ddb9..6799fb1 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -91,8 +91,6 @@ sub _render { $tree->defmap(smap => \%args); my $process = __PACKAGE__->can("process_$tmpl"); $process->($tree, %args) if $process; - $_->detach for $tree->look_down(static => $args{static} ? 'no' : 'yes'); - $_->attr('static', undef) for $tree->look_down(sub {$_[0]->attr('static')}); $_->attr('smap', undef) for $tree->look_down(sub {$_[0]->attr('smap')}); $tree->as_HTML(undef, undef, $optional_end_tags); } @@ -282,10 +280,6 @@ sub process_log { $elem->find('a')->edit_href(sub{s/$/&$str/}) if $str; } $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}"); - - my @detach; - push @detach, $args{args}{$_} ? $tree->fclass($_) : () for qw/problem contest owner/; - $_->detach for @detach; } sub process_st { diff --git a/tmpl/pb_entry.en b/tmpl/pb_entry.en index ce2c100..7f04faf 100644 --- a/tmpl/pb_entry.en +++ b/tmpl/pb_entry.en @@ -13,14 +13,14 @@ Job log
Solution -

Submit solution

+

Submit solution

The contest has finished.
To submit solutions to this problem, please visit the problem outside the contest.
-
+
diff --git a/tmpl/skel.en b/tmpl/skel.en index f7ca622..3622006 100644 --- a/tmpl/skel.en +++ b/tmpl/skel.en @@ -16,7 +16,7 @@