monkey
This commit is contained in:
parent
4b3439a757
commit
057a3e634f
8
cw
8
cw
|
|
@ -51,8 +51,8 @@ get_orientation_img() {
|
||||||
# Получить вертикальную обоину
|
# Получить вертикальную обоину
|
||||||
get_vertical_wall() {
|
get_vertical_wall() {
|
||||||
while true; do
|
while true; do
|
||||||
img=$(get_path_img)
|
local img=$(get_path_img)
|
||||||
orientation=$(get_orientation_img $img)
|
local orientation=$(get_orientation_img $img)
|
||||||
[[ $orientation -eq 'vertical' ]] && { printf $img; break ; }
|
[[ $orientation -eq 'vertical' ]] && { printf $img; break ; }
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +60,8 @@ get_vertical_wall() {
|
||||||
# Получить горизонтальную обоину
|
# Получить горизонтальную обоину
|
||||||
get_horizontal_wall() {
|
get_horizontal_wall() {
|
||||||
while true; do
|
while true; do
|
||||||
img=$(get_path_img)
|
local img=$(get_path_img)
|
||||||
orientation=$(get_orientation_img $img)
|
local orientation=$(get_orientation_img $img)
|
||||||
[[ $orientation -eq 'horizontal' ]] && { printf $img; break ; }
|
[[ $orientation -eq 'horizontal' ]] && { printf $img; break ; }
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name TabName_in_ZephyrPlayer
|
||||||
|
// @namespace Violentmonkey Scripts
|
||||||
|
// @match https://jira.astralinux.ru/secure/Tests.jspa*
|
||||||
|
// @grant none
|
||||||
|
// @version 1.0
|
||||||
|
// @author -
|
||||||
|
// @description 17.09.2025, 17:12:31
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
// Ожидание элемента -- искомый элемент находится в h2.title
|
||||||
|
function waitForElm(selector) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
return resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
|
||||||
|
const observer = new MutationObserver(mutations => {
|
||||||
|
if (document.querySelector(selector)) {
|
||||||
|
observer.disconnect();
|
||||||
|
resolve(document.querySelector(selector));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ждём и немного логируем
|
||||||
|
waitForElm("h2").then((elm) => {
|
||||||
|
console.log("Element is ready");
|
||||||
|
console.log(elm.title);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
// Включаем наблюдателя по доке MutationObserver
|
||||||
|
var mutationObserver = new MutationObserver(function(mutations) {
|
||||||
|
mutations.forEach(function(mutation) {
|
||||||
|
|
||||||
|
// Трындец какой костыль. Но иначе я не смог
|
||||||
|
if (mutation.type === 'attributes') {
|
||||||
|
const element = mutation.target;
|
||||||
|
const attributeName = mutation.attributeName;
|
||||||
|
const oldValue = mutation.oldValue;
|
||||||
|
const newValue = element.getAttribute(attributeName);
|
||||||
|
|
||||||
|
if (attributeName === 'title' && element.tagName === 'H2' ) {
|
||||||
|
document.title = newValue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Наблюдаем за различными параметрами. Пытался определить какой именно нужный, чтобы меньше отслижвать - всё ломалось, поэтому отслеживаю всё.
|
||||||
|
mutationObserver.observe(document.documentElement, {
|
||||||
|
attributes: true,
|
||||||
|
characterData: true,
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
attributeOldValue: true,
|
||||||
|
characterDataOldValue: true
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue