From: Marius Gavrilescu Date: Tue, 4 Aug 2015 13:04:40 +0000 (+0300) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c13e110a3f07e2aef0892f64207f20dcd01ebdd6;hp=0ffa7a2279c36443ce58a2b0d383e45011b7230e;p=gruntmaster-page.git Merge branch 'master' into newmc --- diff --git a/css/themes/cyborg.css b/css/themes/cyborg.css index 32c642a..ca686c9 100644 --- a/css/themes/cyborg.css +++ b/css/themes/cyborg.css @@ -1,11 +1,16 @@ /*! - * bootswatch v3.3.4+1 + * bootswatch v3.3.5 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT * Based on Bootstrap */ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; @@ -232,9 +237,6 @@ th { h3 { page-break-after: avoid; } - select { - background: #fff !important; - } .navbar { display: none; } @@ -521,62 +523,72 @@ mark, .text-primary { color: #2a9fd6; } -a.text-primary:hover { +a.text-primary:hover, +a.text-primary:focus { color: #2180ac; } .text-success { color: #ffffff; } -a.text-success:hover { +a.text-success:hover, +a.text-success:focus { color: #e6e6e6; } .text-info { color: #ffffff; } -a.text-info:hover { +a.text-info:hover, +a.text-info:focus { color: #e6e6e6; } .text-warning { color: #ffffff; } -a.text-warning:hover { +a.text-warning:hover, +a.text-warning:focus { color: #e6e6e6; } .text-danger { color: #ffffff; } -a.text-danger:hover { +a.text-danger:hover, +a.text-danger:focus { color: #e6e6e6; } .bg-primary { color: #fff; background-color: #2a9fd6; } -a.bg-primary:hover { +a.bg-primary:hover, +a.bg-primary:focus { background-color: #2180ac; } .bg-success { background-color: #77b300; } -a.bg-success:hover { +a.bg-success:hover, +a.bg-success:focus { background-color: #558000; } .bg-info { background-color: #9933cc; } -a.bg-info:hover { +a.bg-info:hover, +a.bg-info:focus { background-color: #7a29a3; } .bg-warning { background-color: #ff8800; } -a.bg-warning:hover { +a.bg-warning:hover, +a.bg-warning:focus { background-color: #cc6d00; } .bg-danger { background-color: #cc0000; } -a.bg-danger:hover { +a.bg-danger:hover, +a.bg-danger:focus { background-color: #990000; } .page-header { @@ -1045,9 +1057,17 @@ textarea.form-control { background-color: #424242; border-color: #424242; } -.btn-default:hover, .btn-default:focus, -.btn-default.focus, +.btn-default.focus { + color: #ffffff; + background-color: #282828; + border-color: #020202; +} +.btn-default:hover { + color: #ffffff; + background-color: #282828; + border-color: #232323; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1055,6 +1075,19 @@ textarea.form-control { background-color: #282828; border-color: #232323; } +.btn-default:active:hover, +.btn-default.active:hover, +.open > .dropdown-toggle.btn-default:hover, +.btn-default:active:focus, +.btn-default.active:focus, +.open > .dropdown-toggle.btn-default:focus, +.btn-default:active.focus, +.btn-default.active.focus, +.open > .dropdown-toggle.btn-default.focus { + color: #ffffff; + background-color: #161616; + border-color: #020202; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1090,9 +1123,17 @@ fieldset[disabled] .btn-default.active { background-color: #2a9fd6; border-color: #2a9fd6; } -.btn-primary:hover, .btn-primary:focus, -.btn-primary.focus, +.btn-primary.focus { + color: #ffffff; + background-color: #2180ac; + border-color: #15506c; +} +.btn-primary:hover { + color: #ffffff; + background-color: #2180ac; + border-color: #1f79a3; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -1100,6 +1141,19 @@ fieldset[disabled] .btn-default.active { background-color: #2180ac; border-color: #1f79a3; } +.btn-primary:active:hover, +.btn-primary.active:hover, +.open > .dropdown-toggle.btn-primary:hover, +.btn-primary:active:focus, +.btn-primary.active:focus, +.open > .dropdown-toggle.btn-primary:focus, +.btn-primary:active.focus, +.btn-primary.active.focus, +.open > .dropdown-toggle.btn-primary.focus { + color: #ffffff; + background-color: #1b698e; + border-color: #15506c; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -1427,6 +1481,12 @@ fieldset[disabled] .btn-primary.active { .text-info:hover { color: #9933cc; } +.bg-success, +.bg-info, +.bg-warning, +.bg-danger { + color: #fff; +} .nav-tabs a, .nav-pills a, .breadcrumb a, diff --git a/css/themes/readable.css b/css/themes/readable.css index 63f7ae5..3a7b322 100644 --- a/css/themes/readable.css +++ b/css/themes/readable.css @@ -1,11 +1,16 @@ /*! - * bootswatch v3.3.4+1 + * bootswatch v3.3.5 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT * Based on Bootstrap */ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; @@ -232,9 +237,6 @@ th { h3 { page-break-after: avoid; } - select { - background: #fff !important; - } .navbar { display: none; } @@ -521,62 +523,72 @@ mark, .text-primary { color: #4582ec; } -a.text-primary:hover { +a.text-primary:hover, +a.text-primary:focus { color: #1863e6; } .text-success { color: #3fad46; } -a.text-success:hover { +a.text-success:hover, +a.text-success:focus { color: #318837; } .text-info { color: #5bc0de; } -a.text-info:hover { +a.text-info:hover, +a.text-info:focus { color: #31b0d5; } .text-warning { color: #f0ad4e; } -a.text-warning:hover { +a.text-warning:hover, +a.text-warning:focus { color: #ec971f; } .text-danger { color: #d9534f; } -a.text-danger:hover { +a.text-danger:hover, +a.text-danger:focus { color: #c9302c; } .bg-primary { color: #fff; background-color: #4582ec; } -a.bg-primary:hover { +a.bg-primary:hover, +a.bg-primary:focus { background-color: #1863e6; } .bg-success { background-color: #dff0d8; } -a.bg-success:hover { +a.bg-success:hover, +a.bg-success:focus { background-color: #c1e2b3; } .bg-info { background-color: #d9edf7; } -a.bg-info:hover { +a.bg-info:hover, +a.bg-info:focus { background-color: #afd9ee; } .bg-warning { background-color: #fcf8e3; } -a.bg-warning:hover { +a.bg-warning:hover, +a.bg-warning:focus { background-color: #f7ecb5; } .bg-danger { background-color: #f2dede; } -a.bg-danger:hover { +a.bg-danger:hover, +a.bg-danger:focus { background-color: #e4b9b9; } .page-header { @@ -1045,9 +1057,17 @@ textarea.form-control { background-color: #ffffff; border-color: #dddddd; } -.btn-default:hover, .btn-default:focus, -.btn-default.focus, +.btn-default.focus { + color: #333333; + background-color: #e6e6e6; + border-color: #9d9d9d; +} +.btn-default:hover { + color: #333333; + background-color: #e6e6e6; + border-color: #bebebe; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1055,6 +1075,19 @@ textarea.form-control { background-color: #e6e6e6; border-color: #bebebe; } +.btn-default:active:hover, +.btn-default.active:hover, +.open > .dropdown-toggle.btn-default:hover, +.btn-default:active:focus, +.btn-default.active:focus, +.open > .dropdown-toggle.btn-default:focus, +.btn-default:active.focus, +.btn-default.active.focus, +.open > .dropdown-toggle.btn-default.focus { + color: #333333; + background-color: #d4d4d4; + border-color: #9d9d9d; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1090,9 +1123,17 @@ fieldset[disabled] .btn-default.active { background-color: #4582ec; border-color: #4582ec; } -.btn-primary:hover, .btn-primary:focus, -.btn-primary.focus, +.btn-primary.focus { + color: #ffffff; + background-color: #1863e6; + border-color: #1045a1; +} +.btn-primary:hover { + color: #ffffff; + background-color: #1863e6; + border-color: #175fdd; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -1100,6 +1141,19 @@ fieldset[disabled] .btn-default.active { background-color: #1863e6; border-color: #175fdd; } +.btn-primary:active:hover, +.btn-primary.active:hover, +.open > .dropdown-toggle.btn-primary:hover, +.btn-primary:active:focus, +.btn-primary.active:focus, +.open > .dropdown-toggle.btn-primary:focus, +.btn-primary:active.focus, +.btn-primary.active.focus, +.open > .dropdown-toggle.btn-primary.focus { + color: #ffffff; + background-color: #1455c6; + border-color: #1045a1; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -1506,18 +1560,3 @@ legend { border: 1px solid #ddd; color: #333333; } -.badge { - padding: 1px 7px 5px; - vertical-align: 2px; - font-family: sans-serif; - font-weight: normal; -} -.panel { - box-shadow: none; -} -.panel-default .close { - color: #333333; -} -.modal .close { - color: #333333; -} diff --git a/css/themes/slate.css b/css/themes/slate.css index d20c8fe..9b484e0 100644 --- a/css/themes/slate.css +++ b/css/themes/slate.css @@ -1,11 +1,16 @@ /*! - * bootswatch v3.3.4+1 + * bootswatch v3.3.5 * Homepage: http://bootswatch.com * Copyright 2012-2015 Thomas Park * Licensed under MIT * Based on Bootstrap */ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/*! + * Bootstrap v3.3.5 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; @@ -232,9 +237,6 @@ th { h3 { page-break-after: avoid; } - select { - background: #fff !important; - } .navbar { display: none; } @@ -521,62 +523,72 @@ mark, .text-primary { color: #7a8288; } -a.text-primary:hover { +a.text-primary:hover, +a.text-primary:focus { color: #62686d; } .text-success { color: #ffffff; } -a.text-success:hover { +a.text-success:hover, +a.text-success:focus { color: #e6e6e6; } .text-info { color: #ffffff; } -a.text-info:hover { +a.text-info:hover, +a.text-info:focus { color: #e6e6e6; } .text-warning { color: #ffffff; } -a.text-warning:hover { +a.text-warning:hover, +a.text-warning:focus { color: #e6e6e6; } .text-danger { color: #ffffff; } -a.text-danger:hover { +a.text-danger:hover, +a.text-danger:focus { color: #e6e6e6; } .bg-primary { color: #fff; background-color: #7a8288; } -a.bg-primary:hover { +a.bg-primary:hover, +a.bg-primary:focus { background-color: #62686d; } .bg-success { background-color: #62c462; } -a.bg-success:hover { +a.bg-success:hover, +a.bg-success:focus { background-color: #42b142; } .bg-info { background-color: #5bc0de; } -a.bg-info:hover { +a.bg-info:hover, +a.bg-info:focus { background-color: #31b0d5; } .bg-warning { background-color: #f89406; } -a.bg-warning:hover { +a.bg-warning:hover, +a.bg-warning:focus { background-color: #c67605; } .bg-danger { background-color: #ee5f5b; } -a.bg-danger:hover { +a.bg-danger:hover, +a.bg-danger:focus { background-color: #e9322d; } .page-header { @@ -1045,9 +1057,17 @@ textarea.form-control { background-color: #3a3f44; border-color: #3a3f44; } -.btn-default:hover, .btn-default:focus, -.btn-default.focus, +.btn-default.focus { + color: #ffffff; + background-color: #232628; + border-color: #000000; +} +.btn-default:hover { + color: #ffffff; + background-color: #232628; + border-color: #1e2023; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1055,6 +1075,19 @@ textarea.form-control { background-color: #232628; border-color: #1e2023; } +.btn-default:active:hover, +.btn-default.active:hover, +.open > .dropdown-toggle.btn-default:hover, +.btn-default:active:focus, +.btn-default.active:focus, +.open > .dropdown-toggle.btn-default:focus, +.btn-default:active.focus, +.btn-default.active.focus, +.open > .dropdown-toggle.btn-default.focus { + color: #ffffff; + background-color: #121415; + border-color: #000000; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -1090,9 +1123,17 @@ fieldset[disabled] .btn-default.active { background-color: #7a8288; border-color: #7a8288; } -.btn-primary:hover, .btn-primary:focus, -.btn-primary.focus, +.btn-primary.focus { + color: #ffffff; + background-color: #62686d; + border-color: #3e4245; +} +.btn-primary:hover { + color: #ffffff; + background-color: #62686d; + border-color: #5d6368; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -1100,6 +1141,19 @@ fieldset[disabled] .btn-default.active { background-color: #62686d; border-color: #5d6368; } +.btn-primary:active:hover, +.btn-primary.active:hover, +.open > .dropdown-toggle.btn-primary:hover, +.btn-primary:active:focus, +.btn-primary.active:focus, +.open > .dropdown-toggle.btn-primary:focus, +.btn-primary:active.focus, +.btn-primary.active.focus, +.open > .dropdown-toggle.btn-primary.focus { + color: #ffffff; + background-color: #51565a; + border-color: #3e4245; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { diff --git a/js/05-makedom.js b/js/05-makedom.js index 389fe4c..a938d2c 100644 --- a/js/05-makedom.js +++ b/js/05-makedom.js @@ -3,3 +3,7 @@ function m(html) { div.innerHTML = html; return div.firstChild; } + +function q(selector) { + return document.querySelector(selector); +} diff --git a/js/10-modal.js b/js/10-modal.js index 3a8a214..d930f44 100644 --- a/js/10-modal.js +++ b/js/10-modal.js @@ -13,8 +13,8 @@ function hide_modal () { } $(function() { - modal = $('.modal')[0]; - backdrop = $('.backdrop')[0]; + 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/80-sidebar.js b/js/80-sidebar.js index 2f6ca8a..5120df5 100644 --- a/js/80-sidebar.js +++ b/js/80-sidebar.js @@ -1,6 +1,6 @@ $(function() { if(!document.getElementById('sidebar')) { - const content = $('main')[0]; + const content = q('main'); content.innerHTML = '
' + content.innerHTML + '
'; content.classList.add('row'); } diff --git a/js/90-divine-format.js b/js/90-divine-format.js index da48856..a842de1 100644 --- a/js/90-divine-format.js +++ b/js/90-divine-format.js @@ -30,11 +30,11 @@ const ext_table = { } function divine_format() { - const filename = $('#prog')[0].value; + const filename = q('#prog').value; const ext = /\.([^.]*)$/.exec(filename)[1]; if(ext_table[ext]) - $('#prog_format')[0].value = ext_table[ext]; + q('#prog_format').value = ext_table[ext]; } $(() => $('#prog').on('change', divine_format)); diff --git a/js/90-form.js b/js/90-form.js index aa5e9ef..a30e7f4 100644 --- a/js/90-form.js +++ b/js/90-form.js @@ -1,5 +1,5 @@ $(function(){ - const result = $('#result')[0]; + const result = q('#result'); $('.jsform > input[type="submit"]').on('click', e => { const form_data = new FormData(this.parentElement); const form = this.parentNode; diff --git a/js/90-mobilenav.js b/js/90-mobilenav.js index 9efe8fc..981c843 100644 --- a/js/90-mobilenav.js +++ b/js/90-mobilenav.js @@ -1,6 +1,6 @@ $(function(){ - const nav = $('nav')[0]; + const nav = q('nav'); nav.classList.add('hidden-xs'); - $('#title')[0].insertAdjacentHTML('beforebegin', '
Tap title to toggle menu
'); + q('#title').insertAdjacentHTML('beforebegin', '
Tap title to toggle menu
'); $('#title,#logo').on('click', () => nav.classList.toggle('hidden-xs')); }); diff --git a/js/90-nav.js b/js/90-nav.js index 746ccd7..c6b776e 100644 --- a/js/90-nav.js +++ b/js/90-nav.js @@ -13,5 +13,5 @@ $(function(){ const path = location.pathname; for (const nav in NAVS) if(path.match(NAVS[nav])) - $('#nav-' + nav)[0].classList.add('active'); + q('#nav-' + nav).classList.add('active'); }); diff --git a/js/90-themes.js b/js/90-themes.js index 6a4c680..50834da 100644 --- a/js/90-themes.js +++ b/js/90-themes.js @@ -3,8 +3,7 @@ function set_style(name, trans){ document.body.classList.add('transition-color'); setTimeout(() => document.body.classList.remove('transition-color'), 1000); } - $('link[title]').each(e => e.disabled = true); - $('link[title="' + name + '"]')[0].disabled = false; + q('html').className = name; localStorage.setItem("theme", name); $(function() { if(name == 'slate' || name == 'cyborg') @@ -19,7 +18,7 @@ $(function() { '
  • Black' + '
  • Grey' + '
  • White'; - const sidebar = $('#sidebar')[0]; + const sidebar = q('#sidebar'); sidebar.insertBefore(m(theme_ul), sidebar.firstChild); $('#themes a').on('click', e => set_style(e.target.dataset.theme, true)); }); diff --git a/js/90-tracker.js b/js/90-tracker.js index b7f5e57..6b73fb3 100644 --- a/js/90-tracker.js +++ b/js/90-tracker.js @@ -31,11 +31,11 @@ function update_tracker(){ data.contests.forEach(e => contests[e.contest] = 1); clean_tracker(); - $('#tracker_userlink')[0].innerHTML = data.name; - $('#tracker_solved')[0].innerHTML = solvednr; - $('#tracker_attempted')[0].innerHTML = attemptednr; - $('#tracker_contests')[0].innerHTML = data.contests.length; - $('#tracker_log')[0].setAttribute('href', '/log/?owner=' + user); + q('#tracker_userlink').innerHTML = data.name; + q('#tracker_solved').innerHTML = solvednr; + q('#tracker_attempted').innerHTML = attemptednr; + q('#tracker_contests').innerHTML = data.contests.length; + q('#tracker_log').setAttribute('href', '/log/?owner=' + user); if(location.pathname == '/pb/') $('table .name a').each(el => { @@ -73,8 +73,8 @@ function update_tracker(){ function start_tracking(user){ localStorage.setItem('tracker_username', user); - $('#tracker_userlink')[0].setAttribute('href', '/us/' + user); - $('#tracker_userlink')[0].innerHTML = user; + q('#tracker_userlink').setAttribute('href', '/us/' + user); + q('#tracker_userlink').innerHTML = user; tracker.classList.remove('hidden'); update_tracker(); const lastfetch = localStorage.getItem('tracker_lastfetch'); @@ -104,7 +104,7 @@ function stop_tracking(){ $(function(){ tracker = m(''); - const sidebar = $('#sidebar')[0]; + const sidebar = q('#sidebar'); sidebar.insertBefore(tracker, sidebar.firstChild); $('#tracker_stop').on('click', stop_tracking); $('#track_user').on('click', function() { stop_tracking(); start_tracking(this.dataset.user) }); diff --git a/js/95-login.js b/js/95-login.js index aad77d3..6036aef 100644 --- a/js/95-login.js +++ b/js/95-login.js @@ -1,5 +1,5 @@ $(function(){ - const sidebar = $('#sidebar')[0]; + const sidebar = q('#sidebar'); const login = document.createElement('div'); login.innerHTML = 'Log in'; sidebar.insertBefore(login, sidebar.firstChild); diff --git a/make_static.PL b/make_static.PL index 06c9eee..1e338ad 100644 --- a/make_static.PL +++ b/make_static.PL @@ -60,26 +60,43 @@ sub read_css_into_blocks { \@blocks } +my $default_theme = 'slate'; + +sub theme_prefix { + my ($theme, $decl, $default) = @_; + return $decl if $theme eq $default_theme || !$decl; + return '' if $decl eq $default; + + $default =~ s/[^{]*{\n//; + $default =~ s/\n}[^}]*//; + $decl =~ s/^$_$//m for split "\n", $default; + $decl =~ s/\n+/\n/g; + + my $prefix = "html.$theme"; + my ($first_line) = $decl =~ /([^{]*){/; + $first_line =~ s/(,\s+)/$1 $prefix /g; + $first_line = "$prefix $first_line"; + $decl =~ s/([^{]*){/$first_line\{/; + $decl +} + sub make_css { - my %css; - $css{common} .= read_file $_ for ; + my $css = join '', map { read_file $_ } ; - my (%themes, $rndtheme); + my (%themes); for () { - ($rndtheme) = m,themes/(.*)\.css,; - $themes{$rndtheme} = read_css_into_blocks $_; + my ($theme) = m,themes/(.*)\.css,; + $themes{$theme} = read_css_into_blocks $_; } + my @themes = sort grep { $_ ne $default_theme } keys %themes; while (grep { scalar @$_ } values %themes) { my %blocks = map { $_ => (shift @{$themes{$_}}) // '' } keys %themes; - if (grep { $_ ne $blocks{$rndtheme} } values %blocks) { - $css{$_} .= $blocks{$_} for keys %themes; - } else { - $css{common} .= $blocks{$rndtheme}; - } + $css .= $blocks{$default_theme}; + $css .= theme_prefix $_, $blocks{$_}, $blocks{$default_theme} for @themes } - write_gzfile "static/css/$_.css", minify $css{$_} for keys %css + write_gzfile "static/css/all.css", minify $css } sub make_js { @@ -97,7 +114,7 @@ for (, ) { } } -my $css_mtime = -M 'static/css/slate.css' // 0; +my $css_mtime = -M 'static/css/all.css' // 0; for (, ) { if (!$css_mtime || $css_mtime > -M) { make_css; diff --git a/tmpl/skel.en b/tmpl/skel.en index cb7156a..6406c51 100644 --- a/tmpl/skel.en +++ b/tmpl/skel.en @@ -4,10 +4,7 @@ - - - - +