Gitee 优化

10101010

目前为 2021-01-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Gitee 优化
// @icon         https://gitee.com/assets/favicon.ico
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  10101010
// @author       Bubble
// @match        *://*gitee.com/*
// @grant        none
// ==/UserScript==

;(function() {
  'use strict';
  const hiddenList = [
    document.querySelector('.udesk-icon-item'),
    document.querySelector("#git-header-nav > div > div.right.menu.userbar > div.item.text"),
    document.querySelector("#git-nav-user-bar > div.ent-guide-helper-button"),
  ]
  hiddenList.forEach(item=>{
    if(item){
      item.style.display = 'none'
    }
  })
  // 改变导航栏背景色
  addNewStyle('#git-header-nav{background:#03a9f4 !important;}')

  const headerIcons = document.querySelectorAll("#git-header-nav i")
  headerIcons.forEach(item=>{
    item.style.color = 'white'
  })
})()

function request(url, method, data){
  method = method || 'GET'
  data = data || {}
  return new Promise((resolve, reject)=>{
    fetch(url, {method, data}).then(res=>res.json()).then(res=>resolve(res)).catch(err=>reject(err))
  })
}

function addNewStyle(newStyle) {
  var styleElement = document.getElementById('bubble_styles_js');
  if (!styleElement) {
    styleElement = document.createElement('style');
    styleElement.type = 'text/css';
    styleElement.id = 'styles_js';
    document.getElementsByTagName('head')[0].appendChild(styleElement);
  }
  styleElement.appendChild(document.createTextNode(newStyle));
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址