Skip to content

Commit acf4e9d

Browse files
committed
Custom-navigation: Fix JS error
1 parent 4d690a9 commit acf4e9d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

github-custom-navigation.user.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name GitHub Custom Navigation
3-
// @version 1.1.9
3+
// @version 1.1.10
44
// @description A userscript that allows you to customize GitHub's main navigation bar
55
// @license MIT
66
// @author Rob Garrison
@@ -592,7 +592,7 @@
592592
indx = els.length;
593593
while (indx--) {
594594
item = els[indx].getAttribute("data-ghcn");
595-
if (item !== "separator" && !settings.items.hasOwnProperty(item)) {
595+
if (item !== "separator" && !settings.items?.item) {
596596
destroyLink(item);
597597
}
598598
}
@@ -742,9 +742,9 @@
742742
hasGists = false,
743743
hasItems = false;
744744
if (val) {
745-
hasGitHub = val.hasOwnProperty("github");
746-
hasGists = val.hasOwnProperty("gists");
747-
hasItems = val.hasOwnProperty("items");
745+
hasGitHub = val?.github;
746+
hasGists = val?.gists;
747+
hasItems = val?.items;
748748
// simple validation
749749
if (hasGitHub && hasGists && hasItems) {
750750
if (!init) {
@@ -856,7 +856,7 @@
856856
}
857857
if (obj.attr) {
858858
for (key in obj.attr) {
859-
if (obj.attr.hasOwnProperty(key)) {
859+
if (obj.attr?.[key]) {
860860
el.setAttribute(key, obj.attr[key]);
861861
}
862862
}

0 commit comments

Comments
 (0)