소스 검색

Merge pull request #10535 from meshulam/docs-filter-fix

Docs: Don't fire hashchange event when typing in filter query
Mr.doob 8 년 전
부모
커밋
da9f5a68e4
2개의 변경된 파일4개의 추가작업 그리고 8개의 파일을 삭제
  1. 2 5
      docs/index.html
  2. 2 3
      examples/index.html

+ 2 - 5
docs/index.html

@@ -249,7 +249,6 @@
 			var MEMBER_DELIMITER = '.';
 			var nameCategoryMap = {};
 			var sections = [];
-			var selected = null;
 
 			var content = document.getElementById( 'content' );
 
@@ -339,11 +338,10 @@
 
 				var v = filterInput.value;
 				if( v !== '' ) {
-					window.history.replaceState( {} , '', '?q=' + v );
+					window.history.replaceState( {} , '', '?q=' + v + window.location.hash );
 				} else {
-					window.history.replaceState( {} , '', window.location.pathname );
+					window.history.replaceState( {} , '', window.location.pathname + window.location.hash );
 				}
-				if( selected ) window.location.hash = selected;
 
 				var exp = new RegExp( filterInput.value, 'gi' );
 				for( var j in nameCategoryMap ) {
@@ -400,7 +398,6 @@
 
 				var title = 'three.js - documentation - ' + section + ' - ' + name;
 				var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name) + (!!member ? MEMBER_DELIMITER + encodeUrl(member) : '');
-				selected = url;
 
 				window.location.hash = url;
 				window.document.title = title;

+ 2 - 3
examples/index.html

@@ -379,11 +379,10 @@
 
 			var v = filterInput.value;
 			if( v !== '' ) {
-				window.history.replaceState( {} , '', '?q=' + v );
+				window.history.replaceState( {} , '', '?q=' + v + window.location.hash );
 			} else {
-				window.history.replaceState( {} , '', window.location.pathname );
+				window.history.replaceState( {} , '', window.location.pathname + window.location.hash );
 			}
-			if( selected ) window.location.hash = selected;
 
 			var exp = new RegExp( v, 'gi' );