Spaces:
Running
Running
Upload 3 files
Browse files- bin_public/config/CustomCSS.css +209 -0
- bin_public/config/Kelpy-Codos.js +76 -0
- bin_public/config/custom.js +1 -0
bin_public/config/CustomCSS.css
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
:root {
|
2 |
+
--chatbot-color-light: #F3F3F3;
|
3 |
+
--chatbot-color-dark: #121111;
|
4 |
+
}
|
5 |
+
|
6 |
+
/* 覆盖gradio的页脚信息QAQ */
|
7 |
+
footer {
|
8 |
+
display: none !important;
|
9 |
+
}
|
10 |
+
#footer{
|
11 |
+
text-align: center;
|
12 |
+
}
|
13 |
+
#footer div{
|
14 |
+
display: inline-block;
|
15 |
+
}
|
16 |
+
#footer .versions{
|
17 |
+
font-size: 85%;
|
18 |
+
opacity: 0.85;
|
19 |
+
}
|
20 |
+
|
21 |
+
/* status_display */
|
22 |
+
#status_display {
|
23 |
+
display: flex;
|
24 |
+
min-height: 2.5em;
|
25 |
+
align-items: flex-end;
|
26 |
+
justify-content: flex-end;
|
27 |
+
}
|
28 |
+
#status_display p {
|
29 |
+
font-size: .85em;
|
30 |
+
font-family: monospace;
|
31 |
+
color: var(--body-text-color-subdued);
|
32 |
+
}
|
33 |
+
|
34 |
+
#chuanhu_chatbot, #status_display {
|
35 |
+
transition: all 0.6s;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* usage_display */
|
39 |
+
#usage_display {
|
40 |
+
position: relative;
|
41 |
+
margin: 0;
|
42 |
+
box-shadow: var(--block-shadow);
|
43 |
+
border-width: var(--block-border-width);
|
44 |
+
border-color: var(--block-border-color);
|
45 |
+
border-radius: var(--block-radius);
|
46 |
+
background: var(--block-background-fill);
|
47 |
+
width: 100%;
|
48 |
+
line-height: var(--line-sm);
|
49 |
+
min-height: 2em;
|
50 |
+
}
|
51 |
+
#usage_display p, #usage_display span {
|
52 |
+
margin: 0;
|
53 |
+
padding: .5em 1em;
|
54 |
+
font-size: .85em;
|
55 |
+
color: var(--body-text-color-subdued);
|
56 |
+
}
|
57 |
+
.progress-bar {
|
58 |
+
background-color: var(--input-background-fill);;
|
59 |
+
margin: 0 1em;
|
60 |
+
height: 20px;
|
61 |
+
border-radius: 10px;
|
62 |
+
overflow: hidden;
|
63 |
+
}
|
64 |
+
.progress {
|
65 |
+
background-color: var(--block-title-background-fill);;
|
66 |
+
height: 100%;
|
67 |
+
border-radius: 10px;
|
68 |
+
text-align: right;
|
69 |
+
transition: width 0.5s ease-in-out;
|
70 |
+
}
|
71 |
+
.progress-text {
|
72 |
+
/* color: white; */
|
73 |
+
color: var(--color-accent) !important;
|
74 |
+
font-size: 1em !important;
|
75 |
+
font-weight: bold;
|
76 |
+
padding-right: 10px;
|
77 |
+
line-height: 20px;
|
78 |
+
}
|
79 |
+
/* list */
|
80 |
+
ol:not(.options), ul:not(.options) {
|
81 |
+
padding-inline-start: 2em !important;
|
82 |
+
}
|
83 |
+
|
84 |
+
/* 对话气泡 */
|
85 |
+
[class *= "message"] {
|
86 |
+
border-radius: var(--radius-xl) !important;
|
87 |
+
border: none;
|
88 |
+
padding: var(--spacing-xl) !important;
|
89 |
+
font-size: var(--text-md) !important;
|
90 |
+
line-height: var(--line-md) !important;
|
91 |
+
min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
|
92 |
+
min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
|
93 |
+
}
|
94 |
+
[data-testid = "bot"] {
|
95 |
+
max-width: 85%;
|
96 |
+
border-bottom-left-radius: 0 !important;
|
97 |
+
}
|
98 |
+
[data-testid = "user"] {
|
99 |
+
max-width: 85%;
|
100 |
+
width: auto !important;
|
101 |
+
border-bottom-right-radius: 0 !important;
|
102 |
+
}
|
103 |
+
/* 表格 */
|
104 |
+
table {
|
105 |
+
margin: 1em 0;
|
106 |
+
border-collapse: collapse;
|
107 |
+
empty-cells: show;
|
108 |
+
}
|
109 |
+
td,th {
|
110 |
+
border: 1.2px solid var(--border-color-primary) !important;
|
111 |
+
padding: 0.2em;
|
112 |
+
}
|
113 |
+
thead {
|
114 |
+
background-color: rgba(175,184,193,0.2);
|
115 |
+
}
|
116 |
+
thead th {
|
117 |
+
padding: .5em .2em;
|
118 |
+
}
|
119 |
+
/* 行内代码 */
|
120 |
+
code {
|
121 |
+
display: inline;
|
122 |
+
white-space: break-spaces;
|
123 |
+
border-radius: 6px;
|
124 |
+
margin: 0 2px 0 2px;
|
125 |
+
padding: .2em .4em .1em .4em;
|
126 |
+
background-color: rgba(175,184,193,0.2);
|
127 |
+
}
|
128 |
+
/* 代码块 */
|
129 |
+
pre code {
|
130 |
+
display: block;
|
131 |
+
overflow: auto;
|
132 |
+
white-space: pre;
|
133 |
+
background-color: hsla(0, 0%, 0%, 80%)!important;
|
134 |
+
border-radius: 10px;
|
135 |
+
padding: 1.4em 1.2em 0em 1.4em;
|
136 |
+
margin: 1.2em 2em 1.2em 0.5em;
|
137 |
+
color: #FFF;
|
138 |
+
box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2);
|
139 |
+
}
|
140 |
+
/* 代码高亮样式 */
|
141 |
+
.highlight .hll { background-color: #49483e }
|
142 |
+
.highlight .c { color: #75715e } /* Comment */
|
143 |
+
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
|
144 |
+
.highlight .k { color: #66d9ef } /* Keyword */
|
145 |
+
.highlight .l { color: #ae81ff } /* Literal */
|
146 |
+
.highlight .n { color: #f8f8f2 } /* Name */
|
147 |
+
.highlight .o { color: #f92672 } /* Operator */
|
148 |
+
.highlight .p { color: #f8f8f2 } /* Punctuation */
|
149 |
+
.highlight .ch { color: #75715e } /* Comment.Hashbang */
|
150 |
+
.highlight .cm { color: #75715e } /* Comment.Multiline */
|
151 |
+
.highlight .cp { color: #75715e } /* Comment.Preproc */
|
152 |
+
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
|
153 |
+
.highlight .c1 { color: #75715e } /* Comment.Single */
|
154 |
+
.highlight .cs { color: #75715e } /* Comment.Special */
|
155 |
+
.highlight .gd { color: #f92672 } /* Generic.Deleted */
|
156 |
+
.highlight .ge { font-style: italic } /* Generic.Emph */
|
157 |
+
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
|
158 |
+
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
159 |
+
.highlight .gu { color: #75715e } /* Generic.Subheading */
|
160 |
+
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
|
161 |
+
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
|
162 |
+
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
|
163 |
+
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
|
164 |
+
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
|
165 |
+
.highlight .kt { color: #66d9ef } /* Keyword.Type */
|
166 |
+
.highlight .ld { color: #e6db74 } /* Literal.Date */
|
167 |
+
.highlight .m { color: #ae81ff } /* Literal.Number */
|
168 |
+
.highlight .s { color: #e6db74 } /* Literal.String */
|
169 |
+
.highlight .na { color: #a6e22e } /* Name.Attribute */
|
170 |
+
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
|
171 |
+
.highlight .nc { color: #a6e22e } /* Name.Class */
|
172 |
+
.highlight .no { color: #66d9ef } /* Name.Constant */
|
173 |
+
.highlight .nd { color: #a6e22e } /* Name.Decorator */
|
174 |
+
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
|
175 |
+
.highlight .ne { color: #a6e22e } /* Name.Exception */
|
176 |
+
.highlight .nf { color: #a6e22e } /* Name.Function */
|
177 |
+
.highlight .nl { color: #f8f8f2 } /* Name.Label */
|
178 |
+
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
|
179 |
+
.highlight .nx { color: #a6e22e } /* Name.Other */
|
180 |
+
.highlight .py { color: #f8f8f2 } /* Name.Property */
|
181 |
+
.highlight .nt { color: #f92672 } /* Name.Tag */
|
182 |
+
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
|
183 |
+
.highlight .ow { color: #f92672 } /* Operator.Word */
|
184 |
+
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
|
185 |
+
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
|
186 |
+
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
|
187 |
+
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
|
188 |
+
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
|
189 |
+
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
|
190 |
+
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
|
191 |
+
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
|
192 |
+
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
|
193 |
+
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
|
194 |
+
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
|
195 |
+
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
|
196 |
+
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
|
197 |
+
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
|
198 |
+
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
|
199 |
+
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
|
200 |
+
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
|
201 |
+
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
|
202 |
+
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
|
203 |
+
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
|
204 |
+
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
|
205 |
+
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
|
206 |
+
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
|
207 |
+
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
|
208 |
+
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
|
209 |
+
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
|
bin_public/config/Kelpy-Codos.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// ==UserScript==
|
2 |
+
// @name Kelpy Codos
|
3 |
+
// @namespace https://github.com/Keldos-Li/Kelpy-Codos
|
4 |
+
// @version 1.0.5
|
5 |
+
// @author Keldos; https://keldos.me/
|
6 |
+
// @description Add copy button to PRE tags before CODE tag, for Chuanhu ChatGPT especially.
|
7 |
+
// Based on Chuanhu ChatGPT version: ac04408 (2023-3-22)
|
8 |
+
// @license GPL-3.0
|
9 |
+
// @grant none
|
10 |
+
// ==/UserScript==
|
11 |
+
|
12 |
+
(function () {
|
13 |
+
'use strict';
|
14 |
+
|
15 |
+
function addCopyButton(pre) {
|
16 |
+
var code = pre.querySelector('code');
|
17 |
+
if (!code) {
|
18 |
+
return; // 如果没有找到 <code> 元素,则不添加按钮
|
19 |
+
}
|
20 |
+
var firstChild = code.firstChild;
|
21 |
+
if (!firstChild) {
|
22 |
+
return; // 如果 <code> 元素没有子节点,则不添加按钮
|
23 |
+
}
|
24 |
+
var button = document.createElement('button');
|
25 |
+
button.textContent = '\uD83D\uDCCE'; // 使用 📎 符号作为“复制”按钮的文本
|
26 |
+
button.style.position = 'relative';
|
27 |
+
button.style.float = 'right';
|
28 |
+
button.style.fontSize = '1em'; // 可选:调整按钮大小
|
29 |
+
button.style.background = 'none'; // 可选:去掉背景颜色
|
30 |
+
button.style.border = 'none'; // 可选:去掉边框
|
31 |
+
button.style.cursor = 'pointer'; // 可选:显示指针样式
|
32 |
+
button.addEventListener('click', function () {
|
33 |
+
var range = document.createRange();
|
34 |
+
range.selectNodeContents(code);
|
35 |
+
range.setStartBefore(firstChild); // 将范围设置为第一个子节点之前
|
36 |
+
var selection = window.getSelection();
|
37 |
+
selection.removeAllRanges();
|
38 |
+
selection.addRange(range);
|
39 |
+
|
40 |
+
try {
|
41 |
+
var success = document.execCommand('copy');
|
42 |
+
if (success) {
|
43 |
+
button.textContent = '\u2714';
|
44 |
+
setTimeout(function () {
|
45 |
+
button.textContent = '\uD83D\uDCCE'; // 恢复按钮为“复制”
|
46 |
+
}, 2000);
|
47 |
+
} else {
|
48 |
+
button.textContent = '\u2716';
|
49 |
+
}
|
50 |
+
} catch (e) {
|
51 |
+
console.error(e);
|
52 |
+
button.textContent = '\u2716';
|
53 |
+
}
|
54 |
+
|
55 |
+
selection.removeAllRanges();
|
56 |
+
});
|
57 |
+
code.insertBefore(button, firstChild); // 将按钮插入到第一个子元素之前
|
58 |
+
}
|
59 |
+
|
60 |
+
function handleNewElements(mutationsList, observer) {
|
61 |
+
for (var mutation of mutationsList) {
|
62 |
+
if (mutation.type === 'childList') {
|
63 |
+
for (var node of mutation.addedNodes) {
|
64 |
+
if (node.nodeName === 'PRE') {
|
65 |
+
addCopyButton(node);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
var observer = new MutationObserver(handleNewElements);
|
73 |
+
observer.observe(document.documentElement, { childList: true, subtree: true });
|
74 |
+
|
75 |
+
document.querySelectorAll('pre').forEach(addCopyButton);
|
76 |
+
})();
|
bin_public/config/custom.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
// custom javascript here
|