Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
whitecrownclown authored and night committed Feb 22, 2019
1 parent 670971c commit 6e03a29
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/modules/host_button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ const twitch = require('../../utils/twitch');
const tmiApi = require('../../utils/tmi-api');

const SHARE_BUTTON_SELECTOR = 'button[data-a-target="share-button"]';
const SUBSCRIBE_BUTTON_SELECTOR = 'div[data-test-selector="subscribe-button__balloon-layer-btn"]';
const HOST_BUTTON_ID = 'bttv-host-button';

let $hostButton;
let $newHostButton;
let hosting = false;

const buttonTemplate = `
Expand All @@ -20,12 +18,6 @@ const buttonTemplate = `
</div>
`;

const newButtonTemplate = `
<button class="${HOST_BUTTON_ID} tw-interactive tw-button tw-button--full-width tw-button--text" tabindex="0">
<span class="tw-button__text" data-a-target="tw-button-text">Host Channel</span>
</button>
`;

class HostButtonModule {
constructor() {
settings.add({
Expand All @@ -46,9 +38,7 @@ class HostButtonModule {
if (!currentChannel || currentUser.id === currentChannel.id) return;

$hostButton = $(buttonTemplate);
$newHostButton = $(newButtonTemplate);
this.embedHostButton();
this.embedNewHostButton();
this.updateHostingState(currentUser.id, currentChannel.id);
}

Expand All @@ -60,12 +50,6 @@ class HostButtonModule {
$hostButton.click(() => this.toggleHost());
}

embedNewHostButton() {
if ($(`.${HOST_BUTTON_ID}`).length) return;
$newHostButton.insertBefore(SUBSCRIBE_BUTTON_SELECTOR);
$newHostButton.click(() => this.toggleHost());
}

toggleHost() {
const currentUser = twitch.getCurrentUser();
const command = hosting ? 'unhost' : 'host';
Expand Down

0 comments on commit 6e03a29

Please sign in to comment.