<commit_before>/* =========================================================================
 * Dependencies
 * ========================================================================= */
const gulp = require('gulp');
const jshint = require('gulp-jshint');
const less = require('gulp-less');
const sh = require('shelljs');
const runSequence = require('run-sequence');
const mocha = require('gulp-spawn-mocha');
const _ = require('underscore');
const childProcess = require('child_process');
const karma = require('karma').server;
const babel = require('gulp-babel');
const electronPackager = require('electron-packager');
const symlink = require('gulp-symlink');
const electron = require('electron-prebuilt');

const appConfig = require('./src/config/appConfig');

require('gulp-task-list')(gulp);

/* =========================================================================
 * Constants
 * ========================================================================= */
const SRC_DIR = 'src';
const DOCS_DIR = 'docs';
const RELEASE_IGNORE_PKGS = [ //any npm packages that should not be included in the release
  'electron-packager',
  'electron-prebuilt',
  'gulp|gulp-jshint',
  'gulp-less',
  'gulp-mocha',
  'gulp-task-list',
  'jshint-stylish',
  'run-sequence',
  'bower',
  'babel',
  'should',
  'sinon',
  'supertest'
];
const RELEASE_IMAGE_ICON = __dirname + '/src/ui/images/logo_icon.icns';

const LESSOPTIONS = {
  compress: false
};

const MOCHA_SETTINGS = {
  reporter: 'spec',
  growl: true,
  env: {
    NODE_ENV: 'test'
  }
};

/* =========================================================================
 * Tasks
 * ========================================================================= */
/**
 * List gulp tasks
 */
gulp.task('?', (next) => {
  sh.exec('gulp task-list');
  next();
});

gulp.task('clean', (next) => {
  sh.rm('-rf', appConfig.releasePath);
  sh.rm('-rf', appConfig.buildPath);
  next();
});

gulp.task('css', () => {
  return gulp.src(SRC_DIR + '/ui/less/main.less')
    .pipe(less(LESSOPTIONS))
    .pipe(gulp.dest(SRC_DIR + '/ui/css'));
});

gulp.task('site-css', () => {
  return gulp.src(DOCS_DIR + '/less/docs.less')
    .pipe(less(LESSOPTIONS))
    .pipe(gulp.dest(DOCS_DIR + '/css'));
});

gulp.task('jshint', () => {
  return _init(gulp.src(['src/**/*.js', '!src/ui/vendor/**/*.js']))
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish'))
    .pipe(jshint.reporter('fail'));
});

gulp.task('release', ['pre-release'], (next) => {
  electronPackager({
    dir: '.',
    name: appConfig.name,
    out: appConfig.releasePath,
    // platform: 'all',
    // arch: 'all',
    platform: 'darwin',
    arch: 'x64',
    version: '0.35.0',
    ignore: RELEASE_IGNORE_PKGS.map((ignore) => {
      return '/node_modules/' + ignore + '($|/)';
    }),
    icon: RELEASE_IMAGE_ICON,
    appPath: 'build/browser/main.js',
    force: true
  }, next);

  // var env = _.extend({}, process.env);
  // env.NODE_ENV = 'production';
  //
  // var child = childProcess.spawn('./node_modules/.bin/electron-packager', [
  //   '.',
  //   appConfig.name,
  //   '--out',
  //   appConfig.releasePath,
  //   '--platform',
  //   'all',
  //   '--arch',
  //   'all',
  //   '--version',
  //   '0.35.0',
  //   '--ignore', ('node_modules/(' + RELEASE_IGNORE_PKGS + ')'),
  //   '--icon',
  //   RELEASE_IMAGE_ICON,
  //   '--appPath',
  //   'build/browser/main.js'
  // ], {
  //   env: env
  // });
  //
  // child.stdout.on('data', (data) => {
  //   console.log('tail output: ' + data);
  // });
  //
  // child.on('exit', (exitCode) => {
  //   console.log('Child exited with code: ' + exitCode);
  //   return next(exitCode === 1 ? new Error('Error running release task') : null);
  // });
});

gulp.task('pre-release', (next) => {
  // Build Steps:
  //-------------------------------------
  // run build to cleanup dirs and compile less
  // run babel to compile ES6 => ES5
  // run prod-sym-links to change symlinks in node_modules that point to src dir to the build dir (which will contain the compiled ES5 code)
  //-------------------------------------
  runSequence('build', 'babel', 'prod-sym-links', next);
});

gulp.task('babel', () => {
  return gulp.src('./src/**/*.js')
    .pipe(babel({
      presets: ['es2015'],
      ignore: 'src/ui/vendor/*',

    }))
    .pipe(gulp.dest(appConfig.buildPath));
});

gulp.task('prod-sym-links', () => {
  return gulp.src(['build/', 'build/lib/'])
    .pipe(symlink(['./node_modules/src', './node_modules/lib'], {
      force: true
    }));
});

gulp.task('dev-sym-links', () => {
  return gulp.src(['src/', 'src/lib/', 'tests/'])
    .pipe(symlink(['./node_modules/src', './node_modules/lib', './node_modules/tests'], {
      force: true
    }));
});

gulp.task('build', ['clean', 'css', 'dev-sym-links']);

gulp.task('serve', ['build'], (next) => {

  var env = _.extend({}, process.env);
  // env.NODE_ENV = 'production';

  var child = childProcess.spawn(electron, ['./'], {
    env: env
  });

  child.stdout.on('data', (data) => {
    console.log('tail output: ' + data);
  });

  child.on('exit', (exitCode) => {
    console.log('Child exited with code: ' + exitCode);
    return next(exitCode === 1 ? new Error('Error running serve task') : null);
  });
});

gulp.task('serve-site', ['site-css'], () => {
  gulp.watch(DOCS_DIR + '/less/*.less', () => {
    gulp.src(DOCS_DIR + '/less/docs.less')
      .pipe(less(LESSOPTIONS))
      .pipe(gulp.dest(DOCS_DIR + '/css'));
  });
});

gulp.task('default', ['serve']);

gulp.task('test', (next) => {
  runSequence('jshint', 'test-int', 'test-unit', 'test-unit-ui', next);
});

gulp.task('test-int', () => {
  return gulp.src('tests/integration/**/**/**-test.js')
    .pipe(mocha(MOCHA_SETTINGS));
});

gulp.task('test-unit', () => {
  return gulp.src('tests/unit/**/**/**-test.js')
    .pipe(mocha(MOCHA_SETTINGS));
});

gulp.task('test-unit-ui', (done) => {
  karma.start({
    configFile: __dirname + '/tests/ui/karma.conf.js',
    singleRun: true,
    files: [
      'karma.shim.js',
      '../../src/ui/vendor/jquery/dist/jquery.min.js',
      '../../src/ui/vendor/toastr/toastr.min.js',
      '../../src/ui/vendor/jquery-ui/jquery-ui.min.js',
      '../../src/ui/vendor/bootstrap/dist/js/bootstrap.js',
      '../../src/ui/vendor/angular/angular.js',
      '../../src/ui/vendor/angular-ui-sortable/sortable.js',
      '../../src/ui/vendor/angular-bootstrap/ui-bootstrap-tpls.js',
      '../../src/ui/vendor/underscore/underscore.js',
      '../../src/ui/vendor/angular-sanitize/angular-sanitize.js',
      '../../src/ui/vendor/angular-auto-grow-input/dist/angular-auto-grow-input.js',
      '../../src/ui/vendor/jquery.splitter/js/jquery.splitter-0.15.0.js',
      '../../src/ui/vendor/moment/moment.js',
      '../../src/ui/vendor/ng-prettyjson/src/ng-prettyjson.js',
      '../../src/ui/vendor/ng-prettyjson/src/ng-prettyjson-tmpl.js',
      '../../src/ui/vendor/Keypress/keypress.js',
      '../../src/ui/vendor/codemirror/lib/codemirror.js',
      '../../src/ui/vendor/codemirror/mode/javascript/javascript.js',
      '../../src/ui/vendor/codemirror/addon/hint/show-hint.js',
      '../../src/ui/vendorCustom/codemirror-formatting.js',
      '../../src/ui/vendor/angular-mocks/angular-mocks.js',
      '../../src/ui/app.js',
      '../../src/ui/components/**/*.js',
      '../../src/ui/directives/**/*.js',
      '../../src/ui/filters/**/*.js',
      '../../src/ui/services/**/*.js',
      './**/*-test.js'
    ]
  }, done);
});

/* =========================================================================
 * Helper Functions
 * ========================================================================= */
function _init(stream) {
  stream.setMaxListeners(0);
  return stream;
}
<commit_msg>Windows and Linux gulp release tasks<commit_after>/* =========================================================================
 * Dependencies
 * ========================================================================= */
const gulp = require('gulp');
const jshint = require('gulp-jshint');
const less = require('gulp-less');
const sh = require('shelljs');
const runSequence = require('run-sequence');
const mocha = require('gulp-spawn-mocha');
const _ = require('underscore');
const childProcess = require('child_process');
const karma = require('karma').server;
const babel = require('gulp-babel');
const electronPackager = require('electron-packager');
const symlink = require('gulp-symlink');
const electron = require('electron-prebuilt');
const fs = require('fs');

const appConfig = require('./src/config/appConfig');

require('gulp-task-list')(gulp);

/* =========================================================================
 * Constants
 * ========================================================================= */
const SRC_DIR = 'src';
const DOCS_DIR = 'docs';
const RELEASE_IGNORE_PKGS = [ //any npm packages that should not be included in the release
  'electron-packager',
  'electron-prebuilt',
  'gulp|gulp-jshint',
  'gulp-less',
  'gulp-mocha',
  'gulp-task-list',
  'jshint-stylish',
  'run-sequence',
  'bower',
  'babel',
  'should',
  'sinon',
  'supertest'
];
const RELEASE_IMAGE_ICON = __dirname + '/src/ui/images/logo_icon.icns';

const LESSOPTIONS = {
  compress: false
};

const MOCHA_SETTINGS = {
  reporter: 'spec',
  growl: true,
  env: {
    NODE_ENV: 'test'
  }
};

/* =========================================================================
 * Tasks
 * ========================================================================= */
/**
 * List gulp tasks
 */
gulp.task('?', (next) => {
  sh.exec('gulp task-list');
  next();
});

gulp.task('clean', (next) => {
  sh.rm('-rf', appConfig.releasePath);
  sh.rm('-rf', appConfig.buildPath);
  next();
});

gulp.task('css', () => {
  return gulp.src(SRC_DIR + '/ui/less/main.less')
    .pipe(less(LESSOPTIONS))
    .pipe(gulp.dest(SRC_DIR + '/ui/css'));
});

gulp.task('site-css', () => {
  return gulp.src(DOCS_DIR + '/less/docs.less')
    .pipe(less(LESSOPTIONS))
    .pipe(gulp.dest(DOCS_DIR + '/css'));
});

gulp.task('jshint', () => {
  return _init(gulp.src(['src/**/*.js', '!src/ui/vendor/**/*.js']))
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish'))
    .pipe(jshint.reporter('fail'));
});

gulp.task('release-osx', ['pre-release'], (next) => {
  electronPackager({
    dir: '.',
    name: appConfig.name,
    out: appConfig.releasePath,
    platform: 'darwin',
    arch: 'x64',
    version: '0.35.0',
    ignore: RELEASE_IGNORE_PKGS.map((ignore) => {
      return '/node_modules/' + ignore + '($|/)';
    }),
    icon: RELEASE_IMAGE_ICON,
    appPath: 'build/browser/main.js',
    force: true
  }, next);

  // var env = _.extend({}, process.env);
  // env.NODE_ENV = 'production';
  //
  // var child = childProcess.spawn('./node_modules/.bin/electron-packager', [
  //   '.',
  //   appConfig.name,
  //   '--out',
  //   appConfig.releasePath,
  //   '--platform',
  //   'all',
  //   '--arch',
  //   'all',
  //   '--version',
  //   '0.35.0',
  //   '--ignore', ('node_modules/(' + RELEASE_IGNORE_PKGS + ')'),
  //   '--icon',
  //   RELEASE_IMAGE_ICON,
  //   '--appPath',
  //   'build/browser/main.js'
  // ], {
  //   env: env
  // });
  //
  // child.stdout.on('data', (data) => {
  //   console.log('tail output: ' + data);
  // });
  //
  // child.on('exit', (exitCode) => {
  //   console.log('Child exited with code: ' + exitCode);
  //   return next(exitCode === 1 ? new Error('Error running release task') : null);
  // });
});

