<commit_before>'use strict';

viewModel.AvailabilityAnalysis = new Object();
var pg = viewModel.AvailabilityAnalysis;
var maxdate = new Date(Date.UTC(2016, 5, 30, 23, 59, 59, 0));

pg.type = ko.observable();
pg.detailDTTopTxt = ko.observable();
pg.isDetailDTTop = ko.observable(false);
pg.periodDesc = ko.observable();

pg.breakDownList = ko.observableArray([
    { "value": "dateinfo.dateid", "text": "Date" },
    { "value": "dateinfo.monthdesc", "text": "Month" },
    { "value": "dateinfo.year", "text": "Year" },
    { "value": "projectname", "text": "Project" },
    { "value": "turbine", "text": "Turbine" },
]);

pg.isFirstDataCon = ko.observable(true);
pg.isFirstVarience = ko.observable(true);
pg.isFirstVarienceOver = ko.observable(true);

pg.loadData = function(){
    app.loading(true);
    fa.LoadData();
    if (fa.project == "") {
        pg.type = "Project Name";
    } else {
        pg.type = "Turbine";
    }

    var request = toolkit.ajaxPost(viewModel.appName + "analyticlossanalysis/getavaildate", {}, function (res) {
        if (!app.isFine(res)) {
            return;
        }
        if(res.data.ScadaData != null) {
            $('#availabledatestartscada').html(kendo.toString(moment.utc(new Date(res.data.ScadaData[0])).format('DD-MMMM-YYYY')));
            $('#availabledateendscada').html(kendo.toString(moment.utc(new Date(res.data.ScadaData[1])).format('DD-MMMM-YYYY')));
        }
        if(res.data.ScadaDataHFD != null) {
            $('#availabledatestartscadahfd').html(kendo.toString(moment.utc(new Date(res.data.ScadaDataHFD[0])).format('DD-MMMM-YYYY')));
            $('#availabledateendscadahfd').html(kendo.toString(moment.utc(new Date(res.data.ScadaDataHFD[1])).format('DD-MMMM-YYYY')));
        }
        if(res.data.DGRData != null) {
            $('#availabledatestartdgr').html(kendo.toString(moment.utc(res.data.DGRData[0]).format('DD-MMMM-YYYY')));
            $('#availabledateendsdgr').html(kendo.toString(moment.utc(res.data.DGRData[1]).format('DD-MMMM-YYYY')));
        }
    });
}

