File tree Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change 1919 </button>
2020{{end}}
2121{{if not (and $.DisableHTTP $.DisableSSH)}}
22- <script defer>
23- const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh';
24- const sshButton = document.getElementById('repo-clone-ssh');
25- const httpsButton = document.getElementById('repo-clone-https');
26- const input = document.getElementById('repo-clone-url');
27- if (input) input.value = (isSSH ? sshButton : httpsButton).getAttribute('data-link');
28- if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary');
29- if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary');
30- setTimeout(() => {
31- if (sshButton) sshButton.classList.remove('no-transition');
32- if (httpsButton) httpsButton.classList.remove('no-transition');
33- }, 100);
22+ <script>
23+ <!-- /* eslint-disable */ -->
24+ window.config.pageData['repoCloneButtons']= {httpsDisabled: {{$.DisableHTTP}}};
25+ </script>
26+ <script>
27+ (() => {
28+ const tmplData = window.config.pageData.repoCloneButtons;
29+ const isSSH = tmplData.httpsDisabled || localStorage.getItem('repo-clone-protocol') === 'ssh';
30+ const sshButton = document.getElementById('repo-clone-ssh');
31+ const httpsButton = document.getElementById('repo-clone-https');
32+ const input = document.getElementById('repo-clone-url');
33+ if (input) input.value = (isSSH ? sshButton : httpsButton).getAttribute('data-link');
34+ if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary');
35+ if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary');
36+ setTimeout(() => {
37+ if (sshButton) sshButton.classList.remove('no-transition');
38+ if (httpsButton) httpsButton.classList.remove('no-transition');
39+ }, 100);
40+ })();
3441 </script>
3542{{end}}
You can’t perform that action at this time.
0 commit comments