You've already forked comprehensive-rust
							
							
				mirror of
				https://github.com/google/comprehensive-rust.git
				synced 2025-10-31 16:47:50 +02:00 
			
		
		
		
	Update mdbook to version 0.4.35 (#1302)
				
					
				
			This also ports over the latest changes to `book.js` and `index.hbs`. We probably need to come up with a more systematic way of doing this, e.g., we could store our changes in a patch and automatically attempt to apply it onto the latest upstream files.
This commit is contained in:
		
							
								
								
									
										47
									
								
								third_party/mdbook/book.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								third_party/mdbook/book.js
									
									
									
									
										vendored
									
									
								
							| @@ -468,7 +468,7 @@ function playground_text(playground, hidden = true) { | ||||
| })(); | ||||
|  | ||||
| (function sidebar() { | ||||
|     var html = document.querySelector("html"); | ||||
|     var body = document.querySelector("body"); | ||||
|     var sidebar = document.getElementById("sidebar"); | ||||
|     var sidebarLinks = document.querySelectorAll('#sidebar a'); | ||||
|     var sidebarToggleButton = document.getElementById("sidebar-toggle"); | ||||
| @@ -476,8 +476,8 @@ function playground_text(playground, hidden = true) { | ||||
|     var firstContact = null; | ||||
|  | ||||
|     function showSidebar() { | ||||
|         html.classList.remove('sidebar-hidden') | ||||
|         html.classList.add('sidebar-visible'); | ||||
|         body.classList.remove('sidebar-hidden') | ||||
|         body.classList.add('sidebar-visible'); | ||||
|         Array.from(sidebarLinks).forEach(function (link) { | ||||
|             link.setAttribute('tabIndex', 0); | ||||
|         }); | ||||
| @@ -498,8 +498,8 @@ function playground_text(playground, hidden = true) { | ||||
|     }); | ||||
|  | ||||
|     function hideSidebar() { | ||||
|         html.classList.remove('sidebar-visible') | ||||
|         html.classList.add('sidebar-hidden'); | ||||
|         body.classList.remove('sidebar-visible') | ||||
|         body.classList.add('sidebar-hidden'); | ||||
|         Array.from(sidebarLinks).forEach(function (link) { | ||||
|             link.setAttribute('tabIndex', -1); | ||||
|         }); | ||||
| @@ -510,14 +510,14 @@ function playground_text(playground, hidden = true) { | ||||
|  | ||||
|     // Toggle sidebar | ||||
|     sidebarToggleButton.addEventListener('click', function sidebarToggle() { | ||||
|         if (html.classList.contains("sidebar-hidden")) { | ||||
|         if (body.classList.contains("sidebar-hidden")) { | ||||
|             var current_width = parseInt( | ||||
|                 document.documentElement.style.getPropertyValue('--sidebar-width'), 10); | ||||
|             if (current_width < 150) { | ||||
|                 document.documentElement.style.setProperty('--sidebar-width', '150px'); | ||||
|             } | ||||
|             showSidebar(); | ||||
|         } else if (html.classList.contains("sidebar-visible")) { | ||||
|         } else if (body.classList.contains("sidebar-visible")) { | ||||
|             hideSidebar(); | ||||
|         } else { | ||||
|             if (getComputedStyle(sidebar)['transform'] === 'none') { | ||||
| @@ -533,14 +533,14 @@ function playground_text(playground, hidden = true) { | ||||
|     function initResize(e) { | ||||
|         window.addEventListener('mousemove', resize, false); | ||||
|         window.addEventListener('mouseup', stopResize, false); | ||||
|         html.classList.add('sidebar-resizing'); | ||||
|         body.classList.add('sidebar-resizing'); | ||||
|     } | ||||
|     function resize(e) { | ||||
|         var pos = (e.clientX - sidebar.offsetLeft); | ||||
|         if (pos < 20) { | ||||
|             hideSidebar(); | ||||
|         } else { | ||||
|             if (html.classList.contains("sidebar-hidden")) { | ||||
|             if (body.classList.contains("sidebar-hidden")) { | ||||
|                 showSidebar(); | ||||
|             } | ||||
|             pos = Math.min(pos, window.innerWidth - 100); | ||||
| @@ -549,7 +549,7 @@ function playground_text(playground, hidden = true) { | ||||
|     } | ||||
|     //on mouseup remove windows functions mousemove & mouseup | ||||
|     function stopResize(e) { | ||||
|         html.classList.remove('sidebar-resizing'); | ||||
|         body.classList.remove('sidebar-resizing'); | ||||
|         window.removeEventListener('mousemove', resize, false); | ||||
|         window.removeEventListener('mouseup', stopResize, false); | ||||
|     } | ||||
| @@ -584,20 +584,35 @@ function playground_text(playground, hidden = true) { | ||||
|     document.addEventListener('keydown', function (e) { | ||||
|         if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; } | ||||
|         if (window.search && window.search.hasFocus()) { return; } | ||||
|         var html = document.querySelector('html'); | ||||
|  | ||||
|         function next() { | ||||
|             var nextButton = document.querySelector('.nav-chapters.next'); | ||||
|             if (nextButton) { | ||||
|                 window.location.href = nextButton.href; | ||||
|             } | ||||
|         } | ||||
|         function prev() { | ||||
|             var previousButton = document.querySelector('.nav-chapters.previous'); | ||||
|             if (previousButton) { | ||||
|                 window.location.href = previousButton.href; | ||||
|             } | ||||
|         } | ||||
|         switch (e.key) { | ||||
|             case 'ArrowRight': | ||||
|                 e.preventDefault(); | ||||
|                 var nextButton = document.querySelector('.nav-chapters.next'); | ||||
|                 if (nextButton) { | ||||
|                     window.location.href = nextButton.href; | ||||
|                 if (html.dir == 'rtl') { | ||||
|                     prev(); | ||||
|                 } else { | ||||
|                     next(); | ||||
|                 } | ||||
|                 break; | ||||
|             case 'ArrowLeft': | ||||
|                 e.preventDefault(); | ||||
|                 var previousButton = document.querySelector('.nav-chapters.previous'); | ||||
|                 if (previousButton) { | ||||
|                     window.location.href = previousButton.href; | ||||
|                 if (html.dir == 'rtl') { | ||||
|                     next(); | ||||
|                 } else { | ||||
|                     prev(); | ||||
|                 } | ||||
|                 break; | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user