<commit_before>import alt from "alt-instance"
import WalletDb from "stores/WalletDb"
import PrivateKeyStore from "stores/PrivateKeyStore"
import AccountRefsStore from "stores/AccountRefsStore"
import BalanceClaimActiveStore from "stores/BalanceClaimActiveStore"
import PrivateKeyActions from "actions/PrivateKeyActions"
import WalletActions from "actions/WalletActions"
import ChainStore from "api/ChainStore"
import BaseStore from "stores/BaseStore"
import iDB from "idb-instance"
import Immutable from "immutable"

/**  High-level container for managing multiple wallets.
*/
class WalletManagerStore extends BaseStore {

    constructor() {
        super()
        this.state = this._getInitialState()
        this.bindListeners({
            onRestore: WalletActions.restore,
            onSetWallet: WalletActions.setWallet,
            onSetBackupDate: WalletActions.setBackupDate,
            onSetBrainkeyBackupDate: WalletActions.setBrainkeyBackupDate
        })
        super._export("init", "setNewWallet", "onDeleteWallet", "onDeleteAllWallets")
    }

    _getInitialState() {
        return {
            new_wallet: undefined,// pending restore
            current_wallet: undefined,
            wallet_names: Immutable.Set()
        }
    }

    /** This will change the current wallet the newly restored wallet. */
    onRestore({wallet_name, wallet_object}) {
        iDB.restore(wallet_name, wallet_object).then( () => {
            return this.onSetWallet({wallet_name})
        }).catch( error => {
            console.error(error)
            return Promise.reject(error)
        })
    }

    /** This may result in a new wallet name being added, only in this case
        should a create_wallet_password be provided.
    */
    onSetWallet({wallet_name = "default", create_wallet_password, brnkey, resolve}) {
        var p = new Promise( resolve => {

            if( /[^a-z0-9_-]/.test(wallet_name) || wallet_name === "" )
                throw new Error("Invalid wallet name")

            if(this.state.current_wallet === wallet_name) {
                resolve()
                return
            }

            var add
            if( ! this.state.wallet_names.has(wallet_name) ) {
                var wallet_names = this.state.wallet_names.add(wallet_name)
                add = iDB.root.setProperty("wallet_names", wallet_names)
                this.setState({wallet_names})
            }

            var current = iDB.root.setProperty("current_wallet", wallet_name)

            resolve( Promise.all([ add, current ]).then(()=>{
                // The database must be closed and re-opened first before the current
                // application code can initialize its new state.
                iDB.close()
                ChainStore.clearCache()
                BalanceClaimActiveStore.reset()
                // Stores may reset when loadDbData is called
                return iDB.init_instance().init_promise.then(()=>{
                    return Promise.all([
                        WalletDb.loadDbData().then(()=>AccountStore.loadDbData()),
                        PrivateKeyActions.loadDbData().then(()=>AccountRefsStore.loadDbData())
                    ]).then(()=>{
                        // Update state here again to make sure listeners re-render

                        if( ! create_wallet_password) {
                            this.setState({current_wallet: wallet_name})
                            return
                        }

                        return WalletDb.onCreateWallet(
                            create_wallet_password,
                            brnkey, //brainkey,
                            true //unlock
                        ).then(()=>
                            this.setState({current_wallet: wallet_name}))

                    })
                })
            }))
        }).catch( error => {
            console.error(error)
            return Promise.reject(error)
        })
        if(resolve) resolve(p)
    }

    /** Used by the components during a pending wallet create. */
    setNewWallet(new_wallet) {
        this.setState({new_wallet})
    }

    init() {
        return iDB.root.getProperty("current_wallet").then(
            current_wallet => {
            return iDB.root.getProperty("wallet_names", []).then( wallet_names => {
                this.setState({
                    wallet_names: Immutable.Set(wallet_names),
                    current_wallet
                })
            })
        })
    }

    onDeleteAllWallets() {
        var deletes = []
        this.state.wallet_names.forEach( wallet_name =>
            deletes.push(this.onDeleteWallet(wallet_name)))
        return Promise.all(deletes)
    }

    onDeleteWallet(delete_wallet_name) {
        return new Promise( resolve => {
            var {current_wallet, wallet_names} = this.state
            if( ! wallet_names.has(delete_wallet_name) ) {
                throw new Error("Can't delete wallet, does not exist in index")
            }
            wallet_names = wallet_names.delete(delete_wallet_name)
            iDB.root.setProperty("wallet_names", wallet_names)
            if(current_wallet === delete_wallet_name) {
                current_wallet = wallet_names.size ? wallet_names.first() : undefined
                iDB.root.setProperty("current_wallet", current_wallet)
            }
            this.setState({current_wallet, wallet_names})
            var database_name = iDB.getDatabaseName(delete_wallet_name)
            var req = iDB.impl.deleteDatabase(database_name)
            resolve( database_name )
        })
    }

    onSetBackupDate() {
        WalletDb.setBackupDate()
    }

    onSetBrainkeyBackupDate() {
        WalletDb.setBrainkeyBackupDate()
    }

}

export var WalletManagerStoreWrapped = alt.createStore(WalletManagerStore, "WalletManagerStore");
export default WalletManagerStoreWrapped
<commit_msg>Wallet manager layout fix<commit_after>import alt from "alt-instance"
import WalletDb from "stores/WalletDb"
import AccountRefsStore from "stores/AccountRefsStore"
import BalanceClaimActiveStore from "stores/BalanceClaimActiveStore"
import PrivateKeyActions from "actions/PrivateKeyActions"
import WalletActions from "actions/WalletActions"
import ChainStore from "api/ChainStore"
import BaseStore from "stores/BaseStore"
import iDB from "idb-instance"
import Immutable from "immutable"

/**  High-level container for managing multiple wallets.
*/
class WalletManagerStore extends BaseStore {

    constructor() {
        super()
        this.state = this._getInitialState()
        this.bindListeners({
            onRestore: WalletActions.restore,
            onSetWallet: WalletActions.setWallet,
            onSetBackupDate: WalletActions.setBackupDate,
            onSetBrainkeyBackupDate: WalletActions.setBrainkeyBackupDate
        })
        super._export("init", "setNewWallet", "onDeleteWallet", "onDeleteAllWallets")
    }

    _getInitialState() {
        return {
            new_wallet: undefined,// pending restore
            current_wallet: undefined,
            wallet_names: Immutable.Set()
        }
    }

    /** This will change the current wallet the newly restored wallet. */
    onRestore({wallet_name, wallet_object}) {
        iDB.restore(wallet_name, wallet_object).then( () => {
            return this.onSetWallet({wallet_name})
        }).catch( error => {
            console.error(error)
            return Promise.reject(error)
        })
    }

    /** This may result in a new wallet name being added, only in this case
        should a create_wallet_password be provided.
    */
    onSetWallet({wallet_name = "default", create_wallet_password, brnkey, resolve}) {
        var p = new Promise( resolve => {

            if( /[^a-z0-9_-]/.test(wallet_name) || wallet_name === "" )
                throw new Error("Invalid wallet name")

            if(this.state.current_wallet === wallet_name) {
                resolve()
                return
            }

            var add
            if( ! this.state.wallet_names.has(wallet_name) ) {
                var wallet_names = this.state.wallet_names.add(wallet_name)
                add = iDB.root.setProperty("wallet_names", wallet_names)
                this.setState({wallet_names})
            }

            var current = iDB.root.setProperty("current_wallet", wallet_name)

            resolve( Promise.all([ add, current ]).then(()=>{
                // The database must be closed and re-opened first before the current
                // application code can initialize its new state.
                iDB.close()
                ChainStore.clearCache()
                BalanceClaimActiveStore.reset()
                // Stores may reset when loadDbData is called
                return iDB.init_instance().init_promise.then(()=>{
                    return Promise.all([
                        WalletDb.loadDbData().then(()=>AccountStore.loadDbData()),
                        PrivateKeyActions.loadDbData().then(()=>AccountRefsStore.loadDbData())
                    ]).then(()=>{
                        // Update state here again to make sure listeners re-render

                        if( ! create_wallet_password) {
                            this.setState({current_wallet: wallet_name})
                            return
                        }

                        return WalletDb.onCreateWallet(
                            create_wallet_password,
                            brnkey, //brainkey,
                            true //unlock
                        ).then(()=>
                            this.setState({current_wallet: wallet_name}))

                    })
                })
            }))
        }).catch( error => {
            console.error(error)
            return Promise.reject(error)
        })
        if(resolve) resolve(p)
    }

    /** Used by the components during a pending wallet create. */
    setNewWallet(new_wallet) {
        this.setState({new_wallet})
    }

    init() {
        return iDB.root.getProperty("current_wallet").then(
            current_wallet => {
            return iDB.root.getProperty("wallet_names", []).then( wallet_names => {
                this.setState({
                    wallet_names: Immutable.Set(wallet_names),
                    current_wallet
                })
            })
        })
    }

    onDeleteAllWallets() {
        var deletes = []
        this.state.wallet_names.forEach( wallet_name =>
            deletes.push(this.onDeleteWallet(wallet_name)))
        return Promise.all(deletes)
    }

