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