diff --git a/src/pages/ContentScripts/features/colorful-calendar/index.scss b/src/pages/ContentScripts/features/colorful-calendar/index.scss deleted file mode 100644 index daad3949..00000000 --- a/src/pages/ContentScripts/features/colorful-calendar/index.scss +++ /dev/null @@ -1,19 +0,0 @@ -.ant-color-picker-trigger { - min-width: 10px !important; - padding: 0 !important; - margin-right: 4px; - border: none !important; -} - -.ant-color-picker-color-block { - width: 10px !important; - min-width: 10px !important; - height: 10px !important; -} - -.ant-color-picker-color-block-inner { - width: 10px !important; - min-width: 10px !important; - height: 10px !important; - border-radius: 3px !important; -} diff --git a/src/pages/ContentScripts/features/colorful-calendar/index.tsx b/src/pages/ContentScripts/features/colorful-calendar/index.tsx deleted file mode 100644 index 50707821..00000000 --- a/src/pages/ContentScripts/features/colorful-calendar/index.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import features from '../../../../feature-manager'; -import waitFor from '../../../../helpers/wait-for'; - -import React from 'react'; -import { render } from 'react-dom'; -import { ColorPicker } from 'antd'; -import $ from 'jquery'; -import * as pageDetect from 'github-url-detection'; - -import './index.scss'; // 需要引入自定义的样式来覆盖antd ColorPicker的默认样式,后面展开说明 - -const featureId = features.getFeatureID(import.meta.url); - -// const CALENDAR_LEVEL_COLORS = [ -// '#ebedf0', -// '#ffedf9', -// '#ffc3eb', -// '#ff3ebf', -// '#c70085', -// ]; -// -// const changeLevelColor = (level: number, color: string) => { -// const root = document.documentElement; -// if (level === 0) { -// root.style.setProperty(`--color-calendar-graph-day-bg`, color); -// } else { -// root.style.setProperty(`--color-calendar-graph-day-L${level}-bg`, color); -// } -// }; - -let colors = ['#ebedf0', '#ffedf9', '#ffc3eb', '#ff3ebf', '#c70085']; - -const changeLevelColor = async (level: number, color: string) => { - const root = document.documentElement; - if (level === 0) { - root.style.setProperty(`--color-calendar-graph-day-bg`, color); - } else { - root.style.setProperty(`--color-calendar-graph-day-L${level}-bg`, color); - } - // Save to storage - const newColors = [...colors]; - newColors[level] = color; - await chrome.storage.local.set({ - calendar_level_colors: newColors, - }); -}; - -const replaceLegendToColorPicker = async ( - level: number, - defaultColor: string -) => { - const legendSelector = `#contribution-graph-legend-level-${level}`; // 选择器selector是用于定位DOM元素的字符串 - await waitFor(() => $(legendSelector).length > 0); // init函数运行的时候,页面中某些元素不一定已经加载完毕,经过测试,日历图加载时机比较靠后,因此需要waitFor一下,不然后面的操作都是无用的 - const $legend = $(legendSelector); - const container = $('
'); - render( -