Merge branch 'master' into newmc
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 6 Aug 2015 09:48:08 +0000 (12:48 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 6 Aug 2015 09:48:08 +0000 (12:48 +0300)
js/10-modal.js
js/90-themes.js
lib/Plack/App/Gruntmaster.pm
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/pb_entry.en
tmpl/skel.en

index d930f44ef0b6b3f956f0076b8055295c8f73de1e..acee78b7fdd6c3e4d525bfc8515bef911c050e2f 100644 (file)
@@ -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');
index 50834da65622a6ffd71536067798d34a8ad54d95..5196574e3064decfb59ce85729acb174c51ff530 100644 (file)
@@ -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() {
index 2ccbeb50d8e216211e656d9b0046a0e469ee5d84..4872da563fd8506f262c248cf21fa41a88c1a25f 100644 (file)
@@ -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) {
index b23ddb970b0269edbb13aa3f0228403d30ce8db0..6799fb107af2e2608a753798e64c1b7fd48b382b 100644 (file)
@@ -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 {
index ce2c100a2fcca4e37b04523f762a2f7679144c0b..7f04fafe8a21e0b3933a67bb0b9f8bad9102dc20 100644 (file)
 <a href="/log/?problem=problem_id" id="job_log">Job log</a><br>
 <a href="/sol/problem_id" id="solution">Solution</a>
 
-<h1 static="no">Submit solution</h1>
+<h1>Submit solution</h1>
 
 <div id="nosubmit">
 The contest has finished.<br>
 To submit solutions to this problem, please visit the problem <a href="/pb/id">outside&nbsp;the&nbsp;contest</a>.
 </div>
 
-<div id="submit" static="no">
+<div id="submit">
 <form id="submitform" action="/action/submit" method="POST" enctype="multipart/form-data" role="form">
 <input type="hidden" name="problem" value="problem_id">
 <input type="hidden" name="contest" value="contest_id">
index f7ca6226f9320600d79528326c0c3627c097fe41..3622006d78c9cad9dd15e3a561b80bbc91827568 100644 (file)
@@ -16,7 +16,7 @@
 <li id="nav-ct"><a href="/ct/">Contests</a>
 <li id="nav-log"><a href="/log/">Job log</a>
 <li id="nav-us"><a href="/us/">Users</a>
-<li id="nav-account" static="no"><a href="/account">Account</a>
+<li id="nav-account"><a href="/account">Account</a>
 <li id="nav-about"><a href="/about">About / Help</a>
 <li id="nav-contribute"><a href="/contribute">Contribute!</a>
 
@@ -26,7 +26,6 @@
 <img id="logo" class="center-block" src="/static/logos/dark.svg#logo-mindcoding" width="600px" height="152px">
 
 <h1 id="title">TITLE</h1>
-<div id="static" class="alert alert-info" static="yes">This is a static version of MindCoding, useful when the <a class="alert-link" href="https://mindcoding.ro/">regular version</a> is overloaded.</div>
 
 <div id="result"></div>
 
This page took 0.015924 seconds and 4 git commands to generate.