Fix #880: block / usage on all sites

This commit is contained in:
Oliver Blanthorn 2018-08-10 23:46:36 +01:00
parent 703a8ac611
commit 312dfedabe
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -190,25 +190,25 @@ config.getAsync("leavegithubalone").then(v => {
if (v == "true") return if (v == "true") return
try { try {
// On quick loading pages, the document is already loaded // On quick loading pages, the document is already loaded
if (document.location.host == "github.com") { // if (document.location.host == "github.com") {
document.body.addEventListener("keydown", function(e) { document.body.addEventListener("keydown", function(e) {
if ("/".indexOf(e.key) != -1) { if ("/".indexOf(e.key) != -1) {
e.cancelBubble = true e.cancelBubble = true
e.stopImmediatePropagation() e.stopImmediatePropagation()
} }
}) })
} // }
} catch (e) { } catch (e) {
// But on slower pages we wait for the document to load // But on slower pages we wait for the document to load
window.addEventListener("DOMContentLoaded", () => { window.addEventListener("DOMContentLoaded", () => {
if (document.location.host == "github.com") { // if (document.location.host == "github.com") {
document.body.addEventListener("keydown", function(e) { document.body.addEventListener("keydown", function(e) {
if ("/".indexOf(e.key) != -1) { if ("/".indexOf(e.key) != -1) {
e.cancelBubble = true e.cancelBubble = true
e.stopImmediatePropagation() e.stopImmediatePropagation()
} }
}) })
} // }
}) })
} }
}) })