Merge branch 'master' into newmc
authorMarius Gavrilescu <marius@ieval.ro>
Tue, 4 Aug 2015 13:04:40 +0000 (16:04 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 4 Aug 2015 13:04:40 +0000 (16:04 +0300)
15 files changed:
css/themes/cyborg.css
css/themes/readable.css
css/themes/slate.css
js/05-makedom.js
js/10-modal.js
js/80-sidebar.js
js/90-divine-format.js
js/90-form.js
js/90-mobilenav.js
js/90-nav.js
js/90-themes.js
js/90-tracker.js
js/95-login.js
make_static.PL
tmpl/skel.en

index 32c642a7b47f3fdc01f9ab2ebaadc5d95f8dd782..ca686c958c9f4d068661d6497c4ab081a84b943d 100644 (file)
@@ -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,
index 63f7ae5c66beb576ac6f82b44ef19fcfda7cad7e..3a7b322146d070c2090cf2296dd01ecaebabde6a 100644 (file)
@@ -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;
-}
index d20c8fea68ef3b71f80095d61a49e99285408087..9b484e055c1c33e56a3bdd0da5620f21cd634fb7 100644 (file)
@@ -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 {
index 389fe4cd893fe1c0405b70ef0706e31af6f597cc..a938d2cb4e13a94183430c5052861b0d481e5936 100644 (file)
@@ -3,3 +3,7 @@ function m(html) {
        div.innerHTML = html;
        return div.firstChild;
 }
+
+function q(selector) {
+       return document.querySelector(selector);
+}
index 3a8a214a6c1716bda539d27ed58ff7b2313bd0e2..d930f44ef0b6b3f956f0076b8055295c8f73de1e 100644 (file)
@@ -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');
index 2f6ca8ac734a7e107c2209cbd12fa891826a3b0c..5120df52eee0be2b289203e1949500b4e4446b1a 100644 (file)
@@ -1,6 +1,6 @@
 $(function() {
        if(!document.getElementById('sidebar')) {
-        const content = $('main')[0];
+        const content = q('main');
                content.innerHTML = '<div class="col-md-9">' + content.innerHTML + '</div><aside id="sidebar" class="col-md-3"></aside>';
                content.classList.add('row');
     }
index da4885695889324bcd9a0712920901b7b5385cee..a842de1353c790ea649ba05cdfff7ce53f67a178 100644 (file)
@@ -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));
index aa5e9eff1428750ba2ec818136dd424f60f7cfd8..a30e7f4fc81f68c1aa3b25a9bebde8c04f099b90 100644 (file)
@@ -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;
index 9efe8fccb7b968b8759ab0d2cb78f50d51152771..981c843b7afc1f641cb6c9931956e654349d37b3 100644 (file)
@@ -1,6 +1,6 @@
 $(function(){
-       const nav = $('nav')[0];
+       const nav = q('nav');
        nav.classList.add('hidden-xs');
-       $('#title')[0].insertAdjacentHTML('beforebegin', '<div class="text-center visible-xs-block">Tap title to toggle menu</div>');
+       q('#title').insertAdjacentHTML('beforebegin', '<div class="text-center visible-xs-block">Tap title to toggle menu</div>');
        $('#title,#logo').on('click', () => nav.classList.toggle('hidden-xs'));
 });
index 746ccd70eda3e1f66c811eed9704c3600d68ee16..c6b776e0d721a3bf1d22389300a669c252c40fd2 100644 (file)
@@ -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');
 });
index 6a4c6809dbbb3a7be503031d4823ebf0bcb1033d..50834da65622a6ffd71536067798d34a8ad54d95 100644 (file)
@@ -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() {
                '<li><a role="button" data-theme="cyborg">Black</a>' +
                '<li><a role="button" data-theme="slate">Grey</a>' +
                '<li><a role="button" data-theme="readable">White</a></ul>';
-       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));
 });
index b7f5e57bacf36f6ff56a03e7fa5220c069daf286..6b73fb34808e332a6ae1bf50656a97f58b4241d9 100644 (file)
@@ -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('<div id="tracker" class="hidden">Tracking <a id="tracker_userlink"></a>.<br><a id="tracker_stop" role="button">Stop tracking</a><br><a id="tracker_log">Job log</a><dl class="dl-horizontal"><dt>Solved</dt>    <dd id="tracker_solved">?</dd><dt>Attempted</dt> <dd id="tracker_attempted">?</dd><dt>Contests</dt>  <dd id="tracker_contests">?</dd></dl></div>');
-       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) });
index aad77d370682a1ad5b47eef8a9ec7f80f59197d0..6036aef912343ba1049dc0795ca6ba8b845b25c0 100644 (file)
@@ -1,5 +1,5 @@
 $(function(){
-       const sidebar = $('#sidebar')[0];
+       const sidebar = q('#sidebar');
        const login = document.createElement('div');
        login.innerHTML = '<a role="button" id="login" class="show">Log in</a>';
        sidebar.insertBefore(login, sidebar.firstChild);
index 06c9eeea791cd9e8da281f4d43fbb576d1398c4e..1e338addd1dc2d2657a6031d3cd71faa983325c2 100644 (file)
@@ -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 <css/*.css>;
+       my $css = join '', map { read_file $_ } <css/*.css>;
 
-       my (%themes, $rndtheme);
+       my (%themes);
        for (<css/themes/*>) {
-               ($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 (<logos/*>, <logos-light/*>) {
        }
 }
 
-my $css_mtime = -M 'static/css/slate.css' // 0;
+my $css_mtime = -M 'static/css/all.css' // 0;
 for (<css/*>, <css/themes/*>) {
        if (!$css_mtime || $css_mtime > -M) {
                make_css;
index cb7156acf72680be062986850032996912de427b..6406c51a233118553e2e11e798c40fc47b7d582a 100644 (file)
@@ -4,10 +4,7 @@
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
 <link href="/static/favicon.png" rel="shortcut icon">
-<link href="/static/css/common.css" rel="stylesheet" integrity="x">
-<link href="/static/css/cyborg.css" title="cyborg" rel="alternate stylesheet" integrity="x">
-<link href="/static/css/slate.css" title="slate" rel="stylesheet" integrity="x">
-<link href="/static/css/readable.css" title="readable" rel="alternate stylesheet" integrity="x">
+<link href="/static/css/all.css" rel="stylesheet" integrity="x">
 <script src="/static/js/all.js" type="text/javascript" async defer integrity="x"></script>
 
 <body>
This page took 0.030878 seconds and 4 git commands to generate.