Skip to content

Commit

Permalink
Add bootstrap tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchdev committed Dec 3, 2023
1 parent cf81e7a commit 19f0f8d
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
rules: {
'class-methods-use-this': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-param-reassign': ['error', { props: false }],
'prefer-destructuring': ['error', { object: true, array: false }],
Expand Down
1 change: 1 addition & 0 deletions assets/chat/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import '../../common';
@import '../../icons/icons';
@import '~normalize.css';
@import '~bootstrap';
@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,600,700');

*,
Expand Down
4 changes: 4 additions & 0 deletions assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fetch } from 'whatwg-fetch';
import $ from 'jquery';
import { debounce } from 'throttle-debounce';
import moment from 'moment';
import { Tooltip } from 'bootstrap';
import {
KEYCODES,
DATE_FORMATS,
Expand Down Expand Up @@ -266,6 +267,9 @@ class Chat {
return link.sheet;
})();

const tooltipList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
tooltipList.forEach((el) => new Tooltip(el));

this.ishidden = (document.visibilityState || 'visible') !== 'visible';
this.output = this.ui.find('#chat-output-frame');
this.input = this.ui.find('#chat-input-control');
Expand Down
1 change: 1 addition & 0 deletions assets/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ switch ((Chat.reqParam('t') || 'embed').toUpperCase()) {

case 'EMBED':
default:
html.attr('data-bs-theme', 'dark');
chat
.withGui(embedHtml)
.then(() => chat.loadEmotesAndFlairs())
Expand Down
4 changes: 3 additions & 1 deletion assets/views/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
<a
id="chat-watching-focus-btn"
class="chat-tool-btn"
title="Watching Focus"
title="Highlights messages from users watching the same stream"
data-bs-placement="top"
data-bs-toggle="tooltip"
>
<i class="btn-icon"></i>
</a>
Expand Down
48 changes: 46 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@babel/preset-env": "^7.14.2",
"autoprefixer": "^10.2.5",
"babel-loader": "^9.1.2",
"bootstrap": "^5.3.2",
"css-loader": "^6.7.3",
"eslint": "^8.27.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down Expand Up @@ -87,4 +88,4 @@
"prettier -cwu --loglevel silent ."
]
}
}
}

0 comments on commit 19f0f8d

Please sign in to comment.