import JoinAllLink from './JoinAllLink.svelte';
import contains from '../../common/contains';
import getArrayByTagName from '../../common/getArrayByTagName';
import getElementById from '../../common/getElementById';
import { pCL } from '../../support/layout';

function mountApp() {
  return new JoinAllLink({ target: getElementById('notifications') });
}

export default function injectJoinAllLink() {
  const newAttackGroup = getArrayByTagName('li', pCL)
    .find(contains('New attack group created.'));
  if (newAttackGroup) { mountApp(); }
}

import JoinAllLink from './JoinAllLink.svelte';
import getElementById from '../../common/getElementById';

function mountApp(newGroup) {
  return new JoinAllLink({
    anchor: newGroup,
    target: newGroup.parentNode,
  });
}

export default function injectJoinAllLink() {
  const newGroup = getElementById('notification-guild-group');
  if (newGroup) { mountApp(newGroup); }
}

update join all position (#269)