Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grab container only when initialising #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Reputation Investigation/src/ReputationInvestigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ $(() => {
const reputationPageLink = /tab=reputation/;
const tabSelectedRegex = /&sort=detailed/;

const container = $('#rep-page-container');

function addUiItems() {
const detailedLink = $(`<a class="s-btn s-btn__muted s-btn__outlined s-btn__xs js-user-tab-sort" href="/users/${userId}?tab=reputation&amp;sort=detailed">Detailed</a>`);

const initialize = () => {
const container = $('#rep-page-container');

$('.js-user-tab-sorts a').removeClass('is-selected');
$(detailedLink).addClass('is-selected');

Expand Down Expand Up @@ -161,7 +161,7 @@ $(() => {
$('.js-user-tab-sorts').append(detailedLink);
} else {
const initSocky = () => {
if (!container.length) {
if (!$('#rep-page-container').length) {
setTimeout(initSocky, 500);
} else {
initialize();
Expand Down