This commit is contained in:
2025-06-27 11:24:28 +08:00
commit 470e9eee62
5 changed files with 587 additions and 0 deletions

235
LICENSE Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,62 @@
// ==UserScript==
// @name Outline背景颜色修改
// @namespace http://tampermonkey.net/
// @version 2025-05-16
// @description
// @author ClanEver
// @match https://outline.eimsound.com/*
// @icon https://minio.eimsound.com/outline/public/d4335404-a074-4741-a98c-05f7b4f013bd/4b90f268-826c-420f-80a9-34cad76922c5/Icon-1024.png
// @updateURL https://dev.eimsound.com/-/snippets/8/raw/main/bg.outline.eimsound.user.js
// @downloadURL https://dev.eimsound.com/-/snippets/8/raw/main/bg.outline.eimsound.user.js
// @grant GM_registerMenuCommand
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
const need_change_css_selector = [
'.heading-actions', // h1, h2, ...前的#
'.byXfdg', // header
'.cENRKu', // body
'.VYaRH', // 标题
'.fTNybC', // 大纲
'.gAJGaK', // body
'.hzusXH', // tab
'.jyiNkt', // list
'.eSXWfi', // tab
'.grkcCz', // list
]
const need_change_css_str = need_change_css_selector.join(',')
const DEFAULT_COLOR = '#f7f8fa';
function getColor() {
return GM_getValue('bgColor', DEFAULT_COLOR);
}
function setColor(color) {
GM_setValue('bgColor', color);
}
// 注册菜单命令
GM_registerMenuCommand('设置背景颜色', () => {
const current = getColor();
const newColor = prompt('请输入新的背景颜色(如 #ffffff 或 red', current);
if (newColor) {
setColor(newColor);
}
});
const style = document.createElement('style');
style.innerHTML = `
${need_change_css_str} {
background-color: ${getColor()} !important;
}
`;
document.documentElement.appendChild(style);
//window.addEventListener('load', () => {
// document.head.appendChild(style);
//});
})();

2
README.md Normal file
View File

@@ -0,0 +1,2 @@
# public-snippets

View File

@@ -0,0 +1,135 @@
// ==UserScript==
// @name auth.eimsound自动登录
// @namespace http://tampermonkey.net/
// @version 1.0.9
// @description no desc
// @author ClanEver
// @match https://auth.eimsound.com/*
// @match https://outline.eimsound.com
// @match https://outline.eimsound.com/*
// @match https://chat.eimsound.com
// @match https://chat.eimsound.com/*
// @match https://chat2.eimsound.com
// @match https://chat2.eimsound.com/*
// @icon https://auth.eimsound.com/static/dist/assets/icons/icon.png
// @updateURL https://dev.eimsound.com/-/snippets/5/raw/main/auto.auth.eimsound.user.js
// @downloadURL https://dev.eimsound.com/-/snippets/5/raw/main/auto.auth.eimsound.user.js
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// ==/UserScript==
(function () {
'use strict';
// Your code here...
let items = ["Github", "Google", "QQ", "None"];
let menus = [];
function fresh_menu() {
for (let i of menus) {
GM_unregisterMenuCommand(i);
}
menus = [];
let login_target = GM_getValue('login_target', 'None');
for (let i of items) {
let name = i;
if (login_target == name) name = `` + i;
const menu_command = GM_registerMenuCommand(name, function (event) {
GM_setValue("login_target", i);
fresh_menu();
});
menus.push(menu_command);
}
}
fresh_menu();
const value_map = {
"Github": "Github",
"Google": "google",
"QQ": "qq",
"None": "None",
};
// auth 登录
if (location.href.includes(`auth.eimsound.com/if/flow/default-authentication-flow`)) {
const interval_1 = setInterval(() => {
let login_target = value_map[GM_getValue('login_target', 'None')];
if (login_target == 'None') return
var btn = document.querySelector('ak-flow-executor').shadowRoot.
querySelector("ak-locale-context").
querySelector('ak-stage-identification').shadowRoot.
querySelector(`img[alt="${login_target}"]`).parentNode.parentNode;
if (btn) {
btn.click();
clearInterval(interval_1);
}
}, 500);
}
// auth 继续
if (location.href.includes(`auth.eimsound.com/if/flow`)) {
const interval_3 = setInterval(() => {
var btns = document.querySelectorAll('ak-flow-executor').shadowRoot.
querySelector("ak-locale-context").
querySelector('ak-stage-consent').shadowRoot.
querySelectors(`button`);
for (let btn of btns) {
if (btn.textContent.includes('继续') || btn.textContent.includes('Continue')) {
btn.click();
clearInterval(interval_3);
}
}
}, 500);
}
// outline 登录
if (location.href.includes(`outline.eimsound.com`)) {
const interval_2 = setInterval(() => {
try {
var h2 = document.querySelector('h2');
if (h2.textContent.includes('登录到 EIM Notes') || h2.textContent.includes('Login to EIM Notes')) {
var btns = document.querySelectorAll('button');
for (let btn of btns) {
if (btn.textContent.includes('OpenID')) {
btn.click();
clearInterval(interval_2);
}
}
}
} catch (err) { }
}, 500);
}
// LiberChat 登录
if (location.href.includes(`chat.eimsound.com`)) {
const interval_4 = setInterval(() => {
if (location.href.includes(`login`)) {
var btns = document.querySelectorAll('a');
for (let btn of btns) {
if (btn.textContent.includes('Authtik')) {
btn.click();
clearInterval(interval_4);
}
}
}
}, 500);
}
// Open Webui 登录
if (location.href.includes(`chat2.eimsound.com`)) {
const interval_5 = setInterval(() => {
if (location.href.includes(`auth`)) {
var btns = document.querySelectorAll('button');
for (let btn of btns) {
if (btn.textContent.includes('Authentik')) {
btn.click();
clearInterval(interval_5);
}
}
}
}, 500);
}
})();

View File

@@ -0,0 +1,153 @@
.enum : Enumerate value
ANY → enumerate($expr$)
.reversed : Reverse iterable
ANY → reversed($expr$)
.sort : Sort iterable
ANY → sorted($expr$)$END$
.sortk : Sort iterable with key
ANY → sorted($expr$, key=$key$)$END$
.sortl : Sort iterable with lambda key
ANY → sorted($expr$, key=lambda o: $key$)$END$
.open : Open a path
ANY → with open($expr$) as f:\
$END$
.openm : Open a path with mode
ANY → with open($expr$, mode='$mode$') as f:\
$END$
.openp : Open a Path object
ANY → with closing($expr$.open()) as f:\
$END$
.for : Iterate through an object
ANY → for $var$ in $expr$:\
$END$
.fori : Iterate through an object
ANY → for i, $var$ in enumerate($expr$):\
$END$
.try : Wrap with try except
ANY → try:\
$expr$\
except $error$ as $error_var$:\
$END$
.tryf : Wrap with try except and finally
ANY → try:\
$expr$\
except $error$ as $error_var$:\
$except$\
finally:\
$END$
.bytes : Cast to bytes
ANY → bytes($expr$)$END$
.str : Cast to str
ANY → str($expr$)$END$
.float : Cast to float
ANY → float($expr$)$END$
.int : Cast to int
ANY → int($expr$)$END$
.set : Wrap with set
ANY → set($expr$)$END$
#.frozenset : Wrap with frozenset
# ANY → frozenset($expr$)$END$
.list : Wrap with list
ANY → list($expr$)$END$
.dict : Wrap with dict
ANY → dict($expr$)$END$
.tuple : Wrap with tuple
ANY → tuple($expr$)$END$
.next : Retrieve the next item from the iterator
ANY → next($expr$)$END$
.iter : Return an iterator object
ANY → iter($expr$)$END$
.min : Return the minimal
ANY → min($expr$)$END$
.max : Return the maximal
ANY → max($expr$)$END$
.abs : Return the absolute value
ANY → abs($expr$)$END$
.pri : print iter
ANY → for i in $expr$:\
print(i)
.prid : dict print iter
ANY → for k, v in $expr$.items():\
print(k, v)
.b : par but to bracket start
ANY → $END$($expr$)
.comp : comprehension
ANY → ($i$ for i in $expr$)
.compif : comprehension with if
ANY → ($i$ for i in $expr$ if $condition$)
.lcomp : list comprehension
ANY → [$i$ for i in $expr$]
.lcompif : list comprehension with if
ANY → [$i$ for i in $expr$ if $condition$]
.dcomp : dict comprehension
ANY → {$i$: $j$ for $i$, $j$ in $expr$}
.dcompif : dict comprehension with if
ANY → {$i$: $j$ for $i$, $j$ in $expr$ if $condition$}
.join : str join iter
ANY → "$sep$".join($expr$)
.ford : iterate k, v for dict
ANY → for $key$, $val$ in $expr$.items():\
$END$
.nextif : find first val in iter
ANY → next((x for x in $expr$ if x$condition$), None)
.repa : django request.query_params.get("param")
ANY → $expr$ = request.query_params.get("$expr$$END$")
.jsonl: json.loads
ANY → json.loads($expr$)
.jsond: json.dumps
ANY → json.dumps($expr$)
.len: len(expr)
ANY → len($expr$)
.round : round($expr$)
ANY → round($expr$)
.dfiter : pandas.Datafream.iterrows()
ANY → for i, row in $expr$.iterrows():
.pdna : pandas.isna()
ANY → pd.isna($expr$)
.resplit : re.split()
ANY → re.split(r'[\n\t, ]+', $expr$)