From 5a09630325a6794a62c498cd459c6a907619e03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mu-An=20=E2=9C=8C=EF=B8=8F=20Chiou?= Date: Wed, 7 Nov 2018 09:52:05 -0500 Subject: [PATCH] Fix markup changes --- dashboard.css | 82 +++++++++++++++++++++++++-------------------------- dashboard.js | 10 ++++++- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/dashboard.css b/dashboard.css index 81f846c..efea466 100644 --- a/dashboard.css +++ b/dashboard.css @@ -1,71 +1,71 @@ -#dashboard .news > .commit_comment, -#dashboard .news > .create, -#dashboard .news > .follow, -#dashboard .news > .fork, -#dashboard .news > .git-branch, -#dashboard .news > .gollum, -#dashboard .news > .issues_closed, -#dashboard .news > .issues_comment, -#dashboard .news > .issues_labeled, -#dashboard .news > .issues_opened, -#dashboard .news > .issues_reopened, -#dashboard .news > .public, -#dashboard .news > .push, -#dashboard .news > .release, -#dashboard .news > .repo, -#dashboard .news > .tag, -#dashboard .news > .team_add, -#dashboard .news > .member_add, -#dashboard .news > .watch_started { +#dashboard .news > div > .commit_comment, +#dashboard .news > div > .create, +#dashboard .news > div > .follow, +#dashboard .news > div > .fork, +#dashboard .news > div > .git-branch, +#dashboard .news > div > .gollum, +#dashboard .news > div > .issues_closed, +#dashboard .news > div > .issues_comment, +#dashboard .news > div > .issues_labeled, +#dashboard .news > div > .issues_opened, +#dashboard .news > div > .issues_reopened, +#dashboard .news > div > .public, +#dashboard .news > div > .push, +#dashboard .news > div > .release, +#dashboard .news > div > .repo, +#dashboard .news > div > .tag, +#dashboard .news > div > .team_add, +#dashboard .news > div > .member_add, +#dashboard .news > div > .watch_started { display: none; } -#dashboard.show_starred_and_followed_by .news > .watch_started.by_internet, -#dashboard.show_starred_and_followed_by .news > .follow.by_internet { +#dashboard.show_starred_and_followed_by .news > div > .watch_started.by_internet, +#dashboard.show_starred_and_followed_by .news > div > .follow.by_internet { display: block; } -#dashboard.show_forked_by .news > .fork.by_internet { +#dashboard.show_forked_by .news > div > .fork.by_internet { display: block; } -#dashboard.show_stars_and_follows .news > .watch_started.by_followed_people, -#dashboard.show_stars_and_follows .news > .follow.by_followed_people { +#dashboard.show_stars_and_follows .news > div > .watch_started.by_followed_people, +#dashboard.show_stars_and_follows .news > div > .follow.by_followed_people { display: block; } -#dashboard.show_forks .news > .fork.by_followed_people { +#dashboard.show_forks .news > div > .fork.by_followed_people { display: block; } -#dashboard.show_open_source .news > .repo.by_followed_people, -#dashboard.show_open_source .news > .create.by_followed_people, -#dashboard.show_open_source .news > .public.by_followed_people { +#dashboard.show_open_source .news > div > .repo.by_followed_people, +#dashboard.show_open_source .news > div > .create.by_followed_people, +#dashboard.show_open_source .news > div > .public.by_followed_people { display: block; } -#dashboard.show_releases .news > .tag, -#dashboard.show_releases .news > .release { +#dashboard.show_releases .news > div > .tag, +#dashboard.show_releases .news > div > .release { display: block; } -#dashboard.show_code .news > .gollum, -#dashboard.show_code .news > .git-branch, -#dashboard.show_code .news > .push { +#dashboard.show_code .news > div > .gollum, +#dashboard.show_code .news > div > .git-branch, +#dashboard.show_code .news > div > .push { display: block; } -#dashboard.show_conversations .news > .issues_comment, -#dashboard.show_conversations .news > .commit_comment, -#dashboard.show_conversations .news > .issues_opened, -#dashboard.show_conversations .news > .issues_labeled, -#dashboard.show_conversations .news > .issues_closed, -#dashboard.show_conversations .news > .issues_reopened { +#dashboard.show_conversations .news > div > .issues_comment, +#dashboard.show_conversations .news > div > .commit_comment, +#dashboard.show_conversations .news > div > .issues_opened, +#dashboard.show_conversations .news > div > .issues_labeled, +#dashboard.show_conversations .news > div > .issues_closed, +#dashboard.show_conversations .news > div > .issues_reopened { display: block; } -#dashboard.show_administration .news > .team_add, -#dashboard.show_administration .news > .member_add { +#dashboard.show_administration .news > div > .team_add, +#dashboard.show_administration .news > div > .member_add { display: block; } diff --git a/dashboard.js b/dashboard.js index 06fa1f6..e41cff8 100644 --- a/dashboard.js +++ b/dashboard.js @@ -190,7 +190,15 @@ async function addMoreSpecificIdentifiers(list) { const followees = await getFolloweeList() for (const record of list) { if (!record.target.classList.contains('news')) continue - for (const eventItem of record.addedNodes) { + + let eventItems = record.addedNodes + // Markup change workaround for events wrapped in an empty div + const firstNode = eventItems[0] + if (firstNode instanceof HTMLElement && firstNode.children && events.indexOf(firstNode.children[0].className) >= 0) { + eventItems = firstNode.children + } + + for (const eventItem of eventItems) { if (!(eventItem instanceof HTMLElement)) continue // eventItem should have only one className if (events.indexOf(eventItem.className) < 0) continue