mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Fix clone url JS error for the empty repo page (#19209)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		@@ -50,14 +50,17 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre>
 | 
			
		||||
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
 | 
			
		||||
								</div>
 | 
			
		||||
							</div>
 | 
			
		||||
							<script defer>
 | 
			
		||||
								/* eslint-disable no-undef */
 | 
			
		||||
								const cloneUrls = document.getElementsByClassName('clone-url');
 | 
			
		||||
								if (cloneUrls) {
 | 
			
		||||
									for (let i = 0; i < cloneUrls.length; i++) {
 | 
			
		||||
										cloneUrls[i].textContent = (isSSH ? sshButton : httpsButton).getAttribute('data-link');
 | 
			
		||||
							<script>
 | 
			
		||||
								(() => {
 | 
			
		||||
									const proto = localStorage.getItem('repo-clone-protocol') || 'https';
 | 
			
		||||
									const btn = document.getElementById(`repo-clone-${proto}`) || document.getElementById(`repo-clone-https`) || document.getElementById(`repo-clone-ssh`);
 | 
			
		||||
									if (btn) {
 | 
			
		||||
										const cloneUrls = document.getElementsByClassName('clone-url');
 | 
			
		||||
										for (let i = 0; i < cloneUrls.length; i++) {
 | 
			
		||||
											cloneUrls[i].textContent = btn.getAttribute('data-link');
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
								})();
 | 
			
		||||
							</script>
 | 
			
		||||
						{{end}}
 | 
			
		||||
					{{else}}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user