Skip to content

Commit eb8abff

Browse files
authored
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
1 parent 6b798fe commit eb8abff

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

web_src/js/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,10 @@ async function initRepository() {
11091109
$('.clone-url').text($(this).data('link'));
11101110
$('#repo-clone-url').val($(this).data('link'));
11111111
$(this).addClass('blue');
1112-
$('#repo-clone-ssh').removeClass('blue');
1113-
localStorage.setItem('repo-clone-protocol', 'https');
1112+
if ($('#repo-clone-ssh').length > 0) {
1113+
$('#repo-clone-ssh').removeClass('blue');
1114+
localStorage.setItem('repo-clone-protocol', 'https');
1115+
}
11141116
});
11151117
$('#repo-clone-url').on('click', function () {
11161118
$(this).select();
@@ -2436,7 +2438,9 @@ $(document).ready(async () => {
24362438
if ($('#repo-clone-url').length > 0) {
24372439
switch (localStorage.getItem('repo-clone-protocol')) {
24382440
case 'ssh':
2439-
if ($('#repo-clone-ssh').length === 0) {
2441+
if ($('#repo-clone-ssh').length > 0) {
2442+
$('#repo-clone-ssh').trigger('click');
2443+
} else {
24402444
$('#repo-clone-https').trigger('click');
24412445
}
24422446
break;

0 commit comments

Comments
 (0)