diff options
author | L0veSunshine <xuan199651@gmail.com> | 2020-05-19 01:44:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 12:44:39 -0500 |
commit | eb8abffcc1be777d38a416a030a6e4f42b06ac25 (patch) | |
tree | 5cd0a999941527969d4c600b3c7896bca0838b44 /web_src/js | |
parent | 6b798feaf6bb59ba32273d13755a11d3dcefaddc (diff) | |
download | gitea-eb8abffcc1be777d38a416a030a6e4f42b06ac25.tar.gz gitea-eb8abffcc1be777d38a416a030a6e4f42b06ac25.zip |
Make localstorage read ssh or https correctly (#11483)
* Make localstorage read ssh or https correctly
* Update index.js
If not login there is only a "https" button, This commit fix the "https" button hasn't blue border.
* Keep user selected whether or not to log in
* Update index.js
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/index.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index f7b4ef24d8..b808812372 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1109,8 +1109,10 @@ async function initRepository() { $('.clone-url').text($(this).data('link')); $('#repo-clone-url').val($(this).data('link')); $(this).addClass('blue'); - $('#repo-clone-ssh').removeClass('blue'); - localStorage.setItem('repo-clone-protocol', 'https'); + if ($('#repo-clone-ssh').length > 0) { + $('#repo-clone-ssh').removeClass('blue'); + localStorage.setItem('repo-clone-protocol', 'https'); + } }); $('#repo-clone-url').on('click', function () { $(this).select(); @@ -2436,7 +2438,9 @@ $(document).ready(async () => { if ($('#repo-clone-url').length > 0) { switch (localStorage.getItem('repo-clone-protocol')) { case 'ssh': - if ($('#repo-clone-ssh').length === 0) { + if ($('#repo-clone-ssh').length > 0) { + $('#repo-clone-ssh').trigger('click'); + } else { $('#repo-clone-https').trigger('click'); } break; |