-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_min.js
More file actions
1 lines (1 loc) · 2.04 KB
/
Copy pathcode_min.js
File metadata and controls
1 lines (1 loc) · 2.04 KB
1
(function(i,d,q,k){var m=[];var l=0;var o=[];function e(z){o[z][q]="section";if(z){o[z-1][q]=k}if((z+1)<o.length){o[z+1][q]=k}}var p=0;var n=-1;var w=32;var v=128;var h=256;function x(B){if(B){for(var z=(o.length-1);z>=0;z--){if((o[z].yy-p)<v){if(z==n){return}if(z==(o.length-1)){b(o.length)}e(z);console.log(m[z]+" is visible");if(n>=0){i.history.pushState("","Title",m[z])}n=z;l=t();return}}}else{if(n<=0||!l){return}var A=o[n];if((A.yy-p)>(l-h)){n--;e(n);console.log(m[n]+" is visible");i.history.pushState("","Title",m[n])}}}function g(){if(Math.abs(pageYOffset-p)<w){return}x((pageYOffset-p)>0);p=pageYOffset}function y(){var A;for(var z=o.length-1;z>=0;z--){A=j(o[z]);if(A==o[z].yy){return}o[z].yy=A}}function r(z){if(o.length<=m.length){console.log(m[o.length]+": "+z+", will be skipped");m.splice(o.length,1);b(o.length)}}function c(B,A,C){if(B.readyState==4&&(B.response||B.responseText)){var z=B.response||B.responseText;if(z.indexOf("<meta")==-1||(B.status&&B.status>=400)){r(B.statusText);return}A.innerHTML=z;C()}}function f(z,A,C){var B=new XMLHttpRequest();if(B.readyState==4||B.readyState==0){B.open("GET",z,true);B.onreadystatechange=function(){c(B,A,C)};B.send(null)}}function u(){var A=d.createElement("div");A.className=k;var z=d.createElement("div");z.className="inner";A.appendChild(z);return z}function a(z){o.push(z);d.body.appendChild(z);z.yy=j(z);x(true)}function t(){if(i.innerHeight){return i.innerHeight}if(d.body&&d.body.clientHeight){return d.body.clientHeight}if(d.documentElement&&d.documentElement.clientHeight){return d.documentElement.clientHeight}var z=d.createElement("div");z.style.position="fixed";z.style.right="0px";z.style.bottom="0px";d.body.appendChild(z);var A=j(z);z.parentNode.removeChild(z);return A}function j(z){var B=z.offsetParent||d.body;var A=z.offsetTop;while(B){A+=B.offsetTop;B=B.offsetParent}return A}function b(z){if(z>=m.length){return}var A=u();f(m[z]+"/",A,function(){a(A.parentNode)})}function s(){m=arguments.callee.arguments;b(0);d.body.onscroll=g;setInterval(y,3456)}i.init=s})(window,document,"className","boring_grey");