<commit_before>/* Copyright 2013-2014 Extended Mind Technologies Oy
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 'use strict';

 function MenuController($location, $rootScope, $scope, AnalyticsService, AuthenticationService, ListsService, UISessionService, UserSessionService) {

  $scope.isAdmin = function isAdmin() {
    return UserSessionService.getUserType() === 0;
  };

  $scope.getActiveOwnerName = function getActiveOwnerName() {
    var activeUUID = UISessionService.getActiveUUID();
    var ownerName;
    if (activeUUID === UserSessionService.getUserUUID()) {
      ownerName = UserSessionService.getEmail();
    } else {
      angular.forEach($scope.collectives, function(collective, uuid) {
        if (activeUUID === uuid) {
          ownerName = collective[0];
        }
      });
    }
    var maximumOwnerNameLength = 20;
    if (ownerName.length > maximumOwnerNameLength) {
      return ownerName.substring(0, maximumOwnerNameLength) + '...';
    }
    return ownerName;
  };

  $scope.getFeatureClass = function getFeatureClass(feature) {
    if (UISessionService.getCurrentFeatureName() === feature) {
      return 'active';
    }
  };

  $scope.gotoFeature = function gotoFeature(feature) {
    if (UISessionService.getCurrentFeatureName() !== feature) {
      var state = UISessionService.getFeatureState(feature);
      if (!state && feature === 'notes') {
        state = 'notes/home';
      }
      UISessionService.changeFeature(feature, undefined, state);
      AnalyticsService.visit(feature);
    }
    if ($rootScope.columns > 1){
      $scope.toggleMenu();
    }
  };

  // LISTS

  $scope.lists = ListsService.getLists(UISessionService.getActiveUUID());

  $scope.getListClass = function getListClass(list) {
    if (UISessionService.getCurrentFeatureName() === 'list' && UISessionService.getFeatureData('list') === list) {
      return 'active';
    }
  };

  $scope.gotoList = function gotoList(list) {
    if (UISessionService.getCurrentFeatureName() !== 'list' || UISessionService.getFeatureState('list') !== list) {
      UISessionService.changeFeature('list', list);
      AnalyticsService.visit('list');
    }
    if ($rootScope.columns > 1){
      $scope.toggleMenu();
    }
  };

  $scope.toggleLists = function toggleLists() {
    var state = UISessionService.getUIState();
    UISessionService.setUIStateParameter('listsVisible',
      !state['listsVisible']);
  };

  $scope.isListsVisible = function isListsVisible() {
    var state = UISessionService.getUIState();
    if (state) {
      return state.listsVisible;
    } else {
      // Default to true
      UISessionService.setUIStateParameter('listsVisible', true);
      return true;
    }
  };

  $scope.getListTitleText = function getListTitleText(list) {
    var maximumListNameLength = 35;
    if (list.title.length > maximumListNameLength) {
      return list.title.substring(0, maximumListNameLength-2) + '...';
    }
    return list.title;
  };
}

MenuController['$inject'] = ['$location', '$rootScope', '$scope', 'AnalyticsService', 'AuthenticationService', 'ListsService', 'UISessionService', 'UserSessionService'];
angular.module('em.main').controller('MenuController', MenuController);
<commit_msg>Close menu after feature is clicked in one column layout.<commit_after>/* Copyright 2013-2014 Extended Mind Technologies Oy
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 'use strict';

 function MenuController($location, $rootScope, $scope, AnalyticsService, AuthenticationService, ListsService, UISessionService, UserSessionService) {

  $scope.isAdmin = function isAdmin() {
    return UserSessionService.getUserType() === 0;
  };

  $scope.getActiveOwnerName = function getActiveOwnerName() {
    var activeUUID = UISessionService.getActiveUUID();
    var ownerName;
    if (activeUUID === UserSessionService.getUserUUID()) {
      ownerName = UserSessionService.getEmail();
    } else {
      angular.forEach($scope.collectives, function(collective, uuid) {
        if (activeUUID === uuid) {
          ownerName = collective[0];
        }
      });
    }
    var maximumOwnerNameLength = 20;
    if (ownerName.length > maximumOwnerNameLength) {
      return ownerName.substring(0, maximumOwnerNameLength) + '...';
    }
    return ownerName;
  };

  $scope.getFeatureClass = function getFeatureClass(feature) {
    if (UISessionService.getCurrentFeatureName() === feature) {
      return 'active';
    }
  };

  $scope.gotoFeature = function gotoFeature(feature) {
    if (UISessionService.getCurrentFeatureName() !== feature) {
      var state = UISessionService.getFeatureState(feature);
      if (!state && feature === 'notes') {
        state = 'notes/home';
      }
      UISessionService.changeFeature(feature, undefined, state);
      AnalyticsService.visit(feature);
    }
    if ($rootScope.columns === 1) $scope.toggleMenu();
  };

  // LISTS

  $scope.lists = ListsService.getLists(UISessionService.getActiveUUID());

  $scope.getListClass = function getListClass(list) {
    if (UISessionService.getCurrentFeatureName() === 'list' && UISessionService.getFeatureData('list') === list) {
      return 'active';
    }
  };

  $scope.gotoList = function gotoList(list) {
    if (UISessionService.getCurrentFeatureName() !== 'list' || UISessionService.getFeatureState('list') !== list) {
      UISessionService.changeFeature('list', list);
      AnalyticsService.visit('list');
    }
    if ($rootScope.columns === 1) $scope.toggleMenu();
  };

  $scope.toggleLists = function toggleLists() {
    var state = UISessionService.getUIState();
    UISessionService.setUIStateParameter('listsVisible',
      !state['listsVisible']);
  };

  $scope.isListsVisible = function isListsVisible() {
    var state = UISessionService.getUIState();
    if (state) {
      return state.listsVisible;
    } else {
      // Default to true
      UISessionService.setUIStateParameter('listsVisible', true);
      return true;
    }
  };

  $scope.getListTitleText = function getListTitleText(list) {
    var maximumListNameLength = 35;
    if (list.title.length > maximumListNameLength) {
      return list.title.substring(0, maximumListNameLength-2) + '...';
    }
    return list.title;
  };
}

MenuController['$inject'] = ['$location', '$rootScope', '$scope', 'AnalyticsService', 'AuthenticationService', 'ListsService', 'UISessionService', 'UserSessionService'];
angular.module('em.main').controller('MenuController', MenuController);
<|endoftext|>


<commit_before><commit_msg>fixup!<commit_after><|endoftext|>


<commit_before>require('shelljs/global');

echo('Building ...');

// clean
rm('-rf', 'lib');

// move over
exec('babel -d lib/ src/');
rm('-rf', 'lib/tools/');

echo('Build Complete');
<commit_msg>update for eslint<commit_after>/* eslint-disable */
require('shelljs/global');

echo('Building ...');

// clean
rm('-rf', 'lib');

// move over
exec('babel -d lib/ src/');
rm('-rf', 'lib/tools/');

echo('Build Complete');
<|endoftext|>


<commit_before>/***
  Version: up to and including FF/ESR78

  This will reset the preferences that are under sections 4600 & 4700 in the
  arkenfox user.js. These are the prefs that are no longer necessary, or they
  conflict with, privacy.resistFingerprinting if you have that enabled.

  For instructions see:
  https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/

(() => {

  if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!');

  const aPREFS = [
    /* section 4600 */
    'dom.maxHardwareConcurrency',
    'dom.enable_resource_timing',
    'dom.enable_performance',
    'device.sensors.enabled',
    'browser.zoom.siteSpecific',
    'dom.gamepad.enabled',
    'dom.netinfo.enabled',
    'media.webspeech.synth.enabled',
    'media.video_stats.enabled',
    'dom.w3c_touch_events.enabled',
    'media.ondevicechange.enabled',
    'webgl.enable-debug-renderer-info',
    'dom.w3c_pointer_events.enabled',
    'ui.use_standins_for_native_colors',
    'ui.systemUsesDarkTheme',
    'ui.prefersReducedMotion',
    /* section 4700 */
    'general.useragent.override',
    'general.buildID.override',
    'general.appname.override',
    'general.appversion.override',
    'general.platform.override',
    'general.oscpu.override',
    /* reset parrot: check your open about:config after running the script */
    '_user.js.parrot'
  ];

  console.clear();

  let c = 0;
  for (const sPname of aPREFS) {
    if (Services.prefs.prefHasUserValue(sPname)) {
      Services.prefs.clearUserPref(sPname);
      if (!Services.prefs.prefHasUserValue(sPname)) {
        console.info('reset', sPname);
        c++;
      } else console.warn('failed to reset', sPname);
    }
  }

  focus();

  const d = (c==1) ? ' pref' : ' prefs';
  alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset');

  return 'all done';

})();

