Skip to content

Commit 31dc0cb

Browse files
committed
document.querySelector should be called directly
1 parent fadc291 commit 31dc0cb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

GitHub One Monokai/Resources/Script.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
function show(enabled: any, useSettingsInsteadOfPreferences: boolean) {
22
if (useSettingsInsteadOfPreferences) {
3-
let querySelector = document.querySelector;
4-
5-
querySelector<HTMLElement>(".state-on").innerText =
6-
"Status: Enabled";
7-
querySelector<HTMLElement>(".state-off").innerText =
8-
"Status: Disabled";
9-
querySelector<HTMLElement>(".state-unknown").innerText =
3+
document.querySelector(".state-on").textContent = "Status: Enabled";
4+
document.querySelector(".state-off").textContent = "Status: Disabled";
5+
document.querySelector(".state-unknown").textContent =
106
"You can turn on GitHub One Monokai’s extension in the Extensions section of Safari Settings.";
11-
querySelector<HTMLElement>(".open-preferences").innerText =
7+
document.querySelector(".open-preferences").textContent =
128
"Open in Safari Settings…";
13-
149
}
1510

1611
if (typeof enabled === "boolean") {

GitHub One Monokai/ViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ class ViewController: NSViewController, WKNavigationDelegate, WKScriptMessageHan
4747
return
4848
}
4949

50-
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { _ in
50+
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
51+
guard error == nil else {
52+
debugPrint("Something went wrong: \(error!.localizedDescription)")
53+
return
54+
}
55+
5156
DispatchQueue.main.async {
5257
NSApplication.shared.terminate(nil)
5358
}

0 commit comments

Comments
 (0)