gulp.task('release-win', ['pre-release'], (next) => {
  electronPackager({
    dir: '.',
    name: appConfig.name,
    out: appConfig.releasePath,
    platform: 'win32',
    arch: 'all',
    version: '0.35.0',
    ignore: RELEASE_IGNORE_PKGS.map((ignore) => {
      return '/node_modules/' + ignore + '($|/)';
    }),
    icon: RELEASE_IMAGE_ICON,
    appPath: 'build/browser/main.js',
    force: true
  }, next);
});

gulp.task('release-lin', ['pre-release'], (next) => {
  electronPackager({
    dir: '.',
    name: appConfig.name,
    out: appConfig.releasePath,
    platform: 'linux',
    arch: 'all',
    version: '0.35.0',
    ignore: RELEASE_IGNORE_PKGS.map((ignore) => {
      return '/node_modules/' + ignore + '($|/)';
    }),
    icon: RELEASE_IMAGE_ICON,
    appPath: 'build/browser/main.js',
    force: true
  }, next);
});

gulp.task('release', ['pre-release'], (next) => {
  electronPackager({
    dir: '.',
    name: appConfig.name,
    out: appConfig.releasePath,
    platform: 'all',
    arch: 'all',
    version: '0.35.0',
    ignore: RELEASE_IGNORE_PKGS.map((ignore) => {
      return '/node_modules/' + ignore + '($|/)';
    }),
    icon: RELEASE_IMAGE_ICON,
    appPath: 'build/browser/main.js',
    force: true
  }, next);
});

gulp.task('pre-release', (next) => {
  // Build Steps:
  //-------------------------------------
  // run build to cleanup dirs and compile less
  // run babel to compile ES6 => ES5
  // run prod-sym-links to change symlinks in node_modules that point to src dir to the build dir (which will contain the compiled ES5 code)
  //-------------------------------------
  runSequence('build', 'babel', 'prod-sym-links', next);
});

gulp.task('babel', () => {
  return gulp.src('./src/**/*.js')
    .pipe(babel({
      presets: ['es2015'],
      ignore: 'src/ui/vendor/*',

    }))
    .pipe(gulp.dest(appConfig.buildPath));
});

gulp.task('remove-link-src', (next) => {
  unlink('./node_modules/src/', next);
});

gulp.task('remove-link-lib', (next) => {
  unlink('./node_modules/lib/', next);
});

gulp.task('remove-link-tests', (next) => {
  unlink('./node_modules/tests/', next);
});

gulp.task('remove-sym-links', ['remove-link-src', 'remove-link-lib', 'remove-link-tests']);

gulp.task('prod-sym-links', ['remove-sym-links'], () => {
  return gulp.src(['build/', 'build/lib/'])
    .pipe(symlink(['./node_modules/src', './node_modules/lib'], {
      force: true
    }));
});

gulp.task('dev-sym-links', ['remove-sym-links'], () => {
  return gulp.src(['src/', 'src/lib/', 'tests/'])
    .pipe(symlink(['./node_modules/src', './node_modules/lib', './node_modules/tests'], {
      force: true
    }));
});

gulp.task('build', ['clean', 'css', 'dev-sym-links']);

gulp.task('serve', ['build'], (next) => {

  var env = _.extend({}, process.env);
  // env.NODE_ENV = 'production';

  var child = childProcess.spawn(electron, ['./'], {
    env: env
  });

  child.stdout.on('data', (data) => {
    console.log('tail output: ' + data);
  });

  child.on('exit', (exitCode) => {
    console.log('Child exited with code: ' + exitCode);
    return next(exitCode === 1 ? new Error('Error running serve task') : null);
  });
});

gulp.task('serve-site', ['site-css'], () => {
  gulp.watch(DOCS_DIR + '/less/*.less', () => {
    gulp.src(DOCS_DIR + '/less/docs.less')
      .pipe(less(LESSOPTIONS))
      .pipe(gulp.dest(DOCS_DIR + '/css'));
  });
});

gulp.task('default', ['serve']);

gulp.task('test', (next) => {
  runSequence('jshint', 'test-int', 'test-unit', 'test-unit-ui', next);
});

gulp.task('test-int', () => {
  return gulp.src('tests/integration/**/**/**-test.js')
    .pipe(mocha(MOCHA_SETTINGS));
});

gulp.task('test-unit', () => {
  return gulp.src('tests/unit/**/**/**-test.js')
    .pipe(mocha(MOCHA_SETTINGS));
});

gulp.task('test-unit-ui', (done) => {
  karma.start({
    configFile: __dirname + '/tests/ui/karma.conf.js',
    singleRun: true,
    files: [
      'karma.shim.js',
      '../../src/ui/vendor/jquery/dist/jquery.min.js',
      '../../src/ui/vendor/toastr/toastr.min.js',
      '../../src/ui/vendor/jquery-ui/jquery-ui.min.js',
      '../../src/ui/vendor/bootstrap/dist/js/bootstrap.js',
      '../../src/ui/vendor/angular/angular.js',
      '../../src/ui/vendor/angular-ui-sortable/sortable.js',
      '../../src/ui/vendor/angular-bootstrap/ui-bootstrap-tpls.js',
      '../../src/ui/vendor/underscore/underscore.js',
      '../../src/ui/vendor/angular-sanitize/angular-sanitize.js',
      '../../src/ui/vendor/angular-auto-grow-input/dist/angular-auto-grow-input.js',
      '../../src/ui/vendor/jquery.splitter/js/jquery.splitter-0.15.0.js',
      '../../src/ui/vendor/moment/moment.js',
      '../../src/ui/vendor/ng-prettyjson/src/ng-prettyjson.js',
      '../../src/ui/vendor/ng-prettyjson/src/ng-prettyjson-tmpl.js',
      '../../src/ui/vendor/Keypress/keypress.js',
      '../../src/ui/vendor/codemirror/lib/codemirror.js',
      '../../src/ui/vendor/codemirror/mode/javascript/javascript.js',
      '../../src/ui/vendor/codemirror/addon/hint/show-hint.js',
      '../../src/ui/vendorCustom/codemirror-formatting.js',
      '../../src/ui/vendor/angular-mocks/angular-mocks.js',
      '../../src/ui/app.js',
      '../../src/ui/components/**/*.js',
      '../../src/ui/directives/**/*.js',
      '../../src/ui/filters/**/*.js',
      '../../src/ui/services/**/*.js',
      './**/*-test.js'
    ]
  }, done);
});

/* =========================================================================
 * Helper Functions
 * ========================================================================= */
function _init(stream) {
  stream.setMaxListeners(0);
  return stream;
}

function unlink(symlink, next) {
  fs.lstat(symlink, function(err, stat) {
    if (err || !stat.isSymbolicLink()) {
      next();
    }

    fs.unlink(symlink, function(lerr) {
      // console.log('unlink symlink', symlink);
      next();
    });
  });
}
<|endoftext|>


<commit_before>/**
 * Created by stefano on 3/21/14.
 */
/*
* linegraph_utils is a collection of js calls to draw in a div the linechart and adapt it
* to the page, even when resized
*/

var linechart = null;
var secondary_linechart = null;

function init_main_linechart(timeline_start_year, timeline_end_year, axisUnit, tooltipUnit, linechart_visible){

    "use strict";
    linechart = visup.linechart(".timeline-multiline");

    // sets default values for Y axis value unit and tooltip value unit
    axisUnit = typeof axisUnit !== 'undefined' ? axisUnit : 'MILIONI';
    tooltipUnit = typeof tooltipUnit !== 'undefined' ? tooltipUnit : 'MLN';
    linechart_visible = typeof linechart_visible !== 'undefined' ? linechart_visible : true;

    linechart.options({
        timeline: {
            start: timeline_start_year,
            end: timeline_end_year,
            barPadding: 3,
            format: "%Y-%m-%d",
            visible: true
        },
        linechart: {
            height: 270,
            start: timeline_start_year,
            end: timeline_end_year,
            circleRadius: 9,
            axisUnit: axisUnit,
            tooltipUnit: tooltipUnit,
            format: "%Y",
            visible: linechart_visible
        },
        legend: {
            rowItems: 2
        }
    });

    // adapt the linechart to the page
    linechart.resize();

}

function init_secondary_linechart(event){
    event.stopPropagation();
    var timeline_start_year = event.data.timeline_start_year;
    var timeline_end_year = event.data.timeline_end_year;

    var panel = $(this),
        panel_id = panel.attr('id').split('-').pop();
    var btn = $('#trend-chart-toggle-' + panel_id);
    var chart_container = $('#trend-chart-container-' + panel_id);
    var chart_td = chart_container.find('div.graph-box');
    var voce_slug = btn.attr('href').substring(1);

    if (chart_td.find('div').length == 0) {
        chart_td.append($("<div>").addClass("trend-chart"));
        secondary_linechart = visup.linechart("#" + chart_container.attr('id') + " .trend-chart");
        secondary_linechart.options({
                timeline: {
                    visible: false
                },
                linechart: {
                    height: 270,
                    start: timeline_start_year,
                    end: timeline_end_year,
                    circleRadius: 9,
                    axisUnit: "EURO",
                    tooltipUnit: "EURO",
                    format: "%Y",
                    visible: true
                },
                legend: {
                    rowItems: 2
                }
            });
        feed_secondary_linechart(voce_slug);
    }

    return false;

    }

/*
* switches the secondary timeline toggle on mouse over. avoids switching img after graph collapse
* */

function hover_secondary_toggle(event){
    event.preventDefault();
    var btn = $( this );
    var chart_container = $('#trend-chart-container-' + btn.attr('id').split('-').pop());
    var button_on_img = event.data.button_on_img;
    var button_off_img = event.data.button_off_img;

    if(chart_container[0].className == "hidden" &&(event.type != "mouseleave" || event.target.src != window.location.origin + button_off_img) ){

        if(event.target.src == window.location.origin + button_on_img)
            event.target.src = window.location.origin + button_off_img;
        else
            event.target.src = window.location.origin + button_on_img;

    }

}

if(linechart){
    $(window).on('resize', function(){

    linechart.resize();
});
}
<commit_msg>Js change over visup bugfix<commit_after>/**
 * Created by stefano on 3/21/14.
 */
/*
* linegraph_utils is a collection of js calls to draw in a div the linechart and adapt it
* to the page, even when resized
*/

var linechart = null;
var secondary_linechart = null;

function init_main_linechart(timeline_start_year, timeline_end_year, axisUnit, tooltipUnit, linechart_visible){

    "use strict";
    linechart = visup.linechart(".timeline-multiline");

    // sets default values for Y axis value unit and tooltip value unit
    axisUnit = typeof axisUnit !== 'undefined' ? axisUnit : 'MILIONI';
    tooltipUnit = typeof tooltipUnit !== 'undefined' ? tooltipUnit : 'Euro';
    linechart_visible = typeof linechart_visible !== 'undefined' ? linechart_visible : true;

    linechart.options({
        timeline: {
            start: timeline_start_year,
            end: timeline_end_year,
            barPadding: 3,
            format: "%Y-%m-%d",
            visible: true
        },
        linechart: {
            height: 270,
            start: timeline_start_year,
            end: timeline_end_year,
            circleRadius: 9,
            axisUnit: axisUnit,
            tooltipUnit: tooltipUnit,
            format: "%Y",
            visible: linechart_visible
        },
        legend: {
            rowItems: 2
        }
    });

    // adapt the linechart to the page
    linechart.resize();

}

function init_secondary_linechart(event){
    event.stopPropagation();
    var timeline_start_year = event.data.timeline_start_year;
    var timeline_end_year = event.data.timeline_end_year;

    var panel = $(this),
        panel_id = panel.attr('id').split('-').pop();
    var btn = $('#trend-chart-toggle-' + panel_id);
    var chart_container = $('#trend-chart-container-' + panel_id);
    var chart_td = chart_container.find('div.graph-box');
    var voce_slug = btn.attr('href').substring(1);

    if (chart_td.find('div').length == 0) {
        chart_td.append($("<div>").addClass("trend-chart"));
        secondary_linechart = visup.linechart("#" + chart_container.attr('id') + " .trend-chart");
        secondary_linechart.options({
                timeline: {
                    visible: false
                },
                linechart: {
                    height: 270,
                    start: timeline_start_year,
                    end: timeline_end_year,
                    circleRadius: 9,
                    axisUnit: "EURO",
                    tooltipUnit: "EURO",
                    format: "%Y",
                    visible: true
                },
                legend: {
                    rowItems: 2
                }
            });
        feed_secondary_linechart(voce_slug);
    }

    return false;

    }