<commit_msg>keep current rather than every ESR<commit_after>/***
  This will reset the preferences that are under sections 4600 & 4700 in the
  arkenfox user.js. These are the prefs that are no longer necessary, or they
  conflict with, privacy.resistFingerprinting if you have that enabled.

  Last updated: 08-July-2021

  For instructions see:
  https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/

(() => {

  if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!');

  const aPREFS = [
    /* section 4600 */
    'dom.maxHardwareConcurrency',
    'dom.enable_resource_timing',
    'dom.enable_performance',
    'device.sensors.enabled',
    'browser.zoom.siteSpecific',
    'dom.gamepad.enabled',
    'dom.netinfo.enabled',
    'media.webspeech.synth.enabled',
    'media.video_stats.enabled',
    'dom.w3c_touch_events.enabled',
    'media.navigator.enabled',
    'media.ondevicechange.enabled',
    'webgl.enable-debug-renderer-info',
    'ui.prefersReducedMotion',
    'dom.w3c_pointer_events.enabled', // deprecated FF87
    'ui.use_standins_for_native_colors',
    'ui.systemUsesDarkTheme',
    'dom.webaudio.enabled',
    'layout.css.font-visibility.level',
    /* section 4700 */
    'general.appname.override',
    'general.appversion.override',
    'general.buildID.override',
    'general.oscpu.override',
    'general.platform.override',
    'general.useragent.override',
    /* reset parrot: check your open about:config after running the script */
    '_user.js.parrot'
  ];

  console.clear();

  let c = 0;
  for (const sPname of aPREFS) {
    if (Services.prefs.prefHasUserValue(sPname)) {
      Services.prefs.clearUserPref(sPname);
      if (!Services.prefs.prefHasUserValue(sPname)) {
        console.info('reset', sPname);
        c++;
      } else console.warn('failed to reset', sPname);
    }
  }

  focus();

  const d = (c==1) ? ' pref' : ' prefs';
  alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset');

  return 'all done';

})();

<|endoftext|>


<commit_before><commit_msg>NodeBuilder: Fix LinearEncoding (#22439)<commit_after><|endoftext|>


<commit_before>'use strict';
function displayAvailChart(bikeArray, dockArray) {
  console.log('displaying bike availability chart');
  var bikectx = document.getElementById('chart-bikeavail').getContext('2d');
  var bikeAvailChart = new Chart(bikectx, {
    type: 'line',
    data: {
      labels: bikeArray, //TODO: this needs to be an array of labels; either figure out how to disable this or figure something out instead of reusing
      datasets: [{
        label: 'Avg. Weekly Bike Availability',
        fill: false,
        lineTension: 0.25,
        backgroundColor: 'rgba(220,180,0,0.4)',
        borderColor: 'rgba(220,180,0,1)',
        borderCapStyle: 'butt',
        borderDash: [],
        borderDashOffset: 0.0,
        borderJoinStyle: 'miter',
        pointBorderColor: 'rgba(220,180,0,1)',
        pointBackgroundColor: '#fff',
        pointBorderWidth: 1,
        pointHoverRadius: 5,
        pointHoverBackgroundColor: 'rgba(220,180,0,1)',
        pointHoverBorderColor: 'rgba(220,180,0,1)',
        pointHoverBorderWidth: 2,
        pointRadius: 1,
        pointHitRadius: 10,
        data: bikeArray,
      },{
        label: 'Avg. Weekly Dock Availability',
        fill: false,
        lineTension: 0.25,
        backgroundColor: 'rgba(75,192,192,0.4)',
        borderColor: 'rgba(75,192,192,1)',
        borderCapStyle: 'butt',
        borderDash: [],
        borderDashOffset: 0.0,
        borderJoinStyle: 'miter',
        pointBorderColor: 'rgba(75,192,192,1)',
        pointBackgroundColor: '#fff',
        pointBorderWidth: 1,
        pointHoverRadius: 5,
        pointHoverBackgroundColor: 'rgba(75,192,192,1)',
        pointHoverBorderColor: 'rgba(220,220,220,1)',
        pointHoverBorderWidth: 2,
        pointRadius: 1,
        pointHitRadius: 10,
        data: dockArray,
      }]
    },
    options: {
      scales: {
        xAxes: [{
          ticks: {
            display: false
          }
        }],
        yAxes: [{
          ticks: {
            max: 20,
            min: 0,
            stepSize: 1,
            beginAtZero:true
          }
        }]
      }
    }
  });
};
<commit_msg>makes chart responsive<commit_after>'use strict';
function displayAvailChart(bikeArray, dockArray) {
  console.log('displaying bike availability chart');
  var bikectx = document.getElementById('chart-bikeavail').getContext('2d');
  var bikeAvailChart = new Chart(bikectx, {
    type: 'line',
    responsive: true,
    maintainAspectRatio: false,
    data: {
      labels: bikeArray, //TODO: this needs to be an array of labels; either figure out how to disable this or figure something out instead of reusing
      datasets: [{
        label: 'Avg. Weekly Bike Availability',
        fill: false,
        lineTension: 0.25,
        backgroundColor: 'rgba(220,180,0,0.4)',
        borderColor: 'rgba(220,180,0,1)',
        borderCapStyle: 'butt',
        borderDash: [],
        borderDashOffset: 0.0,
        borderJoinStyle: 'miter',
        pointBorderColor: 'rgba(220,180,0,1)',
        pointBackgroundColor: '#fff',
        pointBorderWidth: 1,
        pointHoverRadius: 5,
        pointHoverBackgroundColor: 'rgba(220,180,0,1)',
        pointHoverBorderColor: 'rgba(220,180,0,1)',
        pointHoverBorderWidth: 2,
        pointRadius: 1,
        pointHitRadius: 10,
        data: bikeArray,
      },{
        label: 'Avg. Weekly Dock Availability',
        fill: false,
        lineTension: 0.25,
        backgroundColor: 'rgba(75,192,192,0.4)',
        borderColor: 'rgba(75,192,192,1)',
        borderCapStyle: 'butt',
        borderDash: [],
        borderDashOffset: 0.0,
        borderJoinStyle: 'miter',
        pointBorderColor: 'rgba(75,192,192,1)',
        pointBackgroundColor: '#fff',
        pointBorderWidth: 1,
        pointHoverRadius: 5,
        pointHoverBackgroundColor: 'rgba(75,192,192,1)',
        pointHoverBorderColor: 'rgba(220,220,220,1)',
        pointHoverBorderWidth: 2,
        pointRadius: 1,
        pointHitRadius: 10,
        data: dockArray,
      }]
    },
    options: {
      scales: {
        xAxes: [{
          ticks: {
            display: false
          }
        }],
        yAxes: [{
          ticks: {
            max: 20,
            min: 0,
            stepSize: 1,
            beginAtZero:true
          }
        }]
      }
    }
  });
};
<|endoftext|>


<commit_before>import React from 'react';
import PropTypes from 'prop-types';

// Components
import Select from 'components/form/SelectInput';
import Input from 'components/form/Input';
import Field from 'components/form/Field';

class SubscriptionSelector extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      selectedDataset: null,
      selectedType: null,
      selectedThreshold: 1,
      index: props.index,
      typeOptions: []
    };

    // ----------------- BINDINGS -----------------------
    this.handleDatasetSelected = this.handleDatasetSelected.bind(this);
    this.handleTypeSelected = this.handleTypeSelected.bind(this);
    this.handleThresholdChange = this.handleThresholdChange.bind(this);
    this.handleRemove = this.handleRemove.bind(this);
  }

  componentWillReceiveProps(newProps) {
    if (newProps.data) {
      const { selectedDataset, selectedType, selectedThreshold, index } = newProps.data;
      const typeOptions = selectedDataset ?
        Object.keys(
          newProps.datasets.find(val => val.id === selectedDataset).attributes.subscribable)
          .map(val => ({ value: val, label: val }))
        : [];
      this.setState({
        selectedDataset,
        selectedType,
        selectedThreshold,
        index,
        typeOptions
      });
    }
  }

  handleDatasetSelected(value) {
    const { datasets } = this.props;

    const typeOptions = value ?
      Object.keys(
        datasets.find(val => val.id === value).attributes.subscribable)
        .map(val => ({ value: val, label: val }))
      : [];

    if (!this.state.selectedType) {
      this.setState({
        selectedDataset: value,
        selectedType: typeOptions[0].value,
        typeOptions
      },
      () => this.props.onUpdate(this.state));
    } else {
      this.setState({
        selectedDataset: value,
        typeOptions
      },
      () => this.props.onUpdate(this.state));
    }
  }

  handleTypeSelected(type) {
    this.setState({ selectedType: type },
      () => this.props.onUpdate(this.state));
  }

  handleThresholdChange(threshold) {
    let newThreshold = threshold;
    if (threshold <= 0) {
      newThreshold = 1;
    }
    this.setState({ selectedThreshold: newThreshold },
      () => this.props.onUpdate(this.state));
  }

  handleRemove() {
    this.props.onRemove(this.props.index);
  }

  render() {
    const { datasets } = this.props;
    const { selectedDataset, selectedType, selectedThreshold, typeOptions } = this.state;

    const datasetOptions = (datasets.length > 0) ?
      datasets.map(val => ({ label: val.attributes.metadata[0] && val.attributes.metadata[0].attributes.info ? val.attributes.metadata[0].attributes.info.name : val.attributes.name, value: val.id, id: val.id }))
      : [];

    return (

 { this.el = node; }}>
        <Select
          className="dataset-select"
          properties={{
            name: 'dataset',
            value: selectedDataset,
            default: selectedDataset,
            placeholder: 'Select a dataset'
          }}
          options={datasetOptions}
          onChange={this.handleDatasetSelected}
        />
        <Select
          properties={{
            name: 'type',
            value: selectedType,
            default: selectedType,
            placeholder: 'Select a type',
            className: 'type-select'
          }}
          options={typeOptions}
          onChange={this.handleTypeSelected}
        />

          Threshold  ≥
          <Field
            className="threshold-input"
            onChange={this.handleThresholdChange}
            properties={{
              name: 'threshold',
              type: 'number',
              default: selectedThreshold,
              value: selectedThreshold
            }}
          >
            {Input}
          </Field>

        <button
          className="c-btn -b"
          onClick={() => this.props.onRemove(this.props.index)}
        >
          Delete
        </button>

    );
  }
}

