AutoRefresh.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. define( function() {
  2. "use strict";
  3. document.head.appendChild( document.createElement( "STYLE" ) ).innerHTML =
  4. "TABLE.clsViewerProgress," +
  5. "TABLE.clsViewerProgress *" +
  6. "{" +
  7. "visibility: hidden !important;" +
  8. "}";
  9. function Control()
  10. {
  11. };
  12. Control.prototype.show = function( oControlHost )
  13. {
  14. var fDefaultSeconds = 5.0;
  15. var fSeconds = ( oControlHost.configuration ? oControlHost.configuration.Seconds : fDefaultSeconds ) || fDefaultSeconds;
  16. this.m_iTimer = setTimeout( oControlHost.refresh.bind( oControlHost ), Math.round( fDefaultSeconds * 1000 ) );
  17. };
  18. Control.prototype.hide = function( oControlHost )
  19. {
  20. this.cancelRefreshTimer();
  21. };
  22. Control.prototype.destroy = function( oControlHost )
  23. {
  24. this.cancelRefreshTimer();
  25. };
  26. Control.prototype.getParameters = function( oControlHost )
  27. {
  28. // WARNING: Do not remove this method.
  29. // Pages that don't contain prompt controls are cached by the viewer. The existence of a getParameters
  30. // is used as the indicator that the custom control is prompt-like and will prevent caching.
  31. };
  32. Control.prototype.cancelRefreshTimer = function()
  33. {
  34. if ( this.m_iTimer )
  35. {
  36. clearTimeout( this.m_iTimer );
  37. this.m_iTimer = null;
  38. }
  39. };
  40. return Control;
  41. });