<commit_before>(function($){

    var data = {
        state : {
            isOverWorld: function(){
                return $('.overworld-locations').is(':visible');
            },
            isChooseParty: function(){
                return $('.page-dungeon-chooseparty').is(':visible');
            },
            isAdventure: function(){
                return $('.dungeon-map-inner').is(':visible') && !$('.modal-window').is(':visible');
            },
            isSelectEncounterCompanion: function(){
                return $('.encounter-party-list').is(':visible');
            },
            isEncounter: function(){
                return $('.page-dungeon-combat').is(':visible') &&
                        (!$('.modal-window').is(':visible') ||
                          $('.modal-confirm.combat-wild > h3:contains(' + data.text.criticalHit + ')').is(':visible'));
            },
            isDiceRoller: function(){
                return $('.combatDiceBox').is(':visible') && !$('.modal-window').is(':visible');
            },
            isCombatVictory: function(){
                return $('.modal-confirm.combat-victory').is(':visible');
            },
            isModal: function(){
                return $('.modal-window').is(':visible');
            }
        },
        text:{
            chooseYourParty: 'Choose Your Party',
            ok: 'OK',
            d20: 'D20',
            criticalHit: 'Critical Hit!'
        }
    };

    var Adventure = function(character){

        var _adv = [
            {
                tier: "tier-[1|2|3|4|5|6]",
                companions: [
                    {
                        "name":"cleric",
                        "required":true||false,
                    },
                    {
                        "name":"guy",
                        "required":true||false,
                    }
                ]
            },
            {
                tier: "tier-1",
                companions: [
                    {
                        "name":"lowbies",
                        "required":true||false,
                    }
                ]
            },

        ];

        this.character = character;
        this.changeCharacter = $.nwg.changeCharacter.create(this.character);
        this.adventures = this.character.adv;
        this.dicePicker = $.nwg.dicePicker.create(this.character, $.nwg.dicePickerBrain.create());
    };

    Adventure.prototype.make_adventure_active = function(task) {
        $('.nav-dungeons').trigger('click');
        return {
            error: false,
            delay: 3000
        };
    };

    Adventure.prototype.check_adventure_state = function(task) {
        console.log("check_adventure_state");
        //var task = self.crete_base_task();
        /*
            Should only be called from the crate_base_task method
        */

        if(data.state.isOverWorld()){
            console.log("isOverWorld");
            task.then(this.start_adventure.bind(this))
            task.then(this.confirm_adventure.bind(this));
            /*
            task.then(this.clear_adventure_party.bind(this));
            task.then(this.select_adventure_party.bind(this));
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isChooseParty()){
            console.log("isChooseParty");
            task.then(this.clear_adventure_party.bind(this));
            task.then(this.select_adventure_party.bind(this));
            task.then(this.comfirm_adventure_party.bind(this));
            /*
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isAdventure()){
            console.log("isAdventure");
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            /*
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isEncounter()){
            console.log("isEncounter");
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            task.then(this.clear_modal.bind(this));
        }
        else if(data.state.isSelectEncounterCompanion()){
            console.log("isSelectEncounterCompanion");
            task.then(this.select_encounter_companion.bind(this));
        }
        //isAdventure
            //select encounter
            //choose encounter companion
        //isSelectEncounterCompanion
        //isEncounter || isCritical
            //select die
        //isDiceRoller
            //wait
        //isModal
            //clear
        else if(data.state.isCombatVictory()){
            console.log("isCombatVictory");
            task.then(this.clear_modal.bind(this));
            task.then(this.clear_modal.bind(this));//clears the daily reward if it appears
            //We're done - set up a new one.
            var new_task = new $.nwg.adventure.create(this.character).create_base_task();
            new_task.progress();
            task.finish();
        }
        else if (data.state.isModal()){
            console.log("isModal");
            task.then(this.clear_modal.bind(this));
        }
        //else

        task.then($.nwg.adventure.create(this.character).check_adventure_state.bind(this));
        return {error:false, delay: 3000};
    };

    Adventure.prototype.start_adventure = function(task) {
        console.log("start_adventure");
        $('a.' + 'tier-1').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.confirm_adventure = function(task) {
        console.log("confirm_adventure");
        $('.choosePartyButton > button:contains(' + data.text.chooseYourParty + ')').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_adventure_party = function(task) {
        console.log("select_adventure_party");
        //select adventure party member (which attemps to cancel the confirm if up THEN clears THEN selects)
        var PARTY_SIZE = 4;
        var adventures = this.adventures;
        var self = this;
        var companionsToSelect = [];

        $(adventures).each(function(indx, adventure){

            var tier = adventure.tier;
            var adventureCompanions = adventure.companions;
            var requiredCompanions = [];
            var optionalCompanions = [];
            var totalCompanionCount = $('.party-entry.full-sheet:not(.promo)').length;
            var disabledCount = $('.party-entry.full-sheet.disabled').length;
            var maxAvailableCount = totalCompanionCount - disabledCount;
            var availableCompanions = $('.party-entry.full-sheet.available:not(.promo)>a:not(.selected)');

            if(adventureCompanions && adventureCompanions.length > 0 &&
                totalCompanionCount > PARTY_SIZE && maxAvailableCount > PARTY_SIZE){

                $(availableCompanions).each(function(indx, aCmp){
                    var aComp = $(aCmp);
                    var matched = false;
                    $(adventureCompanions).each(function(indx, cmp){
                        var companion = aComp.has(':contains(' + cmp.name + ')');
                        if(companion.length === 1){
                            matched = true;
                            if(cmp.required){
                                requiredCompanions.push(companion);
                            }
                            else if(!cmp.excluded){
                                optionalCompanions.push(companion);
                            }
                        }
                    });
                    if(!matched){
                        optionalCompanions.push(aComp);
                    }
                    //console.log("rC=" + requiredCompanions.length + " | oC=" + optionalCompanions.length);
                });

                if(requiredCompanions.length + optionalCompanions.length >= PARTY_SIZE){

                    for(var i = 0; i < requiredCompanions.length && i < PARTY_SIZE; i++){
                        companionsToSelect.push($(requiredCompanions[i]));
                    }

                    for(var ii = 0; ii < optionalCompanions.length && ii < PARTY_SIZE && ii < PARTY_SIZE - requiredCompanions.length; ii++){
                        companionsToSelect.push($(optionalCompanions[ii]));
                    }

                    return false;
                }
            }
            else if(totalCompanionCount <= PARTY_SIZE && disabledCount === 0){
                companionsToSelect = availableCompanions;
                return false;
            }
        });

        if(companionsToSelect.length > 0){
            for(var i = 0; i < companionsToSelect.length && i < PARTY_SIZE; i++){
                $(companionsToSelect[i]).trigger('click');
            }
        }

        return {error:false, delay: 2000};
    };

    Adventure.prototype.clear_adventure_party = function(task){
        console.log("clear_adventure_party");
        var partyCloseButtons = $('.party-entry > button.close-button');
        partyCloseButtons.each(function(idx, btn) {
            $(btn).trigger('click');
        });

        return {
            error: false,
            delay: 3000
        };
    };

    Adventure.prototype.comfirm_adventure_party = function(task) {
        console.log("comfirm_adventure_party");
        $('.modal-window  button:contains(' + data.text.ok + ')').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_encounter = function(task) {
        console.log("select_encounter");
        if($('.dungeon-map-inner').length === 0){
            //console.log("Dungeon not ready");
            return {
                error: false,
                delay: 1000
            };
        }
        var encounters = $('.overlay.button:not(.complete, .exit, .boss)');
        var boss = $('.overlay.button.boss');

        //console.log("[encounters=" + encounters.length + "]");
        if(encounters.length > 0){
            encounters.eq(0).trigger('click');
        }
        else if(boss.length > 0){
            boss.eq(0).trigger('click');
        }

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_encounter_companion = function(task) {
        console.log("select_encounter_companion");
        var companions = $('a.selectable');
        if(!companions.length){
            //console.log("companions not found");
            return {
                error: false,
                delay: 5000
            };
        };
        $('a.selectable').eq(0).trigger('click');
        return {
            error: false,
            delay: 5000
        };
    };

    Adventure.prototype.clear_modal = function(task) {
        var m = $('.modal-window');

        var okBtn = m.find('button:contains(' + data.text.ok + ')')
        var d20Btn = m.find('button:contains('+ data.text.d20+')');

        if(okBtn.length === 1){
            okBtn.trigger('click');
        }
        if(d20Btn.l === 1){
            d20Btn.trigger('click');
        }

        return {
            error:false,
            delay: 3000
        }
    };

    Adventure.prototype.create_base_task = function create_base_task() {
        console.log("create_base_task");
        var self = this;
        var task = $.task.create(this.changeCharacter.activate.bind(this.changeCharacter));
        task.then(this.make_adventure_active.bind(this));
        task.then(this.check_adventure_state.bind(this));

        return task;
    };

    $.extend(true, $.nwg, {
        adventure: {
            create:function(character){
                return new Adventure(character);
            }
        }
    });

}(jQuery));<commit_msg>SCA wip [this is faster than C&P into js-console]<commit_after>(function($){

    var data = {
        state : {
            isOverWorld: function(){
                return $('.overworld-locations').is(':visible');
            },
            isChooseParty: function(){
                return $('.page-dungeon-chooseparty').is(':visible');
            },
            isAdventure: function(){
                return $('.dungeon-map-inner').is(':visible') && !$('.modal-window').is(':visible');
            },
            isSelectEncounterCompanion: function(){
                return $('.encounter-party-list').is(':visible');
            },
            isEncounter: function(){
                return $('.page-dungeon-combat').is(':visible') &&
                        (!$('.modal-window').is(':visible') ||
                          $('.modal-confirm.combat-wild > h3:contains(' + data.text.criticalHit + ')').is(':visible'));
            },
            isDiceRoller: function(){
                return $('.combatDiceBox').is(':visible') && !$('.modal-window').is(':visible');
            },
            isCombatVictory: function(){
                return $('.modal-confirm.combat-victory').is(':visible');
            },
            isModal: function(){
                return $('.modal-window').is(':visible');
            }
        },
        text:{
            chooseYourParty: 'Choose Your Party',
            ok: 'OK',
            d20: 'D20',
            criticalHit: 'Critical Hit!'
        }
    };

    var Adventure = function(character){

        var _adv = [
            {
                tier: "tier-[1|2|3|4|5|6]",
                companions: [
                    {
                        "name":"cleric",
                        "required":true||false,
                    },
                    {
                        "name":"guy",
                        "required":true||false,
                    }
                ]
            },
            {
                tier: "tier-1",
                companions: [
                    {
                        "name":"lowbies",
                        "required":true||false,
                    }
                ]
            },

        ];

        this.character = character;
        this.changeCharacter = $.nwg.changeCharacter.create(this.character);
        this.adventures = this.character.adv;
        this.dicePicker = $.nwg.dicePicker.create(this.character, $.nwg.dicePickerBrain.create());
    };

    Adventure.prototype.make_adventure_active = function(task) {
        $('.nav-dungeons').trigger('click');
        return {
            error: false,
            delay: 3000
        };
    };

    Adventure.prototype.check_adventure_state = function(task) {
        console.log("check_adventure_state");
        //var task = self.crete_base_task();
        /*
            Should only be called from the crate_base_task method
        */

        if(data.state.isOverWorld()){
            console.log("isOverWorld");
            task.then(this.start_adventure.bind(this))
            task.then(this.confirm_adventure.bind(this));
            /*
            task.then(this.clear_adventure_party.bind(this));
            task.then(this.select_adventure_party.bind(this));
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isChooseParty()){
            console.log("isChooseParty");
            task.then(this.clear_adventure_party.bind(this));
            task.then(this.select_adventure_party.bind(this));
            task.then(this.comfirm_adventure_party.bind(this));
            /*
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isAdventure()){
            console.log("isAdventure");
            task.then(this.select_encounter.bind(this));
            task.then(this.select_encounter_companion.bind(this));
            /*
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            */
        }
        else if(data.state.isEncounter()){
            console.log("isEncounter");
            task.then(this.dicePicker.pick_die.bind(this.dicePicker));
            task.then(this.clear_modal.bind(this));
        }
        else if(data.state.isSelectEncounterCompanion()){
            console.log("isSelectEncounterCompanion");
            task.then(this.select_encounter_companion.bind(this));
        }
        //isAdventure
            //select encounter
            //choose encounter companion
        //isSelectEncounterCompanion
        //isEncounter || isCritical
            //select die
        //isDiceRoller
            //wait
        //isModal
            //clear
        else if(data.state.isCombatVictory()){
            console.log("isCombatVictory");
            task.then(this.clear_modal.bind(this));
            task.then(this.clear_modal.bind(this));//clears the daily reward if it appears
            //We're done - set up a new one.
            var new_task = new $.nwg.adventure.create(this.character).create_base_task();
            new_task.start_in(1500);
            task.finish();
        }
        else if (data.state.isModal()){
            console.log("isModal");
            task.then(this.clear_modal.bind(this));
        }
        //else

        task.then($.nwg.adventure.create(this.character).check_adventure_state.bind(this));
        return {error:false, delay: 3000};
    };

    Adventure.prototype.start_adventure = function(task) {
        console.log("start_adventure");
        $('a.' + 'tier-1').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.confirm_adventure = function(task) {
        console.log("confirm_adventure");
        $('.choosePartyButton > button:contains(' + data.text.chooseYourParty + ')').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_adventure_party = function(task) {
        console.log("select_adventure_party");
        //select adventure party member (which attemps to cancel the confirm if up THEN clears THEN selects)
        var PARTY_SIZE = 4;
        var adventures = this.adventures;
        var self = this;
        var companionsToSelect = [];

        $(adventures).each(function(indx, adventure){

            var tier = adventure.tier;
            var adventureCompanions = adventure.companions;
            var requiredCompanions = [];
            var optionalCompanions = [];
            var totalCompanionCount = $('.party-entry.full-sheet:not(.promo)').length;
            var disabledCount = $('.party-entry.full-sheet.disabled').length;
            var maxAvailableCount = totalCompanionCount - disabledCount;
            var availableCompanions = $('.party-entry.full-sheet.available:not(.promo)>a:not(.selected)');

            if(adventureCompanions && adventureCompanions.length > 0 &&
                totalCompanionCount > PARTY_SIZE && maxAvailableCount > PARTY_SIZE){

                $(availableCompanions).each(function(indx, aCmp){
                    var aComp = $(aCmp);
                    var matched = false;
                    $(adventureCompanions).each(function(indx, cmp){
                        var companion = aComp.has(':contains(' + cmp.name + ')');
                        if(companion.length === 1){
                            matched = true;
                            if(cmp.required){
                                requiredCompanions.push(companion);
                            }
                            else if(!cmp.excluded){
                                optionalCompanions.push(companion);
                            }
                        }
                    });
                    if(!matched){
                        optionalCompanions.push(aComp);
                    }
                    //console.log("rC=" + requiredCompanions.length + " | oC=" + optionalCompanions.length);
                });

                if(requiredCompanions.length + optionalCompanions.length >= PARTY_SIZE){

                    for(var i = 0; i < requiredCompanions.length && i < PARTY_SIZE; i++){
                        companionsToSelect.push($(requiredCompanions[i]));
                    }

                    for(var ii = 0; ii < optionalCompanions.length && ii < PARTY_SIZE && ii < PARTY_SIZE - requiredCompanions.length; ii++){
                        companionsToSelect.push($(optionalCompanions[ii]));
                    }

                    return false;
                }
            }
            else if(totalCompanionCount <= PARTY_SIZE && disabledCount === 0){
                companionsToSelect = availableCompanions;
                return false;
            }
        });

        if(companionsToSelect.length > 0){
            for(var i = 0; i < companionsToSelect.length && i < PARTY_SIZE; i++){
                $(companionsToSelect[i]).trigger('click');
            }
        }

        return {error:false, delay: 2000};
    };

    Adventure.prototype.clear_adventure_party = function(task){
        console.log("clear_adventure_party");
        var partyCloseButtons = $('.party-entry > button.close-button');
        partyCloseButtons.each(function(idx, btn) {
            $(btn).trigger('click');
        });

        return {
            error: false,
            delay: 3000
        };
    };

    Adventure.prototype.comfirm_adventure_party = function(task) {
        console.log("comfirm_adventure_party");
        $('.modal-window  button:contains(' + data.text.ok + ')').trigger('click');

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_encounter = function(task) {
        console.log("select_encounter");
        if($('.dungeon-map-inner').length === 0){
            //console.log("Dungeon not ready");
            return {
                error: false,
                delay: 1000
            };
        }
        var encounters = $('.overlay.button:not(.complete, .exit, .boss)');
        var boss = $('.overlay.button.boss');

        //console.log("[encounters=" + encounters.length + "]");
        if(encounters.length > 0){
            encounters.eq(0).trigger('click');
        }
        else if(boss.length > 0){
            boss.eq(0).trigger('click');
        }

        return {
            error: false,
            delay: 1000
        };
    };

    Adventure.prototype.select_encounter_companion = function(task) {
        console.log("select_encounter_companion");
        var companions = $('a.selectable');
        if(!companions.length){
            //console.log("companions not found");
            return {
                error: false,
                delay: 5000
            };
        };
        $('a.selectable').eq(0).trigger('click');
        return {
            error: false,
            delay: 5000
        };
    };

    Adventure.prototype.clear_modal = function(task) {
        var m = $('.modal-window');

        var okBtn = m.find('button:contains(' + data.text.ok + ')')
        var d20Btn = m.find('button:contains('+ data.text.d20+')');

        if(okBtn.length === 1){
            okBtn.trigger('click');
        }
        if(d20Btn.l === 1){
            d20Btn.trigger('click');
        }

        return {
            error:false,
            delay: 3000
        }
    };

    Adventure.prototype.create_base_task = function create_base_task() {
        console.log("create_base_task");
        var self = this;
        var task = $.task.create(this.changeCharacter.activate.bind(this.changeCharacter));
        task.then(this.make_adventure_active.bind(this));
        task.then(this.check_adventure_state.bind(this));

        return task;
    };

    $.extend(true, $.nwg, {
        adventure: {
            create:function(character){
                return new Adventure(character);
            }
        }
    });

}(jQuery));<|endoftext|>


<commit_before>'use strict';

var wiredep = require('wiredep');
var yargs = require('yargs');

var root = __dirname + '/..';
var src = root + '/kuulemma/static';
var dest = root + '/kuulemma/static/dist';

module.exports = {
  options: yargs.argv,
  root: root,
  src: src,
  dest: dest,
  js: {
    src: {
      vendor: wiredep().js.concat([src + '/bower_components/moment/locale/fi.js']),
      vendorTest: wiredep({ devDependencies: true }).js.concat([src + '/bower_components/moment/locale/fi.js']),
      app: [src + '/app/**/*.js', '!' + src + '/app/**/*_test.js'],
      mocks: [src + '/mocks/**/*.js'],
      test: [src + '/app/**/*_test.js'],
      e2e: [root + '/tests/e2e/**/*.js']
    },
    dest: dest + '/js'
  },
  html: {
    src: [src + '/app/**/*.html'],
    dest: dest + '/partials'
  },
  less: {
    src: [src + '/app/app.less'],
    watch: [src + '/app/**/*.less', '!' + src + '/app/app.less'],
    dest: dest + '/css'
  },
  img: {
    src: [src + '/images/**'],
    dest: dest + '/images'
  },
  server: {
    host: 'localhost',
    port: 5000
  },
  tests: {
    karma: root + '/karma.conf.js',
    protractor: root + '/protractor.conf.js'
  }
};
<commit_msg>Make sure app.js is the first non-vendor script in all.js<commit_after>'use strict';

var wiredep = require('wiredep');
var yargs = require('yargs');

var root = __dirname + '/..';
var src = root + '/kuulemma/static';
var dest = root + '/kuulemma/static/dist';

module.exports = {
  options: yargs.argv,
  root: root,
  src: src,
  dest: dest,
  js: {
    src: {
      vendor: wiredep().js.concat([src + '/bower_components/moment/locale/fi.js']),
      vendorTest: wiredep({ devDependencies: true }).js.concat([src + '/bower_components/moment/locale/fi.js']),
      app: [src + '/app/app.js', src + '/app/**/*.js', '!' + src + '/app/**/*_test.js'],
      mocks: [src + '/mocks/**/*.js'],
      test: [src + '/app/**/*_test.js'],
      e2e: [root + '/tests/e2e/**/*.js']
    },
    dest: dest + '/js'
  },
  html: {
    src: [src + '/app/**/*.html'],
    dest: dest + '/partials'
  },
  less: {
    src: [src + '/app/app.less'],
    watch: [src + '/app/**/*.less', '!' + src + '/app/app.less'],
    dest: dest + '/css'
  },
  img: {
    src: [src + '/images/**'],
    dest: dest + '/images'
  },
  server: {
    host: 'localhost',
    port: 5000
  },
  tests: {
    karma: root + '/karma.conf.js',
    protractor: root + '/protractor.conf.js'
  }
};
<|endoftext|>


<commit_before>/*
   All emon_widgets code is released under the GNU General Public License v3.
   See COPYRIGHT.txt and LICENSE.txt.

    ---------------------------------------------------------------------
    Part of the OpenEnergyMonitor project:
    http://openenergymonitor.org

    Author: Trystan Lea: trystan.lea@googlemail.com
    If you have any questions please get in touch, try the forums here:
    http://openenergymonitor.org/emon/forum
 */

// Convenience function for shoving things into the widget object
// I'm not sure about calling optionKey "optionKey", but I don't want to just use "options" (because that's what this whole function returns), and it's confusing enough as it is.
function addOption(widget, optionKey, optionType, optionName, optionHint, optionData)
{

  widget["options"    ].push(optionKey);
  widget["optionstype"].push(optionType);
  widget["optionsname"].push(optionName);
  widget["optionshint"].push(optionHint);
  widget["optionsdata"].push(optionData);

}
function dial_widgetlist()
{
  var widgets =
  {
    "dial":
    {
      "offsetx":-80,"offsety":-80,"width":160,"height":160,
      "menu":"Widgets",
      "options":    [],
      "optionstype":[],
      "optionsname":[],
      "optionshint":[],
      "optionsdata":[]

    }
  };

  var typeDropBoxOptions = [        // Options for the type combobox. Each item is [typeID, "description"]
          [0,    "Light <-> dark green, Zero at left"],
          [1,    "Red <-> Green, Zero at center"],
          [2,    "Green <-> Red, Zero at left"],
          [3,    "Green <-> Red, Zero at center"],
          [4,    "Red <-> Green, Zero at left"],
          [5,    "Red <-> Green, Zero at center"],
          [6,    "Green center <-> orange edges, Zero at center "],
          [7,    "Light <-> Dark blue, Zero at left"],
          [8,    "Light blue <-> Red, Zero at mid-left"],
          [9,    "Red <-> Dark Red, Zero at left"],
          [10,   "Black <-> White, Zero at left"]
        ];

  var graduationDropBoxOptions = [
          [1, "Yes"],
          [0, "No"]
        ]

  addOption(widgets["dial"], "feed",        "feed",    _Tr("Feed"),        _Tr("Feed value"),                                                            []);
  addOption(widgets["dial"], "max",         "value",   _Tr("Max value"),   _Tr("Max value to show"),                                                     []);
  addOption(widgets["dial"], "scale",       "value",   _Tr("Scale"),       _Tr("Value is multiplied by scale before display"),                           []);
  addOption(widgets["dial"], "units",       "value",   _Tr("Units"),       _Tr("Units to show"),                                                         []);
  addOption(widgets["dial"], "offset",      "value",   _Tr("Offset"),      _Tr("Static offset. Subtracted from value before computing needle position"), []);
  addOption(widgets["dial"], "type",        "dropbox", _Tr("Type"),        _Tr("Type to show"),                                                          typeDropBoxOptions);
  addOption(widgets["dial"], "graduations", "dropbox", _Tr("Graduations"), _Tr("Should the graduation limits be shown"),                                 graduationDropBoxOptions);

  return widgets;
}

function dial_init()
{
  setup_widget_canvas('dial');
}

function dial_draw()
{
  $('.dial').each(function(index)
  {
    var feed = $(this).attr("feed");
    var val = curve_value(feed,dialrate);
    // ONLY UPDATE ON CHANGE
    if ((val * 1).toFixed(2) != (assoc[feed] * 1).toFixed(2) || redraw == 1)
    {
      var id = "can-"+$(this).attr("id");
      var scale = 1*$(this).attr("scale") || 1;
      draw_gauge(widgetcanvas[id],
                 0,
                 0,
                 $(this).width(),
                 $(this).height(),val*scale,
                 $(this).attr("max"),
                 $(this).attr("units"),
                 $(this).attr("type"),
                 $(this).attr("offset"),
                 $(this).attr("graduations"));
    }
  });
}

function dial_slowupdate()
{

}

function dial_fastupdate()
{
  dial_draw();
}

function deg_to_radians(deg)
{
  return deg * (Math.PI / 180)
}
function polar_to_cart(mag, ang, xOff, yOff)
{
  ang = deg_to_radians(ang);
  var x = mag * Math.cos(ang) + xOff;
  var y = mag * Math.sin(ang) + yOff;
  return [x, y];
}

// X, Y are the center coordinates of the canvas
function draw_gauge(ctx,x,y,width,height,position,maxvalue,units,type, offset, graduationBool)
{
  if (!ctx) return;

  // if (1 * maxvalue) == false: 3000. Else 1 * maxvalue
  maxvalue = 1 * maxvalue || 3000;
  // if units == false: "". Else units
  units = units || "";
  offset = 1*offset || 0;
  var val = position
  position = position-offset

  var size = 0;
  if (width<height) size = width/2;
  else size = height/2;
  size = size - (size*0.058/2);

  x = width/2;
  y = height/2;

  ctx.clearRect(0,0,200,200);

  if (!position)
    position = 0;

  var angleOffset = 0;
  var segment = ["#c0e392","#9dc965","#87c03f","#70ac21","#378d42","#046b34"];

  type = type || 0;

  if (type == 0)
  {
    if (position<0)
      position = 0;
  }
  else if (type == 1)
  {
    angleOffset = -0.75;
    segment = ["#e61703","#ff6254","#ffa29a","#70ac21","#378d42","#046b34"];
  }
  else if (type == 2)
  {
    if (position<0)
      position = 0;
    segment = ["#046b34","#378d42","#87c03f","#f8a01b","#f46722","#bf2025"];
  }
  else if (type == 3)
  {
    angleOffset = -0.75;
    segment = ["#046b34","#378d42","#87c03f","#f8a01b","#f46722","#bf2025"];
  }
  else if (type == 4)
  {
    if (position<0)
      position = 0;
    segment = ["#bf2025","#f46722","#f8a01b","#87c03f","#378d42","#046b34"];
  }
  else if (type == 5)
  {
    angleOffset = -0.75;
    segment = ["#bf2025","#f46722","#f8a01b","#87c03f","#378d42","#046b34"];
  }
  else if (type == 6)
  {
    angleOffset = -0.75;
    segment = ["#f46722","#f8a01b","#87c03f","#87c03f","#f8a01b","#f46722"];
  }
  else if (type == 7)
  {
    if (position<0)
      position = 0;
    segment = ["#a7cbe2","#68b7eb","#0d97f3","#0f81d0","#0c6dae","#08578e"];
  }
  else if (type == 8)  //temperature dial blue-red, first segment blue should mean below freezing C
  {
    angleOffset = -0.25;
    segment = ["#b7beff","#ffd9d9","#ffbebe","#ff9c9c","#ff6e6e","#ff3d3d"];
  }
  else if (type == 9)  //temperature dial blue-red, first segment blue should mean below freezing C
  {
    angleOffset = 0;
    segment = ["#e94937","#da4130","#c43626","#ad2b1c","#992113","#86170a"];
  }
  else if (type == 10) //light: from dark grey to white
  {
    if (position<0)
      position = 0;
    segment = ["#202020","#4D4D4D","#7D7D7D","#EEF0F3","#F7F7F7", "#FFFFFF"];
  }

  if (position>maxvalue)
    position = maxvalue;

  var a = 1.75 - ((position/maxvalue) * 1.5) + angleOffset;

  width = 0.785;
  var c=3*0.785;
  var pos = 0;
  var inner = size * 0.48;

  // Segments
  for (var z in segment)
  {
    ctx.fillStyle = segment[z];
    ctx.beginPath();
    ctx.arc(x,y,size,c+pos,c+pos+width+0.01,false);
    ctx.lineTo(x,y);
    ctx.closePath();
    ctx.fill();
    pos += width;
  }
  pos -= width;
  ctx.lineWidth = (size*0.058).toFixed(0);
  pos += width;
  ctx.strokeStyle = "#fff";
  ctx.beginPath();
  ctx.arc(x,y,size,c,c+pos,false);
  ctx.lineTo(x,y);
  ctx.closePath();
  ctx.stroke();

  ctx.fillStyle = "#666867";
  ctx.beginPath();
  ctx.arc(x,y,inner,0,Math.PI*2,true);
  ctx.closePath();
  ctx.fill();

  ctx.lineWidth = (size*0.052).toFixed(0);
  //---------------------------------------------------------------
  ctx.beginPath();
  ctx.moveTo(x+Math.sin(Math.PI*a-0.2)*inner,y+Math.cos(Math.PI*a-0.2)*inner);
  ctx.lineTo(x+Math.sin(Math.PI*a)*size,y+Math.cos(Math.PI*a)*size);
  ctx.lineTo(x+Math.sin(Math.PI*a+0.2)*inner,y+Math.cos(Math.PI*a+0.2)*inner);
  ctx.arc(x,y,inner,1-(Math.PI*a-0.2),1-(Math.PI*a+5.4),true);
  ctx.closePath();
  ctx.fill();
  ctx.stroke();

  //---------------------------------------------------------------

  ctx.fillStyle = "#fff";
  ctx.textAlign    = "center";
  ctx.font = "bold "+(size*0.28)+"px arial";

    if (isNaN(val))  val = 0;

    else if (val>=100)
        val = val.toFixed(0);
    else if (val>=10)
        val = val.toFixed(1);
    else if (val<=-100)
        val = val.toFixed(0);
    else if (val<=-10)
        val = val.toFixed(1);
    else
        val = val.toFixed(2);

  ctx.fillText(val+units,x,y+(size*0.125));

  ctx.fillStyle = "#000";
  var spreadAngle = 32;

  if (graduationBool == 1)
  {

    ctx.font = "bold "+(size*0.22)+"px arial";

    var posStrt = polar_to_cart(size/1.15, 90+spreadAngle, x, y);
    var posStop = polar_to_cart(size/1.15, 90-spreadAngle, x, y);

    ctx.save()
    ctx.translate(posStrt[0], posStrt[1]);
    ctx.rotate(deg_to_radians(-45));
    ctx.fillText(""+offset+units, 0, 0);        // Since we've translated the entire context, the coords we want to draw at are now at [0,0]
    ctx.restore();

    ctx.save(); // each ctx.save is only good for one restore, apparently.
    ctx.translate(posStop[0], posStop[1]);
    ctx.rotate(deg_to_radians(45));
    ctx.fillText(""+(offset+maxvalue)+units, 0, 0);
    ctx.restore();
  }

}

<commit_msg>Proportional resizing of dial widget<commit_after>/*
   All emon_widgets code is released under the GNU General Public License v3.
   See COPYRIGHT.txt and LICENSE.txt.

    ---------------------------------------------------------------------
    Part of the OpenEnergyMonitor project:
    http://openenergymonitor.org

    Author: Trystan Lea: trystan.lea@googlemail.com
    If you have any questions please get in touch, try the forums here:
    http://openenergymonitor.org/emon/forum
 */

// Convenience function for shoving things into the widget object
// I'm not sure about calling optionKey "optionKey", but I don't want to just use "options" (because that's what this whole function returns), and it's confusing enough as it is.
function addOption(widget, optionKey, optionType, optionName, optionHint, optionData)
{

  widget["options"    ].push(optionKey);
  widget["optionstype"].push(optionType);
  widget["optionsname"].push(optionName);
  widget["optionshint"].push(optionHint);
  widget["optionsdata"].push(optionData);

}
function dial_widgetlist()
{
  var widgets =
  {
    "dial":
    {
      "offsetx":-80,"offsety":-80,"width":160,"height":160,
      "menu":"Widgets",
      "options":    [],
      "optionstype":[],
      "optionsname":[],
      "optionshint":[],
      "optionsdata":[]

    }
  };

  var typeDropBoxOptions = [        // Options for the type combobox. Each item is [typeID, "description"]
          [0,    "Light <-> dark green, Zero at left"],
          [1,    "Red <-> Green, Zero at center"],
          [2,    "Green <-> Red, Zero at left"],
          [3,    "Green <-> Red, Zero at center"],
          [4,    "Red <-> Green, Zero at left"],
          [5,    "Red <-> Green, Zero at center"],
          [6,    "Green center <-> orange edges, Zero at center "],
          [7,    "Light <-> Dark blue, Zero at left"],
          [8,    "Light blue <-> Red, Zero at mid-left"],
          [9,    "Red <-> Dark Red, Zero at left"],
          [10,   "Black <-> White, Zero at left"]
        ];

  var graduationDropBoxOptions = [
          [1, "Yes"],
          [0, "No"]
        ]

  addOption(widgets["dial"], "feed",        "feed",    _Tr("Feed"),        _Tr("Feed value"),                                                            []);
  addOption(widgets["dial"], "max",         "value",   _Tr("Max value"),   _Tr("Max value to show"),                                                     []);
  addOption(widgets["dial"], "scale",       "value",   _Tr("Scale"),       _Tr("Value is multiplied by scale before display"),                           []);
  addOption(widgets["dial"], "units",       "value",   _Tr("Units"),       _Tr("Units to show"),                                                         []);
  addOption(widgets["dial"], "offset",      "value",   _Tr("Offset"),      _Tr("Static offset. Subtracted from value before computing needle position"), []);
  addOption(widgets["dial"], "type",        "dropbox", _Tr("Type"),        _Tr("Type to show"),                                                          typeDropBoxOptions);
  addOption(widgets["dial"], "graduations", "dropbox", _Tr("Graduations"), _Tr("Should the graduation limits be shown"),                                 graduationDropBoxOptions);

  return widgets;
}

function dial_init()
{
  setup_widget_canvas('dial');
}

function dial_draw()
{
  $('.dial').each(function(index)
  {
    var feed = $(this).attr("feed");
    var val = curve_value(feed,dialrate);
    // ONLY UPDATE ON CHANGE
    if ((val * 1).toFixed(2) != (assoc[feed] * 1).toFixed(2) || redraw == 1)
    {
      var id = "can-"+$(this).attr("id");
      var scale = 1*$(this).attr("scale") || 1;
      draw_gauge(widgetcanvas[id],
                 0,
                 0,
                 $(this).width(),
                 $(this).height(),val*scale,
                 $(this).attr("max"),
                 $(this).attr("units"),
                 $(this).attr("type"),
                 $(this).attr("offset"),
                 $(this).attr("graduations"));
    }
  });
}

function dial_slowupdate()
{

}

function dial_fastupdate()
{
  dial_draw();
}

function deg_to_radians(deg)
{
  return deg * (Math.PI / 180)
}
function polar_to_cart(mag, ang, xOff, yOff)
{
  ang = deg_to_radians(ang);
  var x = mag * Math.cos(ang) + xOff;
  var y = mag * Math.sin(ang) + yOff;
  return [x, y];
}

// X, Y are the center coordinates of the canvas
function draw_gauge(ctx,x,y,width,height,position,maxvalue,units,type, offset, graduationBool)
{
  if (!ctx) return;

  // if (1 * maxvalue) == false: 3000. Else 1 * maxvalue
  maxvalue = 1 * maxvalue || 3000;
  // if units == false: "". Else units
  units = units || "";
  offset = 1*offset || 0;
  var val = position
  position = position-offset

  var size = 0;
  if (width<height) size = width/2;
  else size = height/2;
  size = size - (size*0.058/2);

  x = width/2;
  y = height/2;

  ctx.clearRect(0,0,200,200);

  if (!position)
    position = 0;

  var angleOffset = 0;
  var segment = ["#c0e392","#9dc965","#87c03f","#70ac21","#378d42","#046b34"];

  type = type || 0;

  if (type == 0)
  {
    if (position<0)
      position = 0;
  }
  else if (type == 1)
  {
    angleOffset = -0.75;
    segment = ["#e61703","#ff6254","#ffa29a","#70ac21","#378d42","#046b34"];
  }
  else if (type == 2)
  {
    if (position<0)
      position = 0;
    segment = ["#046b34","#378d42","#87c03f","#f8a01b","#f46722","#bf2025"];
  }
  else if (type == 3)
  {
    angleOffset = -0.75;
    segment = ["#046b34","#378d42","#87c03f","#f8a01b","#f46722","#bf2025"];
  }
  else if (type == 4)
  {
    if (position<0)
      position = 0;
    segment = ["#bf2025","#f46722","#f8a01b","#87c03f","#378d42","#046b34"];
  }
  else if (type == 5)
  {
    angleOffset = -0.75;
    segment = ["#bf2025","#f46722","#f8a01b","#87c03f","#378d42","#046b34"];
  }
  else if (type == 6)
  {
    angleOffset = -0.75;
    segment = ["#f46722","#f8a01b","#87c03f","#87c03f","#f8a01b","#f46722"];
  }
  else if (type == 7)
  {
    if (position<0)
      position = 0;
    segment = ["#a7cbe2","#68b7eb","#0d97f3","#0f81d0","#0c6dae","#08578e"];
  }
  else if (type == 8)  //temperature dial blue-red, first segment blue should mean below freezing C
  {
    angleOffset = -0.25;
    segment = ["#b7beff","#ffd9d9","#ffbebe","#ff9c9c","#ff6e6e","#ff3d3d"];
  }
  else if (type == 9)  //temperature dial blue-red, first segment blue should mean below freezing C
  {
    angleOffset = 0;
    segment = ["#e94937","#da4130","#c43626","#ad2b1c","#992113","#86170a"];
  }
  else if (type == 10) //light: from dark grey to white
  {
    if (position<0)
      position = 0;
    segment = ["#202020","#4D4D4D","#7D7D7D","#EEF0F3","#F7F7F7", "#FFFFFF"];
  }

  if (position>maxvalue)
    position = maxvalue;

  var a = 1.75 - ((position/maxvalue) * 1.5) + angleOffset;

  width = 0.785;
  var c=3*0.785;
  var pos = 0;
  var inner = size * 0.48;

  // Segments
  for (var z in segment)
  {
    ctx.fillStyle = segment[z];
    ctx.beginPath();
    ctx.arc(x,y,size,c+pos,c+pos+width+0.01,false);
    ctx.lineTo(x,y);
    ctx.closePath();
    ctx.fill();
    pos += width;
  }
  pos -= width;
  ctx.lineWidth = (size*0.058).toFixed(0);
  pos += width;
  ctx.strokeStyle = "#fff";
  ctx.beginPath();
  ctx.arc(x,y,size,c,c+pos,false);
  ctx.lineTo(x,y);
  ctx.closePath();
  ctx.stroke();

  ctx.fillStyle = "#666867";
  ctx.beginPath();
  ctx.arc(x,y,inner,0,Math.PI*2,true);
  ctx.closePath();
  ctx.fill();

  ctx.lineWidth = (size*0.052).toFixed(0);
  //---------------------------------------------------------------
  ctx.beginPath();
  ctx.moveTo(x+Math.sin(Math.PI*a-0.2)*inner,y+Math.cos(Math.PI*a-0.2)*inner);
  ctx.lineTo(x+Math.sin(Math.PI*a)*size,y+Math.cos(Math.PI*a)*size);
  ctx.lineTo(x+Math.sin(Math.PI*a+0.2)*inner,y+Math.cos(Math.PI*a+0.2)*inner);
  ctx.arc(x,y,inner,1-(Math.PI*a-0.2),1-(Math.PI*a+5.4),true);
  ctx.closePath();
  ctx.fill();
  ctx.stroke();

  //---------------------------------------------------------------

    if (isNaN(val))  val = 0;

    else if (val>=100)
        val = val.toFixed(0);
    else if (val>=10)
        val = val.toFixed(1);
    else if (val<=-100)
        val = val.toFixed(0);
    else if (val<=-10)
        val = val.toFixed(1);
    else
        val = val.toFixed(2);

  var dialtext = val+units;
  var textsize = (size / (dialtext.length+2)) * 6;

  ctx.fillStyle = "#fff";
  ctx.textAlign    = "center";
  ctx.font = "bold "+(textsize*0.26)+"px arial";

  ctx.fillText(val+units,x,y+(textsize*0.125));

  ctx.fillStyle = "#000";
  var spreadAngle = 32;

  if (graduationBool == 1)
  {

    ctx.font = "bold "+(size*0.22)+"px arial";

    var posStrt = polar_to_cart(size/1.15, 90+spreadAngle, x, y);
    var posStop = polar_to_cart(size/1.15, 90-spreadAngle, x, y);

    ctx.save()
    ctx.translate(posStrt[0], posStrt[1]);
    ctx.rotate(deg_to_radians(-45));
    ctx.fillText(""+offset+units, 0, 0);        // Since we've translated the entire context, the coords we want to draw at are now at [0,0]
    ctx.restore();

    ctx.save(); // each ctx.save is only good for one restore, apparently.
    ctx.translate(posStop[0], posStop[1]);
    ctx.rotate(deg_to_radians(45));
    ctx.fillText(""+(offset+maxvalue)+units, 0, 0);
    ctx.restore();
  }

}

<|endoftext|>


<commit_before>var app = angular.module('PIR', ['ui.grid', 'ui.grid.edit', 'ui.grid.cellNav', 'ngRoute', 'chart.js', 'ngResource']);
var sort_by = function(field, reverse, primer){
   var key = primer ?
       function(x) {return primer(x[field])} :
       function(x) {return x[field]};
   reverse = !reverse ? 1 : -1;
   return function (a, b) {
       return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
     }
};
//twitter-typeahead
var substringMatcher = function(strs) {
  return function findMatches(q, cb) {
    var matches, substringRegex;

    // an array that will be populated with substring matches
    matches = [];

    // regex used to determine if a string contains the substring `q`
    substrRegex = new RegExp(q, 'i');

    // iterate through the pool of strings and for any string that
    // contains the substring `q`, add it to the `matches` array
    $.each(strs, function(i, str) {
      if (substrRegex.test(str)) {
        matches.push(str);
      }
    });

    cb(matches);
  };
};
['User', 'ReportClass', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3', 'VariableDef', 'vVariableDef']
.forEach((urlobject)=>{
    app.factory(urlobject, ['$resource',
        function($resource) {
            return $resource(`/restful/${urlobject}/:where/:value`, {}, {
                get: {method: 'GET', cache: false, isArray: false},
                query: {method:'GET', isArray:true, transformResponse: function (data)
                    {
                        return angular.fromJson(data);
                    },
                },
                save: {method: 'POST', cache: false, isArray: false},
                update: {method: 'PUT', cache: false, isArray: false},
                delete: {method: 'DELETE', cache: false, isArray: false}
            });
        }]
    );
});

['Log']
.forEach((urlobject)=>{
  app.factory(urlobject, ['$resource',
    function($resource) {
      return $resource(`/restful/${urlobject}/:where`, {}, {
          'get':    {method:'GET'},
          //'save':   {method:'POST'},
          //'query':  {method:'GET', isArray:true},
          //'remove': {method:'DELETE'},
          //'delete': {method:'DELETE'}
      });
    }]
  );
});
//controllers for resources
['Log', 'User', 'ReportClass', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3', 'VariableDef', 'vVariableDef']
.forEach((urlobject)=>{
    app.controller(urlobject + 'Controller',['$scope', urlobject, function ($scope, resource) {
        const newitem = -2;
        $scope.changed = false;
        $scope.init = function(handler) {
            handler();
            $scope.$on('eventUpdateSelected', handler);
        };
        $scope.getlatestselectedhandler = function() {
            var _where = (urlobject === 'Log') ? $scope.getlatestselected('User') : $scope.getlatestselected(urlobject);
            if (_where >= 0) {
                var res = resource.get({where: _where}, function() {
                    if(urlobject === 'Log') {
                        $scope.item = {};
                        $scope.item.log = '';
                        res.data.forEach((item)=>{$scope.item.log += item.message + " @ " + item.timestamp + "\n"});
                    } else {
                        $scope.newitem = false;
                        $scope.load(res);
                    };
                });
            } else if (_where == newitem) {
                $scope.newitem = true;
                $scope.load({});
            }
        }
        $scope.query = function (where, callback) {
            if(urlobject!=='Log') {
                $scope.registerSelected(urlobject);
                var res = resource.query(where, function(data) {
                    if (urlobject !== 'User') {
                        $scope.data = res.sort(sort_by('code'));
                    } else {
                        $scope.data = res.sort(sort_by('lname'));
                    }
                    if (callback !== undefined) {
                        callback($scope.data);
                    }
                });
            };
        };
        $scope.isSelected = function (id) {
            return $scope.selectedHas(urlobject, id);
        };
        $scope.selectitem = function (id) {
            $scope.updateSelected(urlobject, id);
        };
        var originItem = {};
        var listener = ()=>{};
        $scope.load = function (item) {
            //unwatch
            listener();
            $scope.item = Object.assign({}, item);
            //watch for any change if is not a new item
            if($scope.newitem === false) {
              //record original value
              originItem = Object.assign({}, item);
              //deep watch
              listener = $scope.$watch((scope)=>{return scope.item}, (newval)=>{
                if(JSON.stringify(originItem) !== JSON.stringify(newval)) {
                    console.log(JSON.stringify(originItem), '\n', JSON.stringify(newval))
                    $scope.changed = true;
                } else {
                    $scope.changed = false;
                }
              }, true);
            }
        };
        $scope.addnew = function () {
            $scope.updateSelected(urlobject, newitem);
        };
        $scope.updateitem = function (key, value) {
            $scope.item[key] = value;
        };
    }]);
});

app.controller('selectController', function ($scope) {
    var selected = {};
    $scope.registerSelected = function(key) {
        if (!(key in selected)) {
          selected[key] = new Set();
        }
    }
    $scope.updateSelected = function(key, value) {
        if (selected[key].has(value)) {
            selected[key].delete(value);
        } else {
            selected[key].add(value);
            if (value !== -2) {
                selected[key].delete(-2);
            }
        }
        $scope.$broadcast("eventUpdateSelected", {key: key, value: value});
    }
    $scope.selectedHas = function(key, value) {
        return selected[key].has(value);
    }
    $scope.selectedIsEmpty = function(key) {
        if ($scope.selectedHas(key, -2)) {
          return (selected[key].size === 1)
        } else {
          return (selected[key].size === 0)
        }
    }
    $scope.getlatestselected = (key) => {
      return ((key in selected) && selected[key].size>0) ? [...selected[key]][selected[key].size-1] : -1;
    };
    $scope.filter = function (item) {
        var show = true;
        var hasrelation = false;
        for (key in selected) {
            var _key = key.toLowerCase() + '_id';
            if (_key !== 'user_id') {
                if (!item.hasOwnProperty(_key)) {
                    continue;
                }
                hasrelation = true;
                show = show && (($scope.selectedIsEmpty(key)) || $scope.selectedHas(key, item[_key]));
            } else {
                for (many in item) {
                    if (many.substring(0, 5) === 'user_') {
                        hasrelation = true;
                        show = show && (($scope.selectedIsEmpty(key)) || $scope.selectedHas(key, item[many]));
                    }
                }
            }
        }
        return !hasrelation || show;
    };
});

app.controller('scopeUpdater', function ($scope) {
    $scope.setVar = function (varName, x) {
        $scope[varName] = x;
    }
});

app.directive('typeaheadDirective', ['User', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3' , 'ReportClass', function (resUser, resCat1, resCat2, resCat3, resReport) {
   return {
     restrict: 'A',
     link: function (scope, el, attrs) {
       var options = {
         hint: true,
         highlight: true,
         minLength: 0
       };
       var rowsource = attrs.rowsource;
       var resource = null;
       if (rowsource == 'User') {
         resource = resUser;
         var rowItem = (item)=>{return (item.lname + ' ' + item.fname + ' ' + item.pcode)};
       }
       if (rowsource == 'VariableCat_1') {
         resource = resCat1;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'VariableCat_2') {
         resource = resCat2;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'VariableCat_3') {
         resource = resCat3;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'ReportClass') {
         resource = resReport;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (resource !== null) {
         var rec = resource.query({}, function(data) {
           var source = [];
           data.forEach((item)=>{source.push(rowItem(item))});
           var rec = resource.query({}, function(data) {
             el.typeahead(
             options,
             {
               name: rowsource,
               source: substringMatcher(source)
             });
             if(attrs.bind) {
               if((scope.item[attrs.bind] >= 0) && (attrs.ngModel !== undefined)) {
                  var selectid = (id) => {
                    var current = data.filter((item)=>{return (item.id === id)})[0];
                    if(current !== undefined) {
                      scope[attrs.ngModel] = rowItem(current);
                    } else {
                      scope[attrs.ngModel] = '';
                    }
                  }
                  selectid(scope.item[attrs.bind]);
                  scope.$watch(function(scope) { return scope.item[attrs.bind] },
                    function() {selectid(scope.item[attrs.bind])}
                  );
               }
               el.bind('typeahead:select', function(ev, suggestion) {
                 scope.item[attrs.bind] = data[source.indexOf(suggestion)].id;
               });
               el.blur(()=>{
                 if(source.indexOf(el.val()) === -1)
                  console.log(fa["Error : element not in list!"]);
                  //scope.item[attrs.bind] = undefined;
               });
             }
           });
         });
       } else {
         el.typeahead(
         options,
         {
           name: rowsource,
           source: substringMatcher(fa[rowsource])
         });
      }
   }
 };
}])
<commit_msg>typeahead with fa source bug<commit_after>var app = angular.module('PIR', ['ui.grid', 'ui.grid.edit', 'ui.grid.cellNav', 'ngRoute', 'chart.js', 'ngResource']);
var sort_by = function(field, reverse, primer){
   var key = primer ?
       function(x) {return primer(x[field])} :
       function(x) {return x[field]};
   reverse = !reverse ? 1 : -1;
   return function (a, b) {
       return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
     }
};
//twitter-typeahead
var substringMatcher = function(strs) {
  return function findMatches(q, cb) {
    var matches, substringRegex;

    // an array that will be populated with substring matches
    matches = [];

    // regex used to determine if a string contains the substring `q`
    substrRegex = new RegExp(q, 'i');

    // iterate through the pool of strings and for any string that
    // contains the substring `q`, add it to the `matches` array
    $.each(strs, function(i, str) {
      if (substrRegex.test(str)) {
        matches.push(str);
      }
    });

    cb(matches);
  };
};
['User', 'ReportClass', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3', 'VariableDef', 'vVariableDef']
.forEach((urlobject)=>{
    app.factory(urlobject, ['$resource',
        function($resource) {
            return $resource(`/restful/${urlobject}/:where/:value`, {}, {
                get: {method: 'GET', cache: false, isArray: false},
                query: {method:'GET', isArray:true, transformResponse: function (data)
                    {
                        return angular.fromJson(data);
                    },
                },
                save: {method: 'POST', cache: false, isArray: false},
                update: {method: 'PUT', cache: false, isArray: false},
                delete: {method: 'DELETE', cache: false, isArray: false}
            });
        }]
    );
});

['Log']
.forEach((urlobject)=>{
  app.factory(urlobject, ['$resource',
    function($resource) {
      return $resource(`/restful/${urlobject}/:where`, {}, {
          'get':    {method:'GET'},
          //'save':   {method:'POST'},
          //'query':  {method:'GET', isArray:true},
          //'remove': {method:'DELETE'},
          //'delete': {method:'DELETE'}
      });
    }]
  );
});
//controllers for resources
['Log', 'User', 'ReportClass', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3', 'VariableDef', 'vVariableDef']
.forEach((urlobject)=>{
    app.controller(urlobject + 'Controller',['$scope', urlobject, function ($scope, resource) {
        const newitem = -2;
        $scope.changed = false;
        $scope.init = function(handler) {
            handler();
            $scope.$on('eventUpdateSelected', handler);
        };
        $scope.getlatestselectedhandler = function() {
            var _where = (urlobject === 'Log') ? $scope.getlatestselected('User') : $scope.getlatestselected(urlobject);
            if (_where >= 0) {
                var res = resource.get({where: _where}, function() {
                    if(urlobject === 'Log') {
                        $scope.item = {};
                        $scope.item.log = '';
                        res.data.forEach((item)=>{$scope.item.log += item.message + " @ " + item.timestamp + "\n"});
                    } else {
                        $scope.newitem = false;
                        $scope.load(res);
                    };
                });
            } else if (_where == newitem) {
                $scope.newitem = true;
                $scope.load({});
            }
        }
        $scope.query = function (where, callback) {
            if(urlobject!=='Log') {
                $scope.registerSelected(urlobject);
                var res = resource.query(where, function(data) {
                    if (urlobject !== 'User') {
                        $scope.data = res.sort(sort_by('code'));
                    } else {
                        $scope.data = res.sort(sort_by('lname'));
                    }
                    if (callback !== undefined) {
                        callback($scope.data);
                    }
                });
            };
        };
        $scope.isSelected = function (id) {
            return $scope.selectedHas(urlobject, id);
        };
        $scope.selectitem = function (id) {
            $scope.updateSelected(urlobject, id);
        };
        var originItem = {};
        var listener = ()=>{};
        $scope.load = function (item) {
            //unwatch
            listener();
            $scope.item = Object.assign({}, item);
            //watch for any change if is not a new item
            if($scope.newitem === false) {
              //record original value
              originItem = Object.assign({}, item);
              //deep watch
              listener = $scope.$watch((scope)=>{return scope.item}, (newval)=>{
                if(JSON.stringify(originItem) !== JSON.stringify(newval)) {
                    //console.log(JSON.stringify(originItem), '\n', JSON.stringify(newval))
                    $scope.changed = true;
                } else {
                    $scope.changed = false;
                }
              }, true);
            }
        };
        $scope.addnew = function () {
            $scope.updateSelected(urlobject, newitem);
        };
        $scope.updateitem = function (key, value) {
            $scope.item[key] = value;
        };
    }]);
});

app.controller('selectController', function ($scope) {
    var selected = {};
    $scope.registerSelected = function(key) {
        if (!(key in selected)) {
          selected[key] = new Set();
        }
    }
    $scope.updateSelected = function(key, value) {
        if (selected[key].has(value)) {
            selected[key].delete(value);
        } else {
            selected[key].add(value);
            if (value !== -2) {
                selected[key].delete(-2);
            }
        }
        $scope.$broadcast("eventUpdateSelected", {key: key, value: value});
    }
    $scope.selectedHas = function(key, value) {
        return selected[key].has(value);
    }
    $scope.selectedIsEmpty = function(key) {
        if ($scope.selectedHas(key, -2)) {
          return (selected[key].size === 1)
        } else {
          return (selected[key].size === 0)
        }
    }
    $scope.getlatestselected = (key) => {
      return ((key in selected) && selected[key].size>0) ? [...selected[key]][selected[key].size-1] : -1;
    };
    $scope.filter = function (item) {
        var show = true;
        var hasrelation = false;
        for (key in selected) {
            var _key = key.toLowerCase() + '_id';
            if (_key !== 'user_id') {
                if (!item.hasOwnProperty(_key)) {
                    continue;
                }
                hasrelation = true;
                show = show && (($scope.selectedIsEmpty(key)) || $scope.selectedHas(key, item[_key]));
            } else {
                for (many in item) {
                    if (many.substring(0, 5) === 'user_') {
                        hasrelation = true;
                        show = show && (($scope.selectedIsEmpty(key)) || $scope.selectedHas(key, item[many]));
                    }
                }
            }
        }
        return !hasrelation || show;
    };
});

app.controller('scopeUpdater', function ($scope) {
    $scope.setVar = function (varName, x) {
        $scope[varName] = x;
    }
});

app.directive('typeaheadDirective', ['User', 'VariableCat_1', 'VariableCat_2', 'VariableCat_3' , 'ReportClass', function (resUser, resCat1, resCat2, resCat3, resReport) {
   return {
     restrict: 'A',
     link: function (scope, el, attrs) {
       var options = {
         hint: true,
         highlight: true,
         minLength: 0
       };
       var rowsource = attrs.rowsource;
       var resource = null;
       if (rowsource == 'User') {
         resource = resUser;
         var rowItem = (item)=>{return (item.lname + ' ' + item.fname + ' ' + item.pcode)};
       }
       if (rowsource == 'VariableCat_1') {
         resource = resCat1;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'VariableCat_2') {
         resource = resCat2;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'VariableCat_3') {
         resource = resCat3;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (rowsource == 'ReportClass') {
         resource = resReport;
         var rowItem = (item)=>{return (item.caption)};
       }
       if (resource !== null) {
         var rec = resource.query({}, function(data) {
           var source = [];
           data.forEach((item)=>{source.push(rowItem(item))});
           var rec = resource.query({}, function(data) {
             el.typeahead(
             options,
             {
               name: rowsource,
               source: substringMatcher(source)
             });
             if(attrs.bind) {
               if((scope.item[attrs.bind] >= 0) && (attrs.ngModel !== undefined)) {
                  var selectid = (id) => {
                    var current = data.filter((item)=>{return (item.id === id)})[0];
                    if(current !== undefined) {
                      scope[attrs.ngModel] = rowItem(current);
                      el.typeahead('val', rowItem(current));
                    } else {
                      scope[attrs.ngModel] = '';
                      console.log('no current value');
                    }
                  }
                  selectid(scope.item[attrs.bind]);
                  //select into typeahead when item updates
                  scope.$watch(function(scope) { return scope.item[attrs.bind] },
                    function() {selectid(scope.item[attrs.bind])}
                  );
               }
               el.bind('typeahead:select', function(ev, suggestion) {
                 scope.item[attrs.bind] = data[source.indexOf(suggestion)].id;
               });
               el.blur(()=>{
                 if(source.indexOf(el.val()) === -1) {
                   console.log(fa["Error : element not in list!"]);
                 }
               });
             }
           });
         });
       } else {
         el.typeahead(
         options,
         {
           name: rowsource,
           source: substringMatcher(fa[rowsource])
         });
         //must set value property of typeahead if not
         el.blur(()=>{
           console.log(el.val());
           console.log(scope[attrs.ngModel]);
           console.log(scope);
           console.log(attrs.ngModel);
         });
      }
   }
 };
}])
<|endoftext|>


<commit_before>if (typeof skytoolkit==='undefined') skytoolkit={};

skytoolkit['tracking'] = function(omniture){

    var vars = {
        verifying: false,
        verifyOutputId: 'bootstrap-tracking-verify',
        siteName: safeString($('#skycom-nav li.selected a').text())
    };

    function setPageConfig(config){
        omniture.pageView ( config, "false" );
    }
    function resetPageConfig(config){
        omniture.pageView ( config, "true" );
    }

    function bindEvents(selector, evnt){
        selector = selector || 'input[type=submit], button, a, *[data-track]';
        evnt = evnt || 'click';
        $('body').find(selector).on(evnt, track);
    }

    function logTracking(type, prop, val){
        if (!vars.verifying){ return; }
        if (type=='start'){
            val.preventDefault();
            console.group(prop);
            $('#' + vars.verifyOutputId).html('');
        } else if (type=='end'){
            console.groupEnd();
        } else {
            console.log(prop +': ', val);
            $('#' + vars.verifyOutputId).append('
' + prop +': ' + val + '
');
        }
    }

    function addTrackVars(prop, val){
        var map = 'D=' + omniture.vmap[prop][1].replace('eVar','v').replace('prop','c');
        omniture.s[omniture.vmap[prop][0]] = map;
        omniture.s[omniture.vmap[prop][1]] = val;
        omniture.s.linkTrackVars += ',' + omniture.vmap[prop];
        logTracking('prop',prop, val);
    }

    function track(e){
        logTracking('start','tracking event', e);
        var refDomain = document.referrer,
            url = document.location.href.split('?')[0],
            $el = $(e.currentTarget),
            events = omniture.eventMap['linkClick'],
            context;

        omniture.s.linkTrackVars = 'events';
        addTrackVars('siteName', vars.siteName);
        addTrackVars('linkDetails', getTrackingProperties($el));
        addTrackVars('refDomain', refDomain);
        addTrackVars('url', url);
        addTrackVars('samId', '');

        if ($el.attr('data-tracking-search')){
            context = $el.attr('data-tracking-context') || getText($('#' + $el.attr('data-tracking-context-id')));
            addTrackVars('searchType', $el.attr('data-tracking-search'));
            addTrackVars('searchTerms', context);
            events += ',' + omniture.eventMap['search'];
        }

        logTracking('prop','events', events);
        omniture.s.linkTrackEvents = omniture.s.events = events;

        logTracking('end');
        omniture.s.trackLink(this,'o','Link Click');
    }

    function verify(on){
        if (on || on === undefined){
            vars.verifying = true;
            $('body').append('

');
        } else {
            vars.verifying = false;
            $('#' + vars.verifyOutputId).remove();
        }
    }

    function getText($el){
        return $el.attr('data-tracking-label') || $el.attr('alt') || $el.attr('value') || $el.text() || $el.attr('name');
    }

    function getTrackingProperties($el){
        var textClicked = getText($el),
            context = $el.attr('data-tracking-context') || getText($('#' + $el.attr('data-tracking-context-id'))),
            theme =  $el.attr('data-tracking-theme') || $el.parents('*[data-tracking-theme]').attr('data-tracking-theme'),
            other = $el.parents('*[data-tracking-other]').attr('data-tracking-other'),
            pod =  $el.parents('*[data-tracking-pod]').attr('data-tracking-pod'),
            module = $el.parents('*[data-tracking-module]').attr('data-tracking-module');

        if (vars.verifying){
            console.groupCollapsed('linkDetails');
            console.log('module: ', module);
            console.log('pod: ', pod);
            console.log('other: ', other);
            console.log('context: ', context);
            console.log('theme: ', theme);
            console.log('textClicked: ', textClicked);
            console.groupEnd();
        }

        return [
            safeString(module),
            safeString(pod),
            safeString(other),
            safeString(context),
            safeString(theme),
            safeString(textClicked)
        ].join('|');
    }

    function safeString(str){
        if (typeof str === 'undefined') { return ''; }
        return str.trim().replace(/ /g,'-').replace(/[&,\+,:]/g,'').toLowerCase();
    }

    return function(config){
        setPageConfig(config);
        bindEvents();
        skytoolkit['tracking'] = {
            verify: verify,
            resetPageConfig: resetPageConfig,
            bind: bindEvents
        };
    }

};

if (typeof window.define === "function" && window.define.amd) {
    window.define("modules/tracking", ['utils/omniture'], function(omniture) {
        skytoolkit['tracking'] = skytoolkit['tracking'](omniture);
        return skytoolkit['tracking'];
    });
} else {
    window.skytoolkit['tracking'] = skytoolkit['tracking'](skytoolkit['omniture']);
}
<commit_msg>tracking: fix site name<commit_after>if (typeof skytoolkit==='undefined') skytoolkit={};

skytoolkit['tracking'] = function(omniture){

    var vars = {
        verifying: false,
        verifyOutputId: 'bootstrap-tracking-verify',
        siteName: safeString($('#skycom-nav li.selected > a').text())
    };

    function setPageConfig(config){
        omniture.pageView ( config, "false" );
    }
    function resetPageConfig(config){
        omniture.pageView ( config, "true" );
    }

    function bindEvents(selector, evnt){
        selector = selector || 'input[type=submit], button, a, *[data-track]';
        evnt = evnt || 'click';
        $('body').find(selector).on(evnt, track);
    }

    function logTracking(type, prop, val){
        if (!vars.verifying){ return; }
        if (type=='start'){
            val.preventDefault();
            console.group(prop);
            $('#' + vars.verifyOutputId).html('');
        } else if (type=='end'){
            console.groupEnd();
        } else {
            console.log(prop +': ', val);
            $('#' + vars.verifyOutputId).append('
' + prop +': ' + val + '
');
        }
    }

    function addTrackVars(prop, val){
        var map = 'D=' + omniture.vmap[prop][1].replace('eVar','v').replace('prop','c');
        omniture.s[omniture.vmap[prop][0]] = map;
        omniture.s[omniture.vmap[prop][1]] = val;
        omniture.s.linkTrackVars += ',' + omniture.vmap[prop];
        logTracking('prop',prop, val);
    }

    function track(e){
        logTracking('start','tracking event', e);
        var refDomain = document.referrer,
            url = document.location.href.split('?')[0],
            $el = $(e.currentTarget),
            events = omniture.eventMap['linkClick'],
            context;

        omniture.s.linkTrackVars = 'events';
        addTrackVars('siteName', vars.siteName);
        addTrackVars('linkDetails', getTrackingProperties($el));
        addTrackVars('refDomain', refDomain);
        addTrackVars('url', url);
        addTrackVars('samId', '');

        if ($el.attr('data-tracking-search')){
            context = $el.attr('data-tracking-context') || getText($('#' + $el.attr('data-tracking-context-id')));
            addTrackVars('searchType', $el.attr('data-tracking-search'));
            addTrackVars('searchTerms', context);
            events += ',' + omniture.eventMap['search'];
        }

        logTracking('prop','events', events);
        omniture.s.linkTrackEvents = omniture.s.events = events;

        logTracking('end');
        omniture.s.trackLink(this,'o','Link Click');
    }

    function verify(on){
        if (on || on === undefined){
            vars.verifying = true;
            $('body').append('

');
        } else {
            vars.verifying = false;
            $('#' + vars.verifyOutputId).remove();
        }
    }

    function getText($el){
        return $el.attr('data-tracking-label') || $el.attr('alt') || $el.attr('value') || $el.text() || $el.attr('name');
    }

    function getTrackingProperties($el){
        var textClicked = getText($el),
            context = $el.attr('data-tracking-context') || getText($('#' + $el.attr('data-tracking-context-id'))),
            theme =  $el.attr('data-tracking-theme') || $el.parents('*[data-tracking-theme]').attr('data-tracking-theme'),
            other = $el.parents('*[data-tracking-other]').attr('data-tracking-other'),
            pod =  $el.parents('*[data-tracking-pod]').attr('data-tracking-pod'),
            module = $el.parents('*[data-tracking-module]').attr('data-tracking-module');

        if (vars.verifying){
            console.groupCollapsed('linkDetails');
            console.log('module: ', module);
            console.log('pod: ', pod);
            console.log('other: ', other);
            console.log('context: ', context);
            console.log('theme: ', theme);
            console.log('textClicked: ', textClicked);
            console.groupEnd();
        }

        return [
            safeString(module),
            safeString(pod),
            safeString(other),
            safeString(context),
            safeString(theme),
            safeString(textClicked)
        ].join('|');
    }

    function safeString(str){
        if (typeof str === 'undefined') { return ''; }
        return str.trim().replace(/ /g,'-').replace(/[&,\+,:]/g,'').toLowerCase();
    }

    return function(config){
        setPageConfig(config);
        bindEvents();
        skytoolkit['tracking'] = {
            verify: verify,
            resetPageConfig: resetPageConfig,
            bind: bindEvents
        };
    }

};

if (typeof window.define === "function" && window.define.amd) {
    window.define("modules/tracking", ['utils/omniture'], function(omniture) {
        skytoolkit['tracking'] = skytoolkit['tracking'](omniture);
        return skytoolkit['tracking'];
    });
} else {
    window.skytoolkit['tracking'] = skytoolkit['tracking'](skytoolkit['omniture']);
}
<|endoftext|>


<commit_before>'use strict';

module.exports = {

  'serverport': 8089,

  'styles': {
    'watch' : 'src/app/sass/**/*.scss',
    'src' : 'src/app/sass/app.scss',
    'dest': 'build/css'
  },

  'scripts': {
    'src' : 'src/app/**/*.js',
    'dest': 'build/js'
  },

  'images': {
    'src' : 'src/images/**/*',
    'dest': 'build/images'
  },

  'fonts': {
    'src' : ['src/fonts/**/*'],
    'dest': 'build/fonts'
  },

  'views': {
    'watch': [
      'src/**/*.html'
    ],
    'src': '/src/**/*.html',
    'dest': 'src/js'
  },

  'gzip': {
    'src': 'build/**/*.{html,xml,json,css,js,js.map}',
    'dest': 'build/',
    'options': {}
  },

  'dist': {
    'root'  : 'build'
  },

  'browserify': {
    'entries'   : ['./src/app/app.js'],
    'bundleName': 'the.js',
    'sourcemap' : true
  },

  'test': {
    'karma': 'test/karma.conf.js',
    'protractor': 'test/protractor.conf.js'
  }

};
<commit_msg>watch all sass<commit_after>'use strict';

module.exports = {

  'serverport': 8089,

  'styles': {
    'watch' : 'src/app/**/*.scss',
    'src' : 'src/app/sass/app.scss',
    'dest': 'build/css'
  },

  'scripts': {
    'src' : 'src/app/**/*.js',
    'dest': 'build/js'
  },

  'images': {
    'src' : 'src/images/**/*',
    'dest': 'build/images'
  },

  'fonts': {
    'src' : ['src/fonts/**/*'],
    'dest': 'build/fonts'
  },

  'views': {
    'watch': [
      'src/**/*.html'
    ],
    'src': '/src/**/*.html',
    'dest': 'src/js'
  },

  'gzip': {
    'src': 'build/**/*.{html,xml,json,css,js,js.map}',
    'dest': 'build/',
    'options': {}
  },

  'dist': {
    'root'  : 'build'
  },

  'browserify': {
    'entries'   : ['./src/app/app.js'],
    'bundleName': 'the.js',
    'sourcemap' : true
  },

  'test': {
    'karma': 'test/karma.conf.js',
    'protractor': 'test/protractor.conf.js'
  }

};
<|endoftext|>


<commit_before>import './../src';

import './helpers';
import './runs';
import './types';
import './wrappers';
<commit_msg>refactor: mock console.warn for tests<commit_after>import './../src';

import './helpers';
import './runs';
import './types';
import './wrappers';

// mock console warn (we don't need no education - from formly ;] )
console.warn = function() {};
<|endoftext|>


<commit_before>module.exports = [
  {
    name: 'Bootstrap',
    repo: 'twbs/bootstrap',
    preprocessors: ['scss']
  }, {
    name: 'Bulma',
    repo: 'jgthms/bulma',
    preprocessors: ['sass']
  }, {
    name: 'Foundation',
    repo: 'zurb/foundation-sites',
    preprocessors: ['scss']
  }, {
    name: 'Material Design Lite',
    repo: 'google/material-design-lite',
    preprocessors: ['scss']
  }, {
    name: 'Spectre.css',
    repo: 'picturepan2/spectre',
    preprocessors: ['less']
  }, {
    name: 'Milligram',
    repo: 'milligram/milligram',
    preprocessors: ['sass', 'scss', 'less', 'stylus', 'cssnext']
  }, {
    name: 'UIkit',
    repo: 'uikit/uikit',
    preprocessors: ['less', 'scss']
  }, {
    name: 'Materialize',
    repo: 'Dogfalo/materialize',
    preprocessors: ['sass']
  }, {
    name: 'siimple',
    repo: 'siimple/siimple',
    preprocessors: ['scss']
  }, {
    name: 'pure',
    repo: 'yahoo/pure',
    preprocessors: []
  }, {
    name: 'Semantic UI',
    repo: 'Semantic-Org/Semantic-UI',
    preprocessors: ['less']
  }, {
    name: 'MUI',
    repo: 'muicss/mui',
    preprocessors: ['scss']
  }, {
    name: 'sakura',
    repo: 'oxalorg/sakura',
    preprocessors: ['scss']
  }, {
    name: 'Cutestrap',
    repo: 'tylerchilds/cutestrap',
    preprocessors: ['scss']
  }, {
    name: 'Kube',
    repo: 'imperavi/kube',
    preprocessors: ['scss']
  }, {
    name: 'Wing',
    repo: 'kbrsh/wing',
    preprocessors: []
  }, {
    name: 'Mobi.css',
    repo: 'mobi-css/mobi.css',
    preprocessors: ['scss']
  }, {
    name: 'mini.css',
    repo: 'Chalarangelo/mini.css',
    preprocessors: ['scss']
  }
]
<commit_msg>Update  repository info<commit_after>module.exports = [
  {
    name: 'Bootstrap',
    repo: 'twbs/bootstrap',
    preprocessors: ['scss']
  }, {
    name: 'Bulma',
    repo: 'jgthms/bulma',
    preprocessors: ['sass']
  }, {
    name: 'Foundation',
    repo: 'zurb/foundation-sites',
    preprocessors: ['scss']
  }, {
    name: 'Material Design Lite',
    repo: 'google/material-design-lite',
    preprocessors: ['scss']
  }, {
    name: 'Spectre.css',
    repo: 'picturepan2/spectre',
    preprocessors: ['less']
  }, {
    name: 'Milligram',
    repo: 'milligram/milligram',
    preprocessors: ['sass', 'scss', 'less', 'stylus', 'cssnext']
  }, {
    name: 'UIkit',
    repo: 'uikit/uikit',
    preprocessors: ['less', 'scss']
  }, {
    name: 'Materialize',
    repo: 'Dogfalo/materialize',
    preprocessors: ['sass']
  }, {
    name: 'siimple',
    repo: 'siimple/siimple',
    preprocessors: ['scss']
  }, {
    name: 'pure',
    repo: 'yahoo/pure',
    preprocessors: []
  }, {
    name: 'Semantic UI',
    repo: 'Semantic-Org/Semantic-UI',
    preprocessors: ['less']
  }, {
    name: 'MUI',
    repo: 'muicss/mui',
    license: 'MIT',
    preprocessors: ['scss']
  }, {
    name: 'sakura',
    repo: 'oxalorg/sakura',
    preprocessors: ['scss']
  }, {
    name: 'Cutestrap',
    repo: 'tylerchilds/cutestrap',
    preprocessors: ['scss']
  }, {
    name: 'Kube',
    repo: 'imperavi/kube',
    preprocessors: ['scss']
  }, {
    name: 'Wing',
    repo: 'kbrsh/wing',
    preprocessors: ['stylus']
  }, {
    name: 'Mobi.css',
    repo: 'mobi-css/mobi.css',
    preprocessors: ['scss']
  }, {
    name: 'mini.css',
    repo: 'Chalarangelo/mini.css',
    preprocessors: ['scss']
  }
]
<|endoftext|>