/*
* switches the secondary timeline toggle on mouse over. avoids switching img after graph collapse
* */

function hover_secondary_toggle(event){
    event.preventDefault();
    var btn = $( this );
    var chart_container = $('#trend-chart-container-' + btn.attr('id').split('-').pop());
    var button_on_img = event.data.button_on_img;
    var button_off_img = event.data.button_off_img;

    if(chart_container[0].className == "hidden" &&(event.type != "mouseleave" || event.target.src != window.location.origin + button_off_img) ){

        if(event.target.src == window.location.origin + button_on_img)
            event.target.src = window.location.origin + button_off_img;
        else
            event.target.src = window.location.origin + button_on_img;

    }

}

if(linechart){
    $(window).on('resize', function(){

    linechart.resize();
});
}
<|endoftext|>


<commit_before>var gulp = require('gulp');
var clean = require('gulp-clean');

gulp.task('clean', function() {
  return gulp.src(['build/*'], {read: false}).pipe(clean());
});

var react = require('gulp-react');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var jshint = require('gulp-jshint');

// Parse and compress JS and JSX files

gulp.task('javascript', function() {
  // Listen to every JS file in ./frontend/javascript
  return gulp.src('lib/**/*.js')
    // Turn React JSX syntax into regular javascript
    .pipe(react())
    // Output each file into the ./build/javascript/ directory
    .pipe(gulp.dest('build/javascript/'))
    // Optimize each JavaScript file
    //.pipe(uglify())
    // Add .min.js to the end of each optimized file
    //.pipe(rename({suffix: '.min'}))
    // Output each optimized .min.js file into the ./build/javascript/ dir
    //.pipe(gulp.dest('build/javascript/'));
});

var browserify = require('gulp-browserify');

gulp.task('browserify', ['javascript', 'lint'], function() {
  return gulp.src('build/javascript/index.js')
    .pipe(browserify({transform: ['envify']}))
    .pipe(rename('compiled.js'))
    .pipe(gulp.dest('build/javascript/'))
    .pipe(uglify())
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('build/javascript/'));
});

gulp.task('lint', function() {
  return gulp.src('./build/*.js')
    .pipe(jshint())
    .pipe(jshint.reporter('default'));
});

var less = require('gulp-less');
var minifycss = require('gulp-minify-css');

// gulp.task('styles', function() {
//   return gulp.src('themes/**/*.less')
//     .pipe(less())
//     .pipe(gulp.dest('build/'))
//     .pipe(minifycss())
//     .pipe(rename({suffix: '.min'}))
//     .pipe(gulp.dest('build/'));
// });
var nodemon = require('gulp-nodemon');

gulp.task('watch', ['clean'], function() {
  var watching = false;
  gulp.start('browserify', 'styles', function() {
    // Protect against this function being called twice. (Bug?)
    if (!watching) {
      watching = true;

      // Watch for changes in frontend js and run the 'javascript' task
      gulp.watch('lib/**/*.js', ['javascript','browserify_nodep']);

      // // Run the 'browserify_nodep' task when client.js changes
      // gulp.watch('build/javascript/compiled.js', ['browserify_nodep']);

      // Watch for .less file changes and re-run the 'styles' task
      //gulp.watch('frontend/**/*.less', ['styles']);

      // Start up the server and have it reload when anything in the
      // ./build/ directory changes
      //nodemon({script: 'server.js', watch: 'build'});
    }
  });
});

gulp.task('default', ['clean'], function() {
  return gulp.start('browserify'
  	//, 'styles'
  	);
});
<commit_msg>add jsx transform to gulpfile<commit_after>var gulp = require('gulp');
var clean = require('gulp-clean');

gulp.task('clean', function() {
  return gulp.src(['build/*'], {read: false}).pipe(clean());
});

var react = require('gulp-react');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var jshint = require('gulp-jshint');

// Parse and compress JS and JSX files

gulp.task('javascript', function() {
  // Listen to every JS file in ./frontend/javascript
  return gulp.src('lib/**/*.js')
    // Turn React JSX syntax into regular javascript
    .pipe(react())
    // Output each file into the ./build/javascript/ directory
    .pipe(gulp.dest('build/javascript/'))
    // Optimize each JavaScript file
    //.pipe(uglify())
    // Add .min.js to the end of each optimized file
    //.pipe(rename({suffix: '.min'}))
    // Output each optimized .min.js file into the ./build/javascript/ dir
    //.pipe(gulp.dest('build/javascript/'));
});

gulp.task('jsxExamples', function() {
  return gulp.src('examples/jsx/*.jsx')
    .pipe(react())
    .pipe(gulp.dest('examples/build/'))
});

var browserify = require('gulp-browserify');

gulp.task('browserify', ['javascript', 'lint'], function() {
  return gulp.src('build/javascript/index.js')
    .pipe(browserify({transform: ['envify']}))
    .pipe(rename('compiled.js'))
    .pipe(gulp.dest('build/javascript/'))
    .pipe(uglify())
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('build/javascript/'));
});

gulp.task('lint', function() {
  return gulp.src('./build/*.js')
    .pipe(jshint())
    .pipe(jshint.reporter('default'));
});

var less = require('gulp-less');
var minifycss = require('gulp-minify-css');

// gulp.task('styles', function() {
//   return gulp.src('themes/**/*.less')
//     .pipe(less())
//     .pipe(gulp.dest('build/'))
//     .pipe(minifycss())
//     .pipe(rename({suffix: '.min'}))
//     .pipe(gulp.dest('build/'));
// });
var nodemon = require('gulp-nodemon');

gulp.task('watch', ['clean'], function() {
  var watching = false;
  gulp.start('browserify', 'styles', function() {
    // Protect against this function being called twice. (Bug?)
    if (!watching) {
      watching = true;

      // Watch for changes in frontend js and run the 'javascript' task
      gulp.watch('lib/**/*.js', ['javascript','browserify_nodep']);

      // // Run the 'browserify_nodep' task when client.js changes
      // gulp.watch('build/javascript/compiled.js', ['browserify_nodep']);

      // Watch for .less file changes and re-run the 'styles' task
      //gulp.watch('frontend/**/*.less', ['styles']);

      // Start up the server and have it reload when anything in the
      // ./build/ directory changes
      //nodemon({script: 'server.js', watch: 'build'});
    }
  });
});

gulp.task('default', ['clean'], function() {
  return gulp.start('browserify'
  	//, 'styles'
  	);
});
<|endoftext|>


<commit_before>var async = require('async');
var gulp = require('gulp');
var watch = require('gulp-watch');
var lodash = require('lodash');
var iconfont = require('gulp-iconfont');
var consolidate = require('gulp-consolidate');

var runSequence = require('run-sequence');
var sass = require('gulp-sass');

var rename = require("gulp-rename");
var template = require('gulp-template');
var removeEmptyLines = require('gulp-remove-empty-lines');

var include = require("gulp-include");
var webserver = require('gulp-webserver');

// Configuration vars
var sharedVars = require('./dev/assets/config');

/*
 * Compile
 * Takes the config vars and creates a JS and Sass variable
 * file using underscore templates
 *
 */
gulp.task('compile', function() {

  // SASS config to template
  gulp.src('./dev/assets/templates/sass-vars.txt')
    .pipe(template(sharedVars))
    .pipe(rename('_vars.scss'))
    .pipe(removeEmptyLines())
    .pipe(gulp.dest('./dev/assets/scss'));

  // Javascript config to template
  gulp.src('./dev/assets/templates/js-vars.txt')
    .pipe(template(sharedVars))
    .pipe(rename('_vars.js'))
    .pipe(removeEmptyLines())
    .pipe(gulp.dest('./dev/assets/js/ninjules/config'));
});

/*
 *  STYLING
 *
 */
gulp.task('style', function () {
  return gulp.src('./dev/assets/scss/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./assets/css'));
});

gulp.task('scripts', function() {
  return gulp.src([
      './dev/assets/js/head-script.js',
      './dev/assets/js/body-script.js'
    ])
    .pipe(include())
    .on('error', console.log)
    .pipe(gulp.dest('./assets/js'));
});

gulp.task('watch', function () {
  gulp.watch('./dev/assets/scss/**/*.scss', ['style']);
  gulp.watch('./dev/assets/js/**/*.js', ['scripts']);
});

/*
 * Twig Template
 *
 */
gulp.task('twig', function () {
  'use strict';
  var twig = require('gulp-twig');
  var contentData = require('./dev/assets/twig/contentData');

  return gulp.src('./dev/assets/twig/**.twig')
    .pipe(twig({
      data: contentData
    }))
    .pipe(gulp.dest('./'));
});

/*
 * ICON FONT
 *
 */
gulp.task('Iconfont', function(done){
  var iconStream = gulp.src(['./dev/assets/icons/*.svg'])
        .pipe(iconfont({ fontName: 'pnfont' }));

  async.parallel([
    function handleGlyphs (cb) {
      iconStream.on('glyphs', function(glyphs, options) {
        gulp.src('./dev/assets/templates/_icons.txt')
          .pipe(consolidate('lodash', {
            glyphs: glyphs,
            fontName: 'pnfont',
            fontPath: '../fonts/',
            className: 'if'
          }))
          .pipe(rename("atoms/_icons.scss"))
          .pipe(gulp.dest('./dev/assets/scss/'))
          .on('finish', cb);
      });
    },
    function handleFonts (cb) {
      iconStream
        .pipe(gulp.dest('./assets/fonts/'))
        .on('finish', cb);
    }
  ], done);
});

gulp.task('copy', function () {
  return gulp.src('./dev/assets/images/**/**.*')
    .pipe(gulp.dest('./assets/images'));
});

gulp.task('webserver', function() {
  gulp.src('./')
    .pipe(webserver({
      livereload: true,
      directoryListing: false,
      open: true,
      fallback: 'index.html'
    }));
});

gulp.task('serve', function () {
  // Endless stream mode
  watch('./dev/assets/scss/**/*.scss', { ignoreInitial: false })
    .pipe(function() {
      gulp.start('style');
    });
});

gulp.task('build', function() {
  runSequence('Iconfont');
});

gulp.task('default', function() {
  runSequence('twig', 'compile', 'scripts', 'style', 'copy');
});<commit_msg>Moved strict to the top<commit_after>'use strict';

var async = require('async');
var gulp = require('gulp');
var watch = require('gulp-watch');
var lodash = require('lodash');
var iconfont = require('gulp-iconfont');
var consolidate = require('gulp-consolidate');

var runSequence = require('run-sequence');
var sass = require('gulp-sass');

var rename = require("gulp-rename");
var template = require('gulp-template');
var removeEmptyLines = require('gulp-remove-empty-lines');

var include = require("gulp-include");
var webserver = require('gulp-webserver');

// Configuration vars
var sharedVars = require('./dev/assets/config');

/*
 * Compile
 * Takes the config vars and creates a JS and Sass variable
 * file using underscore templates
 *
 */
gulp.task('compile', function() {

  // SASS config to template
  gulp.src('./dev/assets/templates/sass-vars.txt')
    .pipe(template(sharedVars))
    .pipe(rename('_vars.scss'))
    .pipe(removeEmptyLines())
    .pipe(gulp.dest('./dev/assets/scss'));

  // Javascript config to template
  gulp.src('./dev/assets/templates/js-vars.txt')
    .pipe(template(sharedVars))
    .pipe(rename('_vars.js'))
    .pipe(removeEmptyLines())
    .pipe(gulp.dest('./dev/assets/js/ninjules/config'));
});

/*
 *  STYLING
 *
 */
gulp.task('style', function () {
  return gulp.src('./dev/assets/scss/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./assets/css'));
});

gulp.task('scripts', function() {
  return gulp.src([
      './dev/assets/js/head-script.js',
      './dev/assets/js/body-script.js'
    ])
    .pipe(include())
    .on('error', console.log)
    .pipe(gulp.dest('./assets/js'));
});

gulp.task('watch', function () {
  gulp.watch('./dev/assets/scss/**/*.scss', ['style']);
  gulp.watch('./dev/assets/js/**/*.js', ['scripts']);
});

/*
 * Twig Template
 *
 */
gulp.task('twig', function () {
  var twig = require('gulp-twig');
  var contentData = require('./dev/assets/twig/contentData');

  return gulp.src('./dev/assets/twig/**.twig')
    .pipe(twig({
      data: contentData
    }))
    .pipe(gulp.dest('./'));
});

/*
 * ICON FONT
 *
 */
gulp.task('Iconfont', function(done){
  var iconStream = gulp.src(['./dev/assets/icons/*.svg'])
        .pipe(iconfont({ fontName: 'pnfont' }));

  async.parallel([
    function handleGlyphs (cb) {
      iconStream.on('glyphs', function(glyphs, options) {
        gulp.src('./dev/assets/templates/_icons.txt')
          .pipe(consolidate('lodash', {
            glyphs: glyphs,
            fontName: 'pnfont',
            fontPath: '../fonts/',
            className: 'if'
          }))
          .pipe(rename("atoms/_icons.scss"))
          .pipe(gulp.dest('./dev/assets/scss/'))
          .on('finish', cb);
      });
    },
    function handleFonts (cb) {
      iconStream
        .pipe(gulp.dest('./assets/fonts/'))
        .on('finish', cb);
    }
  ], done);
});

gulp.task('copy', function () {
  return gulp.src('./dev/assets/images/**/**.*')
    .pipe(gulp.dest('./assets/images'));
});

gulp.task('webserver', function() {
  gulp.src('./')
    .pipe(webserver({
      livereload: true,
      directoryListing: false,
      open: true,
      fallback: 'index.html'
    }));
});

gulp.task('serve', function () {
  // Endless stream mode
  watch('./dev/assets/scss/**/*.scss', { ignoreInitial: false })
    .pipe(function() {
      gulp.start('style');
    });
});

gulp.task('build', function() {
  runSequence('Iconfont');
});

gulp.task('default', function() {
  runSequence('twig', 'compile', 'scripts', 'style', 'copy');
});<|endoftext|>


<commit_before>var gulp = require('gulp');
var audiosprite = require('./vendor/audiosprite');
var glob = require('glob');
var shell = require('gulp-shell');
var fs = require('fs');

gulp.task('audio', function() {
  var files = glob.sync('./src/assets/sounds/*.mp3');
  var outputPath = './dist/audio';
  var opts = {
    output: outputPath,
    path: './',
    format: 'howler2',
    'export': 'ogg,mp3',
    loop: ['quacking', 'sniff']
  };

  return audiosprite(files, opts, function(err, obj) {
    if (err) {
      console.error(err);
    }

    return fs.writeFile('./dist/audio' + '.json', JSON.stringify(obj, null, 2));
  });
});

gulp.task('images', function(){
  // There is a texturepacker template for spritesmith but it doesn't work
  // well with complex directory structures, so instead we use the shell
  // checking TexturePacker --version first ensures it bails if TexturePacker
  // isn't installed
  return gulp.src('', {read:false})
    .pipe(shell([
      'TexturePacker --version || echo ERROR: TexturePacker not found, install TexturePacker',
      'TexturePacker --disable-rotation --data dist/sprites.json --format json --sheet dist/sprites.png src/assets/images'
    ]))
    .pipe(connect.reload());
});

gulp.task('deploy', function() {
  return gulp.src('', {read:false})
    .pipe(shell([
    'AWS_PROFILE=duckhunt terraform plan',
    'AWS_PROFILE=duckhunt terraform apply',
    'aws --profile duckhunt s3 sync dist/ s3://duckhuntjs.com --include \'*\' --acl \'public-read\''
  ]));
});

gulp.task('default', ['images', 'audio']);
<commit_msg>Update to use new gulp api<commit_after>var gulp = require('gulp');
var audiosprite = require('./vendor/audiosprite');
var glob = require('glob');
var shell = require('gulp-shell');
var fs = require('fs');

gulp.task('audio', gulp.parallel(function() {
  var files = glob.sync('./src/assets/sounds/*.mp3');
  var outputPath = './dist/audio';
  var opts = {
    output: outputPath,
    path: './',
    format: 'howler2',
    'export': 'ogg,mp3',
    loop: ['quacking', 'sniff']
  };

  return audiosprite(files, opts, function(err, obj) {
    if (err) {
      console.error(err);
    }

    return fs.writeFile('./dist/audio' + '.json', JSON.stringify(obj, null, 2));
  });
}));

gulp.task('images', gulp.parallel(function(){
  // There is a texturepacker template for spritesmith but it doesn't work
  // well with complex directory structures, so instead we use the shell
  // checking TexturePacker --version first ensures it bails if TexturePacker
  // isn't installed
  return gulp.src('*', {read:false})
    .pipe(shell([
      'TexturePacker --version || echo ERROR: TexturePacker not found, install TexturePacker',
      'TexturePacker --disable-rotation --data dist/sprites.json --format json --sheet dist/sprites.png src/assets/images'
    ]))
    .pipe(connect.reload());
}));

gulp.task('deploy', gulp.parallel(function() {
  return gulp.src('*', {read:false})
    .pipe(shell([
    'AWS_PROFILE=duckhunt terraform plan',
    'AWS_PROFILE=duckhunt terraform apply',
    'aws --profile duckhunt s3 sync dist/ s3://duckhuntjs.com --include \'*\' --acl \'public-read\''
  ]));
}));

gulp.task('default', gulp.parallel('images', 'audio'));
<|endoftext|>


<commit_before>//fgnass.github.com/spin.js
(function(a,b,c){function n(a){var b={x:a.offsetLeft,y:a.offsetTop};while(a=a.offsetParent)b.x+=a.offsetLeft,b.y+=a.offsetTop;return b}function m(a,b){for(var d in b)a[d]===c&&(a[d]=b[d]);return a}function l(a,b){for(var c in b)a.style[k(a,c)||c]=b[c];return a}function k(a,b){var e=a.style,f,g;if(e[b]!==c)return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(g=0;g<d.length;g++){f=d[g]+b;if(e[f]!==c)return f}}function j(a,b){var c=["opacity",b,~~(a*100)].join("-"),f="{opacity:"+a+"}",g;if(!e[c]){for(g=0;g<d.length;g++)try{i.insertRule("@"+(d[g]&&"-"+d[g].toLowerCase()+"-"||"")+"keyframes "+c+"{0%{opacity:1}"+b+"%"+f+"to"+f+"}",i.cssRules.length)}catch(h){}e[c]=1}return c}function h(a,b,c){c&&!c.parentNode&&h(a,c),a.insertBefore(b,c||null);return a}function g(a,c){var d=b.createElement(a||"div"),e;for(e in c)d[e]=c[e];return d}var d=["webkit","Moz","ms","O"],e={},f;h(b.getElementsByTagName("head")[0],g("style"));var i=b.styleSheets[b.styleSheets.length-1],o=function(a){this.opts=m(a||{},{lines:12,trail:100,length:7,width:5,radius:10,color:"#000",opacity:.25,speed:1})},p=o.prototype={spin:function(a){var b=this,c=b.el=l(g(),{position:"relative"}),d,e;a&&(e=n(h(a,c,a.firstChild)),d=n(c),l(c,{left:(a.offsetWidth>>1)-d.x+e.x+"px",top:(a.offsetHeight>>1)-d.y+e.y+"px"})),b.lines(c,b.opts);if(!f){var i=b.opts,j=0,k=20/i.speed,m=(1-i.opacity)/(k*i.trail/100),o=k/i.lines;(function p(){j++;for(var a=i.lines;a;a--){var d=Math.max(1-(j+a*o)%k*m,i.opacity);b.opacity(c,i.lines-a,d,i)}b.timeout=b.el&&setTimeout(p,50)})()}return b},stop:function(){var a=this,b=a.el;clearTimeout(a.timeout),b&&b.parentNode&&b.parentNode.removeChild(b),a.el=c;return a}};p.lines=function(a,b){function f(a,c){return l(g(),{position:"absolute",width:b.length+b.width+"px",height:b.width+"px",background:a,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/b.lines*d)+"deg) translate("+b.radius+"px"+",0)",borderRadius:"100em"})}var c=j(b.opacity,b.trail),d=0,e;for(;d<b.lines;d++)e=l(g(),{position:"absolute",top:1+~(b.width/2)+"px",transform:"translate3d(0,0,0)",opacity:b.opacity,animation:c+" "+1/b.speed+"s linear infinite "+1/b.lines/b.speed*d+"s"}),b.shadow&&h(e,l(f("#000","0 0 4px #000"),{top:"2px"})),h(a,h(e,f(b.color,"0 0 1px rgba(0,0,0,.1)")));return a},p.opacity=function(a,b,c){a.childNodes[b].style.opacity=c},function(){var a=l(g("group"),{behavior:"url(#default#VML)"}),b;if(!k(a,"transform")&&a.adj){for(b=4;b--;)i.addRule(["group","roundrect","fill","stroke"][b],"behavior:url(#default#VML)");p.lines=function(a,b){function k(a,d,i){h(f,h(l(e(),{rotation:360/b.lines*a+"deg",left:~~d}),h(l(g("roundrect",{arcsize:1}),{width:c,height:b.width,left:b.radius,top:-b.width>>1,filter:i}),g("fill",{color:b.color,opacity:b.opacity}),g("stroke",{opacity:0}))))}function e(){return l(g("group",{coordsize:d+" "+d,coordorigin:-c+" "+ -c}),{width:d,height:d})}var c=b.length+b.width,d=2*c,f=e(),i=~(b.length+b.radius+b.width)+"px",j;if(b.shadow)for(j=1;j<=b.lines;j++)k(j,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(j=1;j<=b.lines;j++)k(j);return h(l(a,{margin:i+" 0 0 "+i}),f)},p.opacity=function(a,b,c,d){d=d.shadow&&d.lines||0,a.firstChild.childNodes[b+d].firstChild.firstChild.opacity=c}}else f=k(a,"animation")}(),a.Spinner=o})(window,document)<commit_msg>Updated the minified version<commit_after>//fgnass.github.com/spin.js
(function(a,b,c){function n(a){var b={x:a.offsetLeft,y:a.offsetTop};while(a=a.offsetParent)b.x+=a.offsetLeft,b.y+=a.offsetTop;return b}function m(a,b){for(var d in b)a[d]===c&&(a[d]=b[d]);return a}function l(a,b){for(var c in b)a.style[k(a,c)||c]=b[c];return a}function k(a,b){var e=a.style,f,g;if(e[b]!==c)return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(g=0;g<d.length;g++){f=d[g]+b;if(e[f]!==c)return f}}function j(a,b){var c=["opacity",b,~~(a*100)].join("-"),f="{opacity:"+a+"}",g,h;if(!e[c]){for(h=0;h<d.length;h++){g=d[h]&&"-"+d[h].toLowerCase()+"-"||"";try{i.insertRule("@"+g+"keyframes "+c+"{0%{opacity:1}"+b+"%"+f+"to"+f+"}",0),i.insertRule(".spin ."+c+"{"+g+"animation: "+c+" 1s linear infinite}",1)}catch(j){}}e[c]=1}return c}function h(a,b,c){c&&!c.parentNode&&h(a,c),a.insertBefore(b,c||null);return a}function g(a,c){var d=b.createElement(a||"div"),e;for(e in c)d[e]=c[e];return d}var d=["webkit","Moz","ms","O"],e={},f;h(b.getElementsByTagName("head")[0],g("style"));var i=b.styleSheets[b.styleSheets.length-1],o=function(a){this.opts=m(a||{},{lines:12,trail:100,length:7,width:5,radius:10,color:"#000",opacity:.25,speed:1})},p=o.prototype={spin:function(a){var b=this,c=b.el=l(g(),{position:"relative"}),d,e;a&&(e=n(h(a,c,a.firstChild)),d=n(c),l(c,{left:(a.offsetWidth>>1)-d.x+e.x+"px",top:(a.offsetHeight>>1)-d.y+e.y+"px"})),b.lines(c,b.opts),setTimeout(function(){c.className="spin"},1);if(!f){var i=b.opts,j=0,k=20/i.speed,m=(1-i.opacity)/(k*i.trail/100),o=k/i.lines;(function p(){j++;for(var a=i.lines;a;a--){var d=Math.max(1-(j+a*o)%k*m,i.opacity);b.opacity(c,i.lines-a,d,i)}b.timeout=b.el&&setTimeout(p,50)})()}return b},stop:function(){var a=this,b=a.el;clearTimeout(a.timeout),b&&b.parentNode&&b.parentNode.removeChild(b),a.el=c;return a}};p.lines=function(a,b){function f(a,c){return l(g(),{position:"absolute",width:b.length+b.width+"px",height:b.width+"px",background:a,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/b.lines*d)+"deg) translate("+b.radius+"px"+",0)",borderRadius:"100em"})}var c=j(b.opacity,b.trail),d=0,e;for(;d<b.lines;d++)e=l(g(0,{className:c}),{position:"absolute",top:1+~(b.width/2)+"px",transform:"translate3d(0,0,0)",opacity:b.opacity,animationDuration:1/b.speed+"s",animationDelay:~~(1e3/b.lines/b.speed*d)+"ms"}),b.shadow&&h(e,l(f("#000","0 0 4px #000"),{top:"2px"})),h(a,h(e,f(b.color,"0 0 1px rgba(0,0,0,.1)")));return a},p.opacity=function(a,b,c){a.childNodes[b].style.opacity=c},function(){var a=l(g("group"),{behavior:"url(#default#VML)"}),b;if(!k(a,"transform")&&a.adj){for(b=4;b--;)i.addRule(["group","roundrect","fill","stroke"][b],"behavior:url(#default#VML)");p.lines=function(a,b){function k(a,d,i){h(f,h(l(e(),{rotation:360/b.lines*a+"deg",left:~~d}),h(l(g("roundrect",{arcsize:1}),{width:c,height:b.width,left:b.radius,top:-b.width>>1,filter:i}),g("fill",{color:b.color,opacity:b.opacity}),g("stroke",{opacity:0}))))}function e(){return l(g("group",{coordsize:d+" "+d,coordorigin:-c+" "+ -c}),{width:d,height:d})}var c=b.length+b.width,d=2*c,f=e(),i=~(b.length+b.radius+b.width)+"px",j;if(b.shadow)for(j=1;j<=b.lines;j++)k(j,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(j=1;j<=b.lines;j++)k(j);return h(l(a,{margin:i+" 0 0 "+i}),f)},p.opacity=function(a,b,c,d){d=d.shadow&&d.lines||0,a.firstChild.childNodes[b+d].firstChild.firstChild.opacity=c}}else f=k(a,"animation")}(),a.Spinner=o})(window,document)<|endoftext|>


