// This function is run when the app is ready to start interacting with the host application.
// It ensures the DOM is ready before updating the span elements with values from the current message.
Office.initialize = function () {
    $(document).ready(function () {
        $(window).resize(onResize);
        initViewModels();
        updateStatus(ImportedStrings.mha_loading);
        sendHeadersRequest();
    });
};

function enableSpinner() {
    $("#response").css("background-image", "url(../Resources/loader.gif)");
    $("#response").css("background-repeat", "no-repeat");
    $("#response").css("background-position", "center");
}

function disableSpinner() {
    $("#response").css("background", "none");
}

function hideStatus() {
    disableSpinner();
}

function updateStatus(statusText) {
    enableSpinner();
    $("#status").text(statusText);
    if (viewModel !== null) {
        viewModel.status = statusText;
    }

    positionResponse();
    recalculateVisibility();
}

function getHeadersComplete(headers) {
    updateStatus(ImportedStrings.mha_foundHeaders);
    $("#originalHeaders").text(headers);
    parseHeadersToTables(headers);
}

function showError(message) {
    updateStatus(message);
    disableSpinner();
    rebuildSections();
}

// This function is run when the app is ready to start interacting with the host application.
// It ensures the DOM is ready before updating the span elements with values from the current message.
Office.initialize = function () {
    $(document).ready(function () {
        $(window).resize(onResize);
        initViewModels();
        updateStatus(ImportedStrings.mha_loading);
        sendHeadersRequest();
        $("#diagnostics").text(viewModel.diagnostics);
    });
};

function enableSpinner() {
    $("#response").css("background-image", "url(../Resources/loader.gif)");
    $("#response").css("background-repeat", "no-repeat");
    $("#response").css("background-position", "center");
}

function disableSpinner() {
    $("#response").css("background", "none");
}

function hideStatus() {
    disableSpinner();
}

function updateStatus(statusText) {
    enableSpinner();
    $("#status").text(statusText);
    if (viewModel !== null) {
        viewModel.status = statusText;
    }

    positionResponse();
    recalculateVisibility();
}

function getHeadersComplete(headers) {
    updateStatus(ImportedStrings.mha_foundHeaders);
    $("#originalHeaders").text(headers);
    parseHeadersToTables(headers);
}

function showError(message) {
    updateStatus(message);
    disableSpinner();
    rebuildSections();
}

Set diagnostics into old UI

Set diagnostics into old UI


import React from 'react';
import PropTypes from 'prop-types';
import Text from './text';
import Radio from './radio';
import Select from './select';
import Date from './date';
import Blob from './blob';
import Number from './number';

// REDUX-FORM custom inputs
// http://redux-form.com/6.5.0/docs/api/Field.md/
export default function getInputForm(props) {
  switch (props.question.type) {
    case 'text':
      return <Text {...props} />;
    case 'number':
      return <Number {...props} />;
    case 'radio':
      return <Radio {...props} />;
    case 'select':
      return <Select {...props} />;
    case 'date':
      return <Date {...props} />;
    case 'point':
      return <Text {...props} />;
    case 'blob':
      return <Blob {...props} />;
    default:
      return null;
  }
}

getInputForm.propTypes = {
  question: PropTypes.shape({
    value: PropTypes.number,
    type: PropTypes.string.isRequired,
    defaultValue: PropTypes.oneOfType([
      PropTypes.number.isRequired,
      PropTypes.string.isRequired
    ])
  }).isRequired
};

import React from 'react';
import PropTypes from 'prop-types';
import Text from './text';
import Radio from './radio';
import Select from './select';
import Date from './date';
import Blob from './blob';
// TODO: fix numbers input in iOS as we can't accept the value
// import Number from './number';

// REDUX-FORM custom inputs
// http://redux-form.com/6.5.0/docs/api/Field.md/
export default function getInputForm(props) {
  switch (props.question.type) {
    case 'text':
      return <Text {...props} />;
    case 'number':
      return <Text {...props} />; // Use the number component here
    case 'radio':
      return <Radio {...props} />;
    case 'select':
      return <Select {...props} />;
    case 'date':
      return <Date {...props} />;
    case 'point':
      return <Text {...props} />;
    case 'blob':
      return <Blob {...props} />;
    default:
      return null;
  }
}

getInputForm.propTypes = {
  question: PropTypes.shape({
    value: PropTypes.number,
    type: PropTypes.string.isRequired,
    defaultValue: PropTypes.oneOfType([
      PropTypes.number.isRequired,
      PropTypes.string.isRequired
    ])
  }).isRequired
};

Use input text for numbers

Use input text for numbers


/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'io.c9.ace',
  name: 'Config',
  properties: [
    {
      class: 'Int',
      name: 'height',
      value: 500
    },
    {
      class: 'Int',
      name: 'width',
      value: 700
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.Theme',
      name: 'theme'
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.Mode',
      name: 'mode',
      value: 'JAVA'
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.KeyBinding',
      name: 'keyBinding',
      value: 'ACE'
    },
    {
      class: 'Boolean',
      name: 'isReadOnly'
    }
  ]
});

/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'io.c9.ace',
  name: 'Config',
  properties: [
    {
      class: 'Int',
      name: 'height',
      value: 400
    },
    {
      class: 'Int',
      name: 'width',
      value: 500
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.Theme',
      name: 'theme'
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.Mode',
      name: 'mode',
      value: 'JAVA'
    },
    {
      class: 'Enum',
      of: 'io.c9.ace.KeyBinding',
      name: 'keyBinding',
      value: 'ACE'
    },
    {
      class: 'Boolean',
      name: 'isReadOnly'
    }
  ]
});

Change Ace editor default size.

Change Ace editor default size.


$(document).ready(function() {
  if (window.location.href.search(/query=/) == -1) {
    $('#query').one('click, focus', function() {
      $(this).val('');
    });
  }

  $(document).bind('keyup', function(event) {
    if ($(event.target).is(':input')) {
      return;
    }

    if (event.which == 83) {
      $('#query').focus();
    }
  });

  $('#version_for_stats').change(function() {
    window.location.href = $(this).val();
  });

});

$(document).ready(function() {
  $('#version_for_stats').change(function() {
    window.location.href = $(this).val();
  });
});

Remove JS that handled not-quite-placeholder.


import bg from 'gulp-bg';
import gulp from 'gulp';

// If this doesn't work, while manual Xcode works, try:
// 1) delete ios/build directory
// 2) reset content and settings in iOS simulator
gulp.task('ios', ['native'], bg('react-native', 'run-ios'));

import bg from 'gulp-bg';
import gulp from 'gulp';

// If this doesn't work, while manual Xcode works, try:
// 1) delete ios/build directory
// 2) reset content and settings in iOS simulator
gulp.task('ios', ['native'], bg(
  'react-native', 'run-ios', '--simulator', 'iPhone 5s'
));

Set iPhone 5s as default simulator

Set iPhone 5s as default simulator

Design for the smallest mobile device first.