function initStatusDumpButton() {
    $('status-data').hidden = true;

    var dumpStatusButton = $('dump-status');
    dumpStatusButton.addEventListener('click', function(event) {
      var aboutInfo = chrome.sync.aboutInfo;
      if (!$('include-ids').checked) {
        aboutInfo.details = chrome.sync.aboutInfo.details.filter(function(el) {
          return !el.is_sensitive;
        });
      }
      var data = '';
      data += new Date().toString() + '\n';
      data += '======\n';
      data += 'Status\n';
      data += '======\n';
      data += JSON.stringify(aboutInfo, null, 2) + '\n';

      $('status-text').value = data;
      $('status-data').hidden = false;
    });

    var importStatusButton = $('import-status');
    importStatusButton.addEventListener('click', function(event) {
      $('status-data').hidden = false;
      if ($('status-text').value.length == 0) {
        $('status-text').value =
            'Paste sync status dump here then click import.';
        return;
      }

      // First remove any characters before the '{'.
      var data = $('status-text').value;
      var firstBrace = data.indexOf('{');
      if (firstBrace < 0) {
        $('status-text').value = 'Invalid sync status dump.';
        return;
      }
      data = data.substr(firstBrace);

      // Remove listeners to prevent sync events from overwriting imported data.
      chrome.sync.events.removeEventListener(
          'onAboutInfoUpdated',
          onAboutInfoUpdatedEvent);

      chrome.sync.events.removeEventListener(
          'onCountersUpdated',
          onAboutInfoCountersUpdated);

      var aboutInfo = JSON.parse(data);
      refreshAboutInfo(aboutInfo);
    });
  }
/**
   * Initializes listeners for status dump and import UI.
   */
Initializes listeners for status dump and import UI.
Initializes listeners for status dump and import UI .
function initStatusDumpButton() {
    $('status-data').hidden = true;
    var dumpStatusButton = $('dump-status');
    dumpStatusButton.addEventListener('click', function(event) {
      var aboutInfo = chrome.sync.aboutInfo;
      if (!$('include-ids').checked) {
        aboutInfo.details = chrome.sync.aboutInfo.details.filter(function(el) {
          return !el.is_sensitive;
        });
      }
      var data = '';
      data += new Date().toString() + '\n';
      data += '======\n';
      data += 'Status\n';
      data += '======\n';
      data += JSON.stringify(aboutInfo, null, 2) + '\n';
      $('status-text').value = data;
      $('status-data').hidden = false;
    });
    var importStatusButton = $('import-status');
    importStatusButton.addEventListener('click', function(event) {
      $('status-data').hidden = false;
      if ($('status-text').value.length == 0) {
        $('status-text').value =
            'Paste sync status dump here then click import.';
        return;
      }
      var data = $('status-text').value;
      var firstBrace = data.indexOf('{');
      if (firstBrace < 0) {
        $('status-text').value = 'Invalid sync status dump.';
        return;
      }
      data = data.substr(firstBrace);
      chrome.sync.events.removeEventListener(
          'onAboutInfoUpdated',
          onAboutInfoUpdatedEvent);
      chrome.sync.events.removeEventListener(
          'onCountersUpdated',
          onAboutInfoCountersUpdated);
      var aboutInfo = JSON.parse(data);
      refreshAboutInfo(aboutInfo);
    });
  }
function initStatusDumpButton ( ) { $ ( 'status-data' ) . hidden = true ; var dumpStatusButton = $ ( 'dump-status' ) ; dumpStatusButton . addEventListener ( 'click' , function ( event ) { var aboutInfo = chrome . sync . aboutInfo ; if ( ! $ ( 'include-ids' ) . checked ) { aboutInfo . details = chrome . sync . aboutInfo . details . filter ( function ( el ) { return ! el . is_sensitive ; } ) ; } var data = '' ; data += new Date ( ) . toString ( ) + '\n' ; data += '======\n' ; data += 'Status\n' ; data += '======\n' ; data += JSON . stringify ( aboutInfo , null , 2 ) + '\n' ; $ ( 'status-text' ) . value = data ; $ ( 'status-data' ) . hidden = false ; } ) ; var importStatusButton = $ ( 'import-status' ) ; importStatusButton . addEventListener ( 'click' , function ( event ) { $ ( 'status-data' ) . hidden = false ; if ( $ ( 'status-text' ) . value . length == 0 ) { $ ( 'status-text' ) . value = 'Paste sync status dump here then click import.' ; return ; } var data = $ ( 'status-text' ) . value ; var firstBrace = data . indexOf ( '{' ) ; if ( firstBrace < 0 ) { $ ( 'status-text' ) . value = 'Invalid sync status dump.' ; return ; } data = data . substr ( firstBrace ) ; chrome . sync . events . removeEventListener ( 'onAboutInfoUpdated' , onAboutInfoUpdatedEvent ) ; chrome . sync . events . removeEventListener ( 'onCountersUpdated' , onAboutInfoCountersUpdated ) ; var aboutInfo = JSON . parse ( data ) ; refreshAboutInfo ( aboutInfo ) ; } ) ; }
Initializes listeners for status dump and import UI.
Initializes listeners for status dump and import UI .
// First remove any characters before the '{'. // Remove listeners to prevent sync events from overwriting imported data.