    onDeleteWallet(delete_wallet_name) {
        return new Promise( resolve => {
            var {current_wallet, wallet_names} = this.state
            if( ! wallet_names.has(delete_wallet_name) ) {
                throw new Error("Can't delete wallet, does not exist in index")
            }
            wallet_names = wallet_names.delete(delete_wallet_name)
            iDB.root.setProperty("wallet_names", wallet_names)
            if(current_wallet === delete_wallet_name) {
                current_wallet = wallet_names.size ? wallet_names.first() : undefined
                iDB.root.setProperty("current_wallet", current_wallet)
            }
            this.setState({current_wallet, wallet_names})
            var database_name = iDB.getDatabaseName(delete_wallet_name)
            var req = iDB.impl.deleteDatabase(database_name)
            resolve( database_name )
        })
    }

    onSetBackupDate() {
        WalletDb.setBackupDate()
    }

    onSetBrainkeyBackupDate() {
        WalletDb.setBrainkeyBackupDate()
    }

}

export var WalletManagerStoreWrapped = alt.createStore(WalletManagerStore, "WalletManagerStore");
export default WalletManagerStoreWrapped
<|endoftext|>


<commit_before>
class controller {

    constructor($scope, $route, $transclude, $element) {
        this.refresh = promise => promise.then(() => {
            $route.reset();
            this.list.page = this.list.page;
        });
        this.columns = [];
        if (this.items && this.items.length) {
            for (let key in this.items[0]) {
                this.columns.push(key);
            }
        }
        let hdrs = $transclude().find('th');
        if (hdrs.length) {
            this.columns = [];
            hdrs.each((i, hdr) => {
                this.columns.push(angular.element(hdr).attr('property'));
            });
            $element.find('thead tr').append(hdrs);
        } else {
            let h = $element.find('thead tr');
            this.columns.map(col => {
                h.append('' + col + '	');
            });
        }
    }
}

controller.$inject = ['$scope', '$route', '$transclude', '$element'];

export default () => {
    return {
        require: '^moList',
        restrict: 'E',
        templateUrl: '../monad/directives/list/table/template.html',
        scope: {rows: '=', templates: '='},
        controller,
        controllerAs: 'tbody',
        link: (scope, elem, attrs, ctrl) => {
            scope.tbody.component = ctrl.component;
        },
        bindToController: true,
        transclude: true
    };
};

<commit_msg>cleanup/fix this directive: link function should handle dom manipulation<commit_after>
class controller {

    constructor($scope, $route, $transclude) {
        this.refresh = promise => promise.then(() => {
            $route.reset();
            this.list.page = this.list.page;
        });
        this.columns = [];
        if (this.items && this.items.length) {
            for (let key in this.items[0]) {
                this.columns.push(key);
            }
        }
        let hdrs = $transclude().find('th');
        if (hdrs.length) {
            this.columns = [];
            angular.forEach(hdrs, hdr => this.columns.push(angular.element(hdr).attr('property')));
            this.header = hdrs.parent('tr');
        } else {
            this.header = angular.element('
');
            this.columns.map(col => this.header.append('' + col + '	'));
        }
    }
}

controller.$inject = ['$scope', '$route', '$transclude'];

export default () => {
    return {
        require: '^moList',
        restrict: 'E',
        templateUrl: '../monad/directives/list/table/template.html',
        scope: {rows: '=', templates: '='},
        controller,
        controllerAs: 'tbody',
        bindToController: true,
        transclude: true,
        link: (scope, elem, attrs, ctrl) => {
            scope.tbody.component = ctrl.component;
            elem.find('thead').append(scope.tbody.header);
        }
    };
};

<|endoftext|>


<commit_before>import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';

import webpackCommonConfig from './webpack.common';
import autoprefixerConfig from './autoprefixer';

export default {
    ...webpackCommonConfig,
    entry: {
        vendor: [
            'react',
            '@yummies/yummies'
        ],
        app: './src/index'
    },
    output: {
        path: path.resolve('./build/'),
        filename: 'js/[name].js'
    },
    module: {
        preLoaders: webpackCommonConfig.module.preLoaders,
        loaders: [
            ...webpackCommonConfig.module.loaders,
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract(
                    'style',
                    'css?-minimize' +
                    '!autoprefixer?' + autoprefixerConfig +
                    '!less'
                )
            }
        ]
    },
    plugins: [
        ...webpackCommonConfig.plugins,
        new webpack.optimize.CommonsChunkPlugin('vendor', 'js/[name].js'),
        new ExtractTextPlugin('css/[name].css', {
            allChunks: true
        }),
        new HtmlWebpackPlugin({
            template: 'src/assets/index.html',
            assets: {
                vendor: 'js/vendor.js',
                app: 'js/app.js',
                css: 'css/app.css'
            }
        }),
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin()
    ]
};
<commit_msg>:wrench: tweak webpack vendor's chunk entry points<commit_after>import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';

import webpackCommonConfig from './webpack.common';
import autoprefixerConfig from './autoprefixer';

export default {
    ...webpackCommonConfig,
    entry: {
        vendor: [
            'react',
            '@yummies/dom'
        ],
        app: './src/index'
    },
    output: {
        path: path.resolve('./build/'),
        filename: 'js/[name].js'
    },
    module: {
        preLoaders: webpackCommonConfig.module.preLoaders,
        loaders: [
            ...webpackCommonConfig.module.loaders,
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract(
                    'style',
                    'css?-minimize' +
                    '!autoprefixer?' + autoprefixerConfig +
                    '!less'
                )
            }
        ]
    },
    plugins: [
        ...webpackCommonConfig.plugins,
        new webpack.optimize.CommonsChunkPlugin('vendor', 'js/[name].js'),
        new ExtractTextPlugin('css/[name].css', {
            allChunks: true
        }),
        new HtmlWebpackPlugin({
            template: 'src/assets/index.html',
            assets: {
                vendor: 'js/vendor.js',
                app: 'js/app.js',
                css: 'css/app.css'
            }
        }),
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin()
    ]
};
<|endoftext|>


<commit_before>// Copyright 2002-2014, University of Colorado Boulder

/**
 * Main ScreenView container for Buttons portion of the UI component demo.
 *
 * @author Sam Reid
 */
define( function( require ) {
  'use strict';

  // modules
  var inherit = require( 'PHET_CORE/inherit' );
  var ScreenView = require( 'JOIST/ScreenView' );
  var OutsideBackgroundNode = require( 'SCENERY_PHET/OutsideBackgroundNode' );
  var ThermometerNode = require( 'SCENERY_PHET/ThermometerNode' );
  var Property = require( 'AXON/Property' );
  var StarNode = require( 'SCENERY_PHET/StarNode' );
  var HSlider = require( 'SUN/HSlider' );
  var Node = require( 'SCENERY/nodes/Node' );
  var WavelengthSlider = require( 'SCENERY_PHET/WavelengthSlider' );
  var MeasuringTape = require( 'SCENERY_PHET/MeasuringTape' );

  function DemoView() {
    ScreenView.call( this, { renderer: 'svg' } );

    // background
    this.addChild( new OutsideBackgroundNode( this.layoutBounds.centerX, this.layoutBounds.centerY + 20, this.layoutBounds.width * 3, this.layoutBounds.height, this.layoutBounds.height ) );

    //Test for thermometer node
    var tempProperty = new Property( 50 );
    var tempSlider = new HSlider( tempProperty, { min: 0, max: 100 } );
    tempSlider.rotation = -Math.PI / 2;
    tempSlider.centerX = this.layoutBounds.centerX + 75;
    tempSlider.centerY = this.layoutBounds.centerY;
    this.addChild( tempSlider );

    var thermometer = new ThermometerNode( 0, 100, tempProperty, { centerX: this.layoutBounds.centerX, centerY: this.layoutBounds.centerY } );
    thermometer.centerX = this.layoutBounds.centerX;
    thermometer.centerY = this.layoutBounds.centerY;
    this.addChild( thermometer );

    //test for measuring tape
    var mtScaleProperty = new Property( 1 );
    var mtUnitsProperty = new Property( { name: 'meters', multiplier: 1 } );
    var measuringTape = new MeasuringTape( this.layoutBounds, mtScaleProperty, mtUnitsProperty,
      {
        x: 500,
        y: 400,
        tipColor: 'black',
        tipRadius: 8,
        initialValue: 10
      } );
    this.addChild( measuringTape );

    //Test for showing the star filling up.  Note this just creates new stars dynamically.  Shouldn't be a problem for sims since stars are relatively static.
    //Stars should be rewritten if they need to support smooth dynamic filling (may require mutable kite paths)
    var starNodeContainer = new Node( {children: [new StarNode()], top: 20, left: 20} );
    this.addChild( starNodeContainer );

    var starValueProperty = new Property( 1 );
    this.addChild( new HSlider( starValueProperty, {min: 0, max: 1} ).mutate( {left: 20, top: 80} ) );
    starValueProperty.link( function( value ) {
      starNodeContainer.children = [new StarNode( {
        value: value
      } )];
    } );

    //Test for wavelength slider
    var wavelengthProperty = new Property( 500 );
    var wavelengthSlider = new WavelengthSlider( wavelengthProperty, { centerY: this.layoutBounds.centerY, tweakersVisible: false, valueVisible: false } );

    this.addChild( wavelengthSlider );
  }

  return inherit( ScreenView, DemoView, {
    step: function( timeElapsed ) {
      // Does nothing for now.
    }
  } );
} );<commit_msg>fix bogus layout code in scenery-phet demo<commit_after>// Copyright 2002-2014, University of Colorado Boulder

