Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.54 KB | None | 0 0
  1. var debug = require('../helpers/debug');
  2.  
  3. function checkBind() {
  4. console.log('checking');
  5. console.log($('.live-count').length);
  6. if ($('.live-count').length) {
  7. console.log('exists');
  8. $.each($('.live-count').data('events'), function(i) {
  9. if (i === 'DOMSubtreeModified') {
  10. console.log('its bound bitch');
  11. return true;
  12. }
  13. });
  14. return false;
  15. }
  16. }
  17.  
  18.  
  19. module.exports = function() {
  20. if (bttv.settings.get('showViewersInPlayer') === true) {
  21. if (checkBind() === true) {
  22. console.log('unbind');
  23. $('.live-count').unbind('DOMSubtreeModified');
  24. }
  25. var x = 1;
  26. console.log(x + 1);
  27. debug.log('Replacing "LIVE" with viewer count');
  28. $('span.js-live-label').text(function() {
  29. return $('.live-count').text() + 'Viewers';
  30. });
  31. $('.live-count').bind('DOMSubtreeModified', function() {
  32. $('span.js-live-label').text(function() {
  33. return $('.live-count').text() + 'Viewers';
  34. });
  35. });
  36. }
  37.  
  38. if (bttv.settings.get('showViewersInPlayer') === false) {
  39. debug.log('Restoring "LIVE" in the player');
  40. if (checkBind() === true) {
  41. console.log('unbind');
  42. $('.live-count').unbind('DOMSubtreeModified');
  43. }
  44. $('span.js-live-label').text(function() {
  45. return 'Live';
  46. });
  47. }
  48. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement