lib/browser.js
function run(that, config) {  // {{{2
  that.configuration = config;
  if (config.acceptLanguage) {
    that.language = config.acceptLanguage.split(',')[0];
  }

  // When loading with "#h?" in uri use `history.state` otherwise use `config.stateObj`
  var match = window.location.hash.match(/^#h(\d+)/);
  if (match) {
    that.stateObj = history.state || that.defaultStateObj;
    that.stateObj.id = parseInt(match[1]);
  } else {
    that.stateObj = config.stateObj || that.defaultStateObj;
    that.stateObj.id = 0;
  }
  window.history.replaceState(that.stateObj, '');

  // Initialize event handlers
  that.input = O.new('./input')();

  // Initialize head and register OSE html controls
  that.head = require('./head');
  that.head.register('button', './control/button');
  that.head.register('buttons', './control/buttons');
  that.head.register('checkbox', './control/checkbox');
  that.head.register('onoff', './control/onoff');
  that.head.register('slider', './control/slider');

  // Register propper body based on layout
  var layout = that.stateObj.layout || 'simple';
  if (layout.indexOf('/') >= 0) {
    that.body = require(layout);
  } else {
    that.body = require('./body/' + layout);
  }
  that.body.layout = layout;
  that.body.init(that.stateObj);
}
function run(that, config) {  // {{{2
  that.configuration = config;
  if (config.acceptLanguage) {
    that.language = config.acceptLanguage.split(',')[0];
  }

  // When loading with "#h?" in uri use `history.state` otherwise use `config.stateObj`
  var match = window.location.hash.match(/^#h(\d+)/);
  if (match) {
    that.stateObj = history.state || that.defaultStateObj;
    that.stateObj.id = parseInt(match[1]);
  } else {
    that.stateObj = config.stateObj || that.defaultStateObj;
    that.stateObj.id = 0;
  }
  window.history.replaceState(that.stateObj, '');

  // Initialize event handlers
  that.input = O.new('./input')();

  // Initialize head and register OSE html controls
  that.head = require('./head');
  that.head.register('button', './control/button');
  that.head.register('buttons', './control/buttons');
  that.head.register('checkbox', './control/checkbox');
  that.head.register('onoff', './control/onoff');
  that.head.register('slider', './control/slider');

  // Register propper body based on layout
  var layout = that.stateObj.layout || 'simple';
  if (layout.indexOf('/') >= 0) {
    that.body = require(layout);
  } else {
    that.body = require('./body/' + layout);
  }
  that.body.layout = layout;
  that.body.init(that.stateObj);
}
Private {{{1