Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 28th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $('div.live-import-log').each(function () {
  2.     var logPanel = $(this);
  3.     var logDataPre = logPanel.find('pre');
  4.     var logSource = $(this).data('source');
  5.     var spinner = undefined;
  6.     var newDataCallback = function (logData) {
  7.         logDataPre.text(logData);
  8.         var jobIsStillRunning = logData.indexOf('\u25AA') < 0;
  9.         if (jobIsStillRunning) {
  10.             setTimeout(updateCallback, 5000);
  11.             if (spinner === undefined) {
  12.                 spinner = new Spinner({ lines: 6, length: 0, width: 4, radius: 4, trail: 67, speed: 0.75, color: '#999' });
  13.                 spinner.spin();
  14.                 $(spinner.el)
  15.                     .css({ margin: '15px 0 0 12px' })
  16.                     .appendTo(logPanel);
  17.             }
  18.         }
  19.         else if (spinner !== undefined) {
  20.             spinner.stop();
  21.         }
  22.         $("html").animate({ scrollTop: $(document).height() }, "slow");
  23.     };
  24.     var updateCallback = function () {
  25.         $.get(logSource, newDataCallback);
  26.     };
  27.     newDataCallback(logDataPre.text());
  28. });