From c3c5947d899cee78bf29961694d86f6bbd9410d7 Mon Sep 17 00:00:00 2001 From: Mattias Blom Date: Mon, 2 Jan 2017 22:01:21 +0100 Subject: [PATCH] Updates hash with selected fonts when selected font changes. --- index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 6feb81f..1277e2a 100755 --- a/index.html +++ b/index.html @@ -328,6 +328,7 @@ function updateGutters(cm) { $("#font-info p").hide(); $("." + font).show(); + updateHash(); } function setSize() { @@ -340,7 +341,15 @@ function updateGutters(cm) { $(".CodeMirror").addClass("no-smooth"); } } - + function updateHash(){ + var newHash = '#' + $("#select-font").val(); + if(history.pushState) { + history.pushState(null, null, newHash); + } + else { + location.hash = newHash; + } + } $(document).ready(function(){ //randomly select a theme