同步操作将从 hiekay/GitCodeTree 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const GH_RESERVED_USER_NAMES = ['settings', 'orgs', 'organizations','site', 'blog', 'about', 'explore','styleguide', 'showcases', 'trending','stars', 'dashboard', 'notifications','search', 'developer', 'account','pulls', 'issues', 'features', 'contact','security', 'join', 'login', 'watching','new', 'integrations', 'gist', 'business','mirrors', 'open-source', 'personal','pricing']const GH_RESERVED_REPO_NAMES = ['followers', 'following', 'repositories']const GH_404_SEL = '#parallax_wrapper'const GH_PJAX_CONTAINER_SEL = '#js-repo-pjax-container, .context-loader-container, [data-pjax-container]'const GH_CONTAINERS = '.container, .container-responsive'const GH_RAW_CONTENT = 'body > pre'class GitHub extends PjaxAdapter {constructor() {super(['jquery.pjax.js'])}// @overrideinit($sidebar) {const pjaxContainer = $(GH_PJAX_CONTAINER_SEL)[0]super.init($sidebar, {'pjaxContainer': pjaxContainer})// Fix #151 by detecting when page layout is updated.// In this case, split-diff page has a wider layout, so need to recompute margin.// Note that couldn't do this in response to URL change, since new DOM via pjax might not be ready.const diffModeObserver = new window.MutationObserver((mutations) => {mutations.forEach((mutation) => {if (~mutation.oldValue.indexOf('split-diff') ||~mutation.target.className.indexOf('split-diff')) {return $(document).trigger(EVENT.LAYOUT_CHANGE)}})})diffModeObserver.observe(document.body, {attributes: true,attributeFilter: ['class'],attributeOldValue: true})}// @overridegetCssClass() {return 'octotree_github_sidebar'}// @overridecanLoadEntireTree() {return true}// @overridegetCreateTokenUrl() {return `${location.protocol}//${location.host}/settings/tokens/new`}// @overrideupdateLayout(togglerVisible, sidebarVisible, sidebarWidth) {const SPACING = 10const $containers = $(GH_CONTAINERS)const autoMarginLeft = ($(document).width() - $containers.width()) / 2const shouldPushLeft = sidebarVisible && (autoMarginLeft <= sidebarWidth + SPACING)$('html').css('margin-left', shouldPushLeft ? sidebarWidth : '')$containers.css('margin-left', shouldPushLeft ? SPACING : '')}// @overridegetRepoFromPath(showInNonCodePage, currentRepo, token, cb) {// 404 page, skipif ($(GH_404_SEL).length) {return cb()}// Skip raw pageif ($(GH_RAW_CONTENT).length) {return cb()}// (username)/(reponame)[/(type)]const match = window.location.pathname.match(/([^\/]+)\/([^\/]+)(?:\/([^\/]+))?/)if (!match) {return cb()}const username = match[1]const reponame = match[2]// Not a repository, skipif (~GH_RESERVED_USER_NAMES.indexOf(username) ||~GH_RESERVED_REPO_NAMES.indexOf(reponame)) {return cb()}// Skip non-code page unless showInNonCodePage is trueif (!showInNonCodePage && match[3] && !~['tree', 'blob'].indexOf(match[3])) {return cb()}// Get branch by inspecting page, quite fragile so provide multiple fallbacksconst branch =// Code page$('.branch-select-menu .select-menu-item.selected').data('name') ||// Pull requests page($('.commit-ref.base-ref').attr('title') || ':').match(/:(.*)/)[1] ||// Reuse last selected branch if exist(currentRepo.username === username && currentRepo.reponame === reponame && currentRepo.branch) ||// Get default branch from cachethis._defaultBranch[username + '/' + reponame]// Still no luck, get default branch for realconst repo = {username: username, reponame: reponame, branch: branch}if (repo.branch) {cb(null, repo)}else {this._get(null, {repo, token}, (err, data) => {if (err) return cb(err)repo.branch = this._defaultBranch[username + '/' + reponame] = data.default_branch || 'master'cb(null, repo)})}}// @overrideselectFile(path) {const $pjaxContainer = $(GH_PJAX_CONTAINER_SEL)super.selectFile(path, {'$pjaxContainer': $pjaxContainer})}// @overrideloadCodeTree(opts, cb) {opts.encodedBranch = encodeURIComponent(decodeURIComponent(opts.repo.branch))opts.path = (opts.node && (opts.node.sha || opts.encodedBranch)) ||(opts.encodedBranch + '?recursive=1')this._loadCodeTree(opts, null, cb)}// @override_getTree(path, opts, cb) {this._get(`/git/trees/${path}`, opts, (err, res) => {if (err) cb(err)else cb(null, res.tree)})}// @override_getSubmodules(tree, opts, cb) {const item = tree.filter((item) => /^\.gitmodules$/i.test(item.path))[0]if (!item) return cb()this._get(`/git/blobs/${item.sha}`, opts, (err, res) => {if (err) return cb(err)const data = atob(res.content.replace(/\n/g,''))cb(null, parseGitmodules(data))})}_get(path, opts, cb) {const host = location.protocol + '//' +(location.host === 'github.com' ? 'api.github.com' : (location.host + '/api/v3'))const url = `${host}/repos/${opts.repo.username}/${opts.repo.reponame}${path || ''}`const cfg = { url, method: 'GET', cache: false }if (opts.token) {cfg.headers = { Authorization: 'token ' + opts.token }}$.ajax(cfg).done((data) => {if (path && path.indexOf('/git/trees') === 0 && data.truncated) {this._handleError({status: 206}, cb)}else cb(null, data)}).fail((jqXHR) => this._handleError(jqXHR, cb))}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。