Fix copy button for apple silicon
This commit is contained in:
		
							parent
							
								
									eab82b5d63
								
							
						
					
					
						commit
						95c1c55f22
					
				
							
								
								
									
										12
									
								
								www/ghcup.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								www/ghcup.js
									
									
									
									
									
								
							| @ -149,7 +149,17 @@ function fill_in_bug_report_values() { | ||||
| } | ||||
| 
 | ||||
| function copyToClipboard() { | ||||
|   const text = document.getElementsByClassName("ghcup-command").item(0).innerText; | ||||
|   const text = document.getElementById("ghcup-command-normal").innerText; | ||||
|   const el = document.createElement('textarea'); | ||||
|   el.value = text; | ||||
|   document.body.appendChild(el); | ||||
|   el.select(); | ||||
|   document.execCommand('copy'); | ||||
|   document.body.removeChild(el); | ||||
| } | ||||
| 
 | ||||
| function copyToClipboardSilicon() { | ||||
|   const text = document.getElementById("ghcup-command-silicon").innerText; | ||||
|   const el = document.createElement('textarea'); | ||||
|   el.value = text; | ||||
|   document.body.appendChild(el); | ||||
|  | ||||
| @ -33,9 +33,9 @@ | ||||
|       <div id="platform-instructions-mac" class="instructions" style="display: none;"> | ||||
|         <p>Run the following in your terminal (as a user other than root), then follow the onscreen instructions.</p> | ||||
| 		<p>On Intel:</p> | ||||
| 		<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
| 		<div class="command-button"><pre><span class='ghcup-command' id="ghcup-command-normal">curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|         <p>On Apple Silicon:</p> | ||||
| 		<div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
| 		<div class="command-button"><pre><span class='ghcup-command' id="ghcup-command-silicon">curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboardSilicon()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|         <p class="other-help">If you don't like curl | sh, see <a href="https://gitlab.haskell.org/haskell/ghcup-hs#manual-install">other installation methods</a>.<br/>You appear to be running macOS. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p> | ||||
|       </div> | ||||
| 
 | ||||
| @ -108,7 +108,7 @@ | ||||
|           in your terminal (as a user other than root), then follow the onscreen instructions.</p> | ||||
| 		  <div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|           <p>For macOS on Apple Silicon, run this instead:</p> | ||||
|           <div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|           <div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboardSilicon()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|           <p class="other-help">If you don't like curl | sh, see <a href="https://gitlab.haskell.org/haskell/ghcup-hs#manual-install">other installation methods</a>.</p> | ||||
|         </div> | ||||
| 
 | ||||
| @ -155,7 +155,7 @@ | ||||
|           in your terminal (as a user other than root), then follow the onscreen instructions.</p> | ||||
| 		  <pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh</span></pre> | ||||
|           <p>For macOS on Apple Silicon, run this instead:</p> | ||||
|           <div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboard()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|           <div class="command-button"><pre><span class='ghcup-command'>curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -x86_64 /bin/bash</span></pre><button class="tooltip" onclick="copyToClipboardSilicon()"><img src="copy.svg" alt="" /><span class="tooltiptext">Copy to clipboard</span></button></div> | ||||
|           <p class="other-help">If you don't like curl | sh, see <a href="https://gitlab.haskell.org/haskell/ghcup-hs#manual-install">other installation methods</a>.</p> | ||||
|         </div> | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user