pg.DataCon = function(){
    app.loading(true);
    fa.LoadData();
    if(pg.isFirstDataCon() === true){
            var param = {
                period: fa.period,
                Turbine: fa.turbine(),
                DateStart: fa.dateStart,
                DateEnd: fa.dateEnd,
                Project: fa.project
            };

            $("#gridSummaryDgrScada").kendoGrid({
                theme: "flat",
                columns: [
                    { title: " ", field: "desc", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-left" }, width: 150 },
                    { title: "DGR", width: 120, field: "dgr", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else {# #: kendo.toString(dgr, 'N2') # #}#" },
                    { title: "Scada", width: 120,field: "scada", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else {# #: kendo.toString(scada, 'N2') # #}#" },
                    { title: "Scada HFD", width: 120,field: "ScadaHFD", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else {# #: kendo.toString(ScadaHFD, 'N2') # #}#" },
                    {
                        title: "Difference",
                        headerAttributes: { style: 'font-weight: bold; text-align: center;' },
                        columns: [
                            { title: "DGR vs Scada", width: 120,field: "difference", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(difference, 'N2') # % #}else if(desc== 'Grid Availability'){# #: kendo.toString(difference, 'N2') # % #}else if(desc== 'Machine Availability'){# #: kendo.toString(difference, 'N2') # % #}else if(desc=='True Availability'){# #: kendo.toString(difference, 'N2') # % #}else {# #: kendo.toString(difference, 'N2') # #}#" },
                            { title: "DGR vs Scada HFD", width: 120,field: "diffdgrhfd", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc== 'Grid Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc== 'Machine Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc=='True Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else {# #: kendo.toString(diffdgrhfd, 'N2') # #}#" },
                         ]
                    },

                ],
                /*dataSource: {
                    data : dataSource,
                }*/
                dataSource: {
                    serverPaging: false,
                    serverSorting: false,
                    serverFiltering: false,
                    transport: {
                        read: {
                            url: viewModel.appName + "analyticdgrscada/getdata",
                            type: "POST",
                            data: param,
                            dataType: "json",
                            contentType: "application/json; charset=utf-8"
                        },
                        parameterMap: function (options) {
                            return JSON.stringify(options);
                        }
                    },
                    schema: {
                        model: {
                            fields: {
                                AlarmOkTime: { type: "number" },
                                OkTime: { type: "number" },
                                Power: { type: "number" },
                                PowerLost: { type: "number" },
                            }
                        },
                        data: function (res) {
                            app.loading(false);
                            if (!app.isFine(res)) {
                                return;
                            }
                            return res.data
                        }
                    },
                },
                dataBound: function(){
                    app.loading(false);
                    pg.isFirstDataCon(false);
                }
            });
    }else{
         setTimeout(function(){
            $("#gridSummaryDgrScada").data("kendoGrid").refresh();
            app.loading(false);
        },200);
    }
}
pg.Variance = function(){

}
pg.VarianceOver = function(){

}
pg.resetStatus = function(){
    pg.isFirstDataCon(true);
    pg.isFirstVarience(true);
    pg.isFirstVarienceOver(true);
}

vm.currentMenu('Data Consistency');
vm.currentTitle('Data Consistency');
vm.breadcrumb([{ title: "KPI's", href: '#' }, { title: 'Data Consistency', href: viewModel.appName + 'page/analyticdataconsistency' }]);

$(function(){
    setTimeout(function(){
        pg.loadData();
        pg.DataCon();
    },200);

    $('#btnRefresh').on('click', function () {
        fa.checkTurbine();
        pg.resetStatus();
        $('.nav').find('li.active').find('a').trigger( "click" );
    });

    $('#projectList').kendoDropDownList({
        change: function () {
            var project = $('#projectList').data("kendoDropDownList").value();
            fa.populateTurbine(project);
        }
    });
})
<commit_msg>adding period validation on data consistency pages<commit_after>'use strict';

viewModel.AvailabilityAnalysis = new Object();
var pg = viewModel.AvailabilityAnalysis;
var maxdate = new Date(Date.UTC(2016, 5, 30, 23, 59, 59, 0));

pg.type = ko.observable();
pg.detailDTTopTxt = ko.observable();
pg.isDetailDTTop = ko.observable(false);
pg.periodDesc = ko.observable();

pg.breakDownList = ko.observableArray([
    { "value": "dateinfo.dateid", "text": "Date" },
    { "value": "dateinfo.monthdesc", "text": "Month" },
    { "value": "dateinfo.year", "text": "Year" },
    { "value": "projectname", "text": "Project" },
    { "value": "turbine", "text": "Turbine" },
]);

pg.isFirstDataCon = ko.observable(true);
pg.isFirstVarience = ko.observable(true);
pg.isFirstVarienceOver = ko.observable(true);

pg.loadData = function(){
    var isValid = fa.LoadData();
    if(isValid) {
        app.loading(true);
        if (fa.project == "") {
            pg.type = "Project Name";
        } else {
            pg.type = "Turbine";
        }

        var request = toolkit.ajaxPost(viewModel.appName + "analyticlossanalysis/getavaildate", {}, function (res) {
            if (!app.isFine(res)) {
                return;
            }
            if(res.data.ScadaData != null) {
                $('#availabledatestartscada').html(kendo.toString(moment.utc(new Date(res.data.ScadaData[0])).format('DD-MMMM-YYYY')));
                $('#availabledateendscada').html(kendo.toString(moment.utc(new Date(res.data.ScadaData[1])).format('DD-MMMM-YYYY')));
            }
            if(res.data.ScadaDataHFD != null) {
                $('#availabledatestartscadahfd').html(kendo.toString(moment.utc(new Date(res.data.ScadaDataHFD[0])).format('DD-MMMM-YYYY')));
                $('#availabledateendscadahfd').html(kendo.toString(moment.utc(new Date(res.data.ScadaDataHFD[1])).format('DD-MMMM-YYYY')));
            }
            if(res.data.DGRData != null) {
                $('#availabledatestartdgr').html(kendo.toString(moment.utc(res.data.DGRData[0]).format('DD-MMMM-YYYY')));
                $('#availabledateendsdgr').html(kendo.toString(moment.utc(res.data.DGRData[1]).format('DD-MMMM-YYYY')));
            }
        });
    }
}

pg.DataCon = function(){
    var isValid = fa.LoadData();
    if(isValid) {
        app.loading(true);
        if(pg.isFirstDataCon() === true){
                var param = {
                    period: fa.period,
                    Turbine: fa.turbine(),
                    DateStart: fa.dateStart,
                    DateEnd: fa.dateEnd,
                    Project: fa.project
                };

                $("#gridSummaryDgrScada").kendoGrid({
                    theme: "flat",
                    columns: [
                        { title: " ", field: "desc", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-left" }, width: 150 },
                        { title: "DGR", width: 120, field: "dgr", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(dgr, 'N2') # #if(dgr!= 'N/A'){# % #}}else {# #: kendo.toString(dgr, 'N2') # #}#" },
                        { title: "Scada", width: 120,field: "scada", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(scada, 'N2') # #if(scada!= 'N/A'){# % #}}else {# #: kendo.toString(scada, 'N2') # #}#" },
                        { title: "Scada HFD", width: 120,field: "ScadaHFD", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc== 'Grid Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc== 'Machine Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else if(desc=='True Availability'){# #: kendo.toString(ScadaHFD, 'N2') # #if(ScadaHFD!= 'N/A'){# % #}}else {# #: kendo.toString(ScadaHFD, 'N2') # #}#" },
                        {
                            title: "Difference",
                            headerAttributes: { style: 'font-weight: bold; text-align: center;' },
                            columns: [
                                { title: "DGR vs Scada", width: 120,field: "difference", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(difference, 'N2') # % #}else if(desc== 'Grid Availability'){# #: kendo.toString(difference, 'N2') # % #}else if(desc== 'Machine Availability'){# #: kendo.toString(difference, 'N2') # % #}else if(desc=='True Availability'){# #: kendo.toString(difference, 'N2') # % #}else {# #: kendo.toString(difference, 'N2') # #}#" },
                                { title: "DGR vs Scada HFD", width: 120,field: "diffdgrhfd", headerAttributes: { style: "text-align: center" }, attributes: { class: "align-center" }, template: "#if(desc== 'PLF'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc== 'Grid Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc== 'Machine Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else if(desc=='True Availability'){# #: kendo.toString(diffdgrhfd, 'N2') # % #}else {# #: kendo.toString(diffdgrhfd, 'N2') # #}#" },
                             ]
                        },

                    ],
                    /*dataSource: {
                        data : dataSource,
                    }*/
                    dataSource: {
                        serverPaging: false,
                        serverSorting: false,
                        serverFiltering: false,
                        transport: {
                            read: {
                                url: viewModel.appName + "analyticdgrscada/getdata",
                                type: "POST",
                                data: param,
                                dataType: "json",
                                contentType: "application/json; charset=utf-8"
                            },
                            parameterMap: function (options) {
                                return JSON.stringify(options);
                            }
                        },
                        schema: {
                            model: {
                                fields: {
                                    AlarmOkTime: { type: "number" },
                                    OkTime: { type: "number" },
                                    Power: { type: "number" },
                                    PowerLost: { type: "number" },
                                }
                            },
                            data: function (res) {
                                app.loading(false);
                                if (!app.isFine(res)) {
                                    return;
                                }
                                return res.data
                            }
                        },
                    },
                    dataBound: function(){
                        app.loading(false);
                        pg.isFirstDataCon(false);
                    }
                });
        }else{
             setTimeout(function(){
                $("#gridSummaryDgrScada").data("kendoGrid").refresh();
                app.loading(false);
            },200);
        }
    }
}
pg.Variance = function(){

}
pg.VarianceOver = function(){

}
pg.resetStatus = function(){
    pg.isFirstDataCon(true);
    pg.isFirstVarience(true);
    pg.isFirstVarienceOver(true);
}

vm.currentMenu('Data Consistency');
vm.currentTitle('Data Consistency');
vm.breadcrumb([{ title: "KPI's", href: '#' }, { title: 'Data Consistency', href: viewModel.appName + 'page/analyticdataconsistency' }]);

$(function(){
    setTimeout(function(){
        pg.loadData();
        pg.DataCon();
    },200);

    $('#btnRefresh').on('click', function () {
        fa.checkTurbine();
        pg.resetStatus();
        $('.nav').find('li.active').find('a').trigger( "click" );
    });

    $('#projectList').kendoDropDownList({
        change: function () {
            var project = $('#projectList').data("kendoDropDownList").value();
            fa.populateTurbine(project);
        }
    });
})
<|endoftext|>


<commit_before>"use strict";
(function() {
  var loader, arr, head;
  if (!chrome.runtime.getManifest) { return; }
  loader = document.querySelector('script[src$="loader.js"]');
  head = loader ? loader.parentElement : document.head;
  arr = chrome.runtime.getManifest().content_scripts[0].js;
  arr.pop();
  arr.forEach(function(src) {
    var scriptElement = document.createElement("script");
    scriptElement.async = false;
    scriptElement.defer = true;
    scriptElement.src = (src[0] !== "/") ? ("/" + src) : src;
    head.replaceChild(scriptElement, loader);
    loader = scriptElement;
  });
  loader.remove();
})();
<commit_msg>loader: use doc.curScript<commit_after>"use strict";
chrome.runtime.getManifest && (function() {
  var loader = document.currentScript, arr, head;
  head = loader ? loader.parentElement : document.head;
  arr = chrome.runtime.getManifest().content_scripts[0].js;
  arr.pop();
  arr.forEach(function(src) {
    var scriptElement = document.createElement("script");
    scriptElement.async = false;
    scriptElement.defer = true;
    scriptElement.src = (src[0] !== "/") ? ("/" + src) : src;
    head.replaceChild(scriptElement, loader);
    loader = scriptElement;
  });
  loader.remove();
})();
<|endoftext|>


<commit_before>import React from 'react'
import { Link } from 'react-router'
import DocumentTitle from 'react-document-title'
import SkyLight from 'react-skylight'
import Tabs from 'react-simpletabs'
import '../node_modules/react-simpletabs/lib/react-simpletabs.css'
import '../css/tabs.css'

import { config } from 'config'

import { prefixLink } from '../utils/urls.js'

import {
  Row,
  Splash,
  Split,
  ImgGallery,
} from './_sharedComponents'

const brothersInfo = require('./_brothers-data.js')

import CoverImg from '../static/brothers-cover.jpg';
import BrothersImg1 from '../static/brothers-1.jpg';
import BrothersImg2 from '../static/brothers-2.jpg';
import BrothersImg3 from '../static/brothers-3.jpg';
import BrothersImg4 from '../static/brothers-4.jpg';
import BrothersImg5 from '../static/brothers-5.jpg';
import BrothersImg6 from '../static/brothers-6.jpg';
import BrothersImg7 from '../static/brothers-7.jpg';
import BrothersImg8 from '../static/brothers-8.jpg';
import BrothersImg9 from '../static/brothers-9.jpg';
import BrothersImg10 from '../static/brothers-10.jpg';
import BrothersImg11 from '../static/brothers-11.jpg';
import BrothersImg12 from '../static/brothers-12.jpg';

const brothersPhotos = [BrothersImg1, BrothersImg2, BrothersImg3, BrothersImg4, BrothersImg5, BrothersImg6, BrothersImg7, BrothersImg8, BrothersImg9, BrothersImg10, BrothersImg11, BrothersImg12 ].map(url => ({src: prefixLink(url)}));

export default function (props) {
  let _brother;
  let openBrotherFn = () => {};

  const onSelect = (brotherDoc) => _brother.setState(brotherDoc) + openBrotherFn();

  return (
      <DocumentTitle title={"Brothers | " + config.siteTitle}>

          <Splash id="brothers" imageUrl={CoverImg}/>

Brothers

ZBT is a non-pledging, historically Jewish fraternity open to all men of good character. Our house attracts smart and energetic young men interested in sciences and engineering with wide range of athletic and academic interests. Many brothers are very active on campus, leading various student organisations and clubs, dancing in troups, trading, playing poker and teaching web development to the wider MIT community. Many brothers are also involved in student clubs working with kids in Boston area such as Camp Kesem and DynaMIT.

            <ImgGallery images={brothersPhotos} useLightbox />

        <Tabs tabActive={5}>
            {/* <Tabs.Panel title="βθ">
              <ClassGallery classid="BetaTheta" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βι">
              <ClassGallery classid="BetaIota" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βκ">
              <ClassGallery classid="BetaKappa" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βλ">
              <ClassGallery classid="BetaLambda" onSelect={onSelect}/>
            </Tabs.Panel> */}
            <Tabs.Panel title="βμ">
              <ClassGallery classid="BetaMu" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βν">
              <ClassGallery classid="BetaNu" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βξ">
              <ClassGallery classid="BetaXi" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βο">
              <ClassGallery classid="BetaOmicron" onSelect={onSelect}/>
            </Tabs.Panel>
          </Tabs>
          <BrotherPane ref={(ref) => _brother = ref} cb={(f) => openBrotherFn = f}/>

      </DocumentTitle>
  );
}

class ClassesTabs extends React.Component {
  constructor() {
    super();
    this.state = { current: 'BetaLambda' };
  }

  render() {
    const greekify = (s) => {
      const name = s.split('Beta')[1];
      return `Β&${name};`;
    };

    const classes = ['BetaTheta', 'BetaIota', 'BetaKappa', 'BetaLambda', 'BetaMu'];
    const { current } = this.state;
    return (

        {
          classes.map((name) =>
                      )
        }

    );
  }
}

class BrotherPane extends React.Component {
  constructor() {
    super();
    this.state = { name: '', classname: '', bio: '' };
  }

  render() {
    this.props.cb(() => this.refs.brotherPopup.show());
    return (
        <SkyLight hideOnOverlayClicked ref="brotherPopup" title={this.state.title}>

{this.state.name}

{this.state.classname}

{this.state.bio}

        </SkyLight>
    );
  }
}

class ClassGallery extends React.Component {
  render() {
    const { classid } = this.props;

    const brothers = brothersInfo.filter(b => b.classid === classid);
    const brothersCards = brothers.map((brotherDoc) => {
      const {imgurl, name, bio} = brotherDoc;
      return (

             {e.preventDefault(); this.props.onSelect(brotherDoc)}}>

            {name}

      );
    });

    return (

{brothers[0].classname}

            {brothersCards}

    );
  }
}
<commit_msg>Remove unused component<commit_after>import React from 'react'
import DocumentTitle from 'react-document-title'
import SkyLight from 'react-skylight'
import Tabs from 'react-simpletabs'
import '../node_modules/react-simpletabs/lib/react-simpletabs.css'
import '../css/tabs.css'

import { config } from 'config'

import { prefixLink } from '../utils/urls.js'

import {
  Row,
  Splash,
  Split,
  ImgGallery,
} from './_sharedComponents'

const brothersInfo = require('./_brothers-data.js')

import CoverImg from '../static/brothers-cover.jpg';
import BrothersImg1 from '../static/brothers-1.jpg';
import BrothersImg2 from '../static/brothers-2.jpg';
import BrothersImg3 from '../static/brothers-3.jpg';
import BrothersImg4 from '../static/brothers-4.jpg';
import BrothersImg5 from '../static/brothers-5.jpg';
import BrothersImg6 from '../static/brothers-6.jpg';
import BrothersImg7 from '../static/brothers-7.jpg';
import BrothersImg8 from '../static/brothers-8.jpg';
import BrothersImg9 from '../static/brothers-9.jpg';
import BrothersImg10 from '../static/brothers-10.jpg';
import BrothersImg11 from '../static/brothers-11.jpg';
import BrothersImg12 from '../static/brothers-12.jpg';

const brothersPhotos = [BrothersImg1, BrothersImg2, BrothersImg3, BrothersImg4, BrothersImg5, BrothersImg6, BrothersImg7, BrothersImg8, BrothersImg9, BrothersImg10, BrothersImg11, BrothersImg12 ].map(url => ({src: prefixLink(url)}));

export default function (props) {
  let _brother;
  let openBrotherFn = () => {};

  const onSelect = (brotherDoc) => _brother.setState(brotherDoc) + openBrotherFn();

  return (
      <DocumentTitle title={"Brothers | " + config.siteTitle}>

          <Splash id="brothers" imageUrl={CoverImg}/>

Brothers

ZBT is a non-pledging, historically Jewish fraternity open to all men of good character. Our house attracts smart and energetic young men interested in sciences and engineering with wide range of athletic and academic interests. Many brothers are very active on campus, leading various student organisations and clubs, dancing in troups, trading, playing poker and teaching web development to the wider MIT community. Many brothers are also involved in student clubs working with kids in Boston area such as Camp Kesem and DynaMIT.

            <ImgGallery images={brothersPhotos} useLightbox />

        <Tabs tabActive={4}>
            {/* <Tabs.Panel title="βθ">
              <ClassGallery classid="BetaTheta" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βι">
              <ClassGallery classid="BetaIota" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βκ">
              <ClassGallery classid="BetaKappa" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βλ">
              <ClassGallery classid="BetaLambda" onSelect={onSelect}/>
            </Tabs.Panel> */}
            <Tabs.Panel title="βμ">
              <ClassGallery classid="BetaMu" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βν">
              <ClassGallery classid="BetaNu" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βξ">
              <ClassGallery classid="BetaXi" onSelect={onSelect}/>
            </Tabs.Panel>
            <Tabs.Panel title="βο">
              <ClassGallery classid="BetaOmicron" onSelect={onSelect}/>
            </Tabs.Panel>
          </Tabs>
          <BrotherPane ref={(ref) => _brother = ref} cb={(f) => openBrotherFn = f}/>

      </DocumentTitle>
  );
}

class BrotherPane extends React.Component {
  constructor() {
    super();
    this.state = { name: '', classname: '', bio: '' };
  }

  render() {
    this.props.cb(() => this.refs.brotherPopup.show());
    return (
        <SkyLight hideOnOverlayClicked ref="brotherPopup" title={this.state.title}>

{this.state.name}

{this.state.classname}

{this.state.bio}

        </SkyLight>
    );
  }
}

class ClassGallery extends React.Component {
  render() {
    const { classid } = this.props;

    const brothers = brothersInfo.filter(b => b.classid === classid);
    const brothersCards = brothers.map((brotherDoc) => {
      const {imgurl, name, bio} = brotherDoc;
      return (

             {e.preventDefault(); this.props.onSelect(brotherDoc)}}>

            {name}

      );
    });

    return (

{brothers[0].classname}

            {brothersCards}

    );
  }
}
<|endoftext|>


<commit_before>/*eslint dot-notation: "off"*/
import {replace, when} from '../../../../test-helper';

describe.only('the products controller', () => {
  let productsService;
  let ProductsController;
  let productsController;

  let makeProductsController = function() {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);
  };

  beforeEach(() => {
    productsService = require('./service/products-service').productsService();
    replace(productsService, 'fetch');
    when(productsService.fetch()).thenResolve(['products']);
  });

  it('has no products', () => {
    makeProductsController();
    productsController.products.should.deepEqual([]);
  });

  it('fetches products from the server', () => {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);

    return productsController.fetch().then(() => {
      productsController.products.should.deepEqual(['products']);
    });
  });
});

<commit_msg>refactor: convert to arrow function<commit_after>/*eslint dot-notation: "off"*/
import {replace, when} from '../../../../test-helper';

describe.only('the products controller', () => {
  let productsService;
  let ProductsController;
  let productsController;

  let makeProductsController = () => {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);
  };

  beforeEach(() => {
    productsService = require('./service/products-service').productsService();
    replace(productsService, 'fetch');
    when(productsService.fetch()).thenResolve(['products']);
  });

  it('has no products', () => {
    makeProductsController();
    productsController.products.should.deepEqual([]);
  });

  it('fetches products from the server', () => {
    ProductsController = require('./products.controller')['ProductsController'];
    productsController = new ProductsController(productsService);

    return productsController.fetch().then(() => {
      productsController.products.should.deepEqual(['products']);
    });
  });
});

<|endoftext|>


<commit_before>// ==UserScript==
// @name           futaba ID+IP popup
// @namespace      https://github.com/himuro-majika
// @description    同じIDやIPのレスをポップアップしちゃう
// @author         himuro_majika
// @note           赤福の「続きを読む」機能で読み込んだレスには反応しません。
// @note           適宜ページ全体をリロードしてください。
// @include        http://*.2chan.net/*/res/*.htm
// @version        1.1
// @grant          GM_addStyle
// @license        MIT
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAPUExURYv4i2PQYy2aLUe0R////zorx9oAAAAFdFJOU/////8A+7YOUwAAAElJREFUeNqUj1EOwDAIQoHn/c88bX+2fq0kRsAoUXVAfwzCttWsDWzw0kNVWd2tZ5K9gqmMZB8libt4pSg6YlO3RnTzyxePAAMAzqMDgTX8hYYAAAAASUVORK5CYII=
// ==/UserScript==
(function () {

	var Start = new Date().getTime();//count parsing time
	var saba = location.host.replace(".2chan.net","") +
		location.pathname.replace("futaba.htm","");
	var timer_show, timer_hide;

	setClassAndName();
	createCounter();
	setEvent();
	setStyle();

	// ID/IPにclass,nameを設定する
	function setClassAndName() {
		res();
		// レス
		function res() {
			var atd = document.getElementsByClassName("rtd");
			for (var i = 0; i < atd.length; i++) {
				var td = atd[i];
				td.innerHTML = td.innerHTML.replace(
					/(I[DP]:\S+)/,
					"$1"
				);
			}
		}
	}
	// 出現数の表示
	function createCounter() {
		var a = document.getElementsByClassName("GM_fip_name");
		var ids = {};
		for (var i = 0; i < a.length; i++) {
			var node = a[i];
			var id = node.name;
			if (ids[id]) {
				ids[id]++;
			} else {
				ids[id] = 1;
			}
			var name = document.querySelectorAll(".GM_fip_name[name='" + id + "']");
			var span = document.createElement("span");
			span.setAttribute("class", "GM_fip_counter");
			span.textContent = "[" + ids[id] + "/" + name.length + "]";
			// node.parentNode.insertBefore(span, node.nextSibling);
			node.appendChild(span);
		}
	}
	// イベントを設定
	function setEvent() {
		var aa = document.getElementsByClassName("GM_fip_name");
		for (var i = 0; i < aa.length; i++) {
			var a = aa[i];
			a.addEventListener("mouseover", show, true);
			a.addEventListener("mouseout", hide, true);
		}
	}
	// ポップアップを表示する
	function show(event) {
		clearTimeout(timer_show);
		delpop();
		var name = this.name;
		timer_show = setTimeout(function() {
			var wX;	//ポップアップ表示位置X
			var wY;	//ポップアップ表示位置Y
			var popup = document.createElement("table");
			var tda = document.getElementsByName(name);
			for (var i = 0; i < tda.length; i++) {
				// restable.push(tda[i].parentNode.parentNode.parentNode.innerHTML);
				var table = tda[i].parentNode.parentNode.parentNode.cloneNode(true);
				popup.appendChild(table);
			}
			var restable = [];
			console.dir(restable);
			popup.id = "GM_fip_pop";
			// popup.innerHTML = restable.join(" ");
			popup.addEventListener("mouseover",function(){
				clearTimeout(timer_hide);
			},true);
			popup.addEventListener("mouseout",hide,true);
			var body = document.getElementsByTagName("body");
			body[0].appendChild(popup);
			wX = event.clientX + 10;
			wY = window.scrollY + event.clientY - popup.clientHeight - 10;
			if ( wY < 0 ) {	//ポップアップが上に見きれる時は下に表示
				wY = window.scrollY + event.clientY;
			}
			popup.setAttribute("style", "left:" + wX + "px; top:" + wY + "px;");
		}, 300);
	}
	// ポップアップを消す
	function hide() {
		clearTimeout(timer_show);
		timer_hide = setTimeout(delpop, 300);
	}

	function delpop() {
		var doc_pop = document.getElementById("GM_fip_pop");
		if ( doc_pop ) {
			doc_pop.parentNode.removeChild(doc_pop);
		}
	}
	/*
	 * スタイル設定
	 */
	function setStyle() {
		var css = "#GM_fip_pop {" +
			"  position: absolute;" +
			"  z-index: 350;" +
			"  background-color: #eeaa88;"+
			"}" +
		"#GM_fip_pop > tbody > tr > td {" +
			"  color: #800000;" +
			"  font-size: 8pt !important;" +
			"}" +
		"#GM_fip_pop > tbody > tr > td > blockquote {" +
			"  margin-top: 0px !important;" +
			"  argin-bottom: 0px !important;" +
			"}" +
		".GM_fip_name {" +
			"  color: #F00;" +
			"}" +
		".GM_fip_counter {" +
		  "  margin: 0 0.3em" +
		"}";
		if (typeof GM_addStyle != "undefined") {
			GM_addStyle(css);
		} else if (typeof addStyle != "undefined") {
			addStyle(css);
		} else {
			var heads = document.getElementsByTagName("head");
			if (heads.length > 0) {
				var node = document.createElement("style");
				node.type = "text/css";
				node.appendChild(document.createTextNode(css));
				heads[0].appendChild(node);
			}
		}
	}

	console.log('Parsing '+saba+': '+((new Date()).getTime()-Start) +'msec');//log parsing time

})();
<commit_msg>Optimize parsing ID<commit_after>// ==UserScript==
// @name           futaba ID+IP popup
// @namespace      https://github.com/himuro-majika
// @description    同じIDやIPのレスをポップアップしちゃう
// @author         himuro_majika
// @note           赤福の「続きを読む」機能で読み込んだレスには反応しません。
// @note           適宜ページ全体をリロードしてください。
// @include        http://*.2chan.net/*/res/*.htm
// @version        1.1
// @grant          GM_addStyle
// @license        MIT
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAPUExURYv4i2PQYy2aLUe0R////zorx9oAAAAFdFJOU/////8A+7YOUwAAAElJREFUeNqUj1EOwDAIQoHn/c88bX+2fq0kRsAoUXVAfwzCttWsDWzw0kNVWd2tZ5K9gqmMZB8libt4pSg6YlO3RnTzyxePAAMAzqMDgTX8hYYAAAAASUVORK5CYII=
// ==/UserScript==
(function () {

	var Start = new Date().getTime();//count parsing time
	var saba = location.host.replace(".2chan.net","") +
		location.pathname.replace("futaba.htm","");
	var timer_show, timer_hide;

	setClassAndNameThread();
	setClassAndNameRes();
	createCounter();
	setEvent();
	setStyle();
	// observeInserted();

	// ID/IPにclass,nameを設定する
	// 本文
	function setClassAndNameThread() {
		// var Start = new Date().getTime();//count parsing time
		var form = document.querySelector("html > body > form:not([enctype])");

		// console.dir(form.childNodes);
		for (var i = 0; i < form.childNodes.length; i++) {
			var text = form.childNodes[i];
			// console.dir(text);
			if (text.nodeValue) {
				var matchText = text.nodeValue.match(/(.+)(I[DP]:\S+)(.*)/);
				if (matchText) {
					var date = document.createTextNode(matchText[1]);
					var id = matchText[2];
					var no = document.createTextNode(matchText[3]);
					var ida = document.createElement("a");
					ida.textContent = id;
					ida.setAttribute("class", "GM_fip_name GM_fip_name_thread");
					ida.setAttribute("name", id);
					text.parentNode.insertBefore(date, text);
					text.parentNode.insertBefore(ida, text);
					text.parentNode.insertBefore(no, text);
					text.parentNode.removeChild(text);
					break;
				}
			}
		}

		// form.innerHTML = form.innerHTML.replace(
		// 	/(I[DP]:\S+)/,
		// 	"$1"
		// );

		// console.log('Parsing '+saba+': '+((new Date()).getTime()-Start) +'msec');//log parsing time
	}
	// レス
	function setClassAndNameRes() {
		var atd = document.getElementsByClassName("rtd");
		for (var i = 0; i < atd.length; i++) {
			var td = atd[i];

			for (var j = 0; j < td.childNodes.length; j++) {
				var text = td.childNodes[j];
				if (text.nodeValue) {
					var matchText = text.nodeValue.match(/(.+)(I[DP]:\S+)(.*)/);
					if (matchText) {
						var date = document.createTextNode(matchText[1]);
						var id = matchText[2];
						var no = document.createTextNode(matchText[3]);
						var ida = document.createElement("a");
						ida.textContent = id;
						ida.setAttribute("class", "GM_fip_name");
						ida.setAttribute("name", id);
						text.parentNode.insertBefore(date, text);
						text.parentNode.insertBefore(ida, text);
						text.parentNode.insertBefore(no, text);
						text.parentNode.removeChild(text);
						break;
					}
				}
			}

			// td.innerHTML = td.innerHTML.replace(
			// 	/(I[DP]:\S+)/,
			// 	"$1"
			// );
		}
	}
	// 出現数の表示
	function createCounter() {
		var a = document.getElementsByClassName("GM_fip_name");
		var ids = {};
		for (var i = 0; i < a.length; i++) {
			var node = a[i];
			var id = node.name;
			if (ids[id]) {
				ids[id]++;
			} else {
				ids[id] = 1;
			}
			var name = document.querySelectorAll(".GM_fip_name[name='" + id + "']");
			var span = document.createElement("span");
			span.setAttribute("class", "GM_fip_counter");
			span.textContent = "[" + ids[id] + "/" + name.length + "]";
			// node.parentNode.insertBefore(span, node.nextSibling);
			node.appendChild(span);
		}
	}
	// イベントを設定
	function setEvent() {
		var aa = document.getElementsByClassName("GM_fip_name");
		for (var i = 0; i < aa.length; i++) {
			var a = aa[i];
			a.addEventListener("mouseover", show, true);
			a.addEventListener("mouseout", hide, true);
		}
	}
	// ポップアップを表示する
	function show(event) {
		clearTimeout(timer_show);
		delpop();
		var name = this.name;
		timer_show = setTimeout(function() {
			var wX;	//ポップアップ表示位置X
			var wY;	//ポップアップ表示位置Y
			var popup = document.createElement("div");
			var tda = document.getElementsByName(name);
			for (var i = 0; i < tda.length; i++) {
				var table;
				if (tda[i].classList.contains("GM_fip_name_thread")) {
					// スレ
					table = document.createElement("form");
					var form = tda[i].parentNode.cloneNode(true);
					// console.log(table.childNodes());
					for (var j = 0; j < form.childNodes.length; j++) {
						table.appendChild(form.childNodes[j].cloneNode(true));
						if (form.childNodes[j].tagName == "BLOCKQUOTE") {
							break;
						}
					}
				} else {
					// レス
					table = tda[i].parentNode.parentNode.parentNode.parentNode.cloneNode(true);
				}
				popup.appendChild(table);
			}
			var restable = [];
			popup.id = "GM_fip_pop";
			// popup.innerHTML = restable.join(" ");
			popup.addEventListener("mouseover",function(){
				clearTimeout(timer_hide);
			},true);
			popup.addEventListener("mouseout",hide,true);
			var body = document.getElementsByTagName("body");
			body[0].appendChild(popup);
			wX = event.clientX + 10;
			wY = window.scrollY + event.clientY - popup.clientHeight - 10;
			if ( wY < 0 ) {	//ポップアップが上に見きれる時は下に表示
				wY = window.scrollY + event.clientY;
			}
			popup.setAttribute("style", "left:" + wX + "px; top:" + wY + "px;");
		}, 300);
	}
	// ポップアップを消す
	function hide() {
		clearTimeout(timer_show);
		timer_hide = setTimeout(delpop, 300);
	}

	function delpop() {
		var doc_pop = document.getElementById("GM_fip_pop");
		if ( doc_pop ) {
			doc_pop.parentNode.removeChild(doc_pop);
		}
	}
	/*
	 * スタイル設定
	 */
	function setStyle() {
		var css = "#GM_fip_pop {" +
		"  position: absolute;" +
		"  z-index: 350;" +
		"  background-color: #eeaa88;"+
		"}" +
		// "#GM_fip_pop > form {" +
		// "  background-color: #ffe" +
		// "}" +
		"#GM_fip_pop > form," +
		"#GM_fip_pop > table > tbody > tr > td {" +
		"  color: #800000;" +
		"  font-size: 8pt !important;" +
		"}" +
		"#GM_fip_pop > form," +
		"#GM_fip_pop > table > tbody > tr > td > blockquote {" +
		"  margin-top: 0px !important;" +
		"  argin-bottom: 0px !important;" +
		"}" +
		".GM_fip_name {" +
		"  color: #F00;" +
		"}" +
		".GM_fip_counter {" +
		"  margin: 0 0.3em" +
		"}";
		if (typeof GM_addStyle != "undefined") {
			GM_addStyle(css);
		} else if (typeof addStyle != "undefined") {
			addStyle(css);
		} else {
			var heads = document.getElementsByTagName("head");
			if (heads.length > 0) {
				var node = document.createElement("style");
				node.type = "text/css";
				node.appendChild(document.createTextNode(css));
				heads[0].appendChild(node);
			}
		}
	}

	console.log('Parsing '+saba+': '+((new Date()).getTime()-Start) +'msec');//log parsing time

})();
<|endoftext|>


<commit_before><commit_msg>compile<commit_after><|endoftext|>


<commit_before>/*
 * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-view',
    'config/alarm/common/ui/js/models/AlarmModel',
    'config/alarm/common/ui/js/views/ConfigAlarmEditView',
    'config/alarm/common/ui/js/ConfigAlarmFormatters'
], function(_, ContrailView, AlarmModel,
    AlarmEditView, AlarmFormatters) {
    var self, gridElId = '#' + ctwc.ALARM_GRID_ID, gridObj,
        alarmEditView = new AlarmEditView(),
        alarmFormatters = new AlarmFormatters();
    var configAlarmGridView = ContrailView.extend({
        el: $(contentContainer),

        render: function () {
            self = this;
            var viewConfig = self.attributes.viewConfig;
            self.renderView4Config(self.$el, self.model,
                getAlarmGridViewConfig(viewConfig));
        }
    });

    function getAlarmGridViewConfig (viewConfig) {
        return {
            elementId:
                cowu.formatElementId(
                [ctwc.CONFIG_ALARM_LIST_VIEW_ID]),
            view: "SectionView",
            viewConfig: {
                rows: [
                    {
                        columns: [
                            {
                                elementId: ctwc.ALARM_GRID_ID,
                                view: "GridView",
                                viewConfig: {
                                    elementConfig:
                                        getConfiguration(viewConfig)
                                }
                            }
                        ]
                    }
                ]
            }
        }
    };

    function getConfiguration (viewConfig) {
        var gridElementConfig = {
            header: {
                title: {
                    text: ctwl.TITLE_ALARM_RULE
                },
                advanceControls: getHeaderActionConfig(viewConfig)
            },
            body: {
                options: {
                    checkboxSelectable: {
                        onNothingChecked: function(e){
                            $('#btnDeleteAlarm').addClass('disabled-link');
                        },
                        onSomethingChecked: function(e){
                            $('#btnDeleteAlarm').
                                removeClass('disabled-link');
                        }
                    },
                    actionCell: getRowActionConfig(viewConfig),
                    detail: {
                        template:
                            cowu.generateDetailTemplateHTML(getAlarmDetailsTemplateConfig(),
                            cowc.APP_CONTRAIL_CONTROLLER)
                    }
                },
                dataSource: {
                },
                statusMessages: {
                    loading: {
                        text: 'Loading Alarms ...'
                    },
                    empty: {
                        text: 'No Alarms found'
                    }
                }
            },
            columnHeader: {
                columns: [
                   {
                        field: "name",
                        name: "Name",
                        sortable: true,
                        maxWidth: 230,
                    },{
                        field: "alarm_severity",
                        name: "Severity",
                        sortable: true,
                        maxWidth: 100,
                        formatter: alarmFormatters.severityFormatter
                    },{
                        field: "uve_keys",
                        name: "UVE Keys",
                        sortable: true,
                        maxWidth: 130,
                        formatter: alarmFormatters.uveKeysFormatter
                    },{
                        field: "alarm_rules",
                        name: "Rule",
                        sortable: true,
                        formatter: alarmFormatters.rulesFormatter
                    }
                ]
            }
        };
        return gridElementConfig;
    };

    function getRowActionConfig(viewConfig) {
        var rowActionConfig = [
            ctwgc.getEditAction(function (rowIndex) {
                var gridObj = $(gridElId).data('contrailGrid'),
                    dataItem = gridObj._dataView.getItem(rowIndex),
                    alarmModel = new AlarmModel(dataItem),
                    title = ctwl.TITLE_EDIT_ALARM_RULE;
                alarmModel.editView = alarmEditView;
                alarmEditView.model = alarmModel;
                alarmEditView.renderAddEditRule({
                    title: title,
                    selectedGridData: [dataItem],
                    callback: function () {
                        gridObj._dataView.refreshData();
                    },
                    mode : ctwl.EDIT_ACTION,
                    rowIndex: rowIndex,
                    isProject: viewConfig.isProject,
                    isGlobal: viewConfig.isGlobal
                 });
            }, 'Edit'),
            ctwgc.getDeleteAction(function (rowIndex) {
                var gridObj = $(gridElId).data('contrailGrid'),
                    dataItem = gridObj._dataView.getItem(rowIndex),
                    alarmModel = new AlarmModel(dataItem);
                alarmEditView.model = alarmModel;
                alarmEditView.renderDeleteRule({
                    title: ctwl.TITLE_ALARM_RULE_DELETE,
                    selectedGridData: [dataItem],
                    callback: function() {
                        var dataView = gridObj._dataView;
                        dataView.refreshData();
                    }
                });
            })
        ];
        return rowActionConfig;
    };

    function getHeaderActionConfig(viewConfig) {
        var headerActionConfig = [
            {
                "type" : "link",
                "title" : ctwl.TITLE_ALARM_RULE_MULTI_DELETE,
                "iconClass": 'icon-trash',
                "linkElementId": 'btnDeleteAlarm',
                "onClick" : function() {
                    var gridObj = $(gridElId).data('contrailGrid'),
                        dataItems = gridObj.getCheckedRows();
                    if(dataItems.length > 0) {
                        var alarmModel = new AlarmModel(dataItems);
                        alarmEditView.model = alarmModel;
                        alarmEditView.renderDeleteRule({
                              "title": ctwl.TITLE_ALARM_RULE_MULTI_DELETE,
                              selectedGridData: dataItems,
                              callback: function() {
                                  var dataView = gridObj._dataView;
                                  dataView.refreshData();
                        }});
                    }
                }
            },
            {
                "type" : "link",
                "title" : ctwl.TITLE_CREATE_ALARM_RULE,
                "iconClass" : "icon-plus",
                "onClick" : function() {
                    var gridObj = $(gridElId).data('contrailGrid'),
                        alarmModel = new AlarmModel();
                    alarmModel.editView = alarmEditView;
                    alarmEditView.model = alarmModel;
                    alarmEditView.renderAddEditRule(
                        {"title": ctwl.TITLE_CREATE_ALARM_RULE,
                            callback: function () {
                                gridObj._dataView.refreshData();
                            },
                            mode : ctwl.CREATE_ACTION,
                            isProject: viewConfig.isProject,
                            isGlobal: viewConfig.isGlobal
                        }
                    );
                }
            }];

        return headerActionConfig;
    };

    function getAlarmDetailsTemplateConfig() {
        return {
            templateGenerator: 'RowSectionTemplateGenerator',
            templateGeneratorConfig: {
                rows: [{
                    templateGenerator: 'ColumnSectionTemplateGenerator',
                    templateGeneratorConfig: {
                        columns: [{
                            class: 'row-fluid',
                            rows: [{
                                title: 'Details',
                                templateGenerator:
                                    'BlockListTemplateGenerator',
                                templateGeneratorConfig: [{
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    key: "name",
                                    templateGenerator: "TextGenerator",
                                    label: "Name",
                                },{
                                    key: "id_perms.created",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Enabled",
                                    templateGeneratorConfig: {
                                        formatter: 'enable'
                                    }
                                },{
                                    key: "id_perms.description",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Description",
                                    templateGeneratorConfig: {
                                        formatter: 'description'
                                    }
                                },{
                                    key: "alarm_severity",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Severity",
                                    templateGeneratorConfig: {
                                        formatter: 'severityFormatter'
                                    }
                                },{
                                    key: "uve_keys",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "UVE Keys",
                                    templateGeneratorConfig: {
                                        formatter: "uveKeysFormatter"
                                    }
                                },{
                                    key: "alarm_rules",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Rules",
                                    templateGeneratorConfig: {
                                        formatter: "rulesFormatter"
                                    }
                                }]
                            }]
                        }]
                    }
                }]
            }
        }
    }
    return configAlarmGridView;
});

<commit_msg>Closes-Bug:#1602364 Increased the grid column width of UVE Keys in config alarms page, so that each key will display in single line without wrapped to next line.<commit_after>/*
 * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-view',
    'config/alarm/common/ui/js/models/AlarmModel',
    'config/alarm/common/ui/js/views/ConfigAlarmEditView',
    'config/alarm/common/ui/js/ConfigAlarmFormatters'
], function(_, ContrailView, AlarmModel,
    AlarmEditView, AlarmFormatters) {
    var self, gridElId = '#' + ctwc.ALARM_GRID_ID, gridObj,
        alarmEditView = new AlarmEditView(),
        alarmFormatters = new AlarmFormatters();
    var configAlarmGridView = ContrailView.extend({
        el: $(contentContainer),

        render: function () {
            self = this;
            var viewConfig = self.attributes.viewConfig;
            self.renderView4Config(self.$el, self.model,
                getAlarmGridViewConfig(viewConfig));
        }
    });

    function getAlarmGridViewConfig (viewConfig) {
        return {
            elementId:
                cowu.formatElementId(
                [ctwc.CONFIG_ALARM_LIST_VIEW_ID]),
            view: "SectionView",
            viewConfig: {
                rows: [
                    {
                        columns: [
                            {
                                elementId: ctwc.ALARM_GRID_ID,
                                view: "GridView",
                                viewConfig: {
                                    elementConfig:
                                        getConfiguration(viewConfig)
                                }
                            }
                        ]
                    }
                ]
            }
        }
    };

    function getConfiguration (viewConfig) {
        var gridElementConfig = {
            header: {
                title: {
                    text: ctwl.TITLE_ALARM_RULE
                },
                advanceControls: getHeaderActionConfig(viewConfig)
            },
            body: {
                options: {
                    checkboxSelectable: {
                        onNothingChecked: function(e){
                            $('#btnDeleteAlarm').addClass('disabled-link');
                        },
                        onSomethingChecked: function(e){
                            $('#btnDeleteAlarm').
                                removeClass('disabled-link');
                        }
                    },
                    actionCell: getRowActionConfig(viewConfig),
                    detail: {
                        template:
                            cowu.generateDetailTemplateHTML(getAlarmDetailsTemplateConfig(),
                            cowc.APP_CONTRAIL_CONTROLLER)
                    }
                },
                dataSource: {
                },
                statusMessages: {
                    loading: {
                        text: 'Loading Alarms ...'
                    },
                    empty: {
                        text: 'No Alarms found'
                    }
                }
            },
            columnHeader: {
                columns: [
                   {
                        field: "name",
                        name: "Name",
                        sortable: true,
                        maxWidth: 230,
                    },{
                        field: "alarm_severity",
                        name: "Severity",
                        sortable: true,
                        maxWidth: 100,
                        formatter: alarmFormatters.severityFormatter
                    },{
                        field: "uve_keys",
                        name: "UVE Keys",
                        sortable: true,
                        maxWidth: 170,
                        formatter: alarmFormatters.uveKeysFormatter
                    },{
                        field: "alarm_rules",
                        name: "Rule",
                        sortable: true,
                        formatter: alarmFormatters.rulesFormatter
                    }
                ]
            }
        };
        return gridElementConfig;
    };

    function getRowActionConfig(viewConfig) {
        var rowActionConfig = [
            ctwgc.getEditAction(function (rowIndex) {
                var gridObj = $(gridElId).data('contrailGrid'),
                    dataItem = gridObj._dataView.getItem(rowIndex),
                    alarmModel = new AlarmModel(dataItem),
                    title = ctwl.TITLE_EDIT_ALARM_RULE;
                alarmModel.editView = alarmEditView;
                alarmEditView.model = alarmModel;
                alarmEditView.renderAddEditRule({
                    title: title,
                    selectedGridData: [dataItem],
                    callback: function () {
                        gridObj._dataView.refreshData();
                    },
                    mode : ctwl.EDIT_ACTION,
                    rowIndex: rowIndex,
                    isProject: viewConfig.isProject,
                    isGlobal: viewConfig.isGlobal
                 });
            }, 'Edit'),
            ctwgc.getDeleteAction(function (rowIndex) {
                var gridObj = $(gridElId).data('contrailGrid'),
                    dataItem = gridObj._dataView.getItem(rowIndex),
                    alarmModel = new AlarmModel(dataItem);
                alarmEditView.model = alarmModel;
                alarmEditView.renderDeleteRule({
                    title: ctwl.TITLE_ALARM_RULE_DELETE,
                    selectedGridData: [dataItem],
                    callback: function() {
                        var dataView = gridObj._dataView;
                        dataView.refreshData();
                    }
                });
            })
        ];
        return rowActionConfig;
    };

    function getHeaderActionConfig(viewConfig) {
        var headerActionConfig = [
            {
                "type" : "link",
                "title" : ctwl.TITLE_ALARM_RULE_MULTI_DELETE,
                "iconClass": 'icon-trash',
                "linkElementId": 'btnDeleteAlarm',
                "onClick" : function() {
                    var gridObj = $(gridElId).data('contrailGrid'),
                        dataItems = gridObj.getCheckedRows();
                    if(dataItems.length > 0) {
                        var alarmModel = new AlarmModel(dataItems);
                        alarmEditView.model = alarmModel;
                        alarmEditView.renderDeleteRule({
                              "title": ctwl.TITLE_ALARM_RULE_MULTI_DELETE,
                              selectedGridData: dataItems,
                              callback: function() {
                                  var dataView = gridObj._dataView;
                                  dataView.refreshData();
                        }});
                    }
                }
            },
            {
                "type" : "link",
                "title" : ctwl.TITLE_CREATE_ALARM_RULE,
                "iconClass" : "icon-plus",
                "onClick" : function() {
                    var gridObj = $(gridElId).data('contrailGrid'),
                        alarmModel = new AlarmModel();
                    alarmModel.editView = alarmEditView;
                    alarmEditView.model = alarmModel;
                    alarmEditView.renderAddEditRule(
                        {"title": ctwl.TITLE_CREATE_ALARM_RULE,
                            callback: function () {
                                gridObj._dataView.refreshData();
                            },
                            mode : ctwl.CREATE_ACTION,
                            isProject: viewConfig.isProject,
                            isGlobal: viewConfig.isGlobal
                        }
                    );
                }
            }];

        return headerActionConfig;
    };

    function getAlarmDetailsTemplateConfig() {
        return {
            templateGenerator: 'RowSectionTemplateGenerator',
            templateGeneratorConfig: {
                rows: [{
                    templateGenerator: 'ColumnSectionTemplateGenerator',
                    templateGeneratorConfig: {
                        columns: [{
                            class: 'row-fluid',
                            rows: [{
                                title: 'Details',
                                templateGenerator:
                                    'BlockListTemplateGenerator',
                                templateGeneratorConfig: [{
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    key: "name",
                                    templateGenerator: "TextGenerator",
                                    label: "Name",
                                },{
                                    key: "id_perms.created",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Enabled",
                                    templateGeneratorConfig: {
                                        formatter: 'enable'
                                    }
                                },{
                                    key: "id_perms.description",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Description",
                                    templateGeneratorConfig: {
                                        formatter: 'description'
                                    }
                                },{
                                    key: "alarm_severity",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Severity",
                                    templateGeneratorConfig: {
                                        formatter: 'severityFormatter'
                                    }
                                },{
                                    key: "uve_keys",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "UVE Keys",
                                    templateGeneratorConfig: {
                                        formatter: "uveKeysFormatter"
                                    }
                                },{
                                    key: "alarm_rules",
                                    valueClass:'span10',
                                    keyClass: 'span2',
                                    templateGenerator: "TextGenerator",
                                    label: "Rules",
                                    templateGeneratorConfig: {
                                        formatter: "rulesFormatter"
                                    }
                                }]
                            }]
                        }]
                    }
                }]
            }
        }
    }
    return configAlarmGridView;
});

<|endoftext|>


<commit_before>import React from "react";
import styled, { keyframes } from "styled-components";
import PropTypes from "prop-types";
import "isomorphic-unfetch";

import Page from "../components/page";

const Projects = ({ timeliteCommits, timestrapCommits }) => {
  let timeliteLatest,
    timestrapLatest = null;

  try {
    timeliteLatest = `{
  "sha": "${timeliteCommits[0].sha}",
  "commit": {
    "message": "${timeliteCommits[0].commit.message}",
    "date": "${timeliteCommits[0].commit.author.date}"
  },
  "author": {
    "login": "${timestrapCommits[0].author.login}",
    "html_url": "${timestrapCommits[0].author.html_url}"
  }
}`;

    timestrapLatest = `{
  "sha": "${timestrapCommits[0].sha}",
  "commit": {
    "message": "${timestrapCommits[0].commit.message}",
    "date": "${timestrapCommits[0].commit.author.date}"
  },
  "author": {
    "login": "${timestrapCommits[0].author.login}",
    "html_url": "${timestrapCommits[0].author.html_url}"
  }
}`;
  } catch (err) {
    console.log(err);
  }

  return (
    <Page title="Projects">
      <Background />
      <Grid>
        <GridLeft>
          <ProjectHeading>Timelite</ProjectHeading>
          <ProjectParagraph>
            A simple time tracking progressive web app. Uses local storage and
            service workers to remain accessible offline. Sometimes you just
            need the essentials when you are busy.
          </ProjectParagraph>
          {timeliteLatest && <ProjectCommit>{timeliteLatest}</ProjectCommit>}
          <ProjectButton
            href="https://www.github.com/overshard/timelite"
            rel="noopener noreferrer"
            target="_blank"
          >
            GitHub
          </ProjectButton>
        </GridLeft>
        <GridRight>
          <ProjectHeading>Timestrap</ProjectHeading>
          <ProjectParagraph>
            A full feature time tracking web app. Supports multiple users and
            exporting reports in multiple formats. Makes use of websockets to
            maintain state across all active clients.
          </ProjectParagraph>
          {timestrapLatest && <ProjectCommit>{timestrapLatest}</ProjectCommit>}
          <ProjectButton
            href="https://www.github.com/overshard/timestrap"
            rel="noopener noreferrer"
            target="_blank"
          >
            GitHub
          </ProjectButton>
        </GridRight>
      </Grid>
    </Page>
  );
};

Projects.getInitialProps = async () => {
  const timestrapCommitsFetch = await fetch(
    "https://api.github.com/repos/overshard/timestrap/commits"
  );
  const timestrapCommits = await timestrapCommitsFetch.json();
  const timeliteCommitsFetch = await fetch(
    "https://api.github.com/repos/overshard/timelite/commits"
  );
  const timeliteCommits = await timeliteCommitsFetch.json();
  return {
    timeliteCommits: timeliteCommits,
    timestrapCommits: timestrapCommits
  };
};

Projects.propTypes = {
  timeliteCommits: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
  timestrapCommits: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
};

export default Projects;

const SlideUp = keyframes`
  from {
    opacity: 0;
    transform: translateY(100px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
`;

const Background = styled.div`
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: white;
  z-index: -2;
`;

const Grid = styled.div`
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-template-areas: "left right";
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
`;

const GridColumn = styled.div`
  opacity: 0;
  transform: translateY(-100px);
  padding-right: 20px;
  animation: ${SlideUp} 500ms normal forwards;
`;

const GridLeft = styled(GridColumn)`
  grid-area: left;
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-column: 1;
    grid-row: 1;
  }
`;

const GridRight = styled(GridColumn)`
  grid-area: right;
  animation-delay: 250ms;
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-column: 1;
    grid-row: 2;
  }
`;

const ProjectHeading = styled.h1`
  font-weight: 700;
  margin-top: 60px;
  margin-bottom: 20px;
  font-size: 2.5em;
  color: black;
  &::before {
    content: "";
    display: block;
    width: 75px;
    height: 5px;
    margin-bottom: 20px;
    background-color: ${props => props.theme.colors.blue};
  }
`;

const ProjectParagraph = styled.p`
  font-size: 1.6em;
  margin-top: 0;
  margin-bottom: 20px;
  font-weight: 300;
  color: black;
`;

const ProjectButton = styled.a`
  padding: 10px 15px;
  font-size: 1.2em;
  text-decoration: none;
  background-color: black;
  margin-bottom: 20px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 2px;
  color: white;
  background-image: linear-gradient(
    to right,
    ${props => props.theme.colors.blue} 0,
    ${props => props.theme.colors.purple} 100%
  );
  transform: scale(1);
  transition-duration: 250ms;
  transition-property: transform;
  &:hover {
    transform: scale(1.2);
  }
`;

const ProjectCommit = styled.pre`
  white-space: pre-wrap;
  font-family: monospace;
  background: black;
  color: #00ff00;
  padding: 20px;
  @media (${props => props.theme.breakpoints.mobile}) {
    display: none;
  }
`;
<commit_msg>Adjusting projects animations<commit_after>import React from "react";
import styled, { keyframes } from "styled-components";
import PropTypes from "prop-types";
import "isomorphic-unfetch";

import Page from "../components/page";

const Projects = ({ timeliteCommits, timestrapCommits }) => {
  let timeliteLatest,
    timestrapLatest = null;

  try {
    timeliteLatest = `{
  "sha": "${timeliteCommits[0].sha}",
  "commit": {
    "message": "${timeliteCommits[0].commit.message}",
    "date": "${timeliteCommits[0].commit.author.date}"
  },
  "author": {
    "login": "${timestrapCommits[0].author.login}",
    "html_url": "${timestrapCommits[0].author.html_url}"
  }
}`;

    timestrapLatest = `{
  "sha": "${timestrapCommits[0].sha}",
  "commit": {
    "message": "${timestrapCommits[0].commit.message}",
    "date": "${timestrapCommits[0].commit.author.date}"
  },
  "author": {
    "login": "${timestrapCommits[0].author.login}",
    "html_url": "${timestrapCommits[0].author.html_url}"
  }
}`;
  } catch (err) {
    console.log(err);
  }

  return (
    <Page title="Projects">
      <Background />
      <Grid>
        <GridLeft>
          <ProjectHeading>Timelite</ProjectHeading>
          <ProjectParagraph>
            A simple time tracking progressive web app. Uses local storage and
            service workers to remain accessible offline. Sometimes you just
            need the essentials when you are busy.
          </ProjectParagraph>
          {timeliteLatest && <ProjectCommit>{timeliteLatest}</ProjectCommit>}
          <ProjectButton
            href="https://www.github.com/overshard/timelite"
            rel="noopener noreferrer"
            target="_blank"
          >
            GitHub
          </ProjectButton>
        </GridLeft>
        <GridRight>
          <ProjectHeading>Timestrap</ProjectHeading>
          <ProjectParagraph>
            A full feature time tracking web app. Supports multiple users and
            exporting reports in multiple formats. Makes use of websockets to
            maintain state across all active clients.
          </ProjectParagraph>
          {timestrapLatest && <ProjectCommit>{timestrapLatest}</ProjectCommit>}
          <ProjectButton
            href="https://www.github.com/overshard/timestrap"
            rel="noopener noreferrer"
            target="_blank"
          >
            GitHub
          </ProjectButton>
        </GridRight>
      </Grid>
    </Page>
  );
};

Projects.getInitialProps = async () => {
  const timestrapCommitsFetch = await fetch(
    "https://api.github.com/repos/overshard/timestrap/commits"
  );
  const timestrapCommits = await timestrapCommitsFetch.json();
  const timeliteCommitsFetch = await fetch(
    "https://api.github.com/repos/overshard/timelite/commits"
  );
  const timeliteCommits = await timeliteCommitsFetch.json();
  return {
    timeliteCommits: timeliteCommits,
    timestrapCommits: timestrapCommits
  };
};

Projects.propTypes = {
  timeliteCommits: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
  timestrapCommits: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
};

export default Projects;

const FadeIn = keyframes`
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
`;

const Background = styled.div`
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: white;
  z-index: -2;
`;

const Grid = styled.div`
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-template-areas: "left right";
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
`;

const GridColumn = styled.div`
  opacity: 0;
  padding-right: 20px;
  animation-fill-mode: forwards;
  animation-name: ${FadeIn};
  animation-duration: 1000ms;
`;

const GridLeft = styled(GridColumn)`
  grid-area: left;
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-column: 1;
    grid-row: 1;
  }
`;

const GridRight = styled(GridColumn)`
  grid-area: right;
  animation-delay: 250ms;
  @media (${props => props.theme.breakpoints.tablet}) {
    grid-column: 1;
    grid-row: 2;
  }
`;

const ProjectHeading = styled.h1`
  font-weight: 700;
  margin-top: 60px;
  margin-bottom: 20px;
  font-size: 2.5em;
  color: black;
  &::before {
    content: "";
    display: block;
    width: 75px;
    height: 5px;
    margin-bottom: 20px;
    background-color: ${props => props.theme.colors.blue};
  }
`;

const ProjectParagraph = styled.p`
  font-size: 1.6em;
  margin-top: 0;
  margin-bottom: 20px;
  font-weight: 300;
  color: black;
`;

const ProjectButton = styled.a`
  padding: 10px 15px;
  font-size: 1.2em;
  text-decoration: none;
  background-color: black;
  margin-bottom: 20px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 2px;
  color: white;
  background-image: linear-gradient(
    to right,
    ${props => props.theme.colors.blue} 0,
    ${props => props.theme.colors.purple} 100%
  );
  transform: scale(1);
  transition-duration: 250ms;
  transition-property: transform;
  &:hover {
    transform: scale(1.2);
  }
`;

const ProjectCommit = styled.pre`
  white-space: pre-wrap;
  font-family: monospace;
  background: black;
  color: #00ff00;
  padding: 20px;
  @media (${props => props.theme.breakpoints.mobile}) {
    display: none;
  }
`;
<|endoftext|>


<commit_before>/*!
 * Ladda 0.5.1 (2013-06-19, 21:04)
 * http://lab.hakim.se/ladda
 * MIT licensed
 *
 * Copyright (C) 2013 Hakim El Hattab, http://hakim.se
 */
(function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(["./spin"],e):t.Ladda=e(t.Spinner)})(this,function(t){"use strict";function e(t){if(t===void 0)throw"Button target must be defined.";var e=o(t,t.getAttribute("data-size")),n=document.createElement("span");n.className="ladda-spinner",t.appendChild(n);var i,a={start:function(){return t.setAttribute("disabled",""),t.setAttribute("data-loading",""),clearTimeout(i),e.spin(n),this.setProgress(0),this},stop:function(){return t.removeAttribute("disabled"),t.removeAttribute("data-loading"),clearTimeout(i),i=setTimeout(function(){e.stop()},1e3),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(e){var n=t.querySelector(".ladda-progress");0===e&&n&&n.parentNode?n.parentNode.removeChild(n):(n||(n=document.createElement("div"),n.className="ladda-progress",t.appendChild(n)),n.style.width=(e||0)*t.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),t.setAttribute("disabled",""),this},isLoading:function(){return t.hasAttribute("data-loading")}};return r.push(a),a}function n(t,n){n=n||{};var i=[];"string"==typeof t?i=[].slice.call(document.querySelectorAll(t)):"object"==typeof t&&"string"==typeof t.nodeName&&(i=[i]);for(var o=0,r=i.length;r>o;o++)(function(){var t=i[o];if("function"==typeof t.addEventListener){var r=e(t),a=-1;t.addEventListener("click",function(){r.start(),"number"==typeof n.timeout&&(clearTimeout(a),a=setTimeout(r.stop,n.timeout)),"function"==typeof n.callback&&n.callback.apply(null,[r])},!1)}})()}function i(){for(var t=0,e=r.length;e>t;t++)r[t].stop()}function o(e){var n=e.offsetHeight;n>32&&(n*=.8);var i=12,o=.2*n,r=.6*o,a=7>o?2:3;return new t({color:"#fff",lines:i,radius:o,length:r,width:a,zIndex:"initial",top:"auto",left:"auto",className:""})}var r=[];return{bind:n,create:e,stopAll:i}});<commit_msg>compile latest js<commit_after>/*!
 * Ladda 0.5.1 (2013-06-27, 08:49)
 * http://lab.hakim.se/ladda
 * MIT licensed
 *
 * Copyright (C) 2013 Hakim El Hattab, http://hakim.se
 */
(function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(["spin"],e):t.Ladda=e(t.Spinner)})(this,function(t){"use strict";function e(t){if(t===void 0)throw"Button target must be defined.";var e=o(t,t.getAttribute("data-size")),n=document.createElement("span");n.className="ladda-spinner",t.appendChild(n);var i,a={start:function(){return t.setAttribute("disabled",""),t.setAttribute("data-loading",""),clearTimeout(i),e.spin(n),this.setProgress(0),this},stop:function(){return t.removeAttribute("disabled"),t.removeAttribute("data-loading"),clearTimeout(i),i=setTimeout(function(){e.stop()},1e3),this},toggle:function(){return this.isLoading()?this.stop():this.start(),this},setProgress:function(e){var n=t.querySelector(".ladda-progress");0===e&&n&&n.parentNode?n.parentNode.removeChild(n):(n||(n=document.createElement("div"),n.className="ladda-progress",t.appendChild(n)),n.style.width=(e||0)*t.offsetWidth+"px")},enable:function(){return this.stop(),this},disable:function(){return this.stop(),t.setAttribute("disabled",""),this},isLoading:function(){return t.hasAttribute("data-loading")}};return r.push(a),a}function n(t,n){n=n||{};var i=[];"string"==typeof t?i=[].slice.call(document.querySelectorAll(t)):"object"==typeof t&&"string"==typeof t.nodeName&&(i=[i]);for(var o=0,r=i.length;r>o;o++)(function(){var t=i[o];if("function"==typeof t.addEventListener){var r=e(t),a=-1;t.addEventListener("click",function(){r.start(),"number"==typeof n.timeout&&(clearTimeout(a),a=setTimeout(r.stop,n.timeout)),"function"==typeof n.callback&&n.callback.apply(null,[r])},!1)}})()}function i(){for(var t=0,e=r.length;e>t;t++)r[t].stop()}function o(e){var n=e.offsetHeight;n>32&&(n*=.8);var i=12,o=.2*n,r=.6*o,a=7>o?2:3;return new t({color:"#fff",lines:i,radius:o,length:r,width:a,zIndex:"initial",top:"auto",left:"auto",className:""})}var r=[];return{bind:n,create:e,stopAll:i}});<|endoftext|>