Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.

Commit 8f4607b

Browse files
committed
fix: update to work with latest UI
1 parent 5c04464 commit 8f4607b

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

script.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let i = 0;
1+
var i = 0;
22
function setTwitter() {
33
loopOfSubmit();
44
}
@@ -13,16 +13,36 @@ function loopOfSubmit() {
1313
splitData = rawData.split("\n");
1414
}
1515
setTimeout(() => {
16-
document.querySelector(".MutedKeywordsActions-openDialogButton").click();
17-
let input = document.querySelector(".MutedKeywordsAddItemForm-input > .rich-editor");
18-
input.innerHTML = "<div>" + splitData[i].toString() + "<div>";
19-
let Btn = document.querySelector(".MutedKeywordsAddItemForm-button");
16+
let inputTwitrer = document.querySelector("input[name='keyword']");
17+
dispatchEventValue(inputTwitrer, splitData[i].toString());
18+
let Btn = document.querySelector("div[data-testid='settingsDetailSave']");
2019
setTimeout(() => {
2120
Btn.click();
2221
}, 500);
2322
i++;
23+
setTimeout(() => {
24+
document.querySelector("a[aria-label*='muted']").click();
25+
}, 1500);
2426
if (i < splitData.length) {
2527
loopOfSubmit();
2628
}
2729
}, 2000);
2830
}
31+
32+
/**
33+
* @method dispatchEventValue
34+
* @description dispatch event for react component
35+
* @param targetInput
36+
* @param value
37+
*/
38+
function dispatchEventValue(targetInput, value) {
39+
let input = targetInput;
40+
let lastValue = input.value;
41+
input.value = value;
42+
let event = new Event('input', { bubbles: true });
43+
let tracker = input._valueTracker;
44+
if (tracker) {
45+
tracker.setValue(lastValue);
46+
}
47+
input.dispatchEvent(event);
48+
}

0 commit comments

Comments
 (0)