diff --git a/assets/js/replace_history.js b/assets/js/replace_history.js deleted file mode 100644 index c7dfa1ca..00000000 --- a/assets/js/replace_history.js +++ /dev/null @@ -1,36 +0,0 @@ -$(window).scroll(function(){ - const scroll_top = $(this).scrollTop(); // scroll + free margin - - // create anchoer list - const anchor_list = $(".drawer-menu-item").map((index, section)=>{ - const href = $(section).attr("href"); - if(href && href.indexOf("#") == 0) return href; - else null; - }); - - // check anchor positions - const positions = anchor_list.map((index, anchor)=>{ - if(!anchor) return -Infinity; - return $(anchor).offset().top - scroll_top - $(window).height()/2; // offset from screen org - }); - - // get large position's index in negative positions - let max_pos = -Infinity; - let max_index = -1; - for(i = 0; i < positions.length; i++){ - if(max_index == i) continue; // nothing to do - if(positions[i] < 0){ // in negative potition - if(positions[i] > max_pos){ // find large - max_pos = positions[i]; - max_index = i; - } - } - } - - // change history from scroll - if(max_index == -1){ - history.replaceState(null, null, "#"); - }else{ - history.replaceState(null, null, anchor_list[max_index]); - } -}); \ No newline at end of file diff --git a/index.html b/index.html index 68bd1214..97b14ca3 100644 --- a/index.html +++ b/index.html @@ -649,10 +649,5 @@

src="./assets/preact_build/polyfill.js" > -