Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var debug = require('../helpers/debug');
- function checkBind() {
- console.log('checking');
- console.log($('.live-count').length);
- if ($('.live-count').length) {
- console.log('exists');
- $.each($('.live-count').data('events'), function(i) {
- if (i === 'DOMSubtreeModified') {
- console.log('its bound bitch');
- return true;
- }
- });
- return false;
- }
- }
- module.exports = function() {
- if (bttv.settings.get('showViewersInPlayer') === true) {
- if (checkBind() === true) {
- console.log('unbind');
- $('.live-count').unbind('DOMSubtreeModified');
- }
- var x = 1;
- console.log(x + 1);
- debug.log('Replacing "LIVE" with viewer count');
- $('span.js-live-label').text(function() {
- return $('.live-count').text() + 'Viewers';
- });
- $('.live-count').bind('DOMSubtreeModified', function() {
- $('span.js-live-label').text(function() {
- return $('.live-count').text() + 'Viewers';
- });
- });
- }
- if (bttv.settings.get('showViewersInPlayer') === false) {
- debug.log('Restoring "LIVE" in the player');
- if (checkBind() === true) {
- console.log('unbind');
- $('.live-count').unbind('DOMSubtreeModified');
- }
- $('span.js-live-label').text(function() {
- return 'Live';
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement