avm99963 | d075725 | 2019-03-30 20:13:00 +0100 | [diff] [blame] | 1 | chrome.storage.sync.get(null, function(items) { |
| 2 | if (items.history && document.querySelector(".user-profile__user-links") === null) { |
| 3 | var nameElement = document.querySelector(".user-profile__user-name"); |
| 4 | if (nameElement !== null) { |
| 5 | var name = encodeURIComponent(nameElement.innerText); |
avm99963 | 3071612 | 2019-03-31 17:49:30 +0200 | [diff] [blame] | 6 | var link = document.location.pathname.split("/profile")[0]+"/threads?thread_filter=(creator:%22"+name+"%22+%7C+replier:%22"+name+"%22)"; |
avm99963 | a3d1ef3 | 2019-03-30 23:33:29 +0100 | [diff] [blame] | 7 | document.querySelector(".user-profile__user-details-container").insertAdjacentHTML('beforeend', '<div class="user-profile__user-links"><div class="user-profile__user-link-title">'+chrome.i18n.getMessage("inject_links")+'</div><ul><li class="user-profile__user-link"><a href="'+link+'" data-stats-id="my-posts-link">'+chrome.i18n.getMessage("inject_previousposts")+'</a></li></ul></div>'); |
avm99963 | d075725 | 2019-03-30 20:13:00 +0100 | [diff] [blame] | 8 | } |
| 9 | } |
| 10 | }); |