mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 07:12:26 -05:00 
			
		
		
		
	[frogend/bugfix] fix dynamicSpoiler elements (#1771)
This commit is contained in:
		
					parent
					
						
							
								b315aa10c8
							
						
					
				
			
			
				commit
				
					
						66df974143
					
				
			
		
					 2 changed files with 17 additions and 19 deletions
				
			
		|  | @ -104,31 +104,29 @@ function dynamicSpoiler(className, updateFunc) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| dynamicSpoiler("text-spoiler", (spoiler) => { | dynamicSpoiler("text-spoiler", (spoiler) => { | ||||||
| 	const button = spoiler.querySelector("button"); | 	const button = spoiler.querySelector(".button"); | ||||||
| 
 | 
 | ||||||
| 	if (button != undefined) { |  | ||||||
| 	return () => { | 	return () => { | ||||||
| 		button.textContent = spoiler.open | 		button.textContent = spoiler.open | ||||||
| 			? "Show less" | 			? "Show less" | ||||||
| 			: "Show more"; | 			: "Show more"; | ||||||
| 	}; | 	}; | ||||||
| 	} |  | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| dynamicSpoiler("video-spoiler", (spoiler) => { | dynamicSpoiler("media-spoiler", (spoiler) => { | ||||||
| 	const video = spoiler.querySelector(".plyr-video"); |  | ||||||
| 	const eye = spoiler.querySelector(".eye.button"); | 	const eye = spoiler.querySelector(".eye.button"); | ||||||
|  | 	const video = spoiler.querySelector(".plyr-video"); | ||||||
| 
 | 
 | ||||||
| 	if (video != undefined) { |  | ||||||
| 	return () => { | 	return () => { | ||||||
| 		if (spoiler.open) { | 		if (spoiler.open) { | ||||||
| 			eye.setAttribute("aria-label", "Hide media"); | 			eye.setAttribute("aria-label", "Hide media"); | ||||||
| 		} else { | 		} else { | ||||||
| 			eye.setAttribute("aria-label", "Show media"); | 			eye.setAttribute("aria-label", "Show media"); | ||||||
|  | 			if (video) { | ||||||
| 				video.pause(); | 				video.pause(); | ||||||
| 			} | 			} | ||||||
| 		}; |  | ||||||
| 		} | 		} | ||||||
|  | 	}; | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => { | Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => { | ||||||
|  |  | ||||||
|  | @ -55,7 +55,7 @@ | ||||||
| 		{{range $index, $media := .}} | 		{{range $index, $media := .}} | ||||||
| 		{{with $media}} | 		{{with $media}} | ||||||
| 		<div class="media-wrapper"> | 		<div class="media-wrapper"> | ||||||
| 			<details class="{{.Type}}-spoiler" {{if not $.Sensitive}}open{{end}}> | 			<details class="{{.Type}}-spoiler media-spoiler" {{if not $.Sensitive}}open{{end}}> | ||||||
| 				<summary> | 				<summary> | ||||||
| 					<div class="show sensitive button" aria-hidden="true"> | 					<div class="show sensitive button" aria-hidden="true"> | ||||||
| 						Show sensitive media | 						Show sensitive media | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue