Native Human

Up

I am doing css and javascript

Let's face it, I don't like javascript programming, but I don't want to rant about it here. Instead, I tried to make good (?) use of it. My blog here still lacks a menu. At least for now I want to keep it simple, and therefore I don't want to use some server side programming or some build script for the web side. Thus, I would need to duplicate the menu for every page manually, which is of course an unacceptable maintenance pain. Thus, I thought I could generate the menu in some javascript code and include that for every page, which needs a menu.

Now the question is: What happens if a client does not support javascript? I could ignore this case, but it is important to me. Although I use firefox most of the time for browsing, I also like to explore some text-browsers like eww for emacs. The blog should work even for such browsers. My solution to this problem is to add an Up-Link to every page, which goes to the index page where all blog posts are linked without javascript. Thus, with two clicks it is also possible for a non-javascript clients to switch to another post and for me as the html developer I only have to duplicate the menu twice, once statically and one time in javascript.

Although I promised not to rant about js, let's face one javascript pain. There are hundereds of slightly different javascript versions of necessary javascript libraries around and the developer has to choose one of them. There are multiple approaches to this problem. One would be to check in the latest version of the library into my git repository. I don't like this approach, because this is not my code, and I don't want to maintain it. Another one is to use some other location on the web. I although don't like this way because you never know if this page is still available in the future and I also might get into problems if I am offline (e.g. in case I have deployed the page on my local machine). Thus, I have chosen a third approach which is to use the packaged javascript libraries from my linux distribution. With the debian packages libjs-jquery and javascript-common, the default apache configuration serves the files at /javascript/jquery/jquery.min.js, or /usr/share/javascript/jquery/jquery.min.js. The downside probably is that this is quite an old version, but I think it is not such a bad idea to rely on older more proven code.

I have also updated my page a bit. I have used a basic div layout and discovered code like:

@media (max-width:640px) { }

which allows to apply styles only if the max-width goes below 640px. I have also found some nice styling for the page links, which I have also applied. I still need to test how this will look on a mobile device, but so far I am quite satisfied with the design. Of course I have stolen and adapted ideas from the web and I will link my main sources below.

References:

Created at: 2015-01-14

Subscribe

List of posts