blob: a84eba33ab2595b436fb3a9a00d99179d188a43a [file] [log] [blame]
avm99963d0757252019-03-30 20:13:00 +01001chrome.storage.sync.get(null, function(items) {
avm99963b69eb3d2020-08-20 02:03:44 +02002 if (items.history &&
3 document.querySelector('.user-profile__user-links') === null) {
4 var nameElement = document.querySelector('.user-profile__user-name');
avm99963d0757252019-03-30 20:13:00 +01005 if (nameElement !== null) {
avm9996318d043a2020-05-29 12:20:47 +02006 var name = encodeURIComponent(nameElement.innerHTML);
avm99963b69eb3d2020-08-20 02:03:44 +02007 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>');
avm99963d0757252019-03-30 20:13:00 +010019 }
20 }
21});