/**
 * Main ScreenView container for Buttons portion of the UI component demo.
 *
 * @author Sam Reid
 */
define( function( require ) {
  'use strict';

  // modules
  var inherit = require( 'PHET_CORE/inherit' );
  var ScreenView = require( 'JOIST/ScreenView' );
  var OutsideBackgroundNode = require( 'SCENERY_PHET/OutsideBackgroundNode' );
  var ThermometerNode = require( 'SCENERY_PHET/ThermometerNode' );
  var Property = require( 'AXON/Property' );
  var StarNode = require( 'SCENERY_PHET/StarNode' );
  var HSlider = require( 'SUN/HSlider' );
  var Node = require( 'SCENERY/nodes/Node' );
  var WavelengthSlider = require( 'SCENERY_PHET/WavelengthSlider' );
  var MeasuringTape = require( 'SCENERY_PHET/MeasuringTape' );

  function DemoView() {
    ScreenView.call( this, { renderer: 'svg' } );

    // background
    this.addChild( new OutsideBackgroundNode( this.layoutBounds.centerX, this.layoutBounds.centerY + 20, this.layoutBounds.width * 3, this.layoutBounds.height, this.layoutBounds.height ) );

    // thermometer
    var tempProperty = new Property( 50 );
    var thermometer = new ThermometerNode( 0, 100, tempProperty, { centerX: this.layoutBounds.centerX, centerY: this.layoutBounds.centerY } );
    thermometer.centerX = this.layoutBounds.centerX;
    thermometer.centerY = this.layoutBounds.centerY;
    this.addChild( thermometer );

    // slider for controlling thermometer
    var tempSlider = new HSlider( tempProperty, { min: 0, max: 100 } );
    tempSlider.rotation = -Math.PI / 2;
    tempSlider.left = thermometer.right + 10;
    tempSlider.centerY = thermometer.centerY;
    this.addChild( tempSlider );

    // measuring tape
    var mtScaleProperty = new Property( 1 );
    var mtUnitsProperty = new Property( { name: 'meters', multiplier: 1 } );
    var measuringTape = new MeasuringTape( this.layoutBounds, mtScaleProperty, mtUnitsProperty,
      {
        x: 500,
        y: 400,
        tipColor: 'black',
        tipRadius: 8,
        initialValue: 10
      } );
    this.addChild( measuringTape );

    //Test for showing the star filling up.  Note this just creates new stars dynamically.  Shouldn't be a problem for sims since stars are relatively static.
    //Stars should be rewritten if they need to support smooth dynamic filling (may require mutable kite paths)
    var starNodeContainer = new Node( {children: [new StarNode()], top: 20, left: 20} );
    this.addChild( starNodeContainer );

    var starValueProperty = new Property( 1 );
    this.addChild( new HSlider( starValueProperty, {min: 0, max: 1} ).mutate( {left: starNodeContainer.left, top: starNodeContainer.bottom + 5 } ) );
    starValueProperty.link( function( value ) {
      starNodeContainer.children = [new StarNode( {
        value: value
      } )];
    } );

    //Test for wavelength slider
    var wavelengthProperty = new Property( 500 );
    var wavelengthSlider = new WavelengthSlider( wavelengthProperty,
      { left: 10, centerY: this.layoutBounds.centerY, tweakersVisible: false, valueVisible: false } );

    this.addChild( wavelengthSlider );
  }

  return inherit( ScreenView, DemoView, {
    step: function( timeElapsed ) {
      // Does nothing for now.
    }
  } );
} );<|endoftext|>


<commit_before>
export default () => {
    return {
        require: '^moList',
        restrict: 'E',
        templateUrl: '../monad/directives/list/table/template.html',
        scope: {rows: '=', templates: '='},
        controller: ['$scope', '$route', '$transclude', '$element', function($scope, $route, $transclude, $element) {
            this.refresh = promise => promise.then(() => {
                $route.reset();
                this.list.page = this.list.page;
            });
            this.columns = [];
            if (this.items && this.items.length) {
                for (let key in this.items[0]) {
                    this.columns.push(key);
                }
            }
            let hdrs = $transclude().find('th');
            if (hdrs.length) {
                this.columns = [];
                hdrs.each((i, hdr) => {
                    this.columns.push(angular.element(hdr).attr('property'));
                });
                $element.find('thead tr').append(hdrs);
            } else {
                let h = $element.find('thead tr');
                this.columns.map(col => {
                    h.append('' + col + '	');
                });
            }
        }],
        controllerAs: 'tbody',
        link: (scope, elem, attrs, ctrl) => {
            scope.tbody.component = ctrl.component;
        },
        bindToController: true,
        transclude: true
    };
};

<commit_msg>this is neater<commit_after>
class controller {

    constructor($scope, $route, $transclude, $element) {
        this.refresh = promise => promise.then(() => {
            $route.reset();
            this.list.page = this.list.page;
        });
        this.columns = [];
        if (this.items && this.items.length) {
            for (let key in this.items[0]) {
                this.columns.push(key);
            }
        }
        let hdrs = $transclude().find('th');
        if (hdrs.length) {
            this.columns = [];
            hdrs.each((i, hdr) => {
                this.columns.push(angular.element(hdr).attr('property'));
            });
            $element.find('thead tr').append(hdrs);
        } else {
            let h = $element.find('thead tr');
            this.columns.map(col => {
                console.log(col);
            //    h.append('' + col + '	');
            });
        }
    }
}

controller.$inject = ['$scope', '$route', '$transclude', '$element'];

export default () => {
    return {
        require: '^moList',
        restrict: 'E',
        templateUrl: '../monad/directives/list/table/template.html',
        scope: {rows: '=', templates: '='},
        controller,
        controllerAs: 'tbody',
        link: (scope, elem, attrs, ctrl) => {
            scope.tbody.component = ctrl.component;
        },
        bindToController: true,
        transclude: true
    };
};

<|endoftext|>


<commit_before>(function($)
{

  $.widget('ui.dmAdminForm', $.extend({}, $.dm.coreForm, {

    _init: function()
    {
      this.$ = $("#dm_admin_content");

      this.focusFirstInput();
      this.markdown();
      this.selectObject();
      this.checkBoxList();
      this.linkDroppable();
      this.hotKeys();
    },

    focusFirstInput: function()
    {
      if ($firstInput = $('div.sf_admin_form_row_inner input:first', this.$))
      {
        $firstInput.focus();
      }
    },

    hotKeys: function()
    {
      if ($save = $('li.sf_admin_action_save:first input', this.$).orNot())
      {
        this.$.bindKey('Ctrl+s', function()
        {
          $save.trigger('click');
          return false;
        });
      }
    },

    markdown: function()
    {
      var form = this;

      $('textarea.dm_markdown', form.element).each(function()
      {
        var $editor = $(this);
        var $preview = $('#dm_markdown_preview_'+$editor.metadata().code);
        var value = $editor.val();

				$editor.dmMarkdown();

        setInterval(function()
        {
          if ($editor.val() != value)
          {
            value = $editor.val();
            $.ajax({
              type: "POST",
              mode: "abort",
              url: $.dm.ctrl.getHref('+/dmCore/markdown'),
              data: {
                text: value
              },
              success: function(html)
              {
                $preview.html(html);
              }
            });
          }
        }, 500);

        $preview.height($editor.closest('div.markItUpContainer').innerHeight() - 13);

        $editor.resizable({
          alsoResize: $preview,
          handles: 's'
        });
      });
    },

    selectObject: function()
    {
      // Switch to another object
      $("#dm_select_object").bind('change', function()
      {
        location.href = $(this).metadata().href.replace('_ID_', $(this).val());
      });
    },

    checkBoxList: function()
    {
      var $list = $('ul.checkbox_list', this.element);

      $('> li > label, > li > input', $list).click(function(e)
      {
        e.stopPropagation();
      });

      $('> li', $list).click(function()
      {
        var $input = $('> input', $(this));
        $input.attr('checked', !$input.attr('checked')).trigger('change');
      });

      $('> li > input', $list).change(function()
      {
        $(this).parent()[($(this).attr('checked') ? 'add' : 'remove') + 'Class']('active');
        return true;
      }).trigger('change');

      $('div.control span.select_all, div.control span.unselect_all', $list.parent().parent()).each(function()
      {
        $(this).click(function()
        {
          $(this).closest('div.sf_admin_form_row_inner').find('input:checkbox').attr('checked', $(this).hasClass('select_all')).trigger('change');
        });
      });
    }

  }));

})(jQuery);
<commit_msg>[Diem] - disable request logging on ajax markdown preview requests<commit_after>(function($)
{

  $.widget('ui.dmAdminForm', $.extend({}, $.dm.coreForm, {

    _init: function()
    {
      this.$ = $("#dm_admin_content");

      this.focusFirstInput();
      this.markdown();
      this.selectObject();
      this.checkBoxList();
      this.linkDroppable();
      this.hotKeys();
    },

    focusFirstInput: function()
    {
      if ($firstInput = $('div.sf_admin_form_row_inner input:first', this.$))
      {
        $firstInput.focus();
      }
    },

    hotKeys: function()
    {
      if ($save = $('li.sf_admin_action_save:first input', this.$).orNot())
      {
        this.$.bindKey('Ctrl+s', function()
        {
          $save.trigger('click');
          return false;
        });
      }
    },

    markdown: function()
    {
      var form = this;

      $('textarea.dm_markdown', form.element).each(function()
      {
        var $editor = $(this);
        var $preview = $('#dm_markdown_preview_'+$editor.metadata().code);
        var value = $editor.val();

				$editor.dmMarkdown();

        setInterval(function()
        {
          if ($editor.val() != value)
          {
            value = $editor.val();
            $.ajax({
              type: "POST",
              mode: "abort",
              url: $.dm.ctrl.getHref('+/dmCore/markdown')+"?dm_nolog=1",
              data: {
                text: value
              },
              success: function(html)
              {
                $preview.html(html);
              }
            });
          }
        }, 500);

        $preview.height($editor.closest('div.markItUpContainer').innerHeight() - 13);

        $editor.resizable({
          alsoResize: $preview,
          handles: 's'
        });
      });
    },

    selectObject: function()
    {
      // Switch to another object
      $("#dm_select_object").bind('change', function()
      {
        location.href = $(this).metadata().href.replace('_ID_', $(this).val());
      });
    },

    checkBoxList: function()
    {
      var $list = $('ul.checkbox_list', this.element);

      $('> li > label, > li > input', $list).click(function(e)
      {
        e.stopPropagation();
      });

      $('> li', $list).click(function()
      {
        var $input = $('> input', $(this));
        $input.attr('checked', !$input.attr('checked')).trigger('change');
      });

      $('> li > input', $list).change(function()
      {
        $(this).parent()[($(this).attr('checked') ? 'add' : 'remove') + 'Class']('active');
        return true;
      }).trigger('change');

      $('div.control span.select_all, div.control span.unselect_all', $list.parent().parent()).each(function()
      {
        $(this).click(function()
        {
          $(this).closest('div.sf_admin_form_row_inner').find('input:checkbox').attr('checked', $(this).hasClass('select_all')).trigger('change');
        });
      });
    }

  }));

})(jQuery);
<|endoftext|>


