-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto-accept.js
30 lines (28 loc) · 1.05 KB
/
auto-accept.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { htmlToElement } from "./utils";
// AUTO ACCEPT FEATURE
export const initSettingAutoAccept = () => {
const checkbox = htmlToElement(`
<div class="auto-accept-checkbox">
<lol-uikit-flat-checkbox class="checked">
<input id="autoAccept" name="autoAccept" type="checkbox" class="ember-checkbox">
<label slot="label">Auto Accept</label>
</lol-uikit-flat-checkbox>
</div>`);
const listMenu = document.querySelector(
"div.lol-social-lower-pane-container > lol-social-roster > lol-uikit-scrollable > div.list-content"
);
listMenu.insertBefore(checkbox, listMenu.firstChild);
const checkboxInput = document.querySelector("#autoAccept");
const checked = DataStore.get("autoAcceptMode");
checkboxInput.checked = checked;
checkboxInput.addEventListener("change", () => {
// Check if the checkbox is checked
if (checkboxInput.checked) {
console.log("checked");
DataStore.set("autoAcceptMode", true);
} else {
console.log("un checked");
DataStore.set("autoAcceptMode", false);
}
});
};