function checkSize() {
    var mobileClassRegex = /(^|\s)mobile($|\s)/;
    if (window.innerWidth < 580) {
        if (!document.body.className.match(mobileClassRegex)) {
            document.body.className += " mobile";
        }
    } else {
        document.body.className =
            document.body.className.replace(mobileClassRegex, "");
    }
}
setInterval(checkSize, 100);
checkSize();

@@ -7,20 +7,16 @@
 on check
-Size
 () %7B%0A   
@@ -340,16 +340,774 @@
 ;%0A    %7D%0A
+%0A    if (window.pageYOffset %3C= 50) %7B%0A        changeHash(null);%0A    %7D else %7B%0A        var elearr = document.querySelectorAll('%5Bid%5D');%0A        var currentAnchor = Array.prototype.map.call(elearr, function(e) %7B%0A            return %7BdiffTop: Math.abs(e.getBoundingClientRect().top), e: e%7D;%0A        %7D).sort(function(a, b) %7B%0A            if (a.diffTop %3C b.diffTop) %7B%0A                return -1;%0A            %7D else %7B%0A                return (a.diffTop %3E b.diffTop ? 1 : 0);%0A            %7D%0A        %7D)%5B0%5D.e;%0A        changeHash(currentAnchor.id);%0A    %7D%0A%7D%0Afunction changeHash(hash) %7B%0A    var selfUrl = window.location.toString().replace(/#.+$/g, %22%22);%0A    if (hash !== null) %7B%0A        selfUrl += %22#%22 + hash;%0A    %7D%0A    window.history.replaceState(%7B%7D, document.title, selfUrl);%0A
 %7D%0AsetInt
@@ -1117,20 +1117,16 @@
 al(check
-Size
 , 100);%0A
@@ -1134,12 +1134,8 @@
 heck
-Size
 ();%0A

Change hash while scrolling