<commit_before>var deviceScripts = {
	manualRouter: {
		onPacketReceived: function(device, packet) {
			for (var i = 0; i < device.rules.length; i++) {
				if (device.rules[i].dstip == packet.network.dstip) {
					sendPacket(device.id, device.rules[i].portNum, packet);
				}
			}
		}
	},

	hub: {
		onPacketReceived: function (device, packet) {
			//.
		}
	},

    ping: {
		onPacketReceived: function(device, packet) {
                    if(packet.hasOwnProperty("proto")){
                        if(packet.transport.proto == "ICMP"){
                            var new_packet = {
                                network: {
                                    srcip: packet.network.dstip,
                                    dstip: packet.network.srcip
                                },
                                transport: {
                                    proto: "ICMP"
                                }
                            };
                            sendPacket(device.id, 0, new_packet);
                        }
                    }
		}
    },
    modem: {
        onPacketReceived: function(device, packet) {
            if(packet.network.dstip == device.id){//look up ip in NAT table
                var new_packet = {};
                for (var i = 0; i < packetFields.length; i++) {
                    console.log("copying layer " + packetFields[i].layer);
                    if(packet.hasOwnProperty(packetFields[i].layer)){
                        new_packet[packetFields[i].layer] = {};
                        for (var j = 0; j < packetFields[i].fields.length; j++) {
                            console.log("copying field " + packetFields[i].fields[j]);
                            if(packet.hasOwnProperty(packetFields[i].fields[j])){
                                console.log("FOUND field!");
                                new_packet[packetFields[i].layer][ packetFields[i].fields[j] ] = packet[packetFields[i].layer][ packetFields[i].fields[j] ];
                                console.log(new_packet[packetFields[i].layer]);
                            }
                        }
                    }
                }
                new_packet.network.dstip = getPortRecipient(device.id, 0);
                sendPacket(device.id, 0, new_packet);
            } else { //replace src ip with device IP and save in NAT table
                var new_packet = {};
                console.log(packet);
                for (var i = 0; i < packetFields.length; i++) {
                    console.log("copying layer " + packetFields[i].layer);
                    if(packet.hasOwnProperty(packetFields[i].layer)){
                        new_packet[packetFields[i].layer] = {};
                        for (var j = 0; j < packetFields[i].fields.length; j++) {
                            console.log("copying field " + packetFields[i].fields[j]);
                            if(packet.hasOwnProperty(packetFields[i].fields[j])){
                                new_packet[packetFields[i].layer][ packetFields[i].fields[j] ] = packet[packetFields[i].layer][ packetFields[i].fields[j] ];
                            }
                        }
                    }
                }
                new_packet.network.srcip = device.id;
                sendPacket(device.id, 1, new_packet);
            }

        }
    }

}

<commit_msg>update to modem script<commit_after>var deviceScripts = {
	manualRouter: {
		onPacketReceived: function(device, packet) {
			for (var i = 0; i < device.rules.length; i++) {
				if (device.rules[i].dstip == packet.network.dstip) {
					sendPacket(device.id, device.rules[i].portNum, packet);
				}
			}
		}
	},

	hub: {
		onPacketReceived: function (device, packet) {
			//.
		}
	},

    ping: {
		onPacketReceived: function(device, packet) {
                    if(packet.hasOwnProperty("proto")){
                        if(packet.transport.proto == "ICMP"){
                            var new_packet = {
                                network: {
                                    srcip: packet.network.dstip,
                                    dstip: packet.network.srcip
                                },
                                transport: {
                                    proto: "ICMP"
                                }
                            };
                            sendPacket(device.id, 0, new_packet);
                        }
                    }
		}
    },
    modem: {
        onPacketReceived: function(device, packet) {
            if(packet.network.dstip == device.id){//look up ip in NAT table
                var new_packet = {};
                for (var i = 0; i < packetFields.length; i++) {
                    console.log("copying layer " + packetFields[i].layer);
                    if(packet.hasOwnProperty(packetFields[i].layer)){
                        new_packet[packetFields[i].layer] = {};
                        for (var j = 0; j < packetFields[i].fields.length; j++) {
                            console.log("copying field " + packetFields[i].fields[j]);
                            if(packet.hasOwnProperty(packetFields[i].fields[j])){
                                console.log("FOUND field!");
                                new_packet[packetFields[i].layer][ packetFields[i].fields[j] ] = packet[packetFields[i].layer][ packetFields[i].fields[j] ];
                                console.log(new_packet[packetFields[i].layer]);
                            }
                        }
                    }
                }
                new_packet.network.dstip = getPortRecipient(device.id, 0);
                sendPacket(device.id, 0, new_packet);
            } else { //replace src ip with device IP and save in NAT table
                var new_packet = {};
                console.log(packet);
                for (var i = 0; i < packetFields.length; i++) {
                    console.log("copying layer " + packetFields[i].layer);
                    if(packet.hasOwnProperty(packetFields[i].layer)){
                        new_packet[packetFields[i].layer] = {};
                        for (var j = 0; j < packetFields[i].fields.length; j++) {
                            console.log("copying field " + packetFields[i].fields[j]);
                            if(packet.hasOwnProperty(packetFields[i].fields[j])){
                                console.log("FOUND field!");
                                new_packet[packetFields[i].layer][ packetFields[i].fields[j] ] = packet[packetFields[i].layer][ packetFields[i].fields[j] ];
                            }
                        }
                    }
                }
                new_packet.network.srcip = device.id;
                sendPacket(device.id, 1, new_packet);
            }

        }
    }

}

<|endoftext|>


<commit_before>/*
 * grunt-i18n-gspreadsheet
 * https://github.com/theoephraim/grunt-i18n-gspreadsheet
 *
 * Copyright (c) 2013 Theo Ephraim
 * Licensed under the MIT license.
 */

'use strict';

var GoogleSpreadsheet = require("google-spreadsheet");
var Step = require('step');
var _ = require('underscore');
var fs = require('fs');
var mkdirp = require('mkdirp');
var path = require('path');

