'; notify_content = null; notify_options = {}; alertTip = ''; $error_box = $(".flash_error.flash_error_box"); if (notify_options.type === 'error' && $error_box.length > 0 && !$.isEmptyObject(notify_content.message)) { if (notify_content.message === 'captcha_fail') { alertTip = "The captcha is incorrect"; } else if (notify_content.message === 'captcha_expired') { alertTip = "The captcha was expired, please refresh it"; } else if (notify_content.message === 'not_found_in_database') { alertTip = "Invalid email or password."; } else if (notify_content.message === 'not_found_and_show_captcha') { alertTip = "Invalid email or password."; } else if (notify_content.message === 'phone_captcha_fail') { alertTip = "The phone captcha is incorrect"; } else { alertTip = notify_content.message; } return $error_box.html(alertTip).show(); } else if (notify_content) { if ("show" === 'third_party_binding') { return $('#third_party_binding-message').html(notify_content.message).addClass('ui message red'); } notify_options.delay = 3000; notify_options.template = template; notify_options.offset = { x: 10, y: 30 }; notify_options.element = '#messages-container'; return $.notify(notify_content, notify_options); } }); }).call(this);
1 Star 21 Fork 2

NFSL2001/CJK-character-count

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
`   $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); if(branch.branch_type.value === 1) { var rule = filterXSS(branch.protection_rule.wildcard); protectRule = ` ` } html += `
${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 < 11) { debounceLoadMore.call(); } }); var debounceLoadMore = window.globalUtils.debouce(function () { if (flag_is_loading) return; flag_page_number += 1; if (flag_page_number > 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
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

The content may contain violation information

MIT License Copyright © 2020-2023 NFSL2001 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

branch: ".concat(htmlSafe(branch), "

path: ").concat(htmlSafe(readonly_item), " Confirm the readonly flag of this path on the cancel branch?\n "); gitGCModal.confirm("Cancel readonly", confirmString, function() { var parentsReadonly = isParentsReadonly(readonly_item) if (parentsReadonly) { return gitGCModal.alert('Prompt', 'Readonly record does not exist, or parent directory is readonly',function () { location.reload() }) } $.ajax({ url: "/NightFurySL2001/CJK-character-count/readonly", type: 'DELETE', data: { branch: branch, path: readonly_item }, success: function(res) { if (res.code !== 0) { gitGCModal.alert("Prompt", res.msg, function() { location.reload(); }) }else { $parent.removeClass('readonly-item') if (gon.readonlyItems) { gon.readonlyItems.splice(gon.readonlyItems.indexOf(readonly_item), 1) } if (type === 'file') { $icon.removeClass('icon-file-readonly readonly-icon') $icon.addClass('icon-file') } else { $icon.removeClass('icon-folder-readonly readonly-icon') $icon.addClass('icon-folders') } $icon.popup('destroy') $item.removeAttr('data-readonly') location.reload(); } } }) }) } // 只读过滤 function isTreeItemReadonly(path, readonlyItems) { var item = readonlyItems.find(function(item) { if (item.slice(-1) === '/') { return path.indexOf(item) === INDEX_BEGIN_WITH_READONLY_DIR } else { return path === item } }) return item !== undefined } function getItemPath(path) { var path_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'file'; return path_type === 'file' ? path : "".concat(path, "/"); } // 启用异步只读差异化的次数 var is_can_readonly = false // 异步对文件树进行只读差异化显示 function markTree() { $.ajax({ url: "/NightFurySL2001/CJK-character-count/readonly", method: 'get', data: { "branch": "master" }, success:function(result) { var readonlyItems = result.readonly_items gon.readonlyItems = readonlyItems $(".tree-list-item").each(function(){ $this = $(this) var path = $this.attr('data-path') var type = $this.attr('data-type') var item_path = getItemPath(path, type) var readonly = isTreeItemReadonly(item_path, readonlyItems) $icon = $this.find('i') $parent = $this.parent('.tree-item') if (readonly) { $parent.addClass('readonly-item') $this.attr('data-readonly', '') $icon.attr('class', "iconfont icon-".concat(type, "-readonly readonly-icon")); $icon.attr('data-readonly', '') $icon.popup({ content: "Readonly", className : { popup: 'ui popup dark', }, position: 'top center' }) } else { var className = type === 'file' ? 'file' : 'folders' $this.removeAttr('data-readonly') $icon.attr('class', "iconfont icon-".concat(className)); $icon.removeAttr('data-readonly') } }) } }) } // 若已开启只读功能,对目录进行只读差异化标记 if (is_can_readonly) { markTree() } // 添加只读标记 function addReadonlyMark(path, $item) { var $icon = $($item.context.children[0]) var $parent = $item.parent('.tree-item') var type = $parent.data('type') var branch = $parent.data('branch') var readonly_item = $item.data('path') if (type !== 'file') { readonly_item += "/" } var confirmString = "\n

branch: ".concat(htmlSafe(branch), "

path: ").concat(htmlSafe(readonly_item), " Confirm that this path on the branch is marked as readonly?\n "); gitGCModal.confirm("Mark readonly", confirmString,function (){ $.ajax({ url: "/NightFurySL2001/CJK-character-count/readonly", type: 'POST', data: { branch: branch, path: readonly_item, }, success: function(res) { if (res.code !== 0) { gitGCModal.alert("Prompt", res.msg,function (){ location.reload(); }) } else { // 之前未开启只读功能 if (!is_can_readonly) { is_can_readonly = true return markTree() } $parent.addClass('readonly-item') var existReadonlyItems = gon.readonlyItems || [] existReadonlyItems.push(readonly_item) gon.readonlyItems = existReadonlyItems $icon.popup({ content: "Readonly", className : { popup: 'ui popup dark', }, position: 'top center' }) if (type === 'file') { $icon.removeClass('icon-file') $icon.addClass('icon-file-readonly readonly-icon') } else { $icon.removeClass('icon-folders') $icon.addClass('icon-folder-readonly readonly-icon') } $item.attr('data-readonly', '') location.reload(); } } }) }) } function removeFile(path, file_name) { var file_name = file_name || path var content = "Are you sure to delete %{name} ?".replace('%{name}', htmlSafe(file_name)); gitGCModal.confirm("Remove", content, function() { $.ajax({ type: "DELETE", dataType: "JSON", url: "/NightFurySL2001/CJK-character-count/delete/" + path, success: function(res) { if (res.status != 1) { var alert_message = res.message || "Failed to delete" return gitGCModal.alert("Prompt", alert_message) } if ($('.tree-item-file-name').length == 2) { window.location.href = '/' + gon.user_project; if(file_name.toUpperCase()==='LICENSE'){ window.location.reload(); } } else { window.location.href = window.location.pathname; if(file_name.toUpperCase()==='LICENSE'){ window.location.reload(); } } } }); }) } // 删除子模块 function removeSubmodule(deleteUrl, $item) { if (!deleteUrl) return var file_name = $item.text().trim() var content = "This operation can not be recovered, Are you sure to delete submodule %{name} ?".replace('%{name}', htmlSafe(file_name)); new GiteeModalHelper({ approveText: "Delete and submit push", cancelText: "Cancel", okText: "Delete and submit push", }).confirm("Remove", content, function() { $.ajax({ type: "DELETE", dataType: "JSON", url: deleteUrl, success: function(res) { if (res.status == 200) { $item.closest('.row.tree-item').remove(); window.location.reload(); } else { Flash.error(res.message, 5000) } }, error: function (err) { err.responseJSON && Flash.error(err.responseJSON.message); }, }); }) } function rename(file_hex) { $(".row.tree-item").show(); $(".tree-item-rename").hide(); if($("."+file_hex).is(':hidden') == true) return; $("."+file_hex).hide(); var _t = $(".rename-"+file_hex); src = _t.attr('src_text') if(src==undefined){ newName = _t.find("[name='new_filename']").val() _t.attr('src_text',newName) }else{ _t.find("[name='new_filename']").val(_t.attr('src_text')) } $(".rename-"+file_hex).css("display",""); } setTimeout(function(){ $(".popup-save").click(function(){ form = $(this).parents(".ui.form") file_hex = $(this).parents(".row.tree-item").attr("file_hex"); new_filename = $.trim(form.find("[name='new_filename']").val()) overwrite = false $('.tree-item-file-name').find('a').each(function(a){ title = $(this).attr('title'); if(title != undefined){ if (title.split('/')[0] == new_filename) { overwrite = true; } } }); if(overwrite){ form.find("[name='new_filename']").focus(); gitGCModal.alert("Prompt", "The same file name exists, please modify and try again") return; } $.ajax({ type: 'POST', url: "/NightFurySL2001/CJK-character-count/rename/"+ form.attr('path').replace(/\+/g, '%20'), data: { new_filename: new_filename }, success: function(o){ if(o.status == 1){ href = window.location.href.split('?')[0] window.location.href = href; }else { var alert_message = o.message || "Rename failed" gitGCModal.alert("Prompt", alert_message) } }, dataType: "json" }); }) $(".popup-close").click(function(){ $(".row.tree-item").show(); $(".tree-item-rename").hide(); }) $('.tree-item-file-name, .tree-item-submodule-name').each(function() { var $this = $(this); if (typeof $this.parent().attr('file_hex') === 'undefined') { return; } $this.on('contextmenu', function(event) { event.preventDefault(); createContextMenu($this, event.pageX, event.pageY); }) }) },1000) })

"; } $complainCommentType.find('.menu').html(result); } }); $complainCommentType.dropdown({showOnFocus: false}); initedCommentsType = true; } } $complainCommentType.on('click', function() { $complaintCommentsModal.modal({ autofocus: false, onApprove: function() { return false; }, onHidden: function() { restoreCommonentDefault(); } }).modal('show'); }); $complaintCommentsContent.on('change keyup', function(e) { var content = $(this).val(); if ($.trim(content).length > 0 && $complainCommentType.dropdown('get value').length > 0 ) { $complaintCommentBtn.removeClass('disabled'); return; } $complaintCommentBtn.addClass('disabled'); }); $complainCommentType.dropdown({ showOnFocus: false, onChange: function(value, text, $selectedItem) { if (value.length > 0 && $.trim($complaintCommentsContent.val()).length > 0) { $complaintCommentBtn.removeClass('disabled'); return } $complaintCommentBtn.addClass('disabled'); } }); function restoreCommonentDefault() { $complainCommentType.dropdown('restore defaults'); $complaintCommentsContent.val(''); $('.exceeded-size-tip').text('').hide(); $complaintModalTip.text('').hide(); setTimeout(function() { setCommentSendTip(false); }, 1500); } $complaintCommentBtn.on('click',function(e){ var reason = $complaintCommentsContent.val(); var appealableId = $('#landing-comments-complaint-modal').attr('data-id'); if (complaintSending) { return; } var appealType = $complainCommentType.dropdown('get value'); var formData = new FormData(); formData.append('appeal_type_id', appealType); formData.append('reason', reason); formData.append('appeal_type','Note'); formData.append('target_id',appealableId); $.ajax({ type: 'POST', url: "/appeals", cache: false, contentType: false, processData: false, data: formData, beforeSend: function() { setCommentSendStatus(true); }, success: function(res) { if (res.status == 200) { setCommentSendTip(true); setTimeout(function() { $complaintCommentsModal.modal('hide'); restoreCommonentDefault(); }, 3000); } setCommentSendStatus(false); }, error: function(err) { showCommonTips(err.responseJSON.message, 'error'); setCommentSendStatus(false); } }) }); function showCommonTips(text, type) { $complaintModalTip.text(text).show(); if (type == 'error') { $complaintModalTip.removeClass('success').addClass('error'); } else { $complaintModalTip.removeClass('error').addClass('success'); } } function setCommentSendStatus(value) { complaintSending = value; if (complaintSending) { $complaintCommentBtn.addClass('loading'); $complaintCommentsContent.attr('readonly', true); $complainCommentType.attr('readonly', true); } else { $complaintCommentBtn.removeClass('loading'); $complaintCommentsContent.attr('readonly', false); $complainCommentType.attr('readonly', false); } } function setCommentSendTip(value) { if (value) { $('.appeal-success-tip').removeClass('hide'); $('.appeal-tip').addClass('hide'); $('.appeal-form').addClass('hide'); $('#landing-comments-complaint-modal .actions').addClass('hide'); } else { $('.appeal-success-tip').addClass('hide'); $('.appeal-tip').removeClass('hide'); $('.appeal-form').removeClass('hide'); $('#landing-comments-complaint-modal .actions').removeClass('hide'); } }

About

No description expand collapse
Python and 2 more languages
MIT
Cancel

Contributors

All

Activities

Load More
can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/NightFurySL2001/CJK-character-count.git
[email protected]:NightFurySL2001/CJK-character-count.git
NightFurySL2001
CJK-character-count
CJK-character-count
master