<commit_before>/* globals ol, isCanvasSupported */

import Ember from 'ember';
import parseQueryString from '../utils/parse-query-string';

export default Ember.Component.extend(Ember.Evented, {
  attributeBindings: ['style'],

  width: '100%',
  height: '100%',
  bingAPIKey: null,
  mapboxAPIKey: null,
  mapTileURL: null,
  baseLayer: null,

  style: Ember.computed('width', 'height', function() {
    let { width, height } = this.getProperties('width', 'height');
    return Ember.String.htmlSafe(`width: ${width}; height: ${height};`);
  }),

  noCanvas: Ember.computed(function() {
    return !isCanvasSupported();
  }),

  init() {
    this._super(...arguments);

    window.flightMap = this;

    let query = parseQueryString(window.location.search);
    this.set('baseLayer', query.baselayer);
    this.set('overlayLayers', query.overlays);
  },

  didInsertElement() {
    if (this.get('noCanvas')) {
      return;
    }

    let interactions = ol.interaction.defaults({
      altShiftDragRotate: false,
      pinchRotate: false
    });

    let map = new ol.Map({
      target: this.elementId,
      view: new ol.View({
        center: ol.proj.transform([10, 50], 'EPSG:4326', 'EPSG:3857'),
        maxZoom: 17,
        zoom: 5
      }),
      controls: ol.control.defaults().extend([
        new ol.control.ScaleLine(),
      ]),
      interactions: interactions,
      ol3Logo: false
    });
    this.set('map', map);

    map.getViewport().setAttribute('tabindex', '0');
    Ember.$(map.getViewport()).click(function() {
      Ember.$(this).focus();
    });

    var osm_layer = new ol.layer.Tile({
      source: new ol.source.OSM(),
      zIndex: 1
    });

    osm_layer.setProperties({
      'name': 'OpenStreetMap',
      'id': 'OpenStreetMap',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    map.addLayer(osm_layer);

    this.addReliefLayer();
    this.addAirspaceLayers();
    this.addMWPLayers();
    this.addBingLayers();
    this.addMapboxLayer();

    this.setBaseLayer(this.get('baseLayer') || Ember.$.cookie('base_layer'));
    this.setOverlayLayers(this.get('overlayLayers') || Ember.$.cookie('overlay_layers'));
  },

  setBaseLayer(base_layer) {
    if (!base_layer) {
      return;
    }

    var fallback = false;
    var map = this.get('map');

    map.getLayers().forEach(layer => {
      if (layer.get('base_layer')) {
        layer.setVisible(layer.get('name') === base_layer);
        fallback = fallback || layer.get('name') === base_layer;
      }
    });

    if (!fallback) {
      map.getLayers().getArray().filter(function(e) {
        return e.get('name') === 'OpenStreetMap';
      })[0].setVisible(true);
    }
  },

  setOverlayLayers(overlay_layers) {
    if (!overlay_layers) {
      return;
    }

    overlay_layers = overlay_layers.split(';');

    // Cycle through the overlay layers to find a match
    this.get('map').getLayers().forEach(layer => {
      if (layer.get('base_layer') || !layer.get('display_in_layer_switcher')) {
        return;
      }

      layer.setVisible(Ember.$.inArray(layer.get('name'), overlay_layers) !== -1);
    });
  },

  addMWPLayers() {
    let tile_url = this.getWithDefault('mapTileURL', '');

    var mwp_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: 'Mountain Wave Data © ' +
                '' +
                'Mountain Wave Project' +
                '.'
          })
        ],
        url: tile_url + '/tiles/1.0.0/mwp/{z}/{x}/{y}.png'
      }),
      zIndex: 11
    });

    mwp_layer.setProperties({
      'name': 'Mountain Wave Project',
      'id': 'MountainWaveProject',
      'base_layer': false,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(mwp_layer);
  },

  addAirspaceLayers() {
    let tile_url = this.getWithDefault('mapTileURL', '');

    var airspace_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        url: tile_url + '/tiles/1.0.0/airspace+airports/{z}/{x}/{y}.png'
      }),
      zIndex: 10
    });

    airspace_layer.setProperties({
      'name': 'Airspace',
      'id': 'Airspace',
      'base_layer': false,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(airspace_layer);
  },

  addReliefLayer() {
    var url = 'http://maps-for-free.com/layer/relief/z{z}/row{y}/{z}_{x}-{y}.jpg';

    var relief_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: 'SRTM relief maps from maps-for-free.com'
          })
        ],
        url: url
      }),
      zIndex: 2
    });

    relief_layer.setProperties({
      'name': 'Shaded Relief',
      'id': 'ShadedRelief',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(relief_layer);
  },

  addMapboxLayer() {
    let tile_url = this.get('mapboxAPIKey');
    if (!tile_url || tile_url == 'null') {
      return;
    }

    var mapbox_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: '' +
                '© Mapbox © OpenStreetMap Improve this map'
          })
        ],
        url: tile_url
      }),
      zIndex: 5
    });

    mapbox_layer.setProperties({
      'name': 'Terrain',
      'id': 'Terrain',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(mapbox_layer);
  },

  addBingLayers() {
    let api_key = this.get('bingAPIKey');
    if (!api_key || api_key == 'null') {
      return;
    }

    // Bing's Road imagerySet
    var road = new ol.layer.Tile({
      source: new ol.source.BingMaps({
        key: api_key,
        imagerySet: 'Road'
      }),
      zIndex: 3
    });

    road.setProperties({
      'name': 'Bing Road',
      'id': 'BingRoad',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    // Bing's AerialWithLabels imagerySet
    var hybrid = new ol.layer.Tile({
      source: new ol.source.BingMaps({
        key: api_key,
        imagerySet: 'AerialWithLabels'
      }),
      zIndex: 4
    });

    hybrid.setProperties({
      'name': 'Bing Satellite',
      'id': 'BingSatellite',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    let map = this.get('map');
    map.addLayer(road);
    map.addLayer(hybrid);
  },
});
<commit_msg>components/flight-map: Initialize ol.Map in init() method<commit_after>/* globals ol, isCanvasSupported */

import Ember from 'ember';
import parseQueryString from '../utils/parse-query-string';

export default Ember.Component.extend(Ember.Evented, {
  attributeBindings: ['style'],

  width: '100%',
  height: '100%',
  bingAPIKey: null,
  mapboxAPIKey: null,
  mapTileURL: null,
  baseLayer: null,

  style: Ember.computed('width', 'height', function() {
    let { width, height } = this.getProperties('width', 'height');
    return Ember.String.htmlSafe(`width: ${width}; height: ${height};`);
  }),

  noCanvas: Ember.computed(function() {
    return !isCanvasSupported();
  }),

  init() {
    this._super(...arguments);

    window.flightMap = this;

    if (this.get('noCanvas')) {
      return;
    }

    let interactions = ol.interaction.defaults({
      altShiftDragRotate: false,
      pinchRotate: false
    });

    let map = new ol.Map({
      view: new ol.View({
        center: ol.proj.transform([10, 50], 'EPSG:4326', 'EPSG:3857'),
        maxZoom: 17,
        zoom: 5
      }),
      controls: ol.control.defaults().extend([
        new ol.control.ScaleLine(),
      ]),
      interactions: interactions,
      ol3Logo: false
    });
    this.set('map', map);

    map.getViewport().setAttribute('tabindex', '0');
    Ember.$(map.getViewport()).click(function() {
      Ember.$(this).focus();
    });

    var osm_layer = new ol.layer.Tile({
      source: new ol.source.OSM(),
      zIndex: 1
    });

    osm_layer.setProperties({
      'name': 'OpenStreetMap',
      'id': 'OpenStreetMap',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    map.addLayer(osm_layer);

    this.addReliefLayer();
    this.addAirspaceLayers();
    this.addMWPLayers();
    this.addBingLayers();
    this.addMapboxLayer();

    let query = parseQueryString(window.location.search);
    this.set('baseLayer', query.baselayer);
    this.set('overlayLayers', query.overlays);

    this.setBaseLayer(this.get('baseLayer') || Ember.$.cookie('base_layer'));
    this.setOverlayLayers(this.get('overlayLayers') || Ember.$.cookie('overlay_layers'));
  },

  didInsertElement() {
    let map = this.get('map');
    if (map) {
      map.setTarget(this.elementId);
    }
  },

  setBaseLayer(base_layer) {
    if (!base_layer) {
      return;
    }

    var fallback = false;
    var map = this.get('map');

    map.getLayers().forEach(layer => {
      if (layer.get('base_layer')) {
        layer.setVisible(layer.get('name') === base_layer);
        fallback = fallback || layer.get('name') === base_layer;
      }
    });

    if (!fallback) {
      map.getLayers().getArray().filter(function(e) {
        return e.get('name') === 'OpenStreetMap';
      })[0].setVisible(true);
    }
  },

  setOverlayLayers(overlay_layers) {
    if (!overlay_layers) {
      return;
    }

    overlay_layers = overlay_layers.split(';');

    // Cycle through the overlay layers to find a match
    this.get('map').getLayers().forEach(layer => {
      if (layer.get('base_layer') || !layer.get('display_in_layer_switcher')) {
        return;
      }

      layer.setVisible(Ember.$.inArray(layer.get('name'), overlay_layers) !== -1);
    });
  },

  addMWPLayers() {
    let tile_url = this.getWithDefault('mapTileURL', '');

    var mwp_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: 'Mountain Wave Data © ' +
                '' +
                'Mountain Wave Project' +
                '.'
          })
        ],
        url: tile_url + '/tiles/1.0.0/mwp/{z}/{x}/{y}.png'
      }),
      zIndex: 11
    });

    mwp_layer.setProperties({
      'name': 'Mountain Wave Project',
      'id': 'MountainWaveProject',
      'base_layer': false,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(mwp_layer);
  },

  addAirspaceLayers() {
    let tile_url = this.getWithDefault('mapTileURL', '');

    var airspace_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        url: tile_url + '/tiles/1.0.0/airspace+airports/{z}/{x}/{y}.png'
      }),
      zIndex: 10
    });

    airspace_layer.setProperties({
      'name': 'Airspace',
      'id': 'Airspace',
      'base_layer': false,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(airspace_layer);
  },

  addReliefLayer() {
    var url = 'http://maps-for-free.com/layer/relief/z{z}/row{y}/{z}_{x}-{y}.jpg';

    var relief_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: 'SRTM relief maps from maps-for-free.com'
          })
        ],
        url: url
      }),
      zIndex: 2
    });

    relief_layer.setProperties({
      'name': 'Shaded Relief',
      'id': 'ShadedRelief',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(relief_layer);
  },

  addMapboxLayer() {
    let tile_url = this.get('mapboxAPIKey');
    if (!tile_url || tile_url == 'null') {
      return;
    }

    var mapbox_layer = new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [
          new ol.Attribution({
            html: '' +
                '© Mapbox © OpenStreetMap Improve this map'
          })
        ],
        url: tile_url
      }),
      zIndex: 5
    });

    mapbox_layer.setProperties({
      'name': 'Terrain',
      'id': 'Terrain',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    this.get('map').addLayer(mapbox_layer);
  },

  addBingLayers() {
    let api_key = this.get('bingAPIKey');
    if (!api_key || api_key == 'null') {
      return;
    }

    // Bing's Road imagerySet
    var road = new ol.layer.Tile({
      source: new ol.source.BingMaps({
        key: api_key,
        imagerySet: 'Road'
      }),
      zIndex: 3
    });

    road.setProperties({
      'name': 'Bing Road',
      'id': 'BingRoad',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    // Bing's AerialWithLabels imagerySet
    var hybrid = new ol.layer.Tile({
      source: new ol.source.BingMaps({
        key: api_key,
        imagerySet: 'AerialWithLabels'
      }),
      zIndex: 4
    });

    hybrid.setProperties({
      'name': 'Bing Satellite',
      'id': 'BingSatellite',
      'base_layer': true,
      'display_in_layer_switcher': true
    });

    let map = this.get('map');
    map.addLayer(road);
    map.addLayer(hybrid);
  },
});
<|endoftext|>


<commit_before>'use strict';

/**
 * world.js is loaded by the cucumber framework before loading the step definitions and feature files
 * it is responsible for setting up and exposing the driver/browser/expect/assert etc required within each step definition
 */

var fs = require('fs-plus');
var path = require('path');
var requireDir = require('require-dir');
var merge = require('merge');
var chalk = require('chalk');
var selenium = require('selenium-webdriver');
var phantomjs = require('phantomjs-prebuilt');
var chromedriver = require('chromedriver');
var firefox = require('geckodriver');
var expect = require('chai').expect;
var assert = require('chai').assert;
var reporter = require('cucumber-html-reporter');
var cucumberJunit = require('cucumber-junit');

/**
 * create the selenium browser based on global var set in index.js
 */
function getDriverInstance() {

    switch (browserName || '') {

        case 'firefox': {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'firefox',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'webdriver.firefox.bin': firefox.path
            }).build();

        } break;

        case 'phantomjs': {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'phantomjs',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'phantomjs.binary.path': phantomjs.path
            }).build();

        } break;

        // default to chrome
        default: {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'chrome',
                javascriptEnabled: true,
                acceptSslCerts: true,
                chromeOptions: {
                    args: ['start-maximized']
                },
                path: chromedriver.path
            }).build();
        }
    }

    return driver;
}

function consoleInfo() {
    var args = [].slice.call(arguments),
        output = chalk.bgBlue.white('\n>>>>> \n' + args + '\n<<<<<\n');

    console.log(output);
}

function World() {

    // create a list of variables to expose globally and therefore accessible within each step definition
    var runtime = {
        driver: null,           // the browser object
        selenium: selenium,     // the raw nodejs selenium driver
        By: selenium.By,        // in keeping with Java expose selenium By
        by: selenium.By,        // provide a javascript lowercase version
        until: selenium.until,  // provide easy access to selenium until methods
        expect: expect,         // expose chai expect to allow variable testing
        assert: assert,         // expose chai assert to allow variable testing
        trace: consoleInfo,     // expose an info method to log output to the console in a readable/visible format
        page: {},               // empty page objects placeholder
        shared: {}              // empty shared objects placeholder
    };

    // expose properties to step definition methods via global variables
    Object.keys(runtime).forEach(function (key) {

        // make property/method available as a global (no this. prefix required)
        global[key] = runtime[key];
    });

    // import shared objects from multiple paths (after global vars have been created)
    if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {

        var allDirs = {};

        // first require directories into objects by directory
        global.sharedObjectPaths.forEach(function (itemPath) {

            if (fs.existsSync(itemPath)) {

                var dir = requireDir(itemPath, { camelcase: true });

                merge(allDirs, dir);
            }
        });

        // if we managed to import some directories, expose them
        if (Object.keys(allDirs).length > 0) {

            // expose globally
            global.shared = allDirs;
        }
    }

    // import page objects (after global vars have been created)
    if (global.pageObjectPath && fs.existsSync(global.pageObjectPath)) {

        // require all page objects using camel case as object names
        runtime.page = requireDir(global.pageObjectPath, { camelcase: true });

        // expose globally
        global.page = runtime.page;
    }

    // add helpers
    global.helpers = require('../runtime/helpers.js');
}

// export the "World" required by cucumber to allow it to expose methods within step def's
module.exports = function () {

    this.World = World;

    // set the default timeout for all tests
    this.setDefaultTimeout(global.DEFAULT_TIMEOUT);

    // create the driver before scenario if it's not instantiated
    this.registerHandler('BeforeScenario', function(scenario) {

        if (!global.driver) {
            global.driver = getDriverInstance();
        }

        driver.manage().window().maximize();
    });

    this.registerHandler('AfterFeatures', function (features, done) {

        var cucumberReportPath = path.resolve(global.reportsPath, 'cucumber-report.json');

        if (global.reportsPath && fs.existsSync(global.reportsPath)) {

            // generate the HTML report
            var reportOptions = {
                theme: 'bootstrap',
                jsonFile: cucumberReportPath,
                output: path.resolve(global.reportsPath, 'cucumber-report.html'),
                reportSuiteAsScenarios: true,
                launchReport: (!global.disableLaunchReport),
                ignoreBadJsonFile: true
            };

            reporter.generate(reportOptions);

            // grab the file data
            var reportRaw = fs.readFileSync(cucumberReportPath).toString().trim();
            var xmlReport = cucumberJunit(reportRaw);
            var junitOutputPath = path.resolve(global.junitPath, 'junit-report.xml');

            fs.writeFileSync(junitOutputPath, xmlReport);
        }

        done();
    });

    // executed after each scenario (always closes the browser to ensure fresh tests)
    this.After(function (scenario) {

        if (scenario.isFailed() && !global.noScreenshot) {

            // add a screenshot to the error report
            return driver.takeScreenshot().then(function (screenShot) {

                scenario.attach(new Buffer(screenShot, 'base64'), 'image/png');

                return driver.close().then(function() {
                    return driver.quit();
                });
            });
        }

        return driver.close().then(function() {
            return driver.quit();
        });
    });
};
<commit_msg>Allow the user to provide a file path for creating a browser driver<commit_after>'use strict';

/**
 * world.js is loaded by the cucumber framework before loading the step definitions and feature files
 * it is responsible for setting up and exposing the driver/browser/expect/assert etc required within each step definition
 */

var fs = require('fs-plus');
var path = require('path');
var requireDir = require('require-dir');
var merge = require('merge');
var chalk = require('chalk');
var selenium = require('selenium-webdriver');
var phantomjs = require('phantomjs-prebuilt');
var chromedriver = require('chromedriver');
var firefox = require('geckodriver');
var expect = require('chai').expect;
var assert = require('chai').assert;
var reporter = require('cucumber-html-reporter');
var cucumberJunit = require('cucumber-junit');

/**
 * create the selenium browser based on global var set in index.js
 */
function getDriverInstance() {

    var driver;
    switch (browserName || '') {

        case 'firefox': {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'firefox',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'webdriver.firefox.bin': firefox.path
            }).build();

        } break;

        case 'phantomjs': {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'phantomjs',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'phantomjs.binary.path': phantomjs.path
            }).build();

        } break;

        case 'chrome': {

            driver = new selenium.Builder().withCapabilities({
                browserName: 'chrome',
                javascriptEnabled: true,
                acceptSslCerts: true,
                chromeOptions: {
                    args: ['start-maximized']
                },
                path: chromedriver.path
            }).build();
        } break;

        // try to load from file
        default: {
            var driverFileName = path.resolve(process.cwd(), browserName);
            if (!fs.isFileSync(driverFileName)) {
                throw "Could not find driver file: " + driverFileName;
            }
            driver = require(driverFileName)();
        }
    }

    return driver;
}

function consoleInfo() {
    var args = [].slice.call(arguments),
        output = chalk.bgBlue.white('\n>>>>> \n' + args + '\n<<<<<\n');

    console.log(output);
}

function World() {

    // create a list of variables to expose globally and therefore accessible within each step definition
    var runtime = {
        driver: null,           // the browser object
        selenium: selenium,     // the raw nodejs selenium driver
        By: selenium.By,        // in keeping with Java expose selenium By
        by: selenium.By,        // provide a javascript lowercase version
        until: selenium.until,  // provide easy access to selenium until methods
        expect: expect,         // expose chai expect to allow variable testing
        assert: assert,         // expose chai assert to allow variable testing
        trace: consoleInfo,     // expose an info method to log output to the console in a readable/visible format
        page: {},               // empty page objects placeholder
        shared: {}              // empty shared objects placeholder
    };

    // expose properties to step definition methods via global variables
    Object.keys(runtime).forEach(function (key) {

        // make property/method available as a global (no this. prefix required)
        global[key] = runtime[key];
    });

    // import shared objects from multiple paths (after global vars have been created)
    if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {

        var allDirs = {};

        // first require directories into objects by directory
        global.sharedObjectPaths.forEach(function (itemPath) {

            if (fs.existsSync(itemPath)) {

                var dir = requireDir(itemPath, { camelcase: true });

                merge(allDirs, dir);
            }
        });

        // if we managed to import some directories, expose them
        if (Object.keys(allDirs).length > 0) {

            // expose globally
            global.shared = allDirs;
        }
    }

    // import page objects (after global vars have been created)
    if (global.pageObjectPath && fs.existsSync(global.pageObjectPath)) {

        // require all page objects using camel case as object names
        runtime.page = requireDir(global.pageObjectPath, { camelcase: true });

        // expose globally
        global.page = runtime.page;
    }

    // add helpers
    global.helpers = require('../runtime/helpers.js');
}

// export the "World" required by cucumber to allow it to expose methods within step def's
module.exports = function () {

    this.World = World;

    // set the default timeout for all tests
    this.setDefaultTimeout(global.DEFAULT_TIMEOUT);

    // create the driver before scenario if it's not instantiated
    this.registerHandler('BeforeScenario', function(scenario) {

        if (!global.driver) {
            global.driver = getDriverInstance();
        }

        driver.manage().window().maximize();
    });

    this.registerHandler('AfterFeatures', function (features, done) {

        var cucumberReportPath = path.resolve(global.reportsPath, 'cucumber-report.json');

        if (global.reportsPath && fs.existsSync(global.reportsPath)) {

            // generate the HTML report
            var reportOptions = {
                theme: 'bootstrap',
                jsonFile: cucumberReportPath,
                output: path.resolve(global.reportsPath, 'cucumber-report.html'),
                reportSuiteAsScenarios: true,
                launchReport: (!global.disableLaunchReport),
                ignoreBadJsonFile: true
            };

            reporter.generate(reportOptions);

            // grab the file data
            var reportRaw = fs.readFileSync(cucumberReportPath).toString().trim();
            var xmlReport = cucumberJunit(reportRaw);
            var junitOutputPath = path.resolve(global.junitPath, 'junit-report.xml');

            fs.writeFileSync(junitOutputPath, xmlReport);
        }

        done();
    });

    // executed after each scenario (always closes the browser to ensure fresh tests)
    this.After(function (scenario) {

        if (scenario.isFailed() && !global.noScreenshot) {

            // add a screenshot to the error report
            return driver.takeScreenshot().then(function (screenShot) {

                scenario.attach(new Buffer(screenShot, 'base64'), 'image/png');

                return driver.close().then(function() {
                    return driver.quit();
                });
            });
        }

        return driver.close().then(function() {
            return driver.quit();
        });
    });
};
<|endoftext|>


<commit_before>System.registerDynamic('src/scroller', ['rxjs/Observable', 'rxjs/add/observable/fromEvent', 'rxjs/add/observable/timer', 'rxjs/add/operator/throttle', 'rxjs/add/operator/filter'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var Observable_1 = $__require('rxjs/Observable');
    $__require('rxjs/add/observable/fromEvent');
    $__require('rxjs/add/observable/timer');
    $__require('rxjs/add/operator/throttle');
    $__require('rxjs/add/operator/filter');
    var Scroller = function () {
        // private axis: AxisResolver;
        function Scroller(windowElement, $interval, $elementRef, infiniteScrollDownCallback, infiniteScrollUpCallback, infiniteScrollDownDistance, infiniteScrollUpDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate, horizontal, alwaysCallback, scrollDisabled, axis) {
            if (horizontal === void 0) {
                horizontal = false;
            }
            if (alwaysCallback === void 0) {
                alwaysCallback = false;
            }
            if (scrollDisabled === void 0) {
                scrollDisabled = false;
            }
            this.windowElement = windowElement;
            this.$interval = $interval;
            this.$elementRef = $elementRef;
            this.infiniteScrollDownCallback = infiniteScrollDownCallback;
            this.infiniteScrollUpCallback = infiniteScrollUpCallback;
            this.infiniteScrollThrottle = infiniteScrollThrottle;
            this.isImmediate = isImmediate;
            this.horizontal = horizontal;
            this.alwaysCallback = alwaysCallback;
            this.scrollDisabled = scrollDisabled;
            this.axis = axis;
            this.lastScrollPosition = 0;
            this.isContainerWindow = Object.prototype.toString.call(this.windowElement).includes('Window');
            this.documentElement = this.isContainerWindow ? this.windowElement.document.documentElement : null;
            this.handleInfiniteScrollDistance(infiniteScrollDownDistance, infiniteScrollUpDistance);
            // if (attrs.infiniteScrollParent != null) {
            // 	attachEvent(angular.element(elem.parent()));
            // }
            this.handleInfiniteScrollDisabled(scrollDisabled);
            this.defineContainer();
            this.createInterval();
            this.axis.setVertical(!this.horizontal);
        }
        Scroller.prototype.defineContainer = function () {
            if (this.isContainerWindow) {
                this.container = this.windowElement;
            } else {
                this.container = this.windowElement.nativeElement;
            }
            this.attachEvent(this.container);
        };
        Scroller.prototype.createInterval = function () {
            var _this = this;
            if (this.isImmediate) {
                this.checkInterval = this.$interval(function () {
                    return _this.handler();
                }, 0);
            }
        };
        Scroller.prototype.height = function (elem) {
            var offsetHeight = this.axis.offsetHeightKey();
            var clientHeight = this.axis.clientHeightKey();
            // elem = elem.nativeElement;
            if (isNaN(elem[offsetHeight])) {
                return this.documentElement[clientHeight];
            } else {
                return elem[offsetHeight];
            }
        };
        Scroller.prototype.offsetTop = function (elem) {
            var top = this.axis.topKey();
            // elem = elem.nativeElement;
            if (!elem.getBoundingClientRect) {
                return;
            }
            return elem.getBoundingClientRect()[top] + this.pageYOffset(elem);
        };
        Scroller.prototype.pageYOffset = function (elem) {
            var pageYOffset = this.axis.pageYOffsetKey();
            var scrollTop = this.axis.scrollTopKey();
            var offsetTop = this.axis.offsetTopKey();
            // elem = elem.nativeElement;
            if (isNaN(window[pageYOffset])) {
                return this.documentElement[scrollTop];
            } else if (elem.ownerDocument) {
                return elem.ownerDocument.defaultView[pageYOffset];
            } else {
                return elem[offsetTop];
            }
        };
        Scroller.prototype.handler = function () {
            var container = this.calculatePoints();
            var scrollingDown = this.lastScrollPosition < container.scrolledUntilNow;
            this.lastScrollPosition = container.scrolledUntilNow;
            var remaining;
            var containerBreakpoint;
            if (scrollingDown) {
                remaining = container.totalToScroll - container.scrolledUntilNow;
                containerBreakpoint = container.height * this.scrollDownDistance + 1;
            } else {
                remaining = container.scrolledUntilNow;
                containerBreakpoint = container.height * this.scrollUpDistance + 1;
            }
            var shouldScroll = remaining <= containerBreakpoint;
            var triggerCallback = (this.alwaysCallback || shouldScroll) && this.scrollEnabled;
            var shouldClearInterval = !shouldScroll && this.checkInterval;
            // if (this.useDocumentBottom) {
            // 	container.totalToScroll = this.height(this.$elementRef.nativeElement.ownerDocument);
            // }
            this.checkWhenEnabled = shouldScroll;
            if (triggerCallback) {
                if (scrollingDown) {
                    this.infiniteScrollDownCallback({ currentScrollPosition: container.scrolledUntilNow });
                } else {
                    this.infiniteScrollUpCallback({ currentScrollPosition: container.scrolledUntilNow });
                }
            }
            if (shouldClearInterval) {
                clearInterval(this.checkInterval);
            }
        };
        Scroller.prototype.calculatePoints = function () {
            return this.isContainerWindow ? this.calculatePointsForWindow() : this.calculatePointsForElement();
        };
        Scroller.prototype.calculatePointsForWindow = function () {
            // container's height
            var height = this.height(this.container);
            // scrolled until now / current y point
            var scrolledUntilNow = height + this.pageYOffset(this.documentElement);
            // total height / most bottom y point
            var totalToScroll = this.offsetTop(this.$elementRef.nativeElement) + this.height(this.$elementRef.nativeElement);
            return { height: height, scrolledUntilNow: scrolledUntilNow, totalToScroll: totalToScroll };
        };
        Scroller.prototype.calculatePointsForElement = function () {
            var scrollTop = this.axis.scrollTopKey();
            var scrollHeight = this.axis.scrollHeightKey();
            var height = this.height(this.container);
            // perhaps use this.container.offsetTop instead of 'scrollTop'
            var scrolledUntilNow = this.container[scrollTop];
            var containerTopOffset = 0;
            var offsetTop = this.offsetTop(this.container);
            if (offsetTop !== void 0) {
                containerTopOffset = offsetTop;
            }
            var totalToScroll = this.container[scrollHeight];
            // const totalToScroll = this.offsetTop(this.$elementRef.nativeElement) - containerTopOffset + this.height(this.$elementRef.nativeElement);
            return { height: height, scrolledUntilNow: scrolledUntilNow, totalToScroll: totalToScroll };
        };
        Scroller.prototype.handleInfiniteScrollDistance = function (scrollDownDistance, scrollUpDistance) {
            this.scrollDownDistance = parseFloat(scrollDownDistance) || 0;
            this.scrollUpDistance = parseFloat(scrollUpDistance) || 0;
        };
        Scroller.prototype.attachEvent = function (newContainer) {
            var _this = this;
            this.clean();
            if (newContainer) {
                var throttle_1 = this.infiniteScrollThrottle;
                this.disposeScroll = Observable_1.Observable.fromEvent(this.container, 'scroll').throttle(function (ev) {
                    return Observable_1.Observable.timer(throttle_1);
                }).filter(function (ev) {
                    return _this.scrollEnabled;
                }).subscribe(function (ev) {
                    return _this.handler();
                });
            }
        };
        Scroller.prototype.clean = function () {
            if (this.disposeScroll) {
                this.disposeScroll.unsubscribe();
            }
        };
        Scroller.prototype.handleInfiniteScrollDisabled = function (scrollDisabled) {
            this.scrollEnabled = !scrollDisabled;
        };
        return Scroller;
    }();
    exports.Scroller = Scroller;
    return module.exports;
});
System.registerDynamic("src/infinite-scroll", ["@angular/core", "./scroller", "./axis-resolver"], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
        var c = arguments.length,
            r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
            d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = this && this.__metadata || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var core_1 = $__require("@angular/core");
    var scroller_1 = $__require("./scroller");
    var axis_resolver_1 = $__require("./axis-resolver");
    var InfiniteScroll = function () {
        function InfiniteScroll(element, zone, axis) {
            this.element = element;
            this.zone = zone;
            this.axis = axis;
            this._distanceDown = 2;
            this._distanceUp = 1.5;
            this._throttle = 300;
            this._disabled = false;
            this.scrollWindow = true;
            this._immediate = false;
            this._horizontal = false;
            this._alwaysCallback = false;
            this.scrolled = new core_1.EventEmitter();
            this.scrolledUp = new core_1.EventEmitter();
        }
        InfiniteScroll.prototype.ngOnInit = function () {
            var containerElement = this.scrollWindow ? window : this.element;
            this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScrollDown.bind(this), this.onScrollUp.bind(this), this._distanceDown, this._distanceUp, {}, this._throttle, this._immediate, this._horizontal, this._alwaysCallback, this._disabled, this.axis);
        };
        InfiniteScroll.prototype.ngOnDestroy = function () {
            this.scroller.clean();
        };
        InfiniteScroll.prototype.ngOnChanges = function (changes) {
            if (changes['_disabled'] && this.scroller) {
                this.scroller.handleInfiniteScrollDisabled(changes['_disabled'].currentValue);
            }
        };
        InfiniteScroll.prototype.onScrollDown = function (data) {
            var _this = this;
            if (data === void 0) {
                data = {};
            }
            this.zone.run(function () {
                return _this.scrolled.next(data);
            });
        };
        InfiniteScroll.prototype.onScrollUp = function (data) {
            var _this = this;
            if (data === void 0) {
                data = {};
            }
            this.zone.run(function () {
                return _this.scrolledUp.next(data);
            });
        };
        __decorate([core_1.Input('infiniteScrollDistance'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_distanceDown", void 0);
        __decorate([core_1.Input('infiniteScrollUpDistance'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_distanceUp", void 0);
        __decorate([core_1.Input('infiniteScrollThrottle'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_throttle", void 0);
        __decorate([core_1.Input('infiniteScrollDisabled'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "_disabled", void 0);
        __decorate([core_1.Input('scrollWindow'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "scrollWindow", void 0);
        __decorate([core_1.Input('immediateCheck'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "_immediate", void 0);
        __decorate([core_1.Input('horizontal'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "_horizontal", void 0);
        __decorate([core_1.Input('alwaysCallback'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "_alwaysCallback", void 0);
        __decorate([core_1.Output(), __metadata('design:type', Object)], InfiniteScroll.prototype, "scrolled", void 0);
        __decorate([core_1.Output(), __metadata('design:type', Object)], InfiniteScroll.prototype, "scrolledUp", void 0);
        InfiniteScroll = __decorate([core_1.Directive({
            selector: '[infinite-scroll]'
        }), __metadata('design:paramtypes', [core_1.ElementRef, core_1.NgZone, axis_resolver_1.AxisResolver])], InfiniteScroll);
        return InfiniteScroll;
    }();
    exports.InfiniteScroll = InfiniteScroll;
    return module.exports;
});
System.registerDynamic("src/axis-resolver", ["@angular/core"], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
        var c = arguments.length,
            r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
            d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = this && this.__metadata || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var core_1 = $__require("@angular/core");
    var AxisResolver = function () {
        function AxisResolver() {
            this.setVertical(true);
        }
        AxisResolver.prototype.setVertical = function (vertical) {
            if (vertical === void 0) {
                vertical = true;
            }
            this.vertical = vertical;
        };
        AxisResolver.prototype.clientHeightKey = function () {
            return this.vertical ? 'clientHeight' : 'clientWidth';
        };
        AxisResolver.prototype.offsetHeightKey = function () {
            return this.vertical ? 'offsetHeight' : 'offsetWidth';
        };
        AxisResolver.prototype.scrollHeightKey = function () {
            return this.vertical ? 'scrollHeight' : 'scrollWidth';
        };
        AxisResolver.prototype.pageYOffsetKey = function () {
            return this.vertical ? 'pageYOffset' : 'pageXOffset';
        };
        AxisResolver.prototype.offsetTopKey = function () {
            return this.vertical ? 'offsetTop' : 'offsetLeft';
        };
        AxisResolver.prototype.scrollTopKey = function () {
            return this.vertical ? 'scrollTop' : 'scrollLeft';
        };
        AxisResolver.prototype.topKey = function () {
            return this.vertical ? 'top' : 'left';
        };
        AxisResolver = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], AxisResolver);
        return AxisResolver;
    }();
    exports.AxisResolver = AxisResolver;
    return module.exports;
});
System.registerDynamic("src/index", ["@angular/core", "./infinite-scroll", "./axis-resolver"], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
        var c = arguments.length,
            r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
            d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = this && this.__metadata || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var core_1 = $__require("@angular/core");
    var infinite_scroll_1 = $__require("./infinite-scroll");
    var axis_resolver_1 = $__require("./axis-resolver");
    var InfiniteScrollModule = function () {
        function InfiniteScrollModule() {}
        InfiniteScrollModule = __decorate([core_1.NgModule({
            imports: [],
            declarations: [infinite_scroll_1.InfiniteScroll],
            exports: [infinite_scroll_1.InfiniteScroll],
            providers: [axis_resolver_1.AxisResolver]
        }), __metadata('design:paramtypes', [])], InfiniteScrollModule);
        return InfiniteScrollModule;
    }();
    exports.InfiniteScrollModule = InfiniteScrollModule;
    return module.exports;
});
System.registerDynamic('angular2-infinite-scroll', ['./src/infinite-scroll', './src/scroller', './src/axis-resolver', './src/index'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    function __export(m) {
        for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
    }
    var infinite_scroll_1 = $__require('./src/infinite-scroll');
    var scroller_1 = $__require('./src/scroller');
    var axis_resolver_1 = $__require('./src/axis-resolver');
    __export($__require('./src/infinite-scroll'));
    __export($__require('./src/scroller'));
    __export($__require('./src/axis-resolver'));
    __export($__require('./src/index'));
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.default = {
        directives: [infinite_scroll_1.InfiniteScroll, scroller_1.Scroller, axis_resolver_1.AxisResolver]
    };
    return module.exports;
});<commit_msg>added aot from a pr<commit_after>System.registerDynamic('src/scroller', ['rxjs/Observable', 'rxjs/add/observable/fromEvent', 'rxjs/add/observable/timer', 'rxjs/add/operator/throttle', 'rxjs/add/operator/filter'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var Observable_1 = $__require('rxjs/Observable');
    $__require('rxjs/add/observable/fromEvent');
    $__require('rxjs/add/observable/timer');
    $__require('rxjs/add/operator/throttle');
    $__require('rxjs/add/operator/filter');
    var Scroller = function () {
        // private axis: AxisResolver;
        function Scroller(windowElement, $interval, $elementRef, infiniteScrollDownCallback, infiniteScrollUpCallback, infiniteScrollDownDistance, infiniteScrollUpDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate, horizontal, alwaysCallback, scrollDisabled, axis) {
            if (horizontal === void 0) {
                horizontal = false;
            }
            if (alwaysCallback === void 0) {
                alwaysCallback = false;
            }
            if (scrollDisabled === void 0) {
                scrollDisabled = false;
            }
            this.windowElement = windowElement;
            this.$interval = $interval;
            this.$elementRef = $elementRef;
            this.infiniteScrollDownCallback = infiniteScrollDownCallback;
            this.infiniteScrollUpCallback = infiniteScrollUpCallback;
            this.infiniteScrollThrottle = infiniteScrollThrottle;
            this.isImmediate = isImmediate;
            this.horizontal = horizontal;
            this.alwaysCallback = alwaysCallback;
            this.scrollDisabled = scrollDisabled;
            this.axis = axis;
            this.lastScrollPosition = 0;
            this.isContainerWindow = Object.prototype.toString.call(this.windowElement).includes('Window');
            this.documentElement = this.isContainerWindow ? this.windowElement.document.documentElement : null;
            this.handleInfiniteScrollDistance(infiniteScrollDownDistance, infiniteScrollUpDistance);
            // if (attrs.infiniteScrollParent != null) {
            // 	attachEvent(angular.element(elem.parent()));
            // }
            this.handleInfiniteScrollDisabled(scrollDisabled);
            this.defineContainer();
            this.createInterval();
            this.axis.setVertical(!this.horizontal);
        }
        Scroller.prototype.defineContainer = function () {
            if (this.isContainerWindow) {
                this.container = this.windowElement;
            } else {
                this.container = this.windowElement.nativeElement;
            }
            this.attachEvent(this.container);
        };
        Scroller.prototype.createInterval = function () {
            var _this = this;
            if (this.isImmediate) {
                this.checkInterval = this.$interval(function () {
                    return _this.handler();
                }, 0);
            }
        };
        Scroller.prototype.height = function (elem) {
            var offsetHeight = this.axis.offsetHeightKey();
            var clientHeight = this.axis.clientHeightKey();
            // elem = elem.nativeElement;
            if (isNaN(elem[offsetHeight])) {
                return this.documentElement[clientHeight];
            } else {
                return elem[offsetHeight];
            }
        };
        Scroller.prototype.offsetTop = function (elem) {
            var top = this.axis.topKey();
            // elem = elem.nativeElement;
            if (!elem.getBoundingClientRect) {
                return;
            }
            return elem.getBoundingClientRect()[top] + this.pageYOffset(elem);
        };
        Scroller.prototype.pageYOffset = function (elem) {
            var pageYOffset = this.axis.pageYOffsetKey();
            var scrollTop = this.axis.scrollTopKey();
            var offsetTop = this.axis.offsetTopKey();
            // elem = elem.nativeElement;
            if (isNaN(window[pageYOffset])) {
                return this.documentElement[scrollTop];
            } else if (elem.ownerDocument) {
                return elem.ownerDocument.defaultView[pageYOffset];
            } else {
                return elem[offsetTop];
            }
        };
        Scroller.prototype.handler = function () {
            var container = this.calculatePoints();
            var scrollingDown = this.lastScrollPosition < container.scrolledUntilNow;
            this.lastScrollPosition = container.scrolledUntilNow;
            var remaining;
            var containerBreakpoint;
            if (scrollingDown) {
                remaining = container.totalToScroll - container.scrolledUntilNow;
                containerBreakpoint = container.height * this.scrollDownDistance + 1;
            } else {
                remaining = container.scrolledUntilNow;
                containerBreakpoint = container.height * this.scrollUpDistance + 1;
            }
            var shouldScroll = remaining <= containerBreakpoint;
            var triggerCallback = (this.alwaysCallback || shouldScroll) && this.scrollEnabled;
            var shouldClearInterval = !shouldScroll && this.checkInterval;
            // if (this.useDocumentBottom) {
            // 	container.totalToScroll = this.height(this.$elementRef.nativeElement.ownerDocument);
            // }
            this.checkWhenEnabled = shouldScroll;
            if (triggerCallback) {
                if (scrollingDown) {
                    this.infiniteScrollDownCallback({ currentScrollPosition: container.scrolledUntilNow });
                } else {
                    this.infiniteScrollUpCallback({ currentScrollPosition: container.scrolledUntilNow });
                }
            }
            if (shouldClearInterval) {
                clearInterval(this.checkInterval);
            }
        };
        Scroller.prototype.calculatePoints = function () {
            return this.isContainerWindow ? this.calculatePointsForWindow() : this.calculatePointsForElement();
        };
        Scroller.prototype.calculatePointsForWindow = function () {
            // container's height
            var height = this.height(this.container);
            // scrolled until now / current y point
            var scrolledUntilNow = height + this.pageYOffset(this.documentElement);
            // total height / most bottom y point
            var totalToScroll = this.offsetTop(this.$elementRef.nativeElement) + this.height(this.$elementRef.nativeElement);
            return { height: height, scrolledUntilNow: scrolledUntilNow, totalToScroll: totalToScroll };
        };
        Scroller.prototype.calculatePointsForElement = function () {
            var scrollTop = this.axis.scrollTopKey();
            var scrollHeight = this.axis.scrollHeightKey();
            var height = this.height(this.container);
            // perhaps use this.container.offsetTop instead of 'scrollTop'
            var scrolledUntilNow = this.container[scrollTop];
            var containerTopOffset = 0;
            var offsetTop = this.offsetTop(this.container);
            if (offsetTop !== void 0) {
                containerTopOffset = offsetTop;
            }
            var totalToScroll = this.container[scrollHeight];
            // const totalToScroll = this.offsetTop(this.$elementRef.nativeElement) - containerTopOffset + this.height(this.$elementRef.nativeElement);
            return { height: height, scrolledUntilNow: scrolledUntilNow, totalToScroll: totalToScroll };
        };
        Scroller.prototype.handleInfiniteScrollDistance = function (scrollDownDistance, scrollUpDistance) {
            this.scrollDownDistance = parseFloat(scrollDownDistance) || 0;
            this.scrollUpDistance = parseFloat(scrollUpDistance) || 0;
        };
        Scroller.prototype.attachEvent = function (newContainer) {
            var _this = this;
            this.clean();
            if (newContainer) {
                var throttle_1 = this.infiniteScrollThrottle;
                this.disposeScroll = Observable_1.Observable.fromEvent(this.container, 'scroll').throttle(function (ev) {
                    return Observable_1.Observable.timer(throttle_1);
                }).filter(function (ev) {
                    return _this.scrollEnabled;
                }).subscribe(function (ev) {
                    return _this.handler();
                });
            }
        };
        Scroller.prototype.clean = function () {
            if (this.disposeScroll) {
                this.disposeScroll.unsubscribe();
            }
        };
        Scroller.prototype.handleInfiniteScrollDisabled = function (scrollDisabled) {
            this.scrollEnabled = !scrollDisabled;
        };
        return Scroller;
    }();
    exports.Scroller = Scroller;
    return module.exports;
});
System.registerDynamic('src/infinite-scroll', ['@angular/core', './scroller', './axis-resolver'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var core_1 = $__require('@angular/core');
    var scroller_1 = $__require('./scroller');
    var axis_resolver_1 = $__require('./axis-resolver');
    var InfiniteScroll = function () {
        function InfiniteScroll(element, zone, axis) {
            this.element = element;
            this.zone = zone;
            this.axis = axis;
            this._distanceDown = 2;
            this._distanceUp = 1.5;
            this._throttle = 300;
            this._disabled = false;
            this.scrollWindow = true;
            this._immediate = false;
            this._horizontal = false;
            this._alwaysCallback = false;
            this.scrolled = new core_1.EventEmitter();
            this.scrolledUp = new core_1.EventEmitter();
        }
        InfiniteScroll.prototype.ngOnInit = function () {
            var containerElement = this.scrollWindow ? window : this.element;
            this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScrollDown.bind(this), this.onScrollUp.bind(this), this._distanceDown, this._distanceUp, {}, this._throttle, this._immediate, this._horizontal, this._alwaysCallback, this._disabled, this.axis);
        };
        InfiniteScroll.prototype.ngOnDestroy = function () {
            this.scroller.clean();
        };
        InfiniteScroll.prototype.ngOnChanges = function (changes) {
            if (changes['_disabled'] && this.scroller) {
                this.scroller.handleInfiniteScrollDisabled(changes['_disabled'].currentValue);
            }
        };
        InfiniteScroll.prototype.onScrollDown = function (data) {
            var _this = this;
            if (data === void 0) {
                data = {};
            }
            this.zone.run(function () {
                return _this.scrolled.next(data);
            });
        };
        InfiniteScroll.prototype.onScrollUp = function (data) {
            var _this = this;
            if (data === void 0) {
                data = {};
            }
            this.zone.run(function () {
                return _this.scrolledUp.next(data);
            });
        };
        InfiniteScroll.decorators = [{ type: core_1.Directive, args: [{
                selector: '[infinite-scroll]'
            }] }];
        /** @nocollapse */
        InfiniteScroll.ctorParameters = [{ type: core_1.ElementRef }, { type: core_1.NgZone }, { type: axis_resolver_1.AxisResolver }];
        InfiniteScroll.propDecorators = {
            '_distanceDown': [{ type: core_1.Input, args: ['infiniteScrollDistance'] }],
            '_distanceUp': [{ type: core_1.Input, args: ['infiniteScrollUpDistance'] }],
            '_throttle': [{ type: core_1.Input, args: ['infiniteScrollThrottle'] }],
            '_disabled': [{ type: core_1.Input, args: ['infiniteScrollDisabled'] }],
            'scrollWindow': [{ type: core_1.Input, args: ['scrollWindow'] }],
            '_immediate': [{ type: core_1.Input, args: ['immediateCheck'] }],
            '_horizontal': [{ type: core_1.Input, args: ['horizontal'] }],
            '_alwaysCallback': [{ type: core_1.Input, args: ['alwaysCallback'] }],
            'scrolled': [{ type: core_1.Output }],
            'scrolledUp': [{ type: core_1.Output }]
        };
        return InfiniteScroll;
    }();
    exports.InfiniteScroll = InfiniteScroll;
    return module.exports;
});
System.registerDynamic("src/axis-resolver", ["@angular/core"], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var core_1 = $__require("@angular/core");
    var AxisResolver = function () {
        function AxisResolver() {
            this.setVertical(true);
        }
        AxisResolver.prototype.setVertical = function (vertical) {
            if (vertical === void 0) {
                vertical = true;
            }
            this.vertical = vertical;
        };
        AxisResolver.prototype.clientHeightKey = function () {
            return this.vertical ? 'clientHeight' : 'clientWidth';
        };
        AxisResolver.prototype.offsetHeightKey = function () {
            return this.vertical ? 'offsetHeight' : 'offsetWidth';
        };
        AxisResolver.prototype.scrollHeightKey = function () {
            return this.vertical ? 'scrollHeight' : 'scrollWidth';
        };
        AxisResolver.prototype.pageYOffsetKey = function () {
            return this.vertical ? 'pageYOffset' : 'pageXOffset';
        };
        AxisResolver.prototype.offsetTopKey = function () {
            return this.vertical ? 'offsetTop' : 'offsetLeft';
        };
        AxisResolver.prototype.scrollTopKey = function () {
            return this.vertical ? 'scrollTop' : 'scrollLeft';
        };
        AxisResolver.prototype.topKey = function () {
            return this.vertical ? 'top' : 'left';
        };
        AxisResolver.decorators = [{ type: core_1.Injectable }];
        /** @nocollapse */
        AxisResolver.ctorParameters = [];
        return AxisResolver;
    }();
    exports.AxisResolver = AxisResolver;
    return module.exports;
});
System.registerDynamic('src/index', ['@angular/core', './infinite-scroll', './axis-resolver'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    var core_1 = $__require('@angular/core');
    var infinite_scroll_1 = $__require('./infinite-scroll');
    var axis_resolver_1 = $__require('./axis-resolver');
    var InfiniteScrollModule = function () {
        function InfiniteScrollModule() {}
        InfiniteScrollModule.decorators = [{ type: core_1.NgModule, args: [{
                imports: [],
                declarations: [infinite_scroll_1.InfiniteScroll],
                exports: [infinite_scroll_1.InfiniteScroll],
                providers: [axis_resolver_1.AxisResolver]
            }] }];
        /** @nocollapse */
        InfiniteScrollModule.ctorParameters = [];
        return InfiniteScrollModule;
    }();
    exports.InfiniteScrollModule = InfiniteScrollModule;
    return module.exports;
});
System.registerDynamic('angular2-infinite-scroll', ['./src/infinite-scroll', './src/scroller', './src/axis-resolver', './src/index'], true, function ($__require, exports, module) {
    "use strict";

    var define,
        global = this || self,
        GLOBAL = global;
    function __export(m) {
        for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
    }
    var infinite_scroll_1 = $__require('./src/infinite-scroll');
    var scroller_1 = $__require('./src/scroller');
    var axis_resolver_1 = $__require('./src/axis-resolver');
    __export($__require('./src/infinite-scroll'));
    __export($__require('./src/scroller'));
    __export($__require('./src/axis-resolver'));
    __export($__require('./src/index'));
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.default = {
        directives: [infinite_scroll_1.InfiniteScroll, scroller_1.Scroller, axis_resolver_1.AxisResolver]
    };
    return module.exports;
});<|endoftext|>


<commit_before>/**
 * A Sea.js plugin for collecting health data of CMD modules
 */
(function(seajs) {

  seajs.health = function() {
    return {
      "multiVersions": getMultiVersions(),
      "circles": getCircles()
    }
  }

  var cachedMods = seajs.cache
  var VERSION_RE = /\/(?:\d+\.){1,2}\d+\/|\D(?:\d+\.){1,2}\d+[^/]*(?=\.js|\.css)/

  // Only support version styles bellow:
  // `zz/1.2.3/xx`
  // `zz/xx-1.2.3-beta.js`
  // `zz/xx.1.2.3.rc2.js`
  function getMultiVersions() {
    var hash = {}
    var ret = {}

    for (var uri in cachedMods) {
      if (!VERSION_RE.test(uri)) return

      var key = uri.replace(VERSION_RE, "{version}")
      var arr = hash[key] || (hash[key] = [])

      if (indexOf(arr, uri) === -1) {
        arr.push(uri)

        if (arr.length > 1) {
          ret[key] = arr
        }
      }
    }

    return ret
  }

  function getCircles() {
    return "NOT available now"
  }

  // Helpers

  var indexOf = [].indexOf ?
      function(arr, item) {
        return arr.indexOf(item)
      } :
      function(arr, item) {
        for (var i = 0; i < arr.length; i++) {
          if (arr[i] === item) {
            return i
          }
        }
        return -1
      }

  // Register as module
  define("seajs-health", [], {})

})(seajs);

<commit_msg>Improve getMultiVersions function<commit_after>/**
 * A Sea.js plugin for collecting health data of CMD modules
 */
(function(seajs) {

  seajs.health = function() {
    return {
      "multiVersions": getMultiVersions(),
      "circles": getCircles()
    }
  }

  var cachedMods = seajs.cache
  var VERSION_RE = /(\/)(?:\d+\.){1,2}\d+(\/)|(\D)(?:\d+\.){1,2}\d+[^/]*(\.(?:js|css))/

  // Only support version styles bellow:
  // `zz/1.2.3/xx`
  // `zz/xx-1.2.3-beta.js`
  // `zz/xx.1.2.3.rc2.js`
  function getMultiVersions() {
    var hash = {}
    var ret = {}

    for (var uri in cachedMods) {
      var m = uri.match(VERSION_RE)
      if (!m) continue

      var key = uri.replace(VERSION_RE,
          (m[1] || m[3]) + "{version}" + (m[2] || m[4]))

      var arr = hash[key] || (hash[key] = [])

      if (indexOf(arr, uri) === -1) {
        arr.push(uri)
        if (arr.length > 1) {
          ret[key] = arr
        }
      }
    }

    return ret
  }

  function getCircles() {
    return "NOT Available"
  }

  // Helpers

  var indexOf = [].indexOf ?
      function(arr, item) {
        return arr.indexOf(item)
      } :
      function(arr, item) {
        for (var i = 0; i < arr.length; i++) {
          if (arr[i] === item) {
            return i
          }
        }
        return -1
      }

  // Register as module
  define("seajs-health", [], {})

})(seajs);

<|endoftext|>


<commit_before>define(function(require, exports, module){
    var Achievement = require('./achievement'),
        config = require('../config'),
        _ = require('../vendor/lodash.min'),
        locale = require('../services/locale'),
        ExtensionsService = require('../services/extensions'),
        image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAADaklEQVR42p2Sf2iUdRzHvwT5RyrlaoglqBSBDksi+rVsOXU07I47KsEE3eBicxWBehTVZJttjVs3k7vKTdncdmNuu82bzgmSO5dw262TgacVPNtipdW53d1ueN1zz/P9ft49zwO7cVr/9IUX38/n/cCL7/fzfNmRI6ysuppNf3d6E4UXTtEk+g3Gk3V0/OdlVNqzmlZYi4jtNBk8aLZRjq2FHj9wkjbZ3fN5h92dGw+517GGr3Onui4Up88HSvDLQg9+w2WMztdgOPIpPu634ED7OyisrMHL9sYMxfV9KPyiC3l2N56pbFG2dgQd7ERbHl2dqkKCZkAkQBDgpIALBWlVR4ViwJfgXMs5ukevY8tRD4rOTybZ2O9f0o1YBwRxBINBtLa2ZhEOhzExMXFfHgqFoHIB27lreD00BybBq53le0PU1NQEk8mUhdfrhcfjuS/XZbqo9qco8m9xsLDSTKPzR42rLIpsNhtqa2sNAoEARkZGMn1paWlGxIWK8dsu9N6pB/vx73oa+vNdqELOiJxOJ2ZnZzE3N4dkMmmg13qmyxZFJNJAwgLMPw/WNLmazvyanyVyuVzg2kCJKAs9czgcSyKuABP7gLGdYFXBZdQmbc4Sud1uCCFw79KzhoaGbNGVMuCiGWzN/gKyOPYgraT/n2jcDsw4wB7YtZc2l30EWVkadmNjI+LxOBKJBGRZRiqVMmo9y5qRcbXPtTm1gz1SfpJe/OyUJlIzIrPZDKvVauDz+dDd3Z3p9W9Lw1aBm98AbWVga+uuUoFrDLL67++ot7f3P98RCQ5M+YDKN8Fe6rpBr3muYzqewl+RCCRJyiIajRq//t589k4EFJkGOg9CqdkFVjwoUeHQDEp++APH4jK+TalIys1QUyegJrzgC2fBE2e1egCqfBuqEjfgMU3SUg44LRgrfwWs4lJfbPetGN7WTnQldQzTih08+QlI526VhhMkh7T9JuiC1vcchNBYaH4Pl9/YiL7tT2Pf+py7rH9w++lBf0G6PVCBawMmSAPbIPkskC7ugRSuhBTUOH4IUvWHkGxbIZW8gA5zHuq2PYX3N6zCW2tWKsW5y+uZv++JtcO+dTXDnU9Gh6ufE/5FvioQ/qHDwn/mA+G3Piv8+RsyVKzPEUW5K8SOx5bHdjz6UN2rD7NV/wATxK/x0owARwAAAABJRU5ErkJggg==",
        extensionsAffected = {};

    function ThemeAchievement(){
        this.calculate = function(extensions){
            var regexp = /theme/;

            _.each(extensions, _.bind(function(extension){
                var bracketsExtension = ExtensionsService.get(extension._id);
                if (bracketsExtension && bracketsExtension.metadata && bracketsExtension.metadata.theme){
                    extensionsAffected[extension._id] = true;
                    this.writeBadge(null, extension);
                    console.log(extension._id);
                }
            }, this));
        }

        this.getTag = function(rating, element){
            return _.template('',{
                badge: image,
                title: locale.get('themeTitle')
            });
        }
    }

    ThemeAchievement.extensions = extensionsAffected;
    ThemeAchievement.prototype = Achievement;
    module.exports = ThemeAchievement;
});
<commit_msg>removed spam to console.log<commit_after>define(function(require, exports, module){
    var Achievement = require('./achievement'),
        config = require('../config'),
        _ = require('../vendor/lodash.min'),
        locale = require('../services/locale'),
        ExtensionsService = require('../services/extensions'),
        image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAADaklEQVR42p2Sf2iUdRzHvwT5RyrlaoglqBSBDksi+rVsOXU07I47KsEE3eBicxWBehTVZJttjVs3k7vKTdncdmNuu82bzgmSO5dw262TgacVPNtipdW53d1ueN1zz/P9ft49zwO7cVr/9IUX38/n/cCL7/fzfNmRI6ysuppNf3d6E4UXTtEk+g3Gk3V0/OdlVNqzmlZYi4jtNBk8aLZRjq2FHj9wkjbZ3fN5h92dGw+517GGr3Onui4Up88HSvDLQg9+w2WMztdgOPIpPu634ED7OyisrMHL9sYMxfV9KPyiC3l2N56pbFG2dgQd7ERbHl2dqkKCZkAkQBDgpIALBWlVR4ViwJfgXMs5ukevY8tRD4rOTybZ2O9f0o1YBwRxBINBtLa2ZhEOhzExMXFfHgqFoHIB27lreD00BybBq53le0PU1NQEk8mUhdfrhcfjuS/XZbqo9qco8m9xsLDSTKPzR42rLIpsNhtqa2sNAoEARkZGMn1paWlGxIWK8dsu9N6pB/vx73oa+vNdqELOiJxOJ2ZnZzE3N4dkMmmg13qmyxZFJNJAwgLMPw/WNLmazvyanyVyuVzg2kCJKAs9czgcSyKuABP7gLGdYFXBZdQmbc4Sud1uCCFw79KzhoaGbNGVMuCiGWzN/gKyOPYgraT/n2jcDsw4wB7YtZc2l30EWVkadmNjI+LxOBKJBGRZRiqVMmo9y5qRcbXPtTm1gz1SfpJe/OyUJlIzIrPZDKvVauDz+dDd3Z3p9W9Lw1aBm98AbWVga+uuUoFrDLL67++ot7f3P98RCQ5M+YDKN8Fe6rpBr3muYzqewl+RCCRJyiIajRq//t589k4EFJkGOg9CqdkFVjwoUeHQDEp++APH4jK+TalIys1QUyegJrzgC2fBE2e1egCqfBuqEjfgMU3SUg44LRgrfwWs4lJfbPetGN7WTnQldQzTih08+QlI526VhhMkh7T9JuiC1vcchNBYaH4Pl9/YiL7tT2Pf+py7rH9w++lBf0G6PVCBawMmSAPbIPkskC7ugRSuhBTUOH4IUvWHkGxbIZW8gA5zHuq2PYX3N6zCW2tWKsW5y+uZv++JtcO+dTXDnU9Gh6ufE/5FvioQ/qHDwn/mA+G3Piv8+RsyVKzPEUW5K8SOx5bHdjz6UN2rD7NV/wATxK/x0owARwAAAABJRU5ErkJggg==",
        extensionsAffected = {};

    function ThemeAchievement(){
        this.calculate = function(extensions){
            var regexp = /theme/;

            _.each(extensions, _.bind(function(extension){
                var bracketsExtension = ExtensionsService.get(extension._id);
                if (bracketsExtension && bracketsExtension.metadata && bracketsExtension.metadata.theme){
                    extensionsAffected[extension._id] = true;
                    this.writeBadge(null, extension);
                }
            }, this));
        }

        this.getTag = function(rating, element){
            return _.template('',{
                badge: image,
                title: locale.get('themeTitle')
            });
        }
    }

    ThemeAchievement.extensions = extensionsAffected;
    ThemeAchievement.prototype = Achievement;
    module.exports = ThemeAchievement;
});
<|endoftext|>


<commit_before>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
import { reactify } from '@superset-ui/chart';
import Component from './NVD3Vis';

export default reactify(Component);
<commit_msg>fix: remove sticky tooltip when query returns no data in explore view (#42)<commit_after>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
import { reactify } from '@superset-ui/chart';
import Component from './NVD3Vis';
import { hideTooltips } from './utils';

function willUnmount() {
  hideTooltips(true);
}

export default reactify(Component, { willUnmount });
<|endoftext|>


<commit_before>module.exports = function(hostname) {

    if (hostname === 'mapseries.mzk.cz') {
        return {
            client_id: '70c8690c165d40b7079d',
            gatekeeper_url: 'http://mapseries.mzk.cz/github-proxy/',
        };
    // Customize these settings for your own development/deployment
    // version of geojson.io.
    } else {
        return {
            client_id: 'bb7bbe70bd1f707125bc',
            gatekeeper_url: 'https://localhostauth.herokuapp.com'
        };
    }
};
<commit_msg>Updated config.js in edit<commit_after>module.exports = function(hostname) {

  if (hostname === 'mapseries.mzk.cz') {
    return {
      client_id: '70c8690c165d40b7079d',
      gatekeeper_url: 'http://mapseries.mzk.cz/server',
    };
  // Customize these settings for your own development/deployment
  // version of geojson.io.
} else if (hostname === 'mapseries.devel.mzk.cz') {
    return {
      client_id: '5395a41f086b3fcaa499',
      gatekeeper_url: 'http://mapseries.devel.mzk.cz/server',
    };
  } else {
      return {
        client_id: 'bb7bbe70bd1f707125bc',
        gatekeeper_url: 'https://localhostauth.herokuapp.com'
      };
    }
};
<|endoftext|>