forked from NYANDEV/forgejo
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:
parent
d59b8541f2
commit
b702f2dac3
1 changed files with 10 additions and 7 deletions
|
@ -50,14 +50,17 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||||
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script defer>
|
<script>
|
||||||
/* eslint-disable no-undef */
|
(() => {
|
||||||
const cloneUrls = document.getElementsByClassName('clone-url');
|
const proto = localStorage.getItem('repo-clone-protocol') || 'https';
|
||||||
if (cloneUrls) {
|
const btn = document.getElementById(`repo-clone-${proto}`) || document.getElementById(`repo-clone-https`) || document.getElementById(`repo-clone-ssh`);
|
||||||
for (let i = 0; i < cloneUrls.length; i++) {
|
if (btn) {
|
||||||
cloneUrls[i].textContent = (isSSH ? sshButton : httpsButton).getAttribute('data-link');
|
const cloneUrls = document.getElementsByClassName('clone-url');
|
||||||
|
for (let i = 0; i < cloneUrls.length; i++) {
|
||||||
|
cloneUrls[i].textContent = btn.getAttribute('data-link');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
Loading…
Reference in a new issue