File tree 1 file changed +19
-12
lines changed
1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change 19
19
</button>
20
20
{{end}}
21
21
{{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
+ })();
34
41
</script>
35
42
{{end}}
You can’t perform that action at this time.
0 commit comments