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;p=gruntmaster-page.git Merge branch 'master' into newmc --- c13e110a3f07e2aef0892f64207f20dcd01ebdd6 diff --cc js/90-mobilenav.js index 9efe8fc,bd47c8f..981c843 --- a/js/90-mobilenav.js +++ b/js/90-mobilenav.js @@@ -1,6 -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').on('click', () => nav.classList.toggle('hidden-xs')); + $('#title,#logo').on('click', () => nav.classList.toggle('hidden-xs')); }); diff --cc js/90-themes.js index 6a4c680,a94d130..50834da --- a/js/90-themes.js +++ b/js/90-themes.js @@@ -3,15 -3,8 +3,14 @@@ 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') + $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/light', 'logos/dark'))); + else + $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/dark', 'logos/light'))); + }); } $(function() { diff --cc make_static.PL index 06c9eee,f599a56..1e338ad --- a/make_static.PL +++ b/make_static.PL @@@ -60,15 -39,35 +60,35 @@@ sub read_css_into_blocks \@blocks } -my $default_theme = 'cyborg'; ++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; @@@ -89,15 -85,7 +106,15 @@@ sub make_js system 'cp', '-rp', 'js', 'static/'; } +my $sprite_mtime = -M 'static/logos/dark.svg' // 0; +for (, ) { + if (!$sprite_mtime || $sprite_mtime > -M) { + make_logos; + last + } +} + - 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 --cc tmpl/skel.en index cb7156a,32eb1f7..6406c51 --- a/tmpl/skel.en +++ b/tmpl/skel.en @@@ -3,11 -3,7 +3,8 @@@ + - - - - +