Greasy Fork is available in English.

github界面优化

github

// ==UserScript==
// @name         github界面优化
// @description  github
// @namespace    gt_hb
// @version      1.0.1
// @author       vizo
// @require      https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js
// @include      *github.com*
// @run-at       document-start
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @noframes

// ==/UserScript==


GM_addStyle(`
  #backtop_act_hgr5 {
    width: 30px;
    height: 30px;
    background: rgba(0,0,0,.2);
    cursor: pointer;
    border-radius: 55%;
    position: fixed;
    right: 40px;
    bottom: 80px;
    z-index: 9998;
  }
  .t-center .container-xl,
  .t-center .js-repo-nav,
  .t-center .pagehead,
  .t-center .Header-item--full,
  .t-center main > .hide-full-screen > .d-flex {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .js-repo-nav {
    position: relative;
  }
  .qh_bj {
    width: 68px;
    cursor: pointer;
  }
`)

$(function() {
  const backTopSlow = () => {
    const sTop = document.documentElement.scrollTop
    const innerFunc = () => {
      if (document.documentElement.scrollTop > 0) {
        document.documentElement.scrollTop -= sTop / 20
        requestAnimationFrame(innerFunc)
      }
    }
    innerFunc()
  }
  
  $('body').append('<div id="backtop_act_hgr5"></div>')
  $('body').addClass('t-center')
  
  $('.Header-item--full.width-full').after(`<div class="Header-item qh_bj">切换布局</div>`)
  $('body').on('click', '#backtop_act_hgr5', function() {
    backTopSlow()
  })
  
  $('body').on('click', '.qh_bj', function() {
    $('body').toggleClass('t-center')
  })
})