<commit_before>/*
 * Copyright © 2016 I.B.M. All rights reserved.
 *
 * 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.
 */

(function() {
    var gulp = require('gulp');
    var $ = require('gulp-load-plugins')({
        pattern: ['gulp-*', 'gulp.*'],
        replaceString: /\bgulp[\-.]/
    });
    var appDev = './ui/';
    var appProd = './dist/';

    gulp.task('build-ibm', function() {
        return gulp.src(appDev + 'ibm/*.js')
            .pipe(gulp.dest(appProd + 'ibm'));
    });

    gulp.task('build-css', ['build-fonts'], function() {
        return gulp.src(appDev + 'css/*.css')
            .pipe($.cleanCss())
            .pipe(gulp.dest(appProd + 'css/'))
            .pipe($.size({ 'title': 'css' }));
    });

    gulp.task('build-fonts', function() {
        return gulp.src([appDev + 'fonts/**'])
//            .pipe($.fontmin())
            .pipe(gulp.dest(appProd + 'fonts'));
    });

    gulp.task('build-html', ['build-img', 'build-css', 'build-ibm'], function() {
        var assets = $.useref({ 'searchPath': ['ui/**/*.*', 'node_modules'] });
        return gulp.src(appDev + 'index.html')
            .pipe(assets) //node_modules dir is in the current dir, search there for dependencies!
            .pipe($.sourcemaps.init({ 'identityMap': true, 'debug': true }))
            .pipe($.useref())
            // TODO re-add with caching
            //.pipe(sourcemaps.write('./maps'))
            .pipe($.if('*.js', $.if('**/dashboard.min.js', $.uglify({mangle: false, preserveComments: 'license'}), $.uglify())))
            .pipe($.if('*.css', $.cleanCss()))
            .pipe(gulp.dest(appProd))
            .pipe($.size({ 'title': 'html' }));
    });

    gulp.task('build-img', function() {
        return gulp.src(appDev + 'images/**/*')
          // TODO re-add with caching
//            .pipe($.if('*.png', $.imagemin()))
            .pipe(gulp.dest(appProd + 'images/'));
    });

    gulp.task('clean', function() {
        return gulp.src(appProd, { read: false })
            .pipe($.clean());
    });

    gulp.task('watch', ['build-html'], function() {
        gulp.watch(appDev + '**/*.js', ['build-html']);
        gulp.watch(appDev + 'css/*.css', ['build-html']);
        gulp.watch(appDev + '**/*.html', ['build-html']);
        gulp.watch(appDev + 'images/**/*', ['build-html']);
    });

    gulp.task('server:start', function() {
        $.developServer.listen({ path: './server.js' });
    });

    gulp.task('server:watch', ['build-html', 'server:start', 'watch']);

    gulp.task('default', ['build-html']);
}());
<commit_msg>Update gulpfile.js<commit_after>/*
 * Copyright © 2016 I.B.M. All rights reserved.
 *
 * 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.
 */

(function() {
    var gulp = require('gulp');
    var $ = require('gulp-load-plugins')({
        pattern: ['gulp-*', 'gulp.*'],
        replaceString: /\bgulp[\-.]/
    });
    var appDev = './ui/';
    var appProd = './dist/';

    gulp.task('build-ibm', function() {
        return gulp.src(appDev + 'ibm/*.js')
            .pipe(gulp.dest(appProd + 'ibm'));
    });

    gulp.task('build-css', ['build-fonts'], function() {
        return gulp.src(appDev + 'css/*.css')
            .pipe($.cleanCss())
            .pipe(gulp.dest(appProd + 'css/'))
            .pipe($.size({ 'title': 'css' }));
    });

    gulp.task('build-fonts', function() {
        return gulp.src([appDev + 'fonts/**'])
//            .pipe($.fontmin())
            .pipe(gulp.dest(appProd + 'fonts'));
    });

    gulp.task('build-html', ['build-img', 'build-css', 'build-ibm'], function() {
        var assets = $.useref({ 'searchPath': ['ui/**/*.*', 'node_modules'] });
        return gulp.src(appDev + 'index.html')
            .pipe(assets) //node_modules dir is in the current dir, search there for dependencies!
            .pipe($.sourcemaps.init({ 'identityMap': true, 'debug': true }))
            .pipe($.useref())
            // TODO re-add with caching
            //.pipe(sourcemaps.write('./maps'))
            // Commenting out lines that don't work with latest version of Node
            // .pipe($.if('*.js', $.if('**/dashboard.min.js', $.uglify({mangle: false, preserveComments: 'license'}), $.uglify())))
            // .pipe($.if('*.css', $.cleanCss()))
            .pipe(gulp.dest(appProd))
            .pipe($.size({ 'title': 'html' }));
    });

    gulp.task('build-img', function() {
        return gulp.src(appDev + 'images/**/*')
          // TODO re-add with caching
//            .pipe($.if('*.png', $.imagemin()))
            .pipe(gulp.dest(appProd + 'images/'));
    });

    gulp.task('clean', function() {
        return gulp.src(appProd, { read: false })
            .pipe($.clean());
    });

    gulp.task('watch', ['build-html'], function() {
        gulp.watch(appDev + '**/*.js', ['build-html']);
        gulp.watch(appDev + 'css/*.css', ['build-html']);
        gulp.watch(appDev + '**/*.html', ['build-html']);
        gulp.watch(appDev + 'images/**/*', ['build-html']);
    });

    gulp.task('server:start', function() {
        $.developServer.listen({ path: './server.js' });
    });

    gulp.task('server:watch', ['build-html', 'server:start', 'watch']);

    gulp.task('default', ['build-html']);
}());
<|endoftext|>


<commit_before>/* jshint devel:true */
/* global exports, require, cytoscape */

exports.template = function(options) {
  'use strict';

  var editor = options.editor;
  var collector = require('./collectdata');
  var defaultContainer = options.graphContainer;
  var jsonproxy = options.jsonproxy;
  var graph;
  var style;
  var cyto = options.cytolib || cytoscape;
  var initialData;
  var layoutName = 'cose';

  if (!editor || !editor.getValue) {
    throw 'editor unavailable or doesn\'t support getValue';
  }
  if (!cyto) {
    throw 'graphing library Cytoscape unavailable';
  }

  var changeStyle = function(data) {
    style = data;
    if (graph) {
      graph.style(style);
    }
  };

  var fromFile = function(file, success, fail) {
    var reader = new FileReader();
    reader.onload = function() {
      setData(reader.result, function() {
        if (success) {
          success(file.name);
        }
      }, function(reason, e) {
        if (fail) {
          fail(file.name, reason, e);
        }
      });

    };
    try {
      reader.readAsText(file);
    }
    catch (e) {
      if (fail) {
        fail(file.name, e);
      }
    }
  };

  var setData = function(data, onSuccess, onError) {
    if (data) {
      try {
        var dataString = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
        var dataObject = typeof data === 'object' ? data : JSON.parse(data);

        editor.setValue(dataString);
        initialData = text();
        show(collector.collectCyData(dataObject));

        if (onSuccess) {
          onSuccess();
        }
      }
      catch (e) {
        if (onError) {
          onError('Error processing data as JSON', e);
        }
      }
    }
    else {
      if (onError) {
        onError('No data');
      }
    }
  };

  var refreshGraph = function(){
    show(collector.collectCyData(json()));
  };

  var show = function(data, container) {
    if (!container && !defaultContainer) {
      throw 'No container available to show data';
    }
    graph = cyto({
      container: container || defaultContainer,
      elements: data,
      style: style,
      layout: {
        name: layoutName,
        padding: 5
      }
    });
    graph.boxSelectionEnabled(true);
  };

  var description = function() {
    var description = 'template';
    try {
      description = json().Description;
    }
    catch (e) {}
    return description;
  };

  var base64Image = function() {
    if (!graph) {
      return;
    }
    graph.center();
    graph.fit();
    return graph.png({
      full: false
    });
  };

  var json = function() {
    return JSON.parse(editor.getValue());
  };

  var setLayout = function(name) {
    layoutName = name;
    if (graph) {
      graph.layout({
        'name': name
      });
    }
  };

  var fromURL = function(url, success, onError) {
    if (!jsonproxy) {
      throw 'No jsonproxy available to request URLs';
    }
    if (url) {
      jsonproxy({
        url: url,
        corsSupport: true,
        success: function(data) {
          setData(data);
          if (success) {
            success(url);
          }
        },
        error: function(data, textStatus) {
            var message;
            if (textStatus === 'parsererror') {
              editor.setValue(data.responseText);
              message = 'Unable to parse the result as valid JSON';
            }
            else {
              message = 'Unable to load: status ' + data.status + ' ' + data.statusText;
            }
            if (onError) {
              onError(url, message, data, textStatus);
            }
          }
          // error, etc.
      });
    }
  };

  var text = function(indent) {
    return indent ? JSON.stringify(json(), null, indent) : editor.getValue();
  };

  var fitGraph= function (){
    if (graph) {
      graph.fit();
    }
  };

  var hasChanged = function() {
    var changed = initialData === text();
    return !changed;
  };

  return {
    setData: setData,
    fromFile: fromFile,
    fromURL: fromURL,
    refreshGraph: refreshGraph,
    setLayout: setLayout,
    base64Image: base64Image,
    description: description,
    changeStyle: changeStyle,
    fitGraph: fitGraph,
    text: text,
    json: json,
    hasChanged: hasChanged,
    initialData: initialData
  };
};
<commit_msg>jshint on template.js<commit_after>/* jshint devel:true */
/* global exports, require, cytoscape */

