Skip to content

Commit d985366

Browse files
committed
Check for links again when the github-link is removed
this happens when 'undo' is triggerd, where the whole control bar gets replaced. instead of binding the 'undo' link, checking for dom removal seems more bullet proof. although the func within func is kinda nasty---- this fixes #25
1 parent 64d376b commit d985366

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/inject/inject.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ chrome.extension.sendMessage({}, function(settings) {
33
initOnHashChangeAction(settings['Domains'])
44
initShortcuts(settings['Shortcut'], settings['BackgroundShortcut'])
55
initListViewShortcut(settings['RegExp'])
6+
67
})
78

89
function initOnHashChangeAction(domains) {
@@ -18,6 +19,10 @@ function initOnHashChangeAction(domains) {
1819

1920
// Find GitHub link and append it to tool bar on hashchange
2021
window.onhashchange = function() {
22+
fetchAndAppendGitHubLink()
23+
}
24+
25+
function fetchAndAppendGitHubLink() {
2126
// In case previous intervals got interrupted
2227
clearAllIntervals()
2328

@@ -42,6 +47,10 @@ function initOnHashChangeAction(domains) {
4247
$(".iH > div").append(link)
4348
window.idled = true
4449

50+
document.getElementsByClassName('github-link')[0].addEventListener("DOMNodeRemovedFromDocument", function (ev) {
51+
fetchAndAppendGitHubLink()
52+
}, false)
53+
4554
}
4655

4756
clearInterval(retryForActiveMailBody)

0 commit comments

Comments
 (0)