SubscriptionSelector.propTypes = {
  datasets: PropTypes.array.isRequired,
  index: PropTypes.number,
  data: PropTypes.object,
  // CALLBACKS
  onRemove: PropTypes.func.isRequired,
  onUpdate: PropTypes.func.isRequired
};

export default SubscriptionSelector;
<commit_msg>sort dataset options alphabetically<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import sortBy from 'lodash/sortBy';

// Components
import Select from 'components/form/SelectInput';
import Input from 'components/form/Input';
import Field from 'components/form/Field';

class SubscriptionSelector extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      selectedDataset: null,
      selectedType: null,
      selectedThreshold: 1,
      index: props.index,
      typeOptions: []
    };

    // ----------------- BINDINGS -----------------------
    this.handleDatasetSelected = this.handleDatasetSelected.bind(this);
    this.handleTypeSelected = this.handleTypeSelected.bind(this);
    this.handleThresholdChange = this.handleThresholdChange.bind(this);
    this.handleRemove = this.handleRemove.bind(this);
  }

  componentWillReceiveProps(newProps) {
    if (newProps.data) {
      const { selectedDataset, selectedType, selectedThreshold, index } = newProps.data;
      const typeOptions = selectedDataset ?
        Object.keys(
          newProps.datasets.find(val => val.id === selectedDataset).attributes.subscribable)
          .map(val => ({ value: val, label: val }))
        : [];
      this.setState({
        selectedDataset,
        selectedType,
        selectedThreshold,
        index,
        typeOptions
      });
    }
  }

  handleDatasetSelected(value) {
    const { datasets } = this.props;

    const typeOptions = value ?
      Object.keys(
        datasets.find(val => val.id === value).attributes.subscribable)
        .map(val => ({ value: val, label: val }))
      : [];

    if (!this.state.selectedType) {
      this.setState({
        selectedDataset: value,
        selectedType: typeOptions[0].value,
        typeOptions
      },
      () => this.props.onUpdate(this.state));
    } else {
      this.setState({
        selectedDataset: value,
        typeOptions
      },
      () => this.props.onUpdate(this.state));
    }
  }

  handleTypeSelected(type) {
    this.setState({ selectedType: type },
      () => this.props.onUpdate(this.state));
  }

  handleThresholdChange(threshold) {
    let newThreshold = threshold;
    if (threshold <= 0) {
      newThreshold = 1;
    }
    this.setState({ selectedThreshold: newThreshold },
      () => this.props.onUpdate(this.state));
  }

  handleRemove() {
    this.props.onRemove(this.props.index);
  }

  render() {
    const { datasets } = this.props;
    const { selectedDataset, selectedType, selectedThreshold, typeOptions } = this.state;

    const datasetOptions = (datasets.length > 0) ?
      datasets.map(val => ({
        label: val.attributes.metadata[0] && val.attributes.metadata[0].attributes.info ?
          val.attributes.metadata[0].attributes.info.name : val.attributes.name,
        value: val.id,
        id: val.id
      }))
      : [];
    const sortedDatasetOptions = sortBy(datasetOptions, d => d.label);

    return (

 { this.el = node; }}>
        <Select
          className="dataset-select"
          properties={{
            name: 'dataset',
            value: selectedDataset,
            default: selectedDataset,
            placeholder: 'Select a dataset'
          }}
          options={sortedDatasetOptions}
          onChange={this.handleDatasetSelected}
        />
        <Select
          properties={{
            name: 'type',
            value: selectedType,
            default: selectedType,
            placeholder: 'Select a type',
            className: 'type-select'
          }}
          options={typeOptions}
          onChange={this.handleTypeSelected}
        />

          Threshold  ≥
          <Field
            className="threshold-input"
            onChange={this.handleThresholdChange}
            properties={{
              name: 'threshold',
              type: 'number',
              default: selectedThreshold,
              value: selectedThreshold
            }}
          >
            {Input}
          </Field>

        <button
          className="c-btn -b"
          onClick={() => this.props.onRemove(this.props.index)}
        >
          Delete
        </button>

    );
  }
}

SubscriptionSelector.propTypes = {
  datasets: PropTypes.array.isRequired,
  index: PropTypes.number,
  data: PropTypes.object,
  // CALLBACKS
  onRemove: PropTypes.func.isRequired,
  onUpdate: PropTypes.func.isRequired
};

export default SubscriptionSelector;
<|endoftext|>


<commit_before>Ext.ns("org.systemsbiology.addama.js");

org.systemsbiology.addama.js.Viewport = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.Viewport.superclass.constructor.call(this);

        this.drawViewport();
    },

    drawViewport: function() {
        var addamaBanner = Ext.DomHelper.append(Ext.getBody(), '

', true);
        var appengineLogo = Ext.DomHelper.append(Ext.getBody(), '

', true);
        var link1 = Ext.DomHelper.append(Ext.getBody(), '
API Keys
', true);
        var link2 = Ext.DomHelper.append(Ext.getBody(), '
Addama Open Source Project
', true);
        var link3 = Ext.DomHelper.append(Ext.getBody(), '
Institute for Systems Biology
', true);
        var link4 = Ext.DomHelper.append(Ext.getBody(), '
Shmulevich Lab
', true);
        var link5 = Ext.DomHelper.append(Ext.getBody(), '
Code for Systems Biology
', true);
        var link6 = Ext.DomHelper.append(Ext.getBody(), '
PMID 19265554
', true);

        var headerPanel = new Ext.Panel({
            region: "north",
            border: false,
            frame: false,
            layout: "border",
            height: 99,
            defaults: { border: false, frame: false },
            items:[
                { contentEl: this.topbarEl, region: "north", height: 30 },
                { contentEl: addamaBanner.id, region: "center" },
                { contentEl: appengineLogo.id, region: "east", width: 130 }
            ]
        });

        if (this.tabs && this.tabs.length) {
            var firstTab = this.tabs[0];
            if (firstTab && !firstTab.title) {
                firstTab.title = "Main";
            }
            Ext.each(this.tabs, function(tab) {
                if (tab && !tab.title) {
                    tab.title = "...";
                }
            });
            if (this.activateAjaxMonitor) {
                var ajaxMonitor = new org.systemsbiology.addama.js.AjaxMonitor();
                this.tabs.push(ajaxMonitor.gridPanel);
            }
        }

        var tabPanel = new Ext.TabPanel({
            region: "center",
            items: this.tabs,
            activeTab: 0,
            border: true,
            margins: "5 5 5 5",
            padding: "5 5 5 5"
        });

        var footerPanel = new Ext.Panel({
            region:"south",
            height: 33,
            layout: "hbox",
            border: false,
            frame: true,
            padding: "1 1 1 1",
            margins: "1 1 1 1",
            layoutConfig: { pack: "center", align: "middle", defaultMargins: "0 10 0 0" },
            items:[ link1.dom, link2.dom, link3.dom, link4.dom, link5.dom, link6.dom ]
        });

        new Ext.Viewport({
            layout:'border',
            items:[ headerPanel, tabPanel, footerPanel ]
        });
    }
});

org.systemsbiology.addama.js.AjaxMonitor = Ext.extend(Object, {
    SEQUENCE_ID: 1,
    GRID_DATA: [],

    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AjaxMonitor.superclass.constructor.call(this);

        this.createGrid();
        Ext.Ajax.on('requestcomplete', this.addResponseToGrid, this);
    },

    createGrid: function() {
        this.store = new Ext.data.JsonStore({
            storeId: "store-ajax-monitor",
            root: "responses",
            idProperty: "id",
            sortInfo: {field: "id", direction: "DESC"},
            fields: [
                { name: "id", type: "int"},
                { name: "method" },
                { name: "uri" },
                { name: "statusCode" },
                { name: "statusText" },
                { name: "responseText" },
                { name: "isJson", type: "boolean" }
            ]
        });

        this.gridPanel = new Ext.grid.GridPanel({
            region: "center",
            store: this.store,
            columns: [
                { header: "ID", width: 50, dataIndex: 'id', type: "int", sortable: true, hidden: true },
                { header: "Method", width: 75, dataIndex: 'method' },
                { header: "URI", width: 400, dataIndex: 'uri', sortable: true },
                { header: "Status Code", width: 75, dataIndex: 'statusCode', sortable: true },
                { header: "Status Text", width: 100, dataIndex: 'statusText' },
                { header: "Response Text", width: 300, dataIndex: 'responseText', hidden: true }
            ],
            stripeRows: true,
            columnLines: true,
            frame:true,
            title: "Requests",
            collapsible: false,
            animCollapse: false,
            iconCls: 'icon-grid'
        });
        this.gridPanel.on("rowclick", this.showResponseContent, this);
    },

    addResponseToGrid: function(connection, response, options) {
        var contentType = response.getResponseHeader("Content-Type");
        var isJson = (contentType != undefined && contentType.indexOf("ation/json") > 0);

        var newData = {
            id:this.incrementedId(),
            method: options.method,
            uri: options.url,
            statusCode: response.status,
            statusText: response.statusText,
            responseText: response.responseText,
            isJson: isJson
        };
        this.GRID_DATA.push(newData);
        this.store.loadData({responses:this.GRID_DATA});
    },

    showResponseContent: function(g, rowIndex, e) {
        var data = this.store.getAt(rowIndex).data;
        var responseText = data.responseText;
        if (data.isJson) {
            var json = Ext.util.JSON.decode(responseText);
            var stringify = JSON.stringify(json, null, "\u00a0\u00a0\u00a0\u00a0");
            responseText = Ext.util.Format.nl2br(stringify);
        }

        new Ext.Window({
            width:800,
            height:400,
            autoScroll: true,
            modal: true,
            title: "Response Content",
            html: responseText
        }).show();
    },

    incrementedId: function() {
        return this.SEQUENCE_ID++;
    }

});

org.systemsbiology.addama.js.AppsPanel = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AppsPanel.superclass.constructor.call(this);

        Ext.Ajax.request({
            url: "/addama/apps",
            method: "GET",
            success: function(o) {
                var json = Ext.util.JSON.decode(o.responseText);
                if (json && json.items) {
                    var html = "";
                    Ext.each(json.items, function(item) {
                        html += "
" + item.label + "
";
                    });
                    Ext.DomHelper(this.contentEl, "
" + html + "
");
                }
            },
            scope: this
        });

    }
});

org.systemsbiology.addama.js.ServicesPanel = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.ServicesPanel.superclass.constructor.call(this);

        Ext.Ajax.request({
            url: "/addama/services",
            method: "GET",
            success: function(o) {
                var json = Ext.util.JSON.decode(o.responseText);
                if (json && json.items) {
                    var html = "";
                    Ext.each(json.items, function(item) {
                        html += "
" + item.label + ":" + item.url + "
";
                    });
                    Ext.DomHelper(this.contentEl, "
" + html + "
");
                }
            },
            scope: this
        });

    }
});
<commit_msg>fixing domhelper append<commit_after>Ext.ns("org.systemsbiology.addama.js");

org.systemsbiology.addama.js.Viewport = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.Viewport.superclass.constructor.call(this);

        this.drawViewport();
    },

    drawViewport: function() {
        var addamaBanner = Ext.DomHelper.append(Ext.getBody(), '

', true);
        var appengineLogo = Ext.DomHelper.append(Ext.getBody(), '

', true);
        var link1 = Ext.DomHelper.append(Ext.getBody(), '
API Keys
', true);
        var link2 = Ext.DomHelper.append(Ext.getBody(), '
Addama Open Source Project
', true);
        var link3 = Ext.DomHelper.append(Ext.getBody(), '
Institute for Systems Biology
', true);
        var link4 = Ext.DomHelper.append(Ext.getBody(), '
Shmulevich Lab
', true);
        var link5 = Ext.DomHelper.append(Ext.getBody(), '
Code for Systems Biology
', true);
        var link6 = Ext.DomHelper.append(Ext.getBody(), '
PMID 19265554
', true);

        var headerPanel = new Ext.Panel({
            region: "north",
            border: false,
            frame: false,
            layout: "border",
            height: 99,
            defaults: { border: false, frame: false },
            items:[
                { contentEl: this.topbarEl, region: "north", height: 30 },
                { contentEl: addamaBanner.id, region: "center" },
                { contentEl: appengineLogo.id, region: "east", width: 130 }
            ]
        });

        if (this.tabs && this.tabs.length) {
            var firstTab = this.tabs[0];
            if (firstTab && !firstTab.title) {
                firstTab.title = "Main";
            }
            Ext.each(this.tabs, function(tab) {
                if (tab && !tab.title) {
                    tab.title = "...";
                }
            });
            if (this.activateAjaxMonitor) {
                var ajaxMonitor = new org.systemsbiology.addama.js.AjaxMonitor();
                this.tabs.push(ajaxMonitor.gridPanel);
            }
        }

        var tabPanel = new Ext.TabPanel({
            region: "center",
            items: this.tabs,
            activeTab: 0,
            border: true,
            margins: "5 5 5 5",
            padding: "5 5 5 5"
        });

        var footerPanel = new Ext.Panel({
            region:"south",
            height: 33,
            layout: "hbox",
            border: false,
            frame: true,
            padding: "1 1 1 1",
            margins: "1 1 1 1",
            layoutConfig: { pack: "center", align: "middle", defaultMargins: "0 10 0 0" },
            items:[ link1.dom, link2.dom, link3.dom, link4.dom, link5.dom, link6.dom ]
        });

        new Ext.Viewport({
            layout:'border',
            items:[ headerPanel, tabPanel, footerPanel ]
        });
    }
});

org.systemsbiology.addama.js.AjaxMonitor = Ext.extend(Object, {
    SEQUENCE_ID: 1,
    GRID_DATA: [],

    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AjaxMonitor.superclass.constructor.call(this);

        this.createGrid();
        Ext.Ajax.on('requestcomplete', this.addResponseToGrid, this);
    },

    createGrid: function() {
        this.store = new Ext.data.JsonStore({
            storeId: "store-ajax-monitor",
            root: "responses",
            idProperty: "id",
            sortInfo: {field: "id", direction: "DESC"},
            fields: [
                { name: "id", type: "int"},
                { name: "method" },
                { name: "uri" },
                { name: "statusCode" },
                { name: "statusText" },
                { name: "responseText" },
                { name: "isJson", type: "boolean" }
            ]
        });

        this.gridPanel = new Ext.grid.GridPanel({
            region: "center",
            store: this.store,
            columns: [
                { header: "ID", width: 50, dataIndex: 'id', type: "int", sortable: true, hidden: true },
                { header: "Method", width: 75, dataIndex: 'method' },
                { header: "URI", width: 400, dataIndex: 'uri', sortable: true },
                { header: "Status Code", width: 75, dataIndex: 'statusCode', sortable: true },
                { header: "Status Text", width: 100, dataIndex: 'statusText' },
                { header: "Response Text", width: 300, dataIndex: 'responseText', hidden: true }
            ],
            stripeRows: true,
            columnLines: true,
            frame:true,
            title: "Requests",
            collapsible: false,
            animCollapse: false,
            iconCls: 'icon-grid'
        });
        this.gridPanel.on("rowclick", this.showResponseContent, this);
    },

    addResponseToGrid: function(connection, response, options) {
        var contentType = response.getResponseHeader("Content-Type");
        var isJson = (contentType != undefined && contentType.indexOf("ation/json") > 0);

        var newData = {
            id:this.incrementedId(),
            method: options.method,
            uri: options.url,
            statusCode: response.status,
            statusText: response.statusText,
            responseText: response.responseText,
            isJson: isJson
        };
        this.GRID_DATA.push(newData);
        this.store.loadData({responses:this.GRID_DATA});
    },

    showResponseContent: function(g, rowIndex, e) {
        var data = this.store.getAt(rowIndex).data;
        var responseText = data.responseText;
        if (data.isJson) {
            var json = Ext.util.JSON.decode(responseText);
            var stringify = JSON.stringify(json, null, "\u00a0\u00a0\u00a0\u00a0");
            responseText = Ext.util.Format.nl2br(stringify);
        }

        new Ext.Window({
            width:800,
            height:400,
            autoScroll: true,
            modal: true,
            title: "Response Content",
            html: responseText
        }).show();
    },

    incrementedId: function() {
        return this.SEQUENCE_ID++;
    }

});

org.systemsbiology.addama.js.AppsPanel = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.AppsPanel.superclass.constructor.call(this);

        Ext.Ajax.request({
            url: "/addama/apps",
            method: "GET",
            success: function(o) {
                var json = Ext.util.JSON.decode(o.responseText);
                if (json && json.items) {
                    var html = "";
                    Ext.each(json.items, function(item) {
                        html += "
" + item.label + "
";
                    });
                    Ext.DomHelper.append(Ext.get(this.contentEl), "
" + html + "
");
                }
            },
            scope: this
        });

    }
});

org.systemsbiology.addama.js.ServicesPanel = Ext.extend(Object, {
    constructor: function(config) {
        Ext.apply(this, config);

        org.systemsbiology.addama.js.ServicesPanel.superclass.constructor.call(this);

        Ext.Ajax.request({
            url: "/addama/services",
            method: "GET",
            success: function(o) {
                var json = Ext.util.JSON.decode(o.responseText);
                if (json && json.items) {
                    var html = "";
                    Ext.each(json.items, function(item) {
                        html += "
" + item.label + ":" + item.url + "
";
                    });
                    Ext.DomHelper.append(Ext.get(this.contentEl), "
" + html + "
");
                }
            },
            scope: this
        });

    }
});
<|endoftext|>


<commit_before><commit_msg>Fix MUWM-3801<commit_after><|endoftext|>


<commit_before>exports.data = [
        {
            id: 1,
            name: 'Joao'
        }
    ];
<commit_msg>SZ-N Adds one more player to game<commit_after>exports.data = [
        {
            id: 1,
            name: 'Player 1',
            cards: [
                { cardNumber : 1 },
                { cardNumber : 52 },
                { cardNumber : 26 }
            ]
            ncards: 3
        },
        {
            id: 2,
            name: 'Player 2',
            cards: [],
            ncards: 2
        }
    ];
<|endoftext|>


<commit_before>/**
 * Created with JetBrains RubyMine.
 * User: i061485
 * Date: 2/13/13
 * Time: 4:50 PM
 * To change this template use File | Settings | File Templates.
 */

define([
    'config/application',
    'config/workspace',
    'config/page',
    'config/template',
    'config/layout',
    'config/widget'
], function definePermissions(Application, Workspace, Page, Template, Layout, Widget) {

    /**
     * Define Application Global permission
     * @type {*}
     */
    Application.prototype.globalPermissions = {
        development: {
            activateDebugger: true,
            deactivateDebugger: true
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Workspace Global permission
     * @type {{}}
     */
    Workspace.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Page Global permission
     * @type {{}}
     */
    Page.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Template Global permission
     * @type {{}}
     */
    Template.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Layout Global permission
     * @type {{}}
     */
    Layout.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Widget Global permission
     * @type {{
     *      development: {draggable: boolean, resizable: boolean},
     *      authorize: {draggable: boolean, resizable: boolean},
     *      consumption: {draggable: boolean, resizable: boolean},
     *      test: {draggable: boolean, resizable: boolean}
     * }}
     */
    Widget.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }

    };

});<commit_msg>remove debugger<commit_after>/**
 * Created with JetBrains RubyMine.
 * User: i061485
 * Date: 2/13/13
 * Time: 4:50 PM
 * To change this template use File | Settings | File Templates.
 */

define([
    'config/application',
    'config/workspace',
    'config/page',
    'config/template',
    'config/layout',
    'config/widget'
], function definePermissions(Application, Workspace, Page, Template, Layout, Widget) {

    /**
     * Define Application Global permission
     * @type {*}
     */
    Application.prototype.globalPermissions = {
        development: {
            activateDebugger: false,
            deactivateDebugger: true
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Workspace Global permission
     * @type {{}}
     */
    Workspace.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Page Global permission
     * @type {{}}
     */
    Page.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Template Global permission
     * @type {{}}
     */
    Template.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Layout Global permission
     * @type {{}}
     */
    Layout.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }
    };

    /**
     * Define Widget Global permission
     * @type {{
     *      development: {draggable: boolean, resizable: boolean},
     *      authorize: {draggable: boolean, resizable: boolean},
     *      consumption: {draggable: boolean, resizable: boolean},
     *      test: {draggable: boolean, resizable: boolean}
     * }}
     */
    Widget.prototype.globalPermissions = {
        development: {
        },
        authorize: {
        },
        consumption: {
        },
        test: {
        }

    };

});<|endoftext|>


<commit_before>// View on GitHub: https://github.com/xPaw/CF-ABetterBrowser

CloudFlare.define( 'abetterbrowser', [ 'cloudflare/dom', 'cloudflare/user', 'abetterbrowser/config' ], function( version, user, config )
{
	"use strict";

	version = version.internetExplorer;
	var maxVersion = parseInt( config.ie, 10 ) || 7;

	/**
	 * Is user using IE? Is it old?
	 */
	if( version === undefined || version > maxVersion )
	{
		return true;
	}

	/**
	 * Did user close this message already?
	 */
	if( user.getCookie( 'cfapp_abetterbrowser' ) === 1 )
	{
		return true;
	}

	/**
	 * Let's collect some referral statistics with link shortener service
	 */
	var moreInformationLink = 'http://goo.gl/OVoHF',

	/**
	 * Translations
	 */
	translations =
	{
		'en': 'You are using an outdated browser. More information »',
		'ru': 'Вы используете устаревший браузер. Подробнее »',
		'fr': 'Votre navigateur n\'est pas à jour. Plus d\'information »',
		'da': 'Du bruger en ældre browser. Mere information »',
		'de': 'Sie benutzen einen veralteten Browser. Mehr Informationen »',
		'ja': 'あなたは、時代遅れのブラウザを使用しています。詳細情報 »',
		'fa': 'شما از مرورگری قدیمی استفاده می کنید. »اطلاعات بیشتر',
		'tr': 'Çok eski bir tarayıcı kullanıyorsunuz. Daha fazla bilgi »',
		'pt': 'Você está usando um navegador antigo. Mais informações »',
		'pl': 'Używasz przestarzałej przeglądarki. Więcej informacji »',
		'fi': 'Käytät vanhentunutta selainta. Lisää tietoa »',
		'zh': '您的浏览器版本过旧。 更多信息 »',
		'es': 'Esta usando un navegador desactualizado. Más información »'
	},

	/**
	 * Style rules
	 */
	rules =
		'#cloudflare-old-browser {' +
			'background:#45484d;' +
			'position:absolute;' +
			'z-index:100000;' +
			'width:100%;' +
			'height:26px;' +
			'top:0;' +
			'left:0;' +
			'overflow:hidden;' +
			'padding:8px 0;' +
			'font:18px/26px Arial,sans-serif;' +
			'text-align:center;' +
			'color:#FFF' +
		'}' +

		'#cloudflare-old-browser a {' +
			'text-decoration:underline;' +
			'color:#EBEBF4' +
		'}' +

		'#cloudflare-old-browser a:hover, #cloudflare-old-browser a:active {' +
			'text-decoration:none;' +
			'color:#DBDBEB' +
		'}' +

		'#cloudflare-old-browser-close {' +
			'background:#393b40;' +
			'display:block;' +
			'width:42px;' +
			'height:42px;' +
			'position:absolute;' +
			'text-decoration:none !important;' +
			'cursor:pointer;' +
			'top:0;' +
			'right:0;' +
			'font-size:30px;' +
			'line-height:42px' +
		'}' +

		'#cloudflare-old-browser-close:hover {' +
			'background:#E04343;' +
			'color:#FFF' +
		'}',

	/**
	 * Injects style rules into the document to handle formatting
	 */
	style = document.createElement( 'style' );
	style.id = 'cloudflare-abetterbrowser';
	style.setAttribute( 'type', 'text/css' );

	if( style.styleSheet )
	{
		style.styleSheet.cssText = rules;
	}
	else
	{
		style.appendChild( document.createTextNode( rules ) );
	}

	var head = document.getElementsByTagName( 'head' )[ 0 ];
	var firstChild = head.firstChild;
	head.insertBefore( style, firstChild );

	/**
	 * Detect user's browser language
	 *
	 * This is aimed at IE, so we don't try to get navigator.language
	 */
	var language    = window.navigator.browserLanguage || window.navigator.userLanguage || 'en',
		translation = translations[ language.substring( 0, 2 ) ] || translations.en;

	/**
	 * Create our message
	 */
	var message = document.createElement( 'div' );
	message.id = 'cloudflare-old-browser';
	message.innerHTML = translation;

	/**
	 * Create close button
	 */
	var closeButton = document.createElement( 'a' );
	closeButton.id = 'cloudflare-old-browser-close';
	closeButton.innerHTML = '×';

	message.appendChild( closeButton );

	closeButton.onclick = function( )
	{
		document.body.removeChild( message );
		document.body.className = document.body.className.replace( new RegExp( '(\\s|^)cloudflare-old-browser-body(\\s|$)' ), '' );

		/**
		 * Hide message for 7 days
		 */
		user.getCookie( 'cfapp_abetterbrowser', 1, 7 );

		return false;
	};

	/**
	 * Injects our message into the body
	 */
	document.body.appendChild( message );
	document.body.className += ' cloudflare-old-browser-body';
} );
<commit_msg>Added Dutch translation<commit_after>// View on GitHub: https://github.com/xPaw/CF-ABetterBrowser

CloudFlare.define( 'abetterbrowser', [ 'cloudflare/dom', 'cloudflare/user', 'abetterbrowser/config' ], function( version, user, config )
{
	"use strict";

	version = version.internetExplorer;
	var maxVersion = parseInt( config.ie, 10 ) || 7;

	/**
	 * Is user using IE? Is it old?
	 */
	if( version === undefined || version > maxVersion )
	{
		return true;
	}

	/**
	 * Did user close this message already?
	 */
	if( user.getCookie( 'cfapp_abetterbrowser' ) === 1 )
	{
		return true;
	}

	/**
	 * Let's collect some referral statistics with link shortener service
	 */
	var moreInformationLink = 'http://goo.gl/OVoHF',

	/**
	 * Translations
	 */
	translations =
	{
		'en': 'You are using an outdated browser. More information »',
		'ru': 'Вы используете устаревший браузер. Подробнее »',
		'fr': 'Votre navigateur n\'est pas à jour. Plus d\'information »',
		'da': 'Du bruger en ældre browser. Mere information »',
		'de': 'Sie benutzen einen veralteten Browser. Mehr Informationen »',
		'ja': 'あなたは、時代遅れのブラウザを使用しています。詳細情報 »',
		'fa': 'شما از مرورگری قدیمی استفاده می کنید. »اطلاعات بیشتر',
		'tr': 'Çok eski bir tarayıcı kullanıyorsunuz. Daha fazla bilgi »',
		'pt': 'Você está usando um navegador antigo. Mais informações »',
		'pl': 'Używasz przestarzałej przeglądarki. Więcej informacji »',
		'fi': 'Käytät vanhentunutta selainta. Lisää tietoa »',
		'zh': '您的浏览器版本过旧。 更多信息 »',
		'es': 'Esta usando un navegador desactualizado. Más información »',
		'nl': 'U gebruikt op dit moment een verouderde webbrowser. Meer informatie »'
	},

	/**
	 * Style rules
	 */
	rules =
		'#cloudflare-old-browser {' +
			'background:#45484d;' +
			'position:absolute;' +
			'z-index:100000;' +
			'width:100%;' +
			'height:26px;' +
			'top:0;' +
			'left:0;' +
			'overflow:hidden;' +
			'padding:8px 0;' +
			'font:18px/26px Arial,sans-serif;' +
			'text-align:center;' +
			'color:#FFF' +
		'}' +

		'#cloudflare-old-browser a {' +
			'text-decoration:underline;' +
			'color:#EBEBF4' +
		'}' +

		'#cloudflare-old-browser a:hover, #cloudflare-old-browser a:active {' +
			'text-decoration:none;' +
			'color:#DBDBEB' +
		'}' +

		'#cloudflare-old-browser-close {' +
			'background:#393b40;' +
			'display:block;' +
			'width:42px;' +
			'height:42px;' +
			'position:absolute;' +
			'text-decoration:none !important;' +
			'cursor:pointer;' +
			'top:0;' +
			'right:0;' +
			'font-size:30px;' +
			'line-height:42px' +
		'}' +

		'#cloudflare-old-browser-close:hover {' +
			'background:#E04343;' +
			'color:#FFF' +
		'}',

	/**
	 * Injects style rules into the document to handle formatting
	 */
	style = document.createElement( 'style' );
	style.id = 'cloudflare-abetterbrowser';
	style.setAttribute( 'type', 'text/css' );

	if( style.styleSheet )
	{
		style.styleSheet.cssText = rules;
	}
	else
	{
		style.appendChild( document.createTextNode( rules ) );
	}

	var head = document.getElementsByTagName( 'head' )[ 0 ];
	var firstChild = head.firstChild;
	head.insertBefore( style, firstChild );

	/**
	 * Detect user's browser language
	 *
	 * This is aimed at IE, so we don't try to get navigator.language
	 */
	var language    = window.navigator.browserLanguage || window.navigator.userLanguage || 'en',
		translation = translations[ language.substring( 0, 2 ) ] || translations.en;

	/**
	 * Create our message
	 */
	var message = document.createElement( 'div' );
	message.id = 'cloudflare-old-browser';
	message.innerHTML = translation;

	/**
	 * Create close button
	 */
	var closeButton = document.createElement( 'a' );
	closeButton.id = 'cloudflare-old-browser-close';
	closeButton.innerHTML = '×';

	message.appendChild( closeButton );

	closeButton.onclick = function( )
	{
		document.body.removeChild( message );
		document.body.className = document.body.className.replace( new RegExp( '(\\s|^)cloudflare-old-browser-body(\\s|$)' ), '' );

		/**
		 * Hide message for 7 days
		 */
		user.getCookie( 'cfapp_abetterbrowser', 1, 7 );

		return false;
	};

	/**
	 * Injects our message into the body
	 */
	document.body.appendChild( message );
	document.body.className += ' cloudflare-old-browser-body';
} );
<|endoftext|>


<commit_before><commit_msg>updated screenfull script file to fix fullscreen mode in chrome<commit_after><|endoftext|>


<commit_before>angular.module('blackjack')
.controller('ErrorCtrl', function($scope, $rootScope, $stateParams) {
  'use strict';
  $rootScope.pageTitle = 'Application Error Handler';
  $scope.errorMessage = $stateParams.err;

});
<commit_msg>Update ErrorCtrl.js<commit_after>angular.module('myapp')
.controller('ErrorCtrl', function($scope, $rootScope, $stateParams) {
  'use strict';
  $rootScope.pageTitle = 'Application Error Handler';
  $scope.errorMessage = $stateParams.err;

});
<|endoftext|>


<commit_before>const refreshDropdown      = require('@binary-com/binary-style').selectDropdown;
const BinaryPjax           = require('../../base/binary_pjax');
const Client               = require('../../base/client');
const BinarySocket         = require('../../base/socket');
const getDecimalPlaces     = require('../../common/currency').getDecimalPlaces;
const getNumberFormat      = require('../../common/currency').getNumberFormat;
const getPaWithdrawalLimit = require('../../common/currency').getPaWithdrawalLimit;
const getElementById       = require('../../../_common/common_functions.js').getElementById;
const FormManager          = require('../../common/form_manager');
const Validation           = require('../../common/form_validation');
const handleVerifyCode     = require('../../common/verification_code').handleVerifyCode;
const localize             = require('../../../_common/localize').localize;
const Url                  = require('../../../_common/url');
const isBinaryApp          = require('../../../config').isBinaryApp;

const PaymentAgentWithdraw = (() => {
    const view_ids  = {
        error  : '#viewError',
        notice : '#viewNotice',
        success: '#viewSuccess',
        confirm: '#viewConfirm',
        form   : '#viewForm',
    };
    const field_ids = {
        ddl_agents: '#ddlAgents',
        txt_agents: '#txtAgents',
        txt_amount: '#txtAmount',
    };

    let $agent_error,
        $ddl_agents,
        $txt_agents,
        $txt_amount,
        $views,
        agent_name,
        agent_website,
        agent_email,
        agent_telephone,
        currency,
        token,
        pa_list;

    // -----------------------
    // ----- Agents List -----
    // -----------------------
    const populateAgentsList = (response) => {
        $ddl_agents = $(field_ids.ddl_agents);
        $ddl_agents.empty();
        pa_list = (response.paymentagent_list || {}).list;
        if (pa_list.length > 0) {
            checkToken();
        } else {
            showPageError(localize('Payment Agent services are not available in your country or in your preferred currency.'));
        }
    };

    const checkToken = () => {
        token = token || Url.getHashValue('token');
        if (!token) {
            BinarySocket.send({ verify_email: Client.get('email'), type: 'paymentagent_withdraw' });
            if (isBinaryApp()) {
                handleVerifyCode((verification_code) => {
                    token = verification_code;
                    checkToken($ddl_agents);
                });
            } else {
                setActiveView(view_ids.notice);
            }
        } else if (!Validation.validEmailToken(token)) {
            showPageError('token_error');
        } else {
            insertListOption($ddl_agents, localize('Select payment agent'), '');
            for (let i = 0; i < pa_list.length; i++) {
                insertListOption($ddl_agents, pa_list[i].name, pa_list[i].paymentagent_loginid);
            }
            setActiveView(view_ids.form);

            const form_id = `#${$(view_ids.form).find('form').attr('id')}`;
            const $form   = $(form_id);

            const getAPILimit = limit => {
                const selected_val = getPALoginID();
                if (selected_val){
                    const selected_pa = pa_list.find(pa => pa.paymentagent_loginid === selected_val);
                    if (selected_pa) return selected_pa[`${limit}_withdrawal`];
                }
                return getPaWithdrawalLimit(currency, limit);
            };

            const min = () => getAPILimit('min');
            const max = () => getAPILimit('max');

            $agent_error = $('.row-agent').find('.error-msg');
            $txt_agents  = $(field_ids.txt_agents);
            $txt_amount  = $(field_ids.txt_amount);

            $form.find('.wrapper-row-agent').find('label').append($('', { text: '*', class: 'required_field_asterisk' }));
            $form.find('label[for="txtAmount"]').text(`${localize('Amount in')} ${currency}`);
            FormManager.init(form_id, [
                { selector: field_ids.txt_amount, validations: ['req', ['number', { type: 'float', decimals: getDecimalPlaces(currency), min, max }], ['custom', { func: () => +Client.get('balance') >= +$txt_amount.val(), message: localize('Insufficient balance.') }]], request_field: 'amount' },

                { request_field: 'currency',              value: currency },
                { request_field: 'paymentagent_loginid',  value: getPALoginID },
                { request_field: 'paymentagent_withdraw', value: 1 },
                { request_field: 'dry_run',               value: 1 },
            ], true);

            $ddl_agents.on('change', () => {
                $agent_error.setVisibility(0);
                if ($txt_agents.val()) {
                    $txt_agents.val('');
                }
                if (!$ddl_agents.val()) {
                    // error handling
                    $agent_error.setVisibility(1);
                }
                validateAmount();
            });

            $txt_agents.on('keyup', () => {
                $agent_error.setVisibility(0);
                if ($ddl_agents.val()) {
                    $ddl_agents.val('');
                    refreshDropdown(field_ids.ddl_agents);
                }
                if (!$txt_agents.val()) {
                    // error handling
                    $agent_error.setVisibility(1);
                }
            });

            $txt_agents.on('focusout', () => {
                validateAmount();
            });

            const validateAmount = () => {
                if ($txt_amount.val()) {
                    Validation.validate(form_id);
                }
            };

            FormManager.handleSubmit({
                form_selector       : form_id,
                fnc_response_handler: withdrawResponse,
                fnc_additional_check: checkAgent,
                enable_button       : true,
            });
        }
    };

    const getPALoginID = () => (
        $ddl_agents.val() || $txt_agents.val()
    );

    const insertListOption = ($ddl_object, item_text, item_value) => {
        $ddl_object.append($('<option/>', { value: item_value, text: item_text }));
    };

    const setAgentDetail = (id, html_value, href_value) => {
        getElementById(id).getElementsByTagName('a')[0].innerHTML = html_value;
        getElementById(id).getElementsByTagName('a')[0].href = href_value;
    };

    // ----------------------------
    // ----- Withdraw Process -----
    // ----------------------------
    const withdrawResponse = (response) => {
        const request = response.echo_req;
        switch (response.paymentagent_withdraw) {
            case 2: { // dry_run success: showing the confirmation page
                setActiveView(view_ids.confirm);

                $('#lblAgentName').text(agent_name);
                $('#lblCurrency').text(request.currency);
                $('#lblAmount').text(getNumberFormat(request.amount, request.currency));

                FormManager.init(view_ids.confirm, [
                    { request_field: 'paymentagent_loginid',  value: request.paymentagent_loginid },
                    { request_field: 'amount',                value: getNumberFormat(request.amount, request.currency) },
                    { request_field: 'currency',              value: request.currency },
                    { request_field: 'paymentagent_withdraw', value: 1 },
                ], true);

                FormManager.handleSubmit({
                    form_selector       : view_ids.confirm,
                    fnc_response_handler: withdrawResponse,
                });

                $(`${view_ids.confirm} #btnBack`).click(() => {
                    setActiveView(view_ids.form);
                });
                break;
            }
            case 1: // withdrawal success
                setActiveView(view_ids.success);
                $('#successMessage').css('display', '')
                    .attr('class', 'success-msg')
                    .html($('
', { class: 'checked' }).append($('
', { text: localize('Your request to withdraw [_1] [_2] from your account [_3] to Payment Agent [_4] account has been successfully processed.', [request.currency, getNumberFormat(request.amount, request.currency), Client.get('loginid'), agent_name]) })));

                // Set PA details.
                if (agent_name && agent_website && agent_email && agent_telephone) {
                    getElementById('agentName').innerHTML = agent_name;
                    setAgentDetail('agentWebsite', agent_website, agent_website);
                    setAgentDetail('agentEmail', agent_email, `mailto:${agent_email}`);
                    setAgentDetail('agentTelephone', agent_telephone, `tel:${agent_telephone}`);

                    getElementById('agentDetails').classList.remove('invisible');
                }
                break;
            default: // error
                if (response.echo_req.dry_run === 1) {
                    setActiveView(view_ids.form);
                    $('#withdrawFormMessage').setVisibility(1).html(response.error.message);
                } else if (response.error.code === 'InvalidToken') {
                    showPageError(localize('Your token has expired or is invalid. Please click [_1]here[_2] to restart the verification process.', ['', '']));
                } else {
                    showPageError(response.error.message);
                }
                break;
        }
    };

    // -----------------------------
    // ----- Message Functions -----
    // -----------------------------
    const showPageError = (err_msg, id) => {
        const $error = $(view_ids.error);
        $error.find(' > p').setVisibility(0);
        if (id) {
            $error.find(`#${id}`).setVisibility(1);
        } else {
            $error.find('#custom-error').html(err_msg).setVisibility(1);
        }
        setActiveView(view_ids.error);
    };

    // ----- View Control -----
    const setActiveView = (view_id) => {
        $views.setVisibility(0);
        $(view_id).setVisibility(1);
    };

    const onLoad = () => {
        if (!Client.get('currency')) {
            BinaryPjax.load(`${Url.urlFor('user/set-currency')}`);
            return;
        }
        BinarySocket.wait('get_account_status').then((data) => {
            $views = $('#paymentagent_withdrawal').find('.viewItem');
            $views.setVisibility(0);

            if (/(withdrawal|cashier)_locked/.test(data.get_account_status.status)) {
                showPageError('', 'withdrawal-locked-error');
            } else {
                currency = Client.get('currency');
                if (!currency || +Client.get('balance') === 0) {
                    showPageError(localize('Please [_1]deposit[_2] to your account.', [`<a href='${`${Url.urlFor('cashier/forwardws')}?action=deposit`}'>`, '']));
                    return;
                }
                BinarySocket.send({
                    paymentagent_list: Client.get('residence'),
                    currency,
                })
                    .then(response => populateAgentsList(response));
            }
        });
    };

    const checkAgent = () => {
        if (!$ddl_agents.val() && !$txt_agents.val()) {
            $agent_error.setVisibility(1);
            return false;
        }
        // else
        setAgentDetails();
        return true;
    };

    const setAgentDetails = () => {
        agent_name = $ddl_agents.val() ? $ddl_agents.find('option:selected').text() : $txt_agents.val();
        pa_list.map(pa => {
            if (pa.name === agent_name || pa.paymentagent_loginid === agent_name) {
                agent_website = pa.url;
                agent_email = pa.email;
                agent_telephone = pa.telephone;
            }
        });
    };

    const onUnload = () => {
        token = '';
    };

    return {
        onLoad,
        onUnload,
    };
})();

module.exports = PaymentAgentWithdraw;
<commit_msg>rearrange require statements<commit_after>const refreshDropdown      = require('@binary-com/binary-style').selectDropdown;
const BinaryPjax           = require('../../base/binary_pjax');
const Client               = require('../../base/client');
const BinarySocket         = require('../../base/socket');
const getDecimalPlaces     = require('../../common/currency').getDecimalPlaces;
const getNumberFormat      = require('../../common/currency').getNumberFormat;
const getPaWithdrawalLimit = require('../../common/currency').getPaWithdrawalLimit;
const FormManager          = require('../../common/form_manager');
const Validation           = require('../../common/form_validation');
const handleVerifyCode     = require('../../common/verification_code').handleVerifyCode;
const getElementById       = require('../../../_common/common_functions.js').getElementById;
const localize             = require('../../../_common/localize').localize;
const Url                  = require('../../../_common/url');
const isBinaryApp          = require('../../../config').isBinaryApp;

const PaymentAgentWithdraw = (() => {
    const view_ids  = {
        error  : '#viewError',
        notice : '#viewNotice',
        success: '#viewSuccess',
        confirm: '#viewConfirm',
        form   : '#viewForm',
    };
    const field_ids = {
        ddl_agents: '#ddlAgents',
        txt_agents: '#txtAgents',
        txt_amount: '#txtAmount',
    };

    let $agent_error,
        $ddl_agents,
        $txt_agents,
        $txt_amount,
        $views,
        agent_name,
        agent_website,
        agent_email,
        agent_telephone,
        currency,
        token,
        pa_list;

    // -----------------------
    // ----- Agents List -----
    // -----------------------
    const populateAgentsList = (response) => {
        $ddl_agents = $(field_ids.ddl_agents);
        $ddl_agents.empty();
        pa_list = (response.paymentagent_list || {}).list;
        if (pa_list.length > 0) {
            checkToken();
        } else {
            showPageError(localize('Payment Agent services are not available in your country or in your preferred currency.'));
        }
    };

    const checkToken = () => {
        token = token || Url.getHashValue('token');
        if (!token) {
            BinarySocket.send({ verify_email: Client.get('email'), type: 'paymentagent_withdraw' });
            if (isBinaryApp()) {
                handleVerifyCode((verification_code) => {
                    token = verification_code;
                    checkToken($ddl_agents);
                });
            } else {
                setActiveView(view_ids.notice);
            }
        } else if (!Validation.validEmailToken(token)) {
            showPageError('token_error');
        } else {
            insertListOption($ddl_agents, localize('Select payment agent'), '');
            for (let i = 0; i < pa_list.length; i++) {
                insertListOption($ddl_agents, pa_list[i].name, pa_list[i].paymentagent_loginid);
            }
            setActiveView(view_ids.form);

            const form_id = `#${$(view_ids.form).find('form').attr('id')}`;
            const $form   = $(form_id);

            const getAPILimit = limit => {
                const selected_val = getPALoginID();
                if (selected_val){
                    const selected_pa = pa_list.find(pa => pa.paymentagent_loginid === selected_val);
                    if (selected_pa) return selected_pa[`${limit}_withdrawal`];
                }
                return getPaWithdrawalLimit(currency, limit);
            };

            const min = () => getAPILimit('min');
            const max = () => getAPILimit('max');

            $agent_error = $('.row-agent').find('.error-msg');
            $txt_agents  = $(field_ids.txt_agents);
            $txt_amount  = $(field_ids.txt_amount);

            $form.find('.wrapper-row-agent').find('label').append($('', { text: '*', class: 'required_field_asterisk' }));
            $form.find('label[for="txtAmount"]').text(`${localize('Amount in')} ${currency}`);
            FormManager.init(form_id, [
                { selector: field_ids.txt_amount, validations: ['req', ['number', { type: 'float', decimals: getDecimalPlaces(currency), min, max }], ['custom', { func: () => +Client.get('balance') >= +$txt_amount.val(), message: localize('Insufficient balance.') }]], request_field: 'amount' },

                { request_field: 'currency',              value: currency },
                { request_field: 'paymentagent_loginid',  value: getPALoginID },
                { request_field: 'paymentagent_withdraw', value: 1 },
                { request_field: 'dry_run',               value: 1 },
            ], true);

            $ddl_agents.on('change', () => {
                $agent_error.setVisibility(0);
                if ($txt_agents.val()) {
                    $txt_agents.val('');
                }
                if (!$ddl_agents.val()) {
                    // error handling
                    $agent_error.setVisibility(1);
                }
                validateAmount();
            });

            $txt_agents.on('keyup', () => {
                $agent_error.setVisibility(0);
                if ($ddl_agents.val()) {
                    $ddl_agents.val('');
                    refreshDropdown(field_ids.ddl_agents);
                }
                if (!$txt_agents.val()) {
                    // error handling
                    $agent_error.setVisibility(1);
                }
            });

            $txt_agents.on('focusout', () => {
                validateAmount();
            });

            const validateAmount = () => {
                if ($txt_amount.val()) {
                    Validation.validate(form_id);
                }
            };

            FormManager.handleSubmit({
                form_selector       : form_id,
                fnc_response_handler: withdrawResponse,
                fnc_additional_check: checkAgent,
                enable_button       : true,
            });
        }
    };

    const getPALoginID = () => (
        $ddl_agents.val() || $txt_agents.val()
    );

    const insertListOption = ($ddl_object, item_text, item_value) => {
        $ddl_object.append($('<option/>', { value: item_value, text: item_text }));
    };

    const setAgentDetail = (id, html_value, href_value) => {
        getElementById(id).getElementsByTagName('a')[0].innerHTML = html_value;
        getElementById(id).getElementsByTagName('a')[0].href = href_value;
    };

    // ----------------------------
    // ----- Withdraw Process -----
    // ----------------------------
    const withdrawResponse = (response) => {
        const request = response.echo_req;
        switch (response.paymentagent_withdraw) {
            case 2: { // dry_run success: showing the confirmation page
                setActiveView(view_ids.confirm);

                $('#lblAgentName').text(agent_name);
                $('#lblCurrency').text(request.currency);
                $('#lblAmount').text(getNumberFormat(request.amount, request.currency));

                FormManager.init(view_ids.confirm, [
                    { request_field: 'paymentagent_loginid',  value: request.paymentagent_loginid },
                    { request_field: 'amount',                value: getNumberFormat(request.amount, request.currency) },
                    { request_field: 'currency',              value: request.currency },
                    { request_field: 'paymentagent_withdraw', value: 1 },
                ], true);

                FormManager.handleSubmit({
                    form_selector       : view_ids.confirm,
                    fnc_response_handler: withdrawResponse,
                });

                $(`${view_ids.confirm} #btnBack`).click(() => {
                    setActiveView(view_ids.form);
                });
                break;
            }
            case 1: // withdrawal success
                setActiveView(view_ids.success);
                $('#successMessage').css('display', '')
                    .attr('class', 'success-msg')
                    .html($('
', { class: 'checked' }).append($('
', { text: localize('Your request to withdraw [_1] [_2] from your account [_3] to Payment Agent [_4] account has been successfully processed.', [request.currency, getNumberFormat(request.amount, request.currency), Client.get('loginid'), agent_name]) })));

                // Set PA details.
                if (agent_name && agent_website && agent_email && agent_telephone) {
                    getElementById('agentName').innerHTML = agent_name;
                    setAgentDetail('agentWebsite', agent_website, agent_website);
                    setAgentDetail('agentEmail', agent_email, `mailto:${agent_email}`);
                    setAgentDetail('agentTelephone', agent_telephone, `tel:${agent_telephone}`);

                    getElementById('agentDetails').classList.remove('invisible');
                }
                break;
            default: // error
                if (response.echo_req.dry_run === 1) {
                    setActiveView(view_ids.form);
                    $('#withdrawFormMessage').setVisibility(1).html(response.error.message);
                } else if (response.error.code === 'InvalidToken') {
                    showPageError(localize('Your token has expired or is invalid. Please click [_1]here[_2] to restart the verification process.', ['', '']));
                } else {
                    showPageError(response.error.message);
                }
                break;
        }
    };

    // -----------------------------
    // ----- Message Functions -----
    // -----------------------------
    const showPageError = (err_msg, id) => {
        const $error = $(view_ids.error);
        $error.find(' > p').setVisibility(0);
        if (id) {
            $error.find(`#${id}`).setVisibility(1);
        } else {
            $error.find('#custom-error').html(err_msg).setVisibility(1);
        }
        setActiveView(view_ids.error);
    };

    // ----- View Control -----
    const setActiveView = (view_id) => {
        $views.setVisibility(0);
        $(view_id).setVisibility(1);
    };

    const onLoad = () => {
        if (!Client.get('currency')) {
            BinaryPjax.load(`${Url.urlFor('user/set-currency')}`);
            return;
        }
        BinarySocket.wait('get_account_status').then((data) => {
            $views = $('#paymentagent_withdrawal').find('.viewItem');
            $views.setVisibility(0);

            if (/(withdrawal|cashier)_locked/.test(data.get_account_status.status)) {
                showPageError('', 'withdrawal-locked-error');
            } else {
                currency = Client.get('currency');
                if (!currency || +Client.get('balance') === 0) {
                    showPageError(localize('Please [_1]deposit[_2] to your account.', [`<a href='${`${Url.urlFor('cashier/forwardws')}?action=deposit`}'>`, '']));
                    return;
                }
                BinarySocket.send({
                    paymentagent_list: Client.get('residence'),
                    currency,
                })
                    .then(response => populateAgentsList(response));
            }
        });
    };

    const checkAgent = () => {
        if (!$ddl_agents.val() && !$txt_agents.val()) {
            $agent_error.setVisibility(1);
            return false;
        }
        // else
        setAgentDetails();
        return true;
    };

    const setAgentDetails = () => {
        agent_name = $ddl_agents.val() ? $ddl_agents.find('option:selected').text() : $txt_agents.val();
        pa_list.map(pa => {
            if (pa.name === agent_name || pa.paymentagent_loginid === agent_name) {
                agent_website = pa.url;
                agent_email = pa.email;
                agent_telephone = pa.telephone;
            }
        });
    };

    const onUnload = () => {
        token = '';
    };

    return {
        onLoad,
        onUnload,
    };
})();

module.exports = PaymentAgentWithdraw;
<|endoftext|>