Added popup gallery in the thread view.

* Cleaned the init code related to the post links.
* Changed name of HTML elements in post (a distinction between image link and tag links was needed).
+ Magnific popup CSS and JS.
+ Slow scrolling while moving to the post.
Better error handling with easier to understand message when the catalog is not available.
Added gallery view (global, board, thread).

+ JS: jquery masonry, imagesloaded,
Navigation is now context-sensitive. Popup gallery added to the gallery view.

There are three modes of navigation:
    global (link to the index, global statistics and global gallery)
    board (link to the current board view/catalog, board statistics and board gallery)
    thread (link to the current thread view and thread gallery)
Those modes are placed in 3 separate snippets and loaded as needed.

+ Header utilizes flexbox. Apparently it really solves all problems CSS ever had.
- Link to statistics in the footer.
Adjusted media queries.
Infinite scroll added to the gallery.
Merge branch 'dev-gallery' into dev.
Stats use only one view to render templates with different scopes (global/board).
Adjusted media queries, responsive gallery.

+ Gallery is animated.
$ Gallery will load even if the user is unable to scroll because the page is too small. That is ensured by checking if more items need to be downloaded after each update.
Cosmetic changes, comments, more readable make.py output.
Cosmetic changes to the gallery. Cleaned up the code.

- Removed gallery animation.
+ Added loading indicator.
+ Gallery elements are hidden until they are loaded and repositioned by the masonry plugin.
+ More gallery images are loaded during the first request.
* Circle icon is displayed instead of the text message at the end of a gallery.
Smooth scrolling no longer breaks the back button.
Cleaned up the css, gallery overlay opacity changed to default to match the nav arrows color.
Added thread scope to the statistics.
Modified thread navigation, made the code gettings the statistics universal.
Updated screenshots.
Hover over the images in the thread view to see the original filenames.