Greasemonkey
2023/04/04 07:56
2023/10/04 18:10
Greasemonkey に関するメモを集約するページ
Q&A
スクリプト作成に関する Q&A
特定のコンポーネントがレンダリングされるのを待ちたい
(async function() {
'use strict';
const sleep = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
var elements = undefined
while(true) {
const es = document.getElementsByTagName("Table")
if (!es) {
await sleep(1000)
continue
} else {
elements = es
break
}
}
// コンポーネントレンダリング後の処理を記述
...
})();
特定のパスだけで処理を行いたい
window.location.pathname; あたりを使って以下のように記述できる
(async function() {
'use strict';
const currentPath = window.location.pathname;
if (currentPath === "/path1") {
......
return
}
if (currentPath === "/path2") {
......
return
}
})();
ある要素をスクリプトから操作したい
なんらかの手段で要素を取得して .click() などでイベントを発生させればよい
// Example:
document.getElementsByTagName("button")[0].click()
スクリプトの設定に関する Q&A
マッチする FQDN や URL を複数設定したい
単に @match を複数個指定すればよいだけ
Pinned Articles
About
ウェブ界隈でエンジニアとして労働活動に励んでいる @gomi_ningen 個人のブログです
Tags
LLM
promptfoo
GenAI
JavaScript
PowerShell
fluentd
kibana
elasticsearch
nginx
村川梨衣
五十嵐裕美
イベント
logrotate
IoT
Scala
Java
ICMP
iputils
C言語
WUG
mastodon
Swift
AWS
Windows
Clock
PoEAA
アーキテクチャ
iOS
DeviceFarm
プログラミング言語
OS
StepFunctions
Lambda
Serverless
terraform
ポエム
RHEL
ネットワーク
GraphQL
CloudWatch
Linux
Coreutils
nc
network
telnet
LinuxKernel
fpinscala
ELB
IAM
AppSync