exports.template = function(options) {
  'use strict';

  var editor = options.editor;
  var collector = require('./collectdata');
  var defaultContainer = options.graphContainer;
  var jsonproxy = options.jsonproxy;
  var graph;
  var style;
  var cyto = options.cytolib || cytoscape;
  var initialData;
  var layoutName = 'cose';

  if (!editor || !editor.getValue) {
    throw 'editor unavailable or doesn\'t support getValue';
  }
  if (!cyto) {
    throw 'graphing library Cytoscape unavailable';
  }

  var json = function() {
    return JSON.parse(editor.getValue());
  };

  var text = function(indent) {
    return indent ? JSON.stringify(json(), null, indent) : editor.getValue();
  };

  var changeStyle = function(data) {
    style = data;
    if (graph) {
      graph.style(style);
    }
  };

  var show = function(data, container) {
    if (!container && !defaultContainer) {
      throw 'No container available to show data';
    }
    graph = cyto({
      container: container || defaultContainer,
      elements: data,
      style: style,
      layout: {
        name: layoutName,
        padding: 5
      }
    });
    graph.boxSelectionEnabled(true);
  };

  var setData = function(data, onSuccess, onError) {
    if (data) {
      try {
        var dataString = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
        var dataObject = typeof data === 'object' ? data : JSON.parse(data);

        editor.setValue(dataString);
        initialData = text();
        show(collector.collectCyData(dataObject));

        if (onSuccess) {
          onSuccess();
        }
      }
      catch (e) {
        if (onError) {
          onError('Error processing data as JSON', e);
        }
      }
    }
    else {
      if (onError) {
        onError('No data');
      }
    }
  };

  var fromFile = function(file, success, fail) {
    var reader = new FileReader();
    reader.onload = function() {
      setData(reader.result, function() {
        if (success) {
          success(file.name);
        }
      }, function(reason, e) {
        if (fail) {
          fail(file.name, reason, e);
        }
      });

    };
    try {
      reader.readAsText(file);
    }
    catch (e) {
      if (fail) {
        fail(file.name, e);
      }
    }
  };

  var refreshGraph = function() {
    show(collector.collectCyData(json()));
  };

  var description = function() {
    var description = 'template';
    try {
      description = json().Description;
    }
    catch (e) {}
    return description;
  };

  var base64Image = function() {
    if (!graph) {
      return;
    }
    graph.center();
    graph.fit();
    return graph.png({
      full: false
    });
  };

  var setLayout = function(name) {
    layoutName = name;
    if (graph) {
      graph.layout({
        'name': name
      });
    }
  };

  var fromURL = function(url, success, onError) {
    if (!jsonproxy) {
      throw 'No jsonproxy available to request URLs';
    }
    if (url) {
      jsonproxy({
        url: url,
        corsSupport: true,
        success: function(data) {
          setData(data);
          if (success) {
            success(url);
          }
        },
        error: function(data, textStatus) {
            var message;
            if (textStatus === 'parsererror') {
              editor.setValue(data.responseText);
              message = 'Unable to parse the result as valid JSON';
            }
            else {
              message = 'Unable to load: status ' + data.status + ' ' + data.statusText;
            }
            if (onError) {
              onError(url, message, data, textStatus);
            }
          }
          // error, etc.
      });
    }
  };

  var fitGraph = function() {
    if (graph) {
      graph.fit();
    }
  };

  var hasChanged = function() {
    var changed = initialData === text();
    return !changed;
  };

  return {
    setData: setData,
    fromFile: fromFile,
    fromURL: fromURL,
    refreshGraph: refreshGraph,
    setLayout: setLayout,
    base64Image: base64Image,
    description: description,
    changeStyle: changeStyle,
    fitGraph: fitGraph,
    text: text,
    json: json,
    hasChanged: hasChanged,
    initialData: initialData
  };
};
<|endoftext|>


<commit_before>/**
 * Copyright (c) 2006
 * Martin Czuchra, Nicolas Peters, Daniel Polak, Willi Tscheschner
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 **/

/**
 * Init namespaces
 */
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}

/**
 * @classDescription Class for adding text to a shape.
 *
 */
