Use protocol-relative URL for MathJax

See
http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
Fixed that MathJax works in preview, but not in page display

Use proper hooks, inspired by SmoothGallery extension