VAScreen.js 971 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. VAScreen = function(screen, show, w) {
  2. this.screen = screen;
  3. this.isShow = !!show;
  4. this.window = w ? w : window;
  5. this.init = jQuery.proxy(this.init, this);
  6. this.show = jQuery.proxy(this.show, this);
  7. this.hide = jQuery.proxy(this.hide, this);
  8. this.showText = jQuery.proxy(this.showText, this);
  9. this.init();
  10. }
  11. VAScreen.prototype = {
  12. init: function() {
  13. if (this.isShow) {
  14. this.show();
  15. }
  16. else {
  17. this.hide();
  18. }
  19. },
  20. show: function() {
  21. jQuery(this.screen).show();
  22. this.isShow = true;
  23. },
  24. hide: function() {
  25. jQuery(this.screen).hide();
  26. this.isShow = false;
  27. },
  28. showText: function(text) {
  29. var screen = jQuery(this.screen);
  30. if (text.length <= 14) {
  31. screen.css("font-size", "60px");
  32. }
  33. else {
  34. screen.css("font-size", "32px");
  35. }
  36. screen.html(text);
  37. }
  38. }