Merge branch 'master' of github.com:h3rald/h3rald into another-10-languages
h3rald h3rald@h3rald.com
Wed, 19 Dec 2018 10:01:32 +0100
4 files changed,
21 insertions(+),
28 deletions(-)
M
assets/js/scripts.js
→
assets/js/scripts.js
@@ -1,32 +1,22 @@
(function (window) { 'use strict'; - - // Theme Switching - var themeSwitcher = document.getElementById('theme-switcher'); + var themeLinks = document.getElementsByClassName('theme-css-link'); - var themeNames = { - light: 'day', - dark: 'night' - } - var hour = new Date().getHours(); var currentTheme = themeLinks[0].href.match(/(light|dark)/)[1]; - var actualTheme = (hour >= 18 || hour < 6) ? 'dark' : 'light'; - function switchTheme() { - var newTheme = currentTheme === 'light' ? 'dark' : 'light'; - for (var i = 0; i < themeLinks.length; i++) { - themeLinks[i].href = themeLinks[i].href.replace(currentTheme, newTheme); + document.addEventListener("DOMContentLoaded", function(event) { + // Theme Switching + var themeSwitcher = document.getElementById('theme-switcher'); + function switchTheme() { + var newTheme = currentTheme === 'light' ? 'dark' : 'light'; + for (var i = 0; i < themeLinks.length; i++) { + themeLinks[i].disabled = themeLinks[i].href.match(currentTheme); + themeLinks[i].rel = themeLinks[i].href.match(currentTheme) ? 'alternate stylesheet' : 'stylesheet'; + } + themeSwitcher.title = themeSwitcher.title.replace(newTheme, currentTheme); + themeSwitcher.innerText = currentTheme; + currentTheme = newTheme; } - themeSwitcher.title = themeSwitcher.title.replace(themeNames[newTheme], themeNames[currentTheme]); - themeSwitcher.innerText = themeNames[currentTheme]; - actualTheme = newTheme; - currentTheme = newTheme; - } - - themeSwitcher.addEventListener('click', switchTheme); - if (actualTheme !== currentTheme) { - switchTheme(); - currentTheme = actualTheme; - } - -})(window)+ themeSwitcher.addEventListener('click', switchTheme); + }); +})(window)
M
contents/articles/10-more-programming-languages.md
→
contents/articles/10-more-programming-languages.md
@@ -4,6 +4,7 @@ title: "10 more programming languages worth checking out"
subtitle: "Another look at 10 non-mainstream programming languages, 10 years later" content-type: article timestamp: 1545358888 +draft: true ----- It has been exactly 10 years today since I published my [10 programming languages worth checking out](/articles/10-programming-languages) article on this web site.@@ -188,4 +189,4 @@ _Why bother?_ —They said. _Why did you create X when Y and Z already do the same thing?_
The answer is that creating a new programming language is sometimes the best strategy to solve a problem. Apple had a problem with Objective-C and created Swift, Mozilla needed something better than C++ to create their next generation browser, some people really loved Ruby but hated its inherent slowness and created Crystal and Elixir. All these extraordinary people and companies were bold enough to bet on something _completely new_ and be successful. -We are living a new Golden Age of programming language design, and we should be grateful for this diversity, not pissed off. Learning a new programming language may feel pointless sometimes, but it is always rewarding to some level... so pick one of these and try it out, you won't be disappointed.+We are living a new Golden Age of programming language design, and we should be grateful for this diversity, not pissed off. Learning a new programming language may feel pointless sometimes, but it is always rewarding to some level... so pick one of these and try it out, you won't be disappointed.
M
templates/_head.mustache
→
templates/_head.mustache
@@ -12,7 +12,10 @@ <meta content="44.388041;9.073248" name="ICBM" />
<link rel="stylesheet" type="text/css" href="/styles/entypo.css" /> <link rel="stylesheet" type="text/css" href="/styles/fonts.css" /> <link rel="stylesheet" type="text/css" href="/styles/atom-one-dark.css" class="theme-css-link" /> + <link rel="alternate stylesheet" type="text/css" href="/styles/atom-one-light.css" class="theme-css-link" /> <link rel="stylesheet" type="text/css" href="/styles/flexboxgrid.min.css" /> <link rel="stylesheet" type="text/css" href="/styles/flexboxgrid-helpers.min.css" /> <link rel="stylesheet" type="text/css" href="/styles/dark-theme.css" class="theme-css-link" /> + <link rel="alternate stylesheet" type="text/css" href="/styles/light-theme.css" class="theme-css-link" /> + <script src="/js/scripts.js" type="text/javascript"></script> </head>