`
 $popPanel.append(no_data_html)
}
var debounceLoadMoreBranches = window.globalUtils.debouce(function () {
if (concurrentRequestLock) return;
branch_page_number += 1;
if (branch_page_number > branch_total_pager) return;
loadData(search_text, branch_page_number);
}, 350);
function loadData(search, page) {
if (concurrentRequestLock) { return; }
concurrentRequestLock = true;
var searchParams = search || "";
var pageParams = page || 1;
$.ajax({
url: "/" + gon.user_project + "/branches/names.json",
type: 'GET',
data: {
search: searchParams,
page: pageParams,
},
dataType: 'json',
success: function (data) {
branch_total_pager = data.total_pages;
var html = '';
if (pageParams === 1) {
$branchesDropdown.empty();
}
data.branches.forEach(function (branch) {
var protectRule = '';
var branchName = filterXSS(branch.name);
var icon = 'gitee:branch'
if(branch.branch_type.value === 1) {
var rule = filterXSS(branch.protection_rule.wildcard);
protectRule = ``
icon ='gitee:pen-lock'
}else if(branch.branch_type.value === 2) {
icon ='gitee:pen-ban'
}
var branchIcon = `
`
html += `
${branchIcon}
${branchName} ${protectRule}
`
});
$branchesDropdown.append(html);
$('.protected-branch-popup').popup()
if (pageParams === 1 && data.count === 0) {
toggleNoResultView($branchesDropdown);
}
},
complete: function () {
concurrentRequestLock = false;
}
});
}
$tagsDropdown.scroll(function() {
var tagsPanel = document.getElementById('tags_panel');
var numOfTags = $tagsDropdown.children().length;
if (tagsPanel.clientHeight + tagsPanel.scrollTop + 37 > tagsPanel.scrollHeight && numOfTags flag_total_pager) return;
fetchTags(search_text, flag_page_number);
}, 350);
function fetchTags(search, page) {
var searchParams = search || "";
var pageParams = page || 1;
if (flag_is_loading) return;
flag_is_loading = true;
$.ajax({
url: "/" + gon.user_project + "/tags/names.json",
data: {
search: searchParams,
page: pageParams,
},
type: "GET",
xhrFields: {
withCredentials: true,
},
success: function (data) {
flag_total_pager = data.total_pages;
if (pageParams === 1) {
$tagsDropdown.html('');
}
data.tags.forEach((tag) => {
const itemDiv = document.createElement('div');
itemDiv.classList.add('item');
itemDiv.setAttribute('data-value', tag.name);
itemDiv.innerText = window.filterXSS(tag.name);
$tagsDropdown.append(itemDiv)
});
if (pageParams === 1 && data.count === 0) {
toggleNoResultView($tagsDropdown);
}
},
error: function () {
},
complete: function () {
flag_is_loading = false;
},
});
}
$('.project-branch-tab-menu').on('click','.tab-menu-item', function (e) {
var $currentTab = $(this).data('tab')
if($currentTab === 'branches') {
$searchNameInput.val('')
search_text = '';
loadData()
}
if($currentTab === 'tags') {
$searchNameInput.val('')
search_text = '';
fetchTags();
}
})
Clone or Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1
Generate RSA keys.
2
Obtain the content of the RSA public key and configure it in
SSH Public Keys
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends
configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
');
const offset = $(this).offset();
$wrapper.css({
position: 'absolute',
top: offset.top,
left: offset.left,
marginTop: '1rem',
zIndex: 1000
});
if (this.loaded) return;
// destroy prev dropdown
document.querySelectorAll('.ui.dropdown[data-prev-dropdown]').forEach(function(el) {
el.parentNode.removeChild(el);
});
const $menu = $(this).find('.menu');
$menu.css({
display: 'block',
border: '1px solid rgba(34,36,38,0.15)',
borderRadius: '4px',
boxShadow: '0px 2px 3px 0px rgba(34, 36, 38, 0.15)'
});
// ç§»å¨å° body
$wrapper.append($menu);
$wrapper.appendTo('body');
$wrapper.attr('data-prev-dropdown', '');
this.$menuWrapper = $wrapper;
this.loaded = true;
}
});
})();
$('#git-project-root-actions #git-tree-file').on('click', function() {
$('#git-project-root-actions .plus-box').addClass('click-active')
$('#git-project-root-actions .repo-dropdown-box').addClass('transition visible')
})
$('.disabled-upload-readonly').popup({
content: "Readonly directory does not allow uploading files",
className: {
popup: 'ui popup',
},
position: 'bottom center',
})
$('.disabled-create-folder').popup({
content: "Readonly directory does not allow directory creation",
className: {
popup: 'ui popup',
},
position: 'bottom center',
})
$('.disabled-create-file').popup({
content: "Readonly directory does not allow files creation",
className: {
popup: 'ui popup',
},
position: 'bottom center',
})
$('.disabled-create-submodule').popup({
content: "Readonly directory does not allow submodule creation",
className: {
popup: 'ui popup',
},
position: 'bottom center',
})
$('.disabled-upload-readonly, .disabled-create-folder, .disabled-create-file, .disabled-create-submodule').click(function() {
return false
})