module.exports = function(grunt) {

  function sortObjectByKeys(map) {
    var keys = _.sortBy(_.keys(map), function(a) { return a.toLowerCase(); });
    var newmap = {};
    _.each(keys, function(k) {
        newmap[k] = map[k];
    });
    return newmap;
  }

  grunt.registerMultiTask('i18n_gspreadsheet', 'Grunt plugin to generate i18n locale files from a google spreadsheet', function() {

    // default options
    var options = this.options({
      output_dir: 'locales',
      default_locale: 'en',
      write_default_translations: false,
      sort_keys: true
    });

    // make this task async
    var done = this.async();

    var locales = [];
    var translations = {};
    var gsheet = new GoogleSpreadsheet( options.document_key );
    var output_dir = path.resolve( process.cwd() + '/' + options.output_dir );

    Step(
      function setAuth(){
        if ( options.google_account && options.google_password ){
          gsheet.setAuth( options.google_account, options.google_password, this );
        } else {
          this();
        }
      },
      function fetchSheetInfo(err){
        if ( err ){
          grunt.log.error('Invalid google credentials for "' + options.google_account + '"');
          return done( false );
        }

        gsheet.getRows( 1, this );
      },
      function buildTranslationJson(err, rows){
        if ( err ){
          grunt.log.error( err );
          return done( false );
        }
        if ( rows.length === 0 ){
          grunt.log.error('ERROR: no translations found in sheet');
          return done( false );
        }

        // First determine which locales are supported
        var gsheet_keys = _(rows[0]).keys();
        _(gsheet_keys).each(function(locale){
          if ( locale != 'id' && locale.length == 2 ){
            locales.push( locale );
            translations[locale] = {};
          }
        });

        grunt.log.writeln( 'Found '+ rows.length.toString().cyan +' translations in ' + locales.length.toString().cyan + ' languages' );

        // read all translations into an object with the correct keys
        _(rows).each(function(row){
          // if an key override column is set, check that first, then use the default locale

          var use_key_override = options.key_column && row[options.key_column];
          var translation_key = use_key_override ? row[options.key_column] : row[options.default_locale];
          if ( !translation_key ) return;
          _(locales).each(function(locale){

            if ( locale == options.default_locale ){
              if ( use_key_override || options.write_default_translations ){
                translations[locale][translation_key] = row[locale];
              }
            } else if ( row[locale] ) {
              translations[locale][translation_key] = row[locale];
            }
          });
        });
        this();
      },
      function ensureDirectoryExists(err){
        if ( err ) {
          grunt.log.error( err );
          return done( false );
        }

        mkdirp( output_dir, this );
      },
      function writeLocaleFiles(err){
        if ( err ) {
          grunt.log.error( err );
          return done( false );
        }

        var step = this;
        _(locales).each(function(locale){
          var file_path = output_dir + '/' + locale + '.js';
          if ( options.sort_keys ) translations[locale] = sortObjectByKeys( translations[locale] );
          var translation_json = JSON.stringify( translations[locale], null, ' ' );
          var write_options = {
            flags: 'w+'
          };
          fs.writeFile( file_path, translation_json, write_options, step.parallel() );
        });
      },
      function finish(err){
        if ( err ){
          grunt.log.error( err );
          return done( false );
        }

        grunt.log.writeln( 'Wrote translation files: ' + locales.toString().magenta );
        done();
      }
    );
  });

};<commit_msg>Added option to use the default locale for missing translations<commit_after>/*
 * grunt-i18n-gspreadsheet
 * https://github.com/theoephraim/grunt-i18n-gspreadsheet
 *
 * Copyright (c) 2013 Theo Ephraim
 * Licensed under the MIT license.
 */

'use strict';

var GoogleSpreadsheet = require("google-spreadsheet");
var Step = require('step');
var _ = require('underscore');
var fs = require('fs');
var mkdirp = require('mkdirp');
var path = require('path');

module.exports = function(grunt) {

  function sortObjectByKeys(map) {
    var keys = _.sortBy(_.keys(map), function(a) { return a.toLowerCase(); });
    var newmap = {};
    _.each(keys, function(k) {
        newmap[k] = map[k];
    });
    return newmap;
  }

  grunt.registerMultiTask('i18n_gspreadsheet', 'Grunt plugin to generate i18n locale files from a google spreadsheet', function() {

    // default options
    var options = this.options({
      output_dir: 'locales',
      default_locale: 'en',
      use_default_on_missing: false,
      write_default_translations: false,
      sort_keys: true
    });

    // make this task async
    var done = this.async();

    var locales = [];
    var translations = {};
    var gsheet = new GoogleSpreadsheet( options.document_key );
    var output_dir = path.resolve( process.cwd() + '/' + options.output_dir );

    Step(
      function setAuth(){
        if ( options.google_account && options.google_password ){
          gsheet.setAuth( options.google_account, options.google_password, this );
        } else {
          this();
        }
      },
      function fetchSheetInfo(err){
        if ( err ){
          grunt.log.error('Invalid google credentials for "' + options.google_account + '"');
          return done( false );
        }

        gsheet.getRows( 1, this );
      },
      function buildTranslationJson(err, rows){
        if ( err ){
          grunt.log.error( err );
          return done( false );
        }
        if ( rows.length === 0 ){
          grunt.log.error('ERROR: no translations found in sheet');
          return done( false );
        }

        // First determine which locales are supported
        var gsheet_keys = _(rows[0]).keys();
        _(gsheet_keys).each(function(locale){
          if ( locale != 'id' && locale.length == 2 ){
            locales.push( locale );
            translations[locale] = {};
          }
        });

        grunt.log.writeln( 'Found '+ rows.length.toString().cyan +' translations in ' + locales.length.toString().cyan + ' languages' );

        // read all translations into an object with the correct keys
        _(rows).each(function(row){
          // if an key override column is set, check that first, then use the default locale

          var use_key_override = options.key_column && row[options.key_column];
          var translation_key = use_key_override ? row[options.key_column] : row[options.default_locale];
          if ( !translation_key ) return;
          _(locales).each(function(locale){

            if ( locale == options.default_locale ){
              if ( use_key_override || options.write_default_translations ){
                translations[locale][translation_key] = row[locale];
              }
            } else if ( row[locale] ) {
              translations[locale][translation_key] = row[locale];
            } else if ( options.use_default_on_missing ){
              translations[locale][translation_key] = row[options.default_locale];
            }
          });
        });
        this();
      },
      function ensureDirectoryExists(err){
        if ( err ) {
          grunt.log.error( err );
          return done( false );
        }

        mkdirp( output_dir, this );
      },
      function writeLocaleFiles(err){
        if ( err ) {
          grunt.log.error( err );
          return done( false );
        }

        var step = this;
        _(locales).each(function(locale){
          var file_path = output_dir + '/' + locale + '.js';
          if ( options.sort_keys ) translations[locale] = sortObjectByKeys( translations[locale] );
          var translation_json = JSON.stringify( translations[locale], null, ' ' );
          var write_options = {
            flags: 'w+'
          };
          fs.writeFile( file_path, translation_json, write_options, step.parallel() );
        });
      },
      function finish(err){
        if ( err ){
          grunt.log.error( err );
          return done( false );
        }

        grunt.log.writeln( 'Wrote translation files: ' + locales.toString().magenta );
        done();
      }
    );
  });

};<|endoftext|>


<commit_before>'use strict';

var jasmine = require('jasmine-node');
var _       = require('underscore');

module.exports = function (grunt) {
    var regExpSpec = function(options) {
      var match      = options.match;
      var nameMatch  = options.matchall ? "" : options.specNameMatcher + "\\.";
      var extensions = options.extensions;
      return new RegExp(match + nameMatch + "(" + extensions + ")$", 'i');
    };
    var onComplete = function(options) {
      return function(runner, log) {
        if (options.forceExit) {
          var count = runner.results().failedCount;
          process.exit(count === 0 ? 0 : 1);
        }
        jasmine.getGlobal().jasmine.currentEnv_ = undefined;
        options.done();
      };
    };
    grunt.registerMultiTask("jasmine_node", "Runs jasmine-node.", function() {
      var self = this;

      var options = _.defaults(this.data, {
        match:           ".",
        matchall:        false,
        specNameMatcher: 'spec',
        extensions:      'js',
        specFolders:     [],
        isVerbose:       true,
        showColors:      true,
        teamcity:        false,
        useRequireJs:    false,
        coffee:          false,
        projectRoot:     ".",
        done:            self.async(),
        junitreport:     {
          report: false,
          savePath : "./reports/",
          useDotNotation: true,
          consolidate: true
        }
      });

      if(options.jUnit) {
        options.junitreport = options.jUnit;
      }

      if(options.useCoffee) {
        options.coffee = options.useCoffee;
      }

      if(options.specFolders.length <= 1) {
        options.specFolders.push(options.projectRoot);
      }

      options.regExpSpec = regExpSpec(options);
      options.onComplete = onComplete(options);

      jasmine.executeSpecsInFolder(options);
  });
};
<commit_msg>In which it is permitted for manual assignment of `regExpSpec` to override `match`/`matchall`/`specnameMatcher`/`extensions`.<commit_after>'use strict';

var jasmine = require('jasmine-node');
var _       = require('underscore');

module.exports = function (grunt) {
    var regExpSpec = function(options) {
      var match      = options.match;
      var nameMatch  = options.matchall ? "" : options.specNameMatcher + "\\.";
      var extensions = options.extensions;
      return new RegExp(match + nameMatch + "(" + extensions + ")$", 'i');
    };
    var onComplete = function(options) {
      return function(runner, log) {
        if (options.forceExit) {
          var count = runner.results().failedCount;
          process.exit(count === 0 ? 0 : 1);
        }
        jasmine.getGlobal().jasmine.currentEnv_ = undefined;
        options.done();
      };
    };
    grunt.registerMultiTask("jasmine_node", "Runs jasmine-node.", function() {
      var self = this;

      var options = _.defaults(this.data, {
        match:           ".",
        matchall:        false,
        specNameMatcher: 'spec',
        extensions:      'js',
        specFolders:     [],
        isVerbose:       true,
        showColors:      true,
        teamcity:        false,
        useRequireJs:    false,
        coffee:          false,
        projectRoot:     ".",
        done:            self.async(),
        junitreport:     {
          report: false,
          savePath : "./reports/",
          useDotNotation: true,
          consolidate: true
        }
      });

      if(options.jUnit) {
        options.junitreport = options.jUnit;
      }

      if(options.useCoffee) {
        options.coffee = options.useCoffee;
      }

      if(options.specFolders.length <= 1) {
        options.specFolders.push(options.projectRoot);
      }

      if(_.isUndefined(options.regExpSpec)) {
        options.regExpSpec = regExpSpec(options);
      }
      options.onComplete = onComplete(options);

      jasmine.executeSpecsInFolder(options);
  });
};
<|endoftext|>