ORYX.Core.SVG.Label = Clazz.extend({

	/**
	 * Constructor
	 * @param options {Object} :
	 * 	textElement
	 *
	 */
	construct: function(options) {
		arguments.callee.$.construct.apply(this, arguments);

		if(!options.textElement) {
			throw "Label: No parameter textElement."
		} else if (!options.textElement instanceof SVGTextElement) {
			throw "Label: Parameter textElement is not an SVGTextElement."
		}

		this.node = options.textElement;
		this.shapeId = options.shapeId;

		this.id;

		this.fitToElemId;

		this.x;
		this.y;
		this.oldX;
		this.oldY;

		this._text;
		this._verticalAlign;
		this._horizontalAlign;
		this._rotate;
		this._fontSize;

		this.anchors = [];

		this._isChanged = true;

		//if the text element already has an id, don't change it.
		var _id = this.node.getAttributeNS(null, 'id');
		if(_id) {
			this.id = _id;
		}

		//initialization

		//set referenced element the text is fit to
		this.fitToElemId = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'fittoelem');
		if(this.fitToElemId)
			this.fitToElemId = this.shapeId + this.fitToElemId;

		//set alignment
		var alignValues = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align');
		if(alignValues) {
			alignValues = alignValues.replace(/,/g, " ");
			alignValues = alignValues.split(" ");
			alignValues = alignValues.without("");

			alignValues.each((function(alignValue) {
				switch (alignValue) {
					case 'top':
					case 'middle':
					case 'bottom':
						if(!this._verticalAlign) {this._verticalAlign = alignValue;}
						break;
					case 'left':
					case 'center':
					case 'right':
						if(!this._horizontalAlign) {this._horizontalAlign = alignValue;}
						break;
				}
			}).bind(this));
		}

		//set rotation
		var rotateValue = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'rotate');
		if(rotateValue) {
			try {
				this._rotate = parseFloat(rotateValue);
			} catch (e) {
				this._rotate = 0;
			}
		} else {
			this._rotate = 0;
		}

		//anchors
		var anchorAttr = this.node.getAttributeNS(NAMESPACE_ORYX, "anchors");
		if(anchorAttr) {
			anchorAttr = anchorAttr.replace("/,/g", " ");
			this.anchors = anchorAttr.split(" ");
			this.anchors = this.anchors.without("");
		}

		//if no alignment defined, set default alignment
		if(!this._verticalAlign) { this._verticalAlign = 'bottom'; }
		if(!this._horizontalAlign) { this._horizontalAlign = 'left'; }

		//set line height
		var fsValue = this.node.getAttributeNS(null, 'font-size');
		this._fontSize = parseFloat(fsValue);
		if(!this._fontSize) {
			this._fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT;
			this.node.setAttributeNS(null, 'font-size', this._fontSize);
		}

		//TODO temporary deactivate events
		//this.node.setAttributeNS(null, 'pointer-events', 'none');

		var xValue = this.node.getAttributeNS(null, 'x');
		if(xValue) {
			this.x = parseFloat(xValue);
			this.oldX = this.x;
		} else {
			//TODO error
		}

		var yValue = this.node.getAttributeNS(null, 'y');
		if(yValue) {
			this.y = parseFloat(yValue);
			this.oldY = this.y;
		} else {
			//TODO error
		}

		//set initial text
		this.text(this.node.textContent);

		//workaround for firefox on mac bug that avoids rendering text fill
		if(navigator.platform.indexOf("Mac") > -1) {
			this.node.setAttributeNS(null, 'stroke', 'black');
			this.node.setAttributeNS(null, 'stroke-width', '0.5px');
			this.node.setAttributeNS(null, 'font-family', 'Skia');
			this.node.setAttributeNS(null, 'letter-spacing', '2px');
		} else {
			this.node.setAttributeNS(null, 'stroke', 'none');
			if (!this.node.getAttributeNS(null, 'font-family')) {
				this.node.setAttributeNS(null, 'font-family', 'Verdana');
			}
		}
	},

	/**
	 * Update the SVG text element.
	 */
	update: function() {
		if(this._isChanged || this.x !== this.oldX || this.y !== this.oldY) {
		//if(true) {
		 	this._isChanged = false;

			this.node.setAttributeNS(null, 'x', this.x);
			this.node.setAttributeNS(null, 'y', this.y);

			this.node.setAttributeNS(null, 'font-size', this._fontSize);
			//this.node.setAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align', this._horizontalAlign + " " + this._verticalAlign);

			this.oldX = this.x;
			this.oldY = this.y;

			//set rotation
			if(this._rotate) {
				this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this.x + ' ' + this.y + ')' );
			}

			var textLines = this._text.split("\n");
			while(textLines.last() == "")
				textLines.remove(textLines.last());

			this.node.textContent = "";

			if(this.node.ownerDocument) {
				textLines.each((function(textLine, index) {
					var tspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
					tspan.textContent = textLine;
					tspan.setAttributeNS(null, 'x', this.x);
					tspan.setAttributeNS(null, 'y', this.y);

					//append tspan to text node
					this.node.appendChild(tspan);
				}).bind(this));

				//Work around for Mozilla bug 293581
				if(this.isVisible) {
					this.node.setAttributeNS(null, 'visibility', 'hidden');
				}

				if(this.fitToElemId)
					window.setTimeout(this._checkFittingToReferencedElem.bind(this), 0);
				else
					window.setTimeout(this._positionText.bind(this), 0);
			}
		}
	},

	_checkFittingToReferencedElem: function() {
		var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');

		var refNode = this.node.ownerDocument.getElementById(this.fitToElemId);

		if (refNode) {

			var refbb = refNode.getBBox();

			var startIndex = 0;

			for (var j = 0; j < tspans.length; j++) {
				var tspan = tspans[j];

				var textLength = tspan.getComputedTextLength();
				//var numOfChars = tspan.getNumberOfChars();
				if(textLength > refbb.width) {

					for (var i = 0; i < tspan.textContent.length; i++) {
						var sslength = tspan.getSubStringLength(startIndex, i - startIndex);

						if(sslength > refbb.width) {
							var newtspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
							newtspan.textContent = tspan.textContent.substring(startIndex, i);
							newtspan.setAttributeNS(null, 'x', this.x);
							newtspan.setAttributeNS(null, 'y', this.y);

							//insert tspan to text node
							this.node.insertBefore(newtspan, tspan);

							startIndex = i;
						}
					}

					tspan.textContent = tspan.textContent.substring(startIndex, tspan.textContent.length);
				}
			}
		}

		window.setTimeout(this._positionText.bind(this), 0);
	},

	/**
	 * This is a work around method for Mozilla bug 293581.
	 * Before the method getComputedTextLength works, the text has to be rendered.
	 */
	_positionText: function() {
		try {
			var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');

			$A(tspans).each((function(tspan, index){
				//set vertical position
				var dy = 0;
				switch (this._verticalAlign) {
					case 'bottom':
						dy = -(tspans.length - index - 1) * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						break;
					case 'middle':
						dy = -(tspans.length / 2.0 - index - 1) * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						dy -= ORYX.CONFIG.LABEL_LINE_DISTANCE / 2;
						break;
					case 'top':
						dy = index * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						dy += this._fontSize;
						break;
				}

				tspan.setAttributeNS(null, 'dy', dy);

				//set horizontal position
				var textLength = tspan.getComputedTextLength();
				switch (this._horizontalAlign) {
					case 'left':
						tspan.setAttributeNS(null, 'dx', 0);
						break;
					case 'center':
						tspan.setAttributeNS(null, 'dx', -textLength / 2);
						break;
					case 'right':
						tspan.setAttributeNS(null, 'dx', -textLength);
						break;
				}
			}).bind(this));

		} catch(e) {
			this._isChanged = true;
		}

		if(this.isVisible) {
			this.node.setAttributeNS(null, 'visibility', 'inherit');
		}
	},

	/**
	 * If no parameter is provided, this method returns the current text.
	 * @param text {String} Optional. Replaces the old text with this one.
	 */
	text: function() {
		switch (arguments.length) {
			case 0:
				return this._text
				break;

			case 1:
				var oldText = this._text;
				if(arguments[0]) {
					this._text = arguments[0].toString();
				} else {
					this._text = "";
				}
				if(oldText !== this._text) {
					this._isChanged = true;
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	verticalAlign: function() {
		switch(arguments.length) {
			case 0:
				return this._verticalAlign;
			case 1:
				if(['top', 'middle', 'bottom'].member(arguments[0])) {
					var oldValue = this._verticalAlign;
					this._verticalAlign = arguments[0];
					if(this._verticalAlign !== oldValue) {
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	horizontalAlign: function() {
		switch(arguments.length) {
			case 0:
				return this._horizontalAlign;
			case 1:
				if(['left', 'center', 'right'].member(arguments[0])) {
					var oldValue = this._horizontalAlign;
					this._horizontalAlign = arguments[0];
					if(this._horizontalAlign !== oldValue) {
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	fontSize: function() {
		switch(arguments.length) {
			case 0:
				return this._fontSize;
			case 1:
				var value = parseFloat(arguments[0]);
				if(value) {
					if(arguments[0] !== this._fontSize) {
						this._fontSize = arguments[0];
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	hide: function() {

	},

	show: function() {

	},

	toString: function() { return "Label " + this.id }
 });<commit_msg>working on word wrapping feature. still buggy. some characters are probably not visualized.<commit_after>/**
 * Copyright (c) 2006
 * Martin Czuchra, Nicolas Peters, Daniel Polak, Willi Tscheschner
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 **/

/**
 * Init namespaces
 */
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}

/**
 * @classDescription Class for adding text to a shape.
 *
 */
ORYX.Core.SVG.Label = Clazz.extend({

	/**
	 * Constructor
	 * @param options {Object} :
	 * 	textElement
	 *
	 */
	construct: function(options) {
		arguments.callee.$.construct.apply(this, arguments);

		if(!options.textElement) {
			throw "Label: No parameter textElement."
		} else if (!options.textElement instanceof SVGTextElement) {
			throw "Label: Parameter textElement is not an SVGTextElement."
		}

		this.node = options.textElement;
		this.shapeId = options.shapeId;

		this.id;

		this.fitToElemId;

		this.x;
		this.y;
		this.oldX;
		this.oldY;

		this._text;
		this._verticalAlign;
		this._horizontalAlign;
		this._rotate;
		this._fontSize;

		this.anchors = [];

		this._isChanged = true;

		//if the text element already has an id, don't change it.
		var _id = this.node.getAttributeNS(null, 'id');
		if(_id) {
			this.id = _id;
		}

		//initialization

		//set referenced element the text is fit to
		this.fitToElemId = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'fittoelem');
		if(this.fitToElemId)
			this.fitToElemId = this.shapeId + this.fitToElemId;

		//set alignment
		var alignValues = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align');
		if(alignValues) {
			alignValues = alignValues.replace(/,/g, " ");
			alignValues = alignValues.split(" ");
			alignValues = alignValues.without("");

			alignValues.each((function(alignValue) {
				switch (alignValue) {
					case 'top':
					case 'middle':
					case 'bottom':
						if(!this._verticalAlign) {this._verticalAlign = alignValue;}
						break;
					case 'left':
					case 'center':
					case 'right':
						if(!this._horizontalAlign) {this._horizontalAlign = alignValue;}
						break;
				}
			}).bind(this));
		}

		//set rotation
		var rotateValue = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'rotate');
		if(rotateValue) {
			try {
				this._rotate = parseFloat(rotateValue);
			} catch (e) {
				this._rotate = 0;
			}
		} else {
			this._rotate = 0;
		}

		//anchors
		var anchorAttr = this.node.getAttributeNS(NAMESPACE_ORYX, "anchors");
		if(anchorAttr) {
			anchorAttr = anchorAttr.replace("/,/g", " ");
			this.anchors = anchorAttr.split(" ");
			this.anchors = this.anchors.without("");
		}

		//if no alignment defined, set default alignment
		if(!this._verticalAlign) { this._verticalAlign = 'bottom'; }
		if(!this._horizontalAlign) { this._horizontalAlign = 'left'; }

		//set line height
		var fsValue = this.node.getAttributeNS(null, 'font-size');
		this._fontSize = parseFloat(fsValue);
		if(!this._fontSize) {
			this._fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT;
			this.node.setAttributeNS(null, 'font-size', this._fontSize);
		}

		//TODO temporary deactivate events
		//this.node.setAttributeNS(null, 'pointer-events', 'none');

		var xValue = this.node.getAttributeNS(null, 'x');
		if(xValue) {
			this.x = parseFloat(xValue);
			this.oldX = this.x;
		} else {
			//TODO error
		}

		var yValue = this.node.getAttributeNS(null, 'y');
		if(yValue) {
			this.y = parseFloat(yValue);
			this.oldY = this.y;
		} else {
			//TODO error
		}

		//set initial text
		this.text(this.node.textContent);

		//workaround for firefox on mac bug that avoids rendering text fill
		if(navigator.platform.indexOf("Mac") > -1) {
			this.node.setAttributeNS(null, 'stroke', 'black');
			this.node.setAttributeNS(null, 'stroke-width', '0.5px');
			this.node.setAttributeNS(null, 'font-family', 'Skia');
			this.node.setAttributeNS(null, 'letter-spacing', '2px');
		} else {
			this.node.setAttributeNS(null, 'stroke', 'none');
			if (!this.node.getAttributeNS(null, 'font-family')) {
				this.node.setAttributeNS(null, 'font-family', 'Verdana');
			}
		}
	},

	/**
	 * Update the SVG text element.
	 */
	update: function() {
		if(this._isChanged || this.x !== this.oldX || this.y !== this.oldY) {
		//if(true) {
		 	this._isChanged = false;

			this.node.setAttributeNS(null, 'x', this.x);
			this.node.setAttributeNS(null, 'y', this.y);

			this.node.setAttributeNS(null, 'font-size', this._fontSize);
			//this.node.setAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align', this._horizontalAlign + " " + this._verticalAlign);

			this.oldX = this.x;
			this.oldY = this.y;

			//set rotation
			if(this._rotate) {
				this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this.x + ' ' + this.y + ')' );
			}

			var textLines = this._text.split("\n");
			while(textLines.last() == "")
				textLines.remove(textLines.last());

			this.node.textContent = "";

			if(this.node.ownerDocument) {
				textLines.each((function(textLine, index) {
					var tspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
					tspan.textContent = textLine;
					tspan.setAttributeNS(null, 'x', this.x);
					tspan.setAttributeNS(null, 'y', this.y);

					//append tspan to text node
					this.node.appendChild(tspan);
				}).bind(this));

				//Work around for Mozilla bug 293581
				if(this.isVisible) {
					this.node.setAttributeNS(null, 'visibility', 'hidden');
				}

				if(this.fitToElemId)
					window.setTimeout(this._checkFittingToReferencedElem.bind(this), 0);
				else
					window.setTimeout(this._positionText.bind(this), 0);
			}
		}
	},

	_checkFittingToReferencedElem: function() {
		var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');

		var refNode = this.node.ownerDocument.getElementById(this.fitToElemId);

		if (refNode) {

			var refbb = refNode.getBBox();

			var startIndex = 0;
			var lastSeperatorIndex = 0;

			for (var j = 0; j < tspans.length; j++) {
				var tspan = tspans[j];

				var textLength = tspan.getComputedTextLength();

				if(textLength > refbb.width) {

					for (var i = 0; i < tspan.textContent.length; i++) {
						var sslength = tspan.getSubStringLength(startIndex, i - startIndex);

						if(sslength > refbb.width) {
							var newtspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
							if(lastSeperatorIndex <= startIndex) {
								newtspan.textContent = tspan.textContent.slice(startIndex, i-1);
								lastSeperatorIndex = i;
							} else{
								newtspan.textContent = tspan.textContent.slice(startIndex, lastSeperatorIndex);
							}

							newtspan.setAttributeNS(null, 'x', this.x);
							newtspan.setAttributeNS(null, 'y', this.y);

							//insert tspan to text node
							this.node.insertBefore(newtspan, tspan);

							startIndex = lastSeperatorIndex;

						} else {
							var curChar = tspan.textContent.charAt(i);
							if(curChar == ' ' ||
							   curChar == '-' ||
							   curChar == "." ||
							   curChar == "," ||
							   curChar == ";" ||
							   curChar == ":") {
								lastSeperatorIndex = i;
							}
						}
					}

					tspan.textContent = tspan.textContent.slice(startIndex);
				}
			}
		}

		window.setTimeout(this._positionText.bind(this), 0);
	},

	/**
	 * This is a work around method for Mozilla bug 293581.
	 * Before the method getComputedTextLength works, the text has to be rendered.
	 */
	_positionText: function() {
		try {
			var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');

			$A(tspans).each((function(tspan, index){
				//set vertical position
				var dy = 0;
				switch (this._verticalAlign) {
					case 'bottom':
						dy = -(tspans.length - index - 1) * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						break;
					case 'middle':
						dy = -(tspans.length / 2.0 - index - 1) * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						dy -= ORYX.CONFIG.LABEL_LINE_DISTANCE / 2;
						break;
					case 'top':
						dy = index * (this._fontSize + ORYX.CONFIG.LABEL_LINE_DISTANCE);
						dy += this._fontSize;
						break;
				}

				tspan.setAttributeNS(null, 'dy', dy);

				//set horizontal position
				var textLength = tspan.getComputedTextLength();
				switch (this._horizontalAlign) {
					case 'left':
						tspan.setAttributeNS(null, 'dx', 0);
						break;
					case 'center':
						tspan.setAttributeNS(null, 'dx', -textLength / 2);
						break;
					case 'right':
						tspan.setAttributeNS(null, 'dx', -textLength);
						break;
				}
			}).bind(this));

		} catch(e) {
			this._isChanged = true;
		}

		if(this.isVisible) {
			this.node.setAttributeNS(null, 'visibility', 'inherit');
		}
	},

	/**
	 * If no parameter is provided, this method returns the current text.
	 * @param text {String} Optional. Replaces the old text with this one.
	 */
	text: function() {
		switch (arguments.length) {
			case 0:
				return this._text
				break;

			case 1:
				var oldText = this._text;
				if(arguments[0]) {
					this._text = arguments[0].toString();
				} else {
					this._text = "";
				}
				if(oldText !== this._text) {
					this._isChanged = true;
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	verticalAlign: function() {
		switch(arguments.length) {
			case 0:
				return this._verticalAlign;
			case 1:
				if(['top', 'middle', 'bottom'].member(arguments[0])) {
					var oldValue = this._verticalAlign;
					this._verticalAlign = arguments[0];
					if(this._verticalAlign !== oldValue) {
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	horizontalAlign: function() {
		switch(arguments.length) {
			case 0:
				return this._horizontalAlign;
			case 1:
				if(['left', 'center', 'right'].member(arguments[0])) {
					var oldValue = this._horizontalAlign;
					this._horizontalAlign = arguments[0];
					if(this._horizontalAlign !== oldValue) {
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	fontSize: function() {
		switch(arguments.length) {
			case 0:
				return this._fontSize;
			case 1:
				var value = parseFloat(arguments[0]);
				if(value) {
					if(arguments[0] !== this._fontSize) {
						this._fontSize = arguments[0];
						this._isChanged = true;
					}
				}
				break;

			default:
				//TODO error
				break;
		}
	},

	hide: function() {

	},

	show: function() {

	},

	toString: function() { return "Label " + this.id }
 });<|endoftext|>


<commit_before>'use strict';

angular.module('scoreWebsiteApp')
    .controller('MainCtrl', function ($rootScope) {

        // App labels
        $rootScope.messages = {
            // nav bar
            navGettingStartedTitle: 'Getting Started',
            navUseCasesTitle: 'Use Cases',
            navAboutTitle: 'About Us',
            //navContactUsTitle: 'Contact Us',
            navDocumentationTitle: 'Documentation',

            // header
            headerMainTitle: 'Process-based, lightweight, Multi-Lingual open-source orchestration engine',
            headerDescription: 'score is a generic java-based open-source orchestration engine which is process-based, ' +
                'embeddable, lightweight, scalable and multi-lingual',
            headerStartNow: 'Start Now',

            // footer
            footerPrivacy: 'Privacy Policy',
            footerTerms: 'Terms os Use',
            footerCopyrightAgent: 'Copyright Agent',
            footerLegal: 'Legal',
            footerContactUs: 'Contact Us',
            footerContribute: 'Contribute',

            // bullets
            mainBulletsProcessBasedTitle: 'Process based',
            mainBulletsMultiLingualTitle: 'Multi-lingual',
            mainBulletsLightweightTitle: 'Lightweight',
            mainBulletsProcessBasedDesc: 'The score language ("slang") is a simple and intuitive language to describe workflows in a re-usable fashion that can run using both the score library or the score command-line.',
            mainBulletsMultiLingualDesc: 'Designed to support multiple compilers that can generate low level execution instructions, score serves as an orchestration platform for potentially any process language out there.',
            mainBulletsLightweightDesc: 'Small footprint, out of the box content and an easy-to-embed approach makes score the perfect choice as the  workflow orchestration solution in your application.',
            mainBulletsReadMore: 'Read More',

            // contact us
            contactUsHeader: 'You\'d like to reach out to us? Drop us a message!',
            contactSuccess: 'Your message was sent successfully. Thanks!',
            contactFailure: 'Please fill out all the fields in the form.',
            contactSendButton: 'Send Message',
            contactPlaceholderName: 'Your Name',
            contactPlaceholderEmail: 'Your Email',
            contactPlaceholderSubject: 'Subject',
            contactPlaceholderMessage: 'Your Message',

            // about us
            aboutUsWhoWeAreText: 'The Eclipse Foundation™ project \'score\' was contributed to the open source community by the HP Software engineers to create a collaborative effort by the community ti create the best orchestration technology.',

            // use cases
            useCasesTitle: 'Use Cases',
            useCasesITTitle: 'IT Process automation',
            useCasesCloudTitle: 'Cloud orchestration',
            useCasesAppDeploymentTitle: 'Application Deployment',
            useCasesDevOpsTitle: 'DevOps',
            useCasesITDesc: 'Disaster Recovery',
            useCasesCloudDesc: 'OpenStack Health Check',
            useCasesAppDeploymentDesc: 'Link Docker Container',
            useCasesDevOpsDesc: 'CI \\ CD',

            // getting started
            downloadCliHeader: 'Download and use score command-line',
            downloadCliDownloadLink: 'Download and see how',
            embedScoreHeader: 'Embed score in your application',
            embedScoreLink: 'Press to see how',
            orText: 'or',
            // -- download and install sli
            detailedDownloadCliHeader: 'Download score command-line',
            detailedDownloadCliText: 'Download and Unzip score command-line',
            detailedDownloadLatest: 'Download latest version',
            detailedDownloadOldVersions: 'Download old versions',
            detailedSlangCliHeader: 'Use slang',
            detailedSlangCliText: 'Write a flow with slang',
            detailedUseCliHeader: 'Start score command-line',
            detailedUseCliText: 'Open your console and execute score cli',
            detailedTriggerFlowHeader: 'Trigger flow',
            detailedTriggerFlowText: 'Trigger your slang written flow from score command-line',
            detailedCliHeader: 'console',
            detailedCliPrefix: '$',
            detailedCliClear: 'Clear',
            detailedCliOpenScore: 'java -jar score-cli.jar^1000\nHi I\'m score!!\n>',
            detailedCliTriggerFlow: 'score trigger\n^1200the weather in San Fransisco is: Hot\n$',
            // -- embed score
            detailedEmbedPomHeader: 'Score dependencies',
            detailedEmbedPomText: 'Add score dependencies to your pom.xml',
            detailedEmbedSpringHeader: 'Spring configuration',
            detailedEmbedSpringText: 'Add some score configuration to your Spring application context xml',
            detailedEmbedScoreApiHeader: 'Use score API',
            detailedEmbedScoreApiText: 'Call score APIs from your Java application (Trigger example)',
            detailedEmbedScoreApiMore: 'Press here for more score APIs',
            detailedEmbedScoreCompileHeader: 'Compile',
            detailedEmbedScoreCompileText: 'Compile your application and create an executable jar using maven',
            detailedEmbedCompileCli: 'mvn clean install^1000\n[INFO] Scanning for projects...\n ......\n[INFO] BUILD SUCCESS\n$',
            detailedEmbedScoreRunHeader: 'Run',
            detailedEmbedScoreRunText: 'Run your application from command line',
            detailedEmbedRunCli: 'cd /dev/score-app/target\n$ java -jar sample-app.jar\n^1000Checking flow status...^1200\nFinished^1000\nthe weather in San Fransisco is: Hot\n$'
        };

        $rootScope.sections = [
            { id: 'gettingStarted', title: $rootScope.messages.navGettingStartedTitle  },
            { id: 'useCases', title: $rootScope.messages.navUseCasesTitle },
            { id: 'about', title: $rootScope.messages.navAboutTitle },
            { id: 'documentation', title: $rootScope.messages.navDocumentationTitle  }
//            { id: 'contactUs', title: $rootScope.messages.navContactUsTitle  }
        ];

        $rootScope.year = new Date().getFullYear();
    });<commit_msg>fixed strings<commit_after>'use strict';

angular.module('scoreWebsiteApp')
    .controller('MainCtrl', function ($rootScope) {

        // App labels
        $rootScope.messages = {
            // nav bar
            navGettingStartedTitle: 'Getting Started',
            navUseCasesTitle: 'Use Cases',
            navAboutTitle: 'About Us',
            //navContactUsTitle: 'Contact Us',
            navDocumentationTitle: 'Documentation',

            // header
            headerMainTitle: 'Process-based, lightweight, Multi-Lingual open-source orchestration engine',
            headerDescription: 'score is a generic java-based open-source orchestration engine which is process-based, ' +
                'embeddable, lightweight, scalable and multi-lingual',
            headerStartNow: 'Start Now',

            // footer
            footerPrivacy: 'Privacy Policy',
            footerTerms: 'Terms os Use',
            footerCopyrightAgent: 'Copyright Agent',
            footerLegal: 'Legal',
            footerContactUs: 'Contact Us',
            footerContribute: 'Contribute',

            // bullets
            mainBulletsProcessBasedTitle: 'Process based',
            mainBulletsMultiLingualTitle: 'Multi-lingual',
            mainBulletsLightweightTitle: 'Lightweight',
            mainBulletsProcessBasedDesc: 'The score language ("slang") is a simple and intuitive language to describe workflows in a re-usable fashion that can run using both the score library or the score command-line.',
            mainBulletsMultiLingualDesc: 'Designed to support multiple compilers that can generate low level execution instructions, score serves as an orchestration platform for potentially any process language out there.',
            mainBulletsLightweightDesc: 'Small footprint, out of the box content and an easy-to-embed approach makes score the perfect choice as the  workflow orchestration solution in your application.',
            mainBulletsReadMore: 'Read More',

            // contact us
            contactUsHeader: 'You\'d like to reach out to us? Drop us a message!',
            contactSuccess: 'Your message was sent successfully. Thanks!',
            contactFailure: 'Please fill out all the fields in the form.',
            contactSendButton: 'Send Message',
            contactPlaceholderName: 'Your Name',
            contactPlaceholderEmail: 'Your Email',
            contactPlaceholderSubject: 'Subject',
            contactPlaceholderMessage: 'Your Message',

            // about us
            aboutUsWhoWeAreText: 'The Eclipse Foundation™ project \'score\' was contributed to the open source community by the HP Software engineers to create a collaborative effort by the community ti create the best orchestration technology.',

            // use cases
            useCasesTitle: 'Use Cases',
            useCasesITTitle: 'IT Process Automation',
            useCasesCloudTitle: 'Cloud Orchestration',
            useCasesAppDeploymentTitle: 'Application Deployment',
            useCasesDevOpsTitle: 'DevOps',
            useCasesITDesc: 'Disaster Recovery',
            useCasesCloudDesc: 'OpenStack Health Check',
            useCasesAppDeploymentDesc: 'Link Docker Container',
            useCasesDevOpsDesc: 'CI \\ CD',

            // getting started
            downloadCliHeader: 'Download and use score command-line',
            downloadCliDownloadLink: 'Download and see how',
            embedScoreHeader: 'Embed score in your application',
            embedScoreLink: 'Press to see how',
            orText: 'or',
            // -- download and install sli
            detailedDownloadCliHeader: 'Download score command-line',
            detailedDownloadCliText: 'Download and Unzip score command-line',
            detailedDownloadLatest: 'Download latest version',
            detailedDownloadOldVersions: 'Download old versions',
            detailedSlangCliHeader: 'Use slang',
            detailedSlangCliText: 'Write a flow with slang',
            detailedUseCliHeader: 'Start score command-line',
            detailedUseCliText: 'Open your console and execute score cli',
            detailedTriggerFlowHeader: 'Trigger flow',
            detailedTriggerFlowText: 'Trigger your slang written flow from score command-line',
            detailedCliHeader: 'console',
            detailedCliPrefix: '$',
            detailedCliClear: 'Clear',
            detailedCliOpenScore: 'java -jar score-cli.jar^1000\nHi I\'m score!!\n>',
            detailedCliTriggerFlow: 'score trigger\n^1200the weather in San Fransisco is: Hot\n$',
            // -- embed score
            detailedEmbedPomHeader: 'Score dependencies',
            detailedEmbedPomText: 'Add score dependencies to your pom.xml',
            detailedEmbedSpringHeader: 'Spring configuration',
            detailedEmbedSpringText: 'Add some score configuration to your Spring application context xml',
            detailedEmbedScoreApiHeader: 'Use score API',
            detailedEmbedScoreApiText: 'Call score APIs from your Java application (Trigger example)',
            detailedEmbedScoreApiMore: 'Press here for more score APIs',
            detailedEmbedScoreCompileHeader: 'Compile',
            detailedEmbedScoreCompileText: 'Compile your application and create an executable jar using maven',
            detailedEmbedCompileCli: 'mvn clean install^1000\n[INFO] Scanning for projects...\n ......\n[INFO] BUILD SUCCESS\n$',
            detailedEmbedScoreRunHeader: 'Run',
            detailedEmbedScoreRunText: 'Run your application from command line',
            detailedEmbedRunCli: 'cd /dev/score-app/target\n$ java -jar sample-app.jar\n^1000Checking flow status...^1200\nFinished^1000\nthe weather in San Fransisco is: Hot\n$'
        };

        $rootScope.sections = [
            { id: 'gettingStarted', title: $rootScope.messages.navGettingStartedTitle  },
            { id: 'useCases', title: $rootScope.messages.navUseCasesTitle },
            { id: 'about', title: $rootScope.messages.navAboutTitle },
            { id: 'documentation', title: $rootScope.messages.navDocumentationTitle  }
//            { id: 'contactUs', title: $rootScope.messages.navContactUsTitle  }
        ];

        $rootScope.year = new Date().getFullYear();
    });<|endoftext|>


<commit_before>var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');

gulp.task('default', function () {
	console.log('this is the gulp default task');
});
gulp.task('browser-sync', function() {
    browserSync.init({
        server: {
            baseDir: "./web"
        }
    });
});

gulp.task('build', function () {
	gulp.src('bower_components/jquery/dist/jquery.js')
		.pipe(gulp.dest('./web/js'));

});

gulp.task('sass', function () {
	gulp.src('./scss/**/*.scss')
		.pipe(sass().on('error', sass.logError))
		.pipe(gulp.dest('./web/css'));
});

// watchers

gulp.task('watch-scss', function () {
   gulp.watch('./scss/**/*.scss', ['sass']);
});
<commit_msg>running karma from gulp<commit_after>var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var Server = require('karma').Server;

gulp.task('default', ['test'],  function () {
	console.log('this is the gulp default task');
});
gulp.task('browser-sync', function() {
    browserSync.init({
        server: {
            baseDir: "./web"
        }
    });
});

gulp.task('build', function () {
	gulp.src('bower_components/jquery/dist/jquery.js')
		.pipe(gulp.dest('./web/js'));

});

gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/karma.conf.js',
    singleRun: true
  }, done).start();
});

gulp.task('sass', function () {
	gulp.src('./scss/**/*.scss')
		.pipe(sass().on('error', sass.logError))
		.pipe(gulp.dest('./web/css'));
});

// watchers

gulp.task('watch-scss', function () {
   gulp.watch('./scss/**/*.scss', ['sass']);
});
<|endoftext|>


<commit_before><commit_msg>Update copyright date to 2019<commit_after><|endoftext|>