<commit_before>/* eslint-env node */

module.exports = 'v2.1';
<commit_msg>version bump.<commit_after>/* eslint-env node */

module.exports = 'v3.0';
<|endoftext|>


<commit_before>$(document).foundation({
   joyride: {
      cookieMonster: true,
      cookieName: 'JoyRide',
      cookieDomain: false,
      cookie_expires: 5
   }
 }).foundation('joyride', 'start');

function Server_provider(id, name, image) {
    this.init();
}

Server_provider.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Distribution(id, name, image) {
    this.init();
}

Distribution.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Aplication(id, name, image) {
    this.init();
}

Aplication.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Service(id, name, image) {
    this.init();
}

Service.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

Foundation.utils.S(document).ready(function(){

  var configurationJSON = ''+
    '{ "server_provider" : [' +
      '{ "slug":"amazon_web_services", "name":"Amazon Web Services" },' +
      '{ "slug":"digital_ocean", "name":"Digital Ocean" },' +
      '{ "slug":"google_cloud", "name":"Google Cloud" },' +
      '{ "slug":"none", "name":"None" }' +
      ' ]' +
    '},'+
    '{ "distribution" : [' +
      '{ "slug":"ubuntu", "name":"Ubuntu" },' +
      '{ "slug":"freebsd", "name":"FreeBSD" },' +
      '{ "slug":"fedora", "name":"Fedora" },' +
      '{ "slug":"debian", "name":"Debian" },' +
      '{ "slug":"coreos", "name":"CoreOS" },' +
      '{ "slug":"centos", "name":"CentOS" }' +
      ' ]' +
    '},'+
    '{ "service" : [' +
      '{ "slug":"amazon_web_services", "name":"Amazon Web Services" },' +
      '{ "slug":"digital_ocean", "name":"Digital Ocean" },' +
      '{ "slug":"google_cloud", "name":"Google Cloud" },' +
      '{ "slug":"none", "name":"None" }' +
      ' ]' +
    '}';

  var $list_automation_software = ["Puppet","Ansible","Chef"];
  var $list_server_provider = ["Amazon Web Services","Digital Ocean","Google Cloud","None"];
  var $list_distribution = ["Ubuntu",  "FreeBSD",  "Fedora",  "Debian",  "CoreOS", "CentOS"];
  var $list_aplication = ["freeBSDAMP",   "LAMP",   "LEMP",   "MEAN",   "Joomla",   "Drone",   "Ghost",   "Rails",  "Drupal",   "MongoDB",   "Node",   "Cassandra",   "Stack",   "Django",   "Docker",   "Magento",   "GitLab",   "MumbleServer",   "MediaWiki",   "WordPress", "OwnCloud",   "Dokku",   "PHPMyAdmin",   "Redmine"];
  var $list_services = ["Apache",   "Nginx",  "Unicorn",   "Sinatra",   "GitHub", "Bitbucket",   "Jenkins",   "Travis",   "Wercker",   "Heroku",   "Ruby",   "Haskell",   "Emacs",   "VIM"];

  var $project_name = "";
  var $active_automation_software = 0;
  var $active_server_provider = 0;
  var $active_distribution = 0;
  var $active_aplication = 7;
  var $active_services = [1, 4];

  Foundation.utils.S("#label-automation-software").text($list_automation_software[$active_automation_software]);
  Foundation.utils.S("#label-server-provider").text($list_server_provider[$active_server_provider]);
  Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]);
  Foundation.utils.S("#label-aplications").text($list_aplication[$active_aplication]);
  Foundation.utils.S("#label-services").text("");
  $active_services.forEach(function(id){
      Foundation.utils.S("#label-services").append($list_services[id]+"
");
  });
  if($active_services.length==0)
    Foundation.utils.S("#label-services").append("none");

  Foundation.utils.S(document.body).on('click', '.pricing-table', function(){
    selectActive(Foundation.utils.S(this));
  });

  Foundation.utils.S(document.body).on('change', '.pricing-table[data-type="distribution"] li select', function(){
    Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]+" "+Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"] select').val());
  });

  var selectActive = function(value){
    if( value.data('type') == "automation-software" ){
      if( value.data('id') != $active_automation_software ){
        Foundation.utils.S('.pricing-table[data-type="automation-software"][data-id="'+ $active_automation_software +'"]').removeClass('active');
        changeActive(value);
        $active_automation_software = value.data('id');
      }
      Foundation.utils.S("#label-automation-software").text($list_automation_software[$active_automation_software]);
    }else if( value.data('type') == "server-provider" ){
      if( value.data('id') != $active_server_provider ){
        Foundation.utils.S('.pricing-table[data-type="server-provider"][data-id="'+ $active_server_provider +'"]').removeClass('active');
        changeActive(value);
        $active_server_provider = value.data('id');
      }
      Foundation.utils.S("#label-server-provider").text($list_server_provider[$active_server_provider]);
    }else if( value.data('type') == "distribution" ){
      if( value.data('id') != $active_distribution ){
        Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"]').removeClass('active');
        changeActive(value);
        $active_distribution = value.data('id');
      }
      Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]+" "+Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"] select').val());
    }else if( value.data('type') == "aplications" ){
      if( value.data('id') != $active_aplication ){
        Foundation.utils.S('.pricing-table[data-type="aplications"][data-id="'+ $active_aplication +'"]').removeClass('active');
        changeActive(value);
        $active_aplication = value.data('id');
      }
      Foundation.utils.S("#label-aplications").text($list_aplication[$active_aplication]);
    }else if( value.data('type') == "services" ){
      //create new oAuth popup window and monitor it
      Foundation.utils.S.oauthpopup({
          path: 'http://localhost:7000/login',
          callback: function(callback)
          {
            $.get('http://localhost:7000/user_info', function(data){
              Foundation.utils.S('#user_info').html(JSON.stringify(data));
            });
              console.log(callback);
              //do callback stuff
          }
      });
      changeActive(value);
      if( $active_services.indexOf(value.data('id')) != -1 ){
        $active_services.splice($active_services.indexOf(value.data('id')),1);
      }else{
        $active_services.push(value.data('id'));
      }
      Foundation.utils.S("#label-services").text("");
      $active_services.forEach(function(id){
          Foundation.utils.S("#label-services").append($list_services[id]+"
");
      });
      if($active_services.length==0)
        Foundation.utils.S("#label-services").append("none");
    }
    validateService();
  }

  var changeActive = function(value){
    if( !value.hasClass("active") )
      value.addClass("active");
    else
      value.removeClass("active");
  }

  var validateService = function(){
    if( $active_services.length > 0 && $project_name != "" ){
      Foundation.utils.S("#btn-create_service").removeClass("disabled");
      Foundation.utils.S("#btn-create_service-mini").removeClass("disabled");
    }else{
      Foundation.utils.S("#btn-create_service").addClass("disabled");
      Foundation.utils.S("#btn-create_service-mini").addClass("disabled");
    }
  }

  Foundation.utils.S(document.body).on('keyup', '#input-project_name', function(e){
    $project_name = Foundation.utils.S(this).val();
    Foundation.utils.S("#label-project-name").text(Foundation.utils.S(this).val());
    if(Foundation.utils.S(this).val().toString()=="")
      Foundation.utils.S("#label-project-name").text("none");
    validateService();
  });

  //Authorization popup window code
  Foundation.utils.S.oauthpopup = function(options)
  {
    options.windowName = options.windowName ||  'ConnectWithOAuth'; // should not include space for IE
    options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400';
    options.callback = options.callback || function(){ window.location.reload(); };
    var that = this;
    that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions);
    that._oauthInterval = window.setInterval(function(){
      console.log(that._oauthWindow.location.href);
    }, 1000);
  };

});
<commit_msg>get the body content from github<commit_after>$(document).foundation({
   joyride: {
      cookieMonster: true,
      cookieName: 'JoyRide',
      cookieDomain: false,
      cookie_expires: 5
   }
 }).foundation('joyride', 'start');

function Server_provider(id, name, image) {
    this.init();
}

Server_provider.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Distribution(id, name, image) {
    this.init();
}

Distribution.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Aplication(id, name, image) {
    this.init();
}

Aplication.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

function Service(id, name, image) {
    this.init();
}

Service.prototype.init = function(id, name, value) {
    this.id = id;
    this.name = name;
    this.value = value;
};

Foundation.utils.S(document).ready(function(){

  var configurationJSON = ''+
    '{ "server_provider" : [' +
      '{ "slug":"amazon_web_services", "name":"Amazon Web Services" },' +
      '{ "slug":"digital_ocean", "name":"Digital Ocean" },' +
      '{ "slug":"google_cloud", "name":"Google Cloud" },' +
      '{ "slug":"none", "name":"None" }' +
      ' ]' +
    '},'+
    '{ "distribution" : [' +
      '{ "slug":"ubuntu", "name":"Ubuntu" },' +
      '{ "slug":"freebsd", "name":"FreeBSD" },' +
      '{ "slug":"fedora", "name":"Fedora" },' +
      '{ "slug":"debian", "name":"Debian" },' +
      '{ "slug":"coreos", "name":"CoreOS" },' +
      '{ "slug":"centos", "name":"CentOS" }' +
      ' ]' +
    '},'+
    '{ "service" : [' +
      '{ "slug":"amazon_web_services", "name":"Amazon Web Services" },' +
      '{ "slug":"digital_ocean", "name":"Digital Ocean" },' +
      '{ "slug":"google_cloud", "name":"Google Cloud" },' +
      '{ "slug":"none", "name":"None" }' +
      ' ]' +
    '}';

  var $list_automation_software = ["Puppet","Ansible","Chef"];
  var $list_server_provider = ["Amazon Web Services","Digital Ocean","Google Cloud","None"];
  var $list_distribution = ["Ubuntu",  "FreeBSD",  "Fedora",  "Debian",  "CoreOS", "CentOS"];
  var $list_aplication = ["freeBSDAMP",   "LAMP",   "LEMP",   "MEAN",   "Joomla",   "Drone",   "Ghost",   "Rails",  "Drupal",   "MongoDB",   "Node",   "Cassandra",   "Stack",   "Django",   "Docker",   "Magento",   "GitLab",   "MumbleServer",   "MediaWiki",   "WordPress", "OwnCloud",   "Dokku",   "PHPMyAdmin",   "Redmine"];
  var $list_services = ["Apache",   "Nginx",  "Unicorn",   "Sinatra",   "GitHub", "Bitbucket",   "Jenkins",   "Travis",   "Wercker",   "Heroku",   "Ruby",   "Haskell",   "Emacs",   "VIM"];

  var $project_name = "";
  var $active_automation_software = 0;
  var $active_server_provider = 0;
  var $active_distribution = 0;
  var $active_aplication = 7;
  var $active_services = [1, 4];

  Foundation.utils.S("#label-automation-software").text($list_automation_software[$active_automation_software]);
  Foundation.utils.S("#label-server-provider").text($list_server_provider[$active_server_provider]);
  Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]);
  Foundation.utils.S("#label-aplications").text($list_aplication[$active_aplication]);
  Foundation.utils.S("#label-services").text("");
  $active_services.forEach(function(id){
      Foundation.utils.S("#label-services").append($list_services[id]+"
");
  });
  if($active_services.length==0)
    Foundation.utils.S("#label-services").append("none");

  Foundation.utils.S(document.body).on('click', '.pricing-table', function(){
    selectActive(Foundation.utils.S(this));
  });

  Foundation.utils.S(document.body).on('change', '.pricing-table[data-type="distribution"] li select', function(){
    Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]+" "+Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"] select').val());
  });

  var selectActive = function(value){
    if( value.data('type') == "automation-software" ){
      if( value.data('id') != $active_automation_software ){
        Foundation.utils.S('.pricing-table[data-type="automation-software"][data-id="'+ $active_automation_software +'"]').removeClass('active');
        changeActive(value);
        $active_automation_software = value.data('id');
      }
      Foundation.utils.S("#label-automation-software").text($list_automation_software[$active_automation_software]);
    }else if( value.data('type') == "server-provider" ){
      if( value.data('id') != $active_server_provider ){
        Foundation.utils.S('.pricing-table[data-type="server-provider"][data-id="'+ $active_server_provider +'"]').removeClass('active');
        changeActive(value);
        $active_server_provider = value.data('id');
      }
      Foundation.utils.S("#label-server-provider").text($list_server_provider[$active_server_provider]);
    }else if( value.data('type') == "distribution" ){
      if( value.data('id') != $active_distribution ){
        Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"]').removeClass('active');
        changeActive(value);
        $active_distribution = value.data('id');
      }
      Foundation.utils.S("#label-distribution").text($list_distribution[$active_distribution]+" "+Foundation.utils.S('.pricing-table[data-type="distribution"][data-id="'+ $active_distribution +'"] select').val());
    }else if( value.data('type') == "aplications" ){
      if( value.data('id') != $active_aplication ){
        Foundation.utils.S('.pricing-table[data-type="aplications"][data-id="'+ $active_aplication +'"]').removeClass('active');
        changeActive(value);
        $active_aplication = value.data('id');
      }
      Foundation.utils.S("#label-aplications").text($list_aplication[$active_aplication]);
    }else if( value.data('type') == "services" ){
      //create new oAuth popup window and monitor it
      Foundation.utils.S.oauthpopup({
          path: '/github/login',
          callback: function(data)
          {
              console.log(data.document.body.getElementsByTagName("pre")[0].innerHTML);
              //do callback stuff
          }
      });
      changeActive(value);
      if( $active_services.indexOf(value.data('id')) != -1 ){
        $active_services.splice($active_services.indexOf(value.data('id')),1);
      }else{
        $active_services.push(value.data('id'));
      }
      Foundation.utils.S("#label-services").text("");
      $active_services.forEach(function(id){
          Foundation.utils.S("#label-services").append($list_services[id]+"
");
      });
      if($active_services.length==0)
        Foundation.utils.S("#label-services").append("none");
    }
    validateService();
  }

  var changeActive = function(value){
    if( !value.hasClass("active") )
      value.addClass("active");
    else
      value.removeClass("active");
  }

  var validateService = function(){
    if( $active_services.length > 0 && $project_name != "" ){
      Foundation.utils.S("#btn-create_service").removeClass("disabled");
      Foundation.utils.S("#btn-create_service-mini").removeClass("disabled");
    }else{
      Foundation.utils.S("#btn-create_service").addClass("disabled");
      Foundation.utils.S("#btn-create_service-mini").addClass("disabled");
    }
  }

  Foundation.utils.S(document.body).on('keyup', '#input-project_name', function(e){
    $project_name = Foundation.utils.S(this).val();
    Foundation.utils.S("#label-project-name").text(Foundation.utils.S(this).val());
    if(Foundation.utils.S(this).val().toString()=="")
      Foundation.utils.S("#label-project-name").text("none");
    validateService();
  });

  //Authorization popup window code
  Foundation.utils.S.oauthpopup = function(options)
  {
    options.windowName = options.windowName ||  'ConnectWithOAuth'; // should not include space for IE
    options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400';
    options.callback = options.callback || function(){ window.location.reload(); };
    var that = this;
    that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions);
    that._oauthInterval = window.setInterval(function(){
      if(that._oauthWindow.location.href.includes("github/github_oauth_cb"))
         options.callback(that._oauthWindow);
         that._oauthWindow.close();
         clearInterval(that._oauthInterval);
    }, 1000);
  };

});<|endoftext|>


<commit_before>/*
 * grunt-accessibility
 * https://github.com/yargalot/grunt-accessibility
 *
 * Copyright (c) 2013 Steven John Miller
 * Licensed under the MIT license.
 */

var path      = require('path');
var fs        = require('fs');
var _         = require('underscore');
var Promise   = require('bluebird');
var asset     = path.join.bind(null, __dirname, '..');

var _that;

function Accessibility(task) {

  this.task     = task;
  this.options  = task.options(Accessibility.Defaults);
  this.basepath = process.cwd();
  this.grunt    = this.task.grunt;
  this.phantom  = require('grunt-lib-phantomjs').init(this.grunt);

  this.log      = '';
  this.logJSON  = {};

  _that = this;

}

Accessibility.taskName         = 'accessibility';
Accessibility.taskDescription  = 'Use HTML codesniffer to grade accessibility';
Accessibility.Defaults         = {
  phantomScript: asset('../phantomjs/bridge.js'),
  urls: [],
  domElement: true,
  verbose: true
};

/**
* The Message Terminal, choo choo
*
*
*/

Accessibility.prototype.terminalLog = function(msg, trace) {
  var ignore = false;
  var msgSplit = msg.split('|');

  var grunt   = _that.grunt;
  var options = _that.options;

  // If ignore get the hell out
  _.each(options.ignore, function (value, key) {
    if (value === msgSplit[1]) {
      ignore = true;
    }
  });

  if (ignore) {
    return;
  }

  // Start messaging
  if (msgSplit[0] === 'ERROR' && !options.force) {
    grunt.fail.warn(msgSplit[1] + ': ' + msgSplit[2]);
  }

  if (msgSplit[0] === 'ERROR' || msgSplit[0] === 'NOTICE' || msgSplit[0] === 'WARNING') {

    if (options.outputFormat === 'json') {

      _that.logJSON[options.file] = _that.logJSON[options.file] || [];

      var currentLog = _that.logJSON[options.file];

      currentLog.push({
        type: msgSplit[0],
        msg: msgSplit[2],
        sc: msgSplit[1].split('.')[3],
        technique: msgSplit[1].split('.')[4]
      });

      if (options.domElement) {
        currentLog[currentLog.length - 1].element = {
          nodeName: msgSplit[3],
          className: msgSplit[4],
          id: msgSplit[5]
        };
      }

    } else {

      if (!options.domElement) {
        msg = msgSplit.slice(0, 3).join('|');
      }

      _that.log += msg + '\r\n';

    }

    if (options.verbose) {
      var heading = null;

      if (msgSplit[0] === 'ERROR') {
        heading = msgSplit[0].red;
      } else if (msgSplit[0] === 'NOTICE') {
        heading = msgSplit[0].blue;
      } else if (msgSplit[0] === 'WARNING') {
        heading = msgSplit[0].yellow;
      }

      heading += ' ' + msgSplit[1];

      grunt.log.writeln(heading);
      grunt.log.writeln(msgSplit[2]);
    }

  } else {
    if (options.verbose) {
      grunt.log.writeln(msg);
    }
  }
};

/**
* Write the file
*
*
*/

Accessibility.prototype.writeFile = function(msg, trace) {

  var grunt   = _that.grunt;
  var options = _that.options;

  grunt.log.writeln('Report Finished'.cyan);

  console.log(_that.options);

  if (options.outputFormat === 'json') {
    grunt.file.write(options.filedest + '.json', JSON.stringify(_that.logJSON[options.file]));
  } else {
    grunt.file.write(options.filedest , _that.log);
  }

  grunt.log.writeln('File "' + options.filedest +
    (options.outputFormat ? '.' + options.outputFormat : '') + '" created.');

  _that.log = '';
  _that.logJSON = {};

  _that.phantom.halt();

};

/**
* Phantom General Errors
*
*
*/

Accessibility.prototype.failLoad = function(url) {
  _that.phantom.halt();
  _that.grunt.warn('PhantomJS unable to load URL:' + url);
};

Accessibility.prototype.failTime = function() {
  _that.phantom.halt();
  _that.grunt.warn('PhantomJS timed out.');
};

Accessibility.prototype.failError = function(message, trace) {
  _that.grunt.log.writeln('error: ' + message);
};

/**
* Run task
*
* @param {Object} grunt - grunt object
*
* @returns {Object} a promise that resolves with final html
*
*/

Accessibility.prototype.run = function() {

  var files   = Promise.resolve(this.task.files);
  var phantom = this.phantom;

  this.grunt.log.writeln('Running accessibility tests'.cyan);

  // Built-in error handlers.
  phantom.on('fail.load',     this.failLoad);
  phantom.on('fail.timeout',  this.failTime);
  phantom.on('error.onError', this.failError);

  // The main events
  phantom.on('console',       this.terminalLog);
  phantom.on('wcaglint.done', this.writeFile);

  return files
    .bind(this)
    .map(function(fileMap) {

      var srcFile  = fileMap.src[0];
      var destFile = fileMap.dest;

      this.options.filedest = destFile;

      return phantom.spawn(srcFile, {
        // Additional PhantomJS options.
        options: this.options,
        // Complete the task when done.
        done: function (err) {
          return (err || true);
        }
      });

    })
    .catch(function(err){ this.grunt.log.error(err); });

};

Accessibility.registerWithGrunt = function(grunt) {

  // Please see the grunt documentation for more information regarding task and
  // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md

  // ==========================================================================
  // TASKS
  // ==========================================================================

  grunt.registerMultiTask(Accessibility.taskName, Accessibility.taskDescription, function() {

    this.grunt = grunt;
    var done = this.async();
    var task = new Accessibility(this);

    task.run();

  });

};

module.exports = Accessibility;<commit_msg>Working<commit_after>/*
 * grunt-accessibility
 * https://github.com/yargalot/grunt-accessibility
 *
 * Copyright (c) 2013 Steven John Miller
 * Licensed under the MIT license.
 */

var path      = require('path');
var fs        = require('fs');
var _         = require('underscore');
var Promise   = require('bluebird');
var asset     = path.join.bind(null, __dirname, '..');

var _that;

function Accessibility(task) {

  this.task     = task;
  this.options  = task.options(Accessibility.Defaults);
  this.basepath = process.cwd();
  this.grunt    = this.task.grunt;
  this.phantom  = require('grunt-lib-phantomjs').init(this.grunt);

  this.log      = '';
  this.logJSON  = {};

  _that = this;

}

Accessibility.taskName         = 'accessibility';
Accessibility.taskDescription  = 'Use HTML codesniffer to grade accessibility';
Accessibility.Defaults         = {
  phantomScript: asset('../phantomjs/bridge.js'),
  urls: [],
  domElement: true,
  verbose: true
};

/**
* The Message Terminal, choo choo
*
*
*/

Accessibility.prototype.terminalLog = function(msg, trace) {
  var ignore = false;
  var msgSplit = msg.split('|');

  var grunt   = _that.grunt;
  var options = _that.options;

  // If ignore get the hell out
  _.each(options.ignore, function (value, key) {
    if (value === msgSplit[1]) {
      ignore = true;
    }
  });

  if (ignore) {
    return;
  }

  // Start messaging
  if (msgSplit[0] === 'ERROR' && !options.force) {
    grunt.fail.warn(msgSplit[1] + ': ' + msgSplit[2]);
  }

  if (msgSplit[0] === 'ERROR' || msgSplit[0] === 'NOTICE' || msgSplit[0] === 'WARNING') {

    if (options.outputFormat === 'json') {

      _that.logJSON[options.file] = _that.logJSON[options.file] || [];

      var currentLog = _that.logJSON[options.file];

      currentLog.push({
        type: msgSplit[0],
        msg: msgSplit[2],
        sc: msgSplit[1].split('.')[3],
        technique: msgSplit[1].split('.')[4]
      });

      if (options.domElement) {
        currentLog[currentLog.length - 1].element = {
          nodeName: msgSplit[3],
          className: msgSplit[4],
          id: msgSplit[5]
        };
      }

    } else {

      if (!options.domElement) {
        msg = msgSplit.slice(0, 3).join('|');
      }

      _that.log += msg + '\r\n';

    }

    if (options.verbose) {
      var heading = null;

      if (msgSplit[0] === 'ERROR') {
        heading = msgSplit[0].red;
      } else if (msgSplit[0] === 'NOTICE') {
        heading = msgSplit[0].blue;
      } else if (msgSplit[0] === 'WARNING') {
        heading = msgSplit[0].yellow;
      }

      heading += ' ' + msgSplit[1];

      grunt.log.writeln(heading);
      grunt.log.writeln(msgSplit[2]);
    }

  } else {
    if (options.verbose) {
      grunt.log.writeln(msg);
    }
  }
};

/**
* Write the file
*
*
*/

Accessibility.prototype.writeFile = function(msg, trace) {

  var grunt   = _that.grunt;
  var options = _that.options;

  grunt.log.writeln('Report Finished'.cyan);

  if (options.outputFormat === 'json') {
    grunt.file.write(options.filedest + '.json', JSON.stringify(_that.logJSON[options.file]));
  } else {
    grunt.file.write(options.filedest , _that.log);
  }

  grunt.log.writeln('File "' + options.filedest +
    (options.outputFormat ? '.' + options.outputFormat : '') + '" created.');

  _that.log = '';
  _that.logJSON = {};

  _that.phantom.halt();

};

/**
* Phantom General Errors
*
*
*/

Accessibility.prototype.failLoad = function(url) {
  _that.phantom.halt();
  _that.grunt.warn('PhantomJS unable to load URL:' + url);
};

Accessibility.prototype.failTime = function() {
  _that.phantom.halt();
  _that.grunt.warn('PhantomJS timed out.');
};

Accessibility.prototype.failError = function(message, trace) {
  _that.grunt.log.writeln('error: ' + message);
};

/**
* Run task
*
* @param {Object} grunt - grunt object
*
* @returns {Object} a promise that resolves with final html
*
*/

Accessibility.prototype.run = function(done) {

  var files   = Promise.resolve(this.task.files);
  var phantom = this.phantom;

  this.grunt.log.writeln('Running accessibility tests'.cyan);

  // Built-in error handlers.
  phantom.on('fail.load',     this.failLoad);
  phantom.on('fail.timeout',  this.failTime);
  phantom.on('error.onError', this.failError);

  // The main events
  phantom.on('console',       this.terminalLog);
  phantom.on('wcaglint.done', this.writeFile);

  return files
    .bind(this)
    .map(function(fileMap) {

      var srcFile  = fileMap.src[0];
      var destFile = fileMap.dest;

      this.options.filedest = destFile;

      return phantom.spawn(srcFile, {
        // Additional PhantomJS options.
        options: this.options,
        // Complete the task when done.
        done: function (err) {
          done();
          return (err || true);
        }
      });

    })
    .catch(function(err){ this.grunt.log.error(err); });

};

Accessibility.registerWithGrunt = function(grunt) {

  // Please see the grunt documentation for more information regarding task and
  // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md

  // ==========================================================================
  // TASKS
  // ==========================================================================

  grunt.registerMultiTask(Accessibility.taskName, Accessibility.taskDescription, function() {

    this.grunt = grunt;
    var done = this.async();
    var task = new Accessibility(this);

    task.run(done);

  });

};

module.exports = Accessibility;<|endoftext|>