<commit_before>'use strict';

var creation = document.getElementById('userInput');
creation.addEventListener('submit', createCharacter);

var femaleArray = ['she', 'She', 'her', 'Her'];
var maleArray = ['he', 'He', 'his', 'His'];
var otherArray = ['they', 'They', 'their', 'them'];

function createCharacter(event) {
  event.preventDefault();
  console.log('YAY!');

  var userName = event.target.user.value;
  console.log(userName);

  var character = event.target.characterName.value;
  console.log(character);

  var genderType = event.target.gender.value;
  console.log(genderType);

  if (genderType == 'She/Her'){
    genderType = femaleArray;
  }else if (genderType == 'He/Him') {
    genderType = maleArray;
  }else if (genderType == 'They/Them') {
    genderType = otherArray;
  }

  var user = new NewUser(userName, character, genderType);
  var stringifiedUser = JSON.stringify(user);
  localStorage.user = stringifiedUser;
  console.log(localStorage);
}

function NewUser(username, characterName, gender){
  this.username = username;
  this.characterName = characterName;
  this.gender = gender;
};

function Paragraph(story, choice1, choice2){
  this.story = story;
  this.choice1 = choice1;
  this.choice2 = choice2;
};

var raeStory = 'Dear Cthulhu, I have many urges and desires, but on this most sacred of nights, there is only one thing that I want. I cannot commit my request to digital media, but please look into my heart of hearts and grant my dearest wish. And I would also like a pony. Yours Truly, ' + localStorage.user.character + '\n' + '\n' + localStorage.user.character + 'finished ' + localStorage.user.genderType[2] + ' letter, and with a shaking hand, clicked the Send button. ' + localStorage.user.character + ' waited several seconds, unsure if ' + localStorage.user.genderType[0] + ' would ever receive a response to ' + localStorage.user.genderType[2] + ' request, but knew that in the end, if ' localStorage.user.genderType[2] +  ' wish was granted, the results would be obvious. ' +  localStorage.user.character + ' stood, stretching, sore from sitting for so long in front of ' localStorage.user.genderType[2] + ' computer. ' + localStorage.user.genderType[1] + ' glanced out the window, squinting at the ominously bright moon. It\’s a good time for a walk,' + localStorage.user.character + ' thought.' + localStorage.user.genderType[1] + ' put on ' + localStorage.user.genderType[2] + ' shoes, grabbed a fresh-baked cinnamon roll, and headed out the door, into the night. It was warm and muggy, fireflies glowing in the air. ' + localStorage.user.character + ' held out ' + localStorage.user.genderType[2] + ' hands, catching one of the bioluminescent bugs. ' + localStorage.user.genderType[1] + '…';

// Choice one: Put the firefly in a jar.
// Choice two: Smeared the firefly along the sidewalk in an arcane symbol.

var par1 = new Paragraph(raeStory, choice1, choice2);
var par2 = new Paragraph(story, choice1, choice2);
var par3 = new Paragraph(story, choice1, choice2);

var storyArray = [par1, par2, par3];
var stringifiedStories = JSON.stringify(storyArray);
localStorage.storyArray = stringifiedStories;
<commit_msg>corrected creation-logic parsing errors in var raeStory<commit_after>'use strict';

var creation = document.getElementById('userInput');
creation.addEventListener('submit', createCharacter);

var femaleArray = ['she', 'She', 'her', 'Her'];
var maleArray = ['he', 'He', 'his', 'His'];
var otherArray = ['they', 'They', 'their', 'them'];

function createCharacter(event) {
  event.preventDefault();
  console.log('YAY!');

  var userName = event.target.user.value;
  console.log(userName);

  var character = event.target.characterName.value;
  console.log(character);

  var genderType = event.target.gender.value;
  console.log(genderType);

  if (genderType == 'She/Her'){
    genderType = femaleArray;
  }else if (genderType == 'He/Him') {
    genderType = maleArray;
  }else if (genderType == 'They/Them') {
    genderType = otherArray;
  }

  var user = new NewUser(userName, character, genderType);
  var stringifiedUser = JSON.stringify(user);
  localStorage.user = stringifiedUser;
  console.log(localStorage);
}

function NewUser(username, characterName, gender){
  this.username = username;
  this.characterName = characterName;
  this.gender = gender;
};

function Paragraph(story, choice1, choice2){
  this.story = story;
  this.choice1 = choice1;
  this.choice2 = choice2;
};

var raeStory = 'Dear Cthulhu, I have many urges and desires, but on this most sacred of nights, there is only one thing that I want. I cannot commit my request to digital media, but please look into my heart of hearts and grant my dearest wish. And I would also like a pony. Yours Truly, ' + localStorage.user.character + '\n' + '\n' + localStorage.user.character + 'finished ' + localStorage.user.genderType[2] + ' letter, and with a shaking hand, clicked the Send button. ' + localStorage.user.character + ' waited several seconds, unsure if ' + localStorage.user.genderType[0] + ' would ever receive a response to ' + localStorage.user.genderType[2] + ' request, but knew that in the end, if ' + localStorage.user.genderType[2] + ' wish was granted, the results would be obvious. ' + localStorage.user.character + ' stood, stretching, sore from sitting for so long in front of ' + localStorage.user.genderType[2] + ' computer. ' + localStorage.user.genderType[1] + ' glanced out the window, squinting at the ominously bright moon. It\’s a good time for a walk,' + localStorage.user.character + ' thought.' + localStorage.user.genderType[1] + ' put on ' + localStorage.user.genderType[2] + ' shoes, grabbed a fresh-baked cinnamon roll, and headed out the door, into the night. It was warm and muggy, fireflies glowing in the air. ' + localStorage.user.character + ' held out ' + localStorage.user.genderType[2] + ' hands, catching one of the bioluminescent bugs. ' + localStorage.user.genderType[1] + '…';

// Choice one: Put the firefly in a jar.
// Choice two: Smeared the firefly along the sidewalk in an arcane symbol.

var par1 = new Paragraph(raeStory, choice1, choice2);
var par2 = new Paragraph(story, choice1, choice2);
var par3 = new Paragraph(story, choice1, choice2);

var storyArray = [par1, par2, par3];
var stringifiedStories = JSON.stringify(storyArray);
localStorage.storyArray = stringifiedStories;
<|endoftext|>


<commit_before>import React from 'react'
import Modal from '../modal'
import GenericForm from '../genericform'
import { setup_fields, service_definition } from '../service/utils'
import Loading from '../loading'
import rpc from 'app/rpc'
import { merge, to_map, to_list } from 'app/utils'
import {i18n} from 'app/utils/i18n'

const RuleList = React.createClass({
  componentDidMount(){
    this.updateToggles( $(this.refs.form).find('.checkbox.toggle') )
  },
  updateToggles(sel){
    let self=this
    $(sel).checkbox({
      onChecked(){
        self.props.activateRule(this.name)
      },
      onUnchecked(){
        self.props.deactivateRule(this.name)
      }
    }).addClass("ready")
  },
  componentDidUpdate(newprops){
    this.updateToggles( $(this.refs.form).find('.checkbox.toggle:not(.ready)') )
  },
  render(){
    const props = this.props
    if (props.rules.length == 0)
      return ()
    return (

          {i18n("Rule presets")}

        {props.rules.map( (r) => (

              <input type="checkbox" className="toggle" defaultChecked={r.is_active} name={r.id}/>
              {i18n(r.name)}

        ))}

    )
  }
})

const SetupComponent=React.createClass({
  getInitialState(){
    let fields=undefined
    if (this.props.service_catalog){
      fields = this.get_fields()
    }
    return {fields,
      values:
        Object.assign({name: this.props.service.name}, this.props.service.config),
      changed_rules: [],
      rules: undefined
    }
  },
  handleActivateRule(id){
    let rules = this.state.rules.map( (r) => {
      if (r.id == id ){
        return merge(r, {is_active: true})
      }
      return r
    })
    let changed_rules=this.state.changed_rules.concat([id])
    console.log("updated rules: %o", rules)
    this.setState({rules, changed_rules})
  },
  handleDeactivateRule(id){
    let rules = this.state.rules.map( (r) => {
      if (r.id == id ){
        return merge(r, {is_active: false})
      }
      return r
    })
    console.log("updated rules: %o", rules)
    let changed_rules=this.state.changed_rules.concat([id])
    this.setState({rules, changed_rules})
  },
  handleAccept : function(ev){
    ev && ev.preventDefault()

    let $form = $(this.refs.form.refs.form)
    if ( $form.form('validate form' ) ){
      //console.log("Ok %o", this.state.values)
      let operations={}
      let values = this.state.values
      this.get_fields().map( (f) => {
        let v = values[f.name]
        if (v)
          operations[f.name]=v
      })
      //console.log(operations)
      let name = $(this.refs.content).find("input[name=name]").val()
      let description = $(this.refs.content).find("textarea[name=description]").val()
      console.log(name, description)
      this.props.onUpdate( this.props.service.uuid, {
        name: name,
        description: description,
        config: operations
      } )
      // Save changed rules
      //console.log("Save rules %o %o", this.state.changed_rules, this.state.rules)
      this.state.rules.find( (rule) => {
        if (this.state.changed_rules.indexOf(rule.id)>=0){
          //console.log("Save rule %o", rule)
          this.props.onSaveRule(rule)
        }
      })
      this.props.onClose()
    }
  },
  handleUpdateForm : function(data){
    this.setState({values:data})
  },
  get_fields(){
    if (this.state && this.state.fields)
      return this.state.fields
    return setup_fields(this.props.service, this.props.service_catalog)
  },
  componentDidMount(){
    let filter = { traits: this.props.service.traits, type: "rule template" }
    console.log(filter)
    Promise.all([
      rpc.call("plugin.component.catalog", filter),
      rpc.call("rules.list", { service: this.props.service.uuid })
    ]).then( ([templates, rules]) => {
      templates = templates.map( t => ({
        id: t.id,
        name: t.name,
        traits: t.traits,
        description: t.description,
        plugin: t.plugin,
        trigger: {
          trigger: t.extra.trigger.trigger,
          params: t.extra.trigger.params
        },
        actions: to_map(to_list(t.extra.actions).map( kv => {
          const k=kv[0]
          const v=kv[1]
          return [k, { params: v.params, action: v.action }]
        }))
      }))

      //console.log(templates, rules)
      const decorated_templates = templates.map( (t) => {
        let r = rules.find( (r) => t.id == r.from_template )
        //console.log("Found rule: %o", r)
        t = merge(t, {service: this.props.service.uuid, is_active: false, from_template: t.id } )
        if (r){
          return merge( t, {is_active: r.is_active, uuid: r.uuid} )
        }
        return t
      })
      //console.log(decorated_templates)
      this.setState({rules: decorated_templates})
    })
  },
  render(){
    const rules=this.state.rules || []

    let props=this.props
    let state=this.state
    if (!props.service_catalog)
      return (
        <Loading>
        Service catalog
        </Loading>
      )
    let fields = state.fields
    if (!fields)
      fields=this.get_fields()
    let servicedef=service_definition(this.props.service.type, this.props.service_catalog)
    return (

              {i18n("Name")}
              <input type="text" name="name"
                placeholder={i18n("Service name as shown in UI")}
                defaultValue={props.service.name}/>

            <RuleList rules={rules} activateRule={this.handleActivateRule} deactivateRule={this.handleDeactivateRule}/>
            <GenericForm ref="form" fields={fields} data={{service: props.service}} updateForm={this.handleUpdateForm} onSubmit={this.handleAccept}/>

              {i18n("Description")}
              <textarea
                name="description"
                placeholder={i18n("Comments about this service")}
                defaultValue={i18n(props.service.description)}
              />

          <button className="ui ok yellow button" onClick={this.handleAccept} style={{margin: 0}}>
            {i18n("Update service settings")}
          </button>

    )
  }
})

export default SetupComponent
<commit_msg>Removed old code for rule templates at service<commit_after>import React from 'react'
import Modal from '../modal'
import GenericForm from '../genericform'
import { setup_fields, service_definition } from '../service/utils'
import Loading from '../loading'
import rpc from 'app/rpc'
import { merge, to_map, to_list } from 'app/utils'
import {i18n} from 'app/utils/i18n'

const SetupComponent=React.createClass({
  getInitialState(){
    let fields=undefined
    if (this.props.service_catalog){
      fields = this.get_fields()
    }
    return {fields,
      values:
        Object.assign({name: this.props.service.name}, this.props.service.config),
    }
  },
  handleAccept : function(ev){
    ev && ev.preventDefault()

    let $form = $(this.refs.form.refs.form)
    if ( $form.form('validate form' ) ){
      //console.log("Ok %o", this.state.values)
      let operations={}
      let values = this.state.values
      this.get_fields().map( (f) => {
        let v = values[f.name]
        if (v)
          operations[f.name]=v
      })
      //console.log(operations)
      let name = $(this.refs.content).find("input[name=name]").val()
      let description = $(this.refs.content).find("textarea[name=description]").val()
      console.log(name, description)
      this.props.onUpdate( this.props.service.uuid, {
        name: name,
        description: description,
        config: operations
      } )
      this.props.onClose()
    }
  },
  handleUpdateForm : function(data){
    this.setState({values:data})
  },
  get_fields(){
    if (this.state && this.state.fields)
      return this.state.fields
    return setup_fields(this.props.service, this.props.service_catalog)
  },
  render(){

    let props=this.props
    let state=this.state
    if (!props.service_catalog)
      return (
        <Loading>
        Service catalog
        </Loading>
      )
    let fields = state.fields
    if (!fields)
      fields=this.get_fields()
    let servicedef=service_definition(this.props.service.type, this.props.service_catalog)
    return (

              {i18n("Name")}
              <input type="text" name="name"
                placeholder={i18n("Service name as shown in UI")}
                defaultValue={props.service.name}/>

            <GenericForm ref="form" fields={fields} data={{service: props.service}} updateForm={this.handleUpdateForm} onSubmit={this.handleAccept}/>

              {i18n("Description")}
              <textarea
                name="description"
                placeholder={i18n("Comments about this service")}
                defaultValue={i18n(props.service.description)}
              />

          <button className="ui ok yellow button" onClick={this.handleAccept} style={{margin: 0}}>
            {i18n("Update service settings")}
          </button>

    )
  }
})

export default SetupComponent
<|endoftext|>


<commit_before>(function(angular){
    "use strict";

    var skeletonData = {
            global: {
                isVerified: false,
                isCombined: false,
                viewMode: 'map',
                filterEntity: null,
                locationFilters: {
                    enabled: null, // circle, address, neighborhood
                    circle: {
                        center: {
                            lat: null,
                            lng: null
                        },
                        radius: null,
                    },
                    neighborhood: {
                        center: {
                            lat: null,
                            lng: null
                        },
                        radius: 2000
                    },
                    address: {
                        text: '',
                        center: {
                            lat: null,
                            lng: null
                        }
                    }
                },
                map: {
                    zoom: null,
                    center: {
                        lat: null,
                        lng: null
                    }
                },
                enabled: {
                    agent: false,
                    space: false,
                    event: false
                }
            },
            agent: {
                keyword: '',
                areas: [],
                type: null,
                isVerified: false,
                id: null
            },
            space: {
                keyword: '',
                areas: [],
                types: [],
                acessibilidade: false,
                isVerified: false,
                id: null
            },
            event: {
                keyword: '',
                linguagens: [],
                from: null,
                to: null,
                classificacaoEtaria: null,
                isVerified: false,
            }
        };

    var diffFilter = function (input) {
        return _diffFilter(input, skeletonData);
    };

    var isEmpty = function (value) {
        if(typeof value === 'undefined' ||
           value === null) return true;

        if(angular.isObject(value)) {
            if(angular.equals(value, {}) ||
               angular.equals(value, []))
                return true;
        }

        return false;
    };

    var _diffFilter = function (input, skeleton) {
        // returns the difference from the input structure and skeleton
        // don't include nulls

        if(typeof input === 'undefined' || typeof skeleton === 'undefined' || input === skeleton) return;

        if(!angular.isObject(input)|| angular.isArray(skeleton)) {
            return input;
        }

        var output = {};

        angular.forEach(input, function(value, key){
            var currVal = _diffFilter(value, skeleton[key]);

            if(isEmpty(currVal)) return;
            this[key] = currVal;
        }, output);

        return output;
    };

    var deepExtend = function (skeleton, extension) {
        angular.forEach(extension, function(value, key){
            if(angular.isObject(value) && !angular.isArray(value)) {
                deepExtend(skeleton[key], value);
                delete extension[key];
            }
        });
        angular.extend(skeleton, extension);
        return skeleton;
    };

    var app = angular.module('search', ['ng-mapasculturais', 'SearchService', 'SearchMap', 'SearchSpatial', 'rison']);

    app.controller('SearchController', ['$scope', '$rootScope', '$location', '$rison', '$window', '$timeout', 'SearchService', function($scope, $rootScope, $location, $rison, $window, $timeout, SearchService){
        $scope.getName = function(valores, id){
            return valores.filter(function(e){if(e.id === id) return true;})[0].name;
        };

        $scope.isSelected = function(array, id){
            return (array.indexOf(id) !== -1);
        };

        $scope.toggleSelection = function(array, id){
            var index = array.indexOf(id);
            if(index !== -1){
                array.splice(index, 1);
            } else {
                array.push(id);
            }
        };

        $scope.toggleVerified = function () {
            angular.forEach($scope.data, function(value, key) {
                $scope.data[key].isVerified = !$scope.data[key].isVerified;
            });
        };

        $scope.hasFilter = function() {
            var ctx = {has: false};
            angular.forEach($scope.data, function(value, key) {
                if(key === 'global') return;
                this.has = this.has || !angular.equals(_diffFilter($scope.data[key], skeletonData[key]), {});
            }, ctx);

            return ctx.has ||
                   $scope.data.global.isVerified ||
                   $scope.data.global.locationFilters.enabled !== null;
        };

        $scope.cleanAllFilters = function () {
            angular.forEach($scope.data, function(value, key) {
                if(key === 'global') return;
                $scope.data[key] = angular.copy(skeletonData[key]);
            });
            $scope.data.global.isVerified = false;
            $scope.data.global.locationFilters = angular.copy(skeletonData.global.locationFilters);
        };

        $scope.cleanLocationFilters = function() {
            $scope.data.global.locationFilters = angular.copy(skeletonData.global.locationFilters);
        };

        $scope.tabClick = function(entity){
            var g = $scope.data.global;
            if(g.isCombined) {
                // combined search click:
                if(g.enabled[entity]){
                    // if the entity is already enabled and it's the last one enabled, avoid disabling
                    if(Object.keys(g.enabled).filter(function(e){if(g.enabled[e]) return e;}).length==1){
                        return;
                    }else{
                        g.enabled[entity] = false;
                    }
                }else{
                    g.enabled[entity] = true;
                }
            }else{
                g.filterEntity = entity;
                angular.forEach(g.enabled, function(value, key) {
                    g.enabled[key] = (key===entity);
                });
            }
        };

        $scope.tabOver = function(entity){
            if($scope.data.global.isCombined){
                $scope.data.global.filterEntity = entity;
            }
        };

        $scope.toggleCombined = function () {
            var g = $scope.data.global;
            if(g.isCombined) {
                g.isCombined = false;
                if(Object.keys(g.enabled).length > 1){
                    angular.forEach(g.enabled, function(value, key) {
                        g.enabled[key] = key===g.filterEntity;
                    });
                }
            }else{
                g.isCombined = true;
                angular.forEach(g.enabled, function(value, key) {
                    g.enabled[key] = true;
                });
            }
        };

        $scope.parseHash = function(){
            var newValue = $location.hash();

            if(newValue && newValue !== $rison.stringify(diffFilter($scope.data))){
                $scope.data = deepExtend(angular.copy(skeletonData), $rison.parse(newValue));
                $rootScope.$emit('searchDataChange', $scope.data);
            }
        };

        $scope.dataChange = function(newValue, oldValue){
            if(newValue === undefined) return;
            var serialized = $rison.stringify(diffFilter(newValue));

            if($location.hash() !== serialized){
                $location.hash(serialized);
                $timeout.cancel($scope.timer);
                $scope.timer = $timeout(function() {
                    $rootScope.$emit('searchDataChange', $scope.data);
                }, 1000);
            }
        };

        $scope.data = angular.copy(skeletonData);

        $scope.areas = MapasCulturais.taxonomyTerms.area.map(function(el, i){ return {id: i, name: el}; });
        $scope.linguagens = MapasCulturais.taxonomyTerms.linguagem.map(function(el, i){ return {id: i, name: el}; });
        MapasCulturais.entityTypes.agent.push({id:null, name: 'Todos'});
        $scope.types = MapasCulturais.entityTypes;

        $rootScope.$on('searchDataChange', function(ev, data) {
            console.log('searchDataChange emitted', data);
            SearchService(data);
        });

        $rootScope.$on('$locationChangeSuccess', $scope.parseHash);

        if($location.hash() === '') {
            $scope.tabClick('agent');
        } else {
            $scope.parseHash();
        }

        $scope.$watch('data', $scope.dataChange, true);

        $scope.numAgents = 0;
        $scope.numSpaces = 0;
        $scope.numEvents = 0;

        $rootScope.$on('searchCountResultsReady', function(ev, results){
            console.log('================= ', results);
            $scope.numAgents = results.agent;
            $scope.numSpaces = results.space;
            $scope.numEvents = results.event;
        });

    }]);
})(angular);
<commit_msg>fixed search menu when not in combined search<commit_after>(function(angular){
    "use strict";

    var skeletonData = {
            global: {
                isVerified: false,
                isCombined: false,
                viewMode: 'map',
                filterEntity: null,
                locationFilters: {
                    enabled: null, // circle, address, neighborhood
                    circle: {
                        center: {
                            lat: null,
                            lng: null
                        },
                        radius: null,
                    },
                    neighborhood: {
                        center: {
                            lat: null,
                            lng: null
                        },
                        radius: 2000
                    },
                    address: {
                        text: '',
                        center: {
                            lat: null,
                            lng: null
                        }
                    }
                },
                map: {
                    zoom: null,
                    center: {
                        lat: null,
                        lng: null
                    }
                },
                enabled: {
                    agent: false,
                    space: false,
                    event: false
                }
            },
            agent: {
                keyword: '',
                areas: [],
                type: null,
                isVerified: false,
                id: null
            },
            space: {
                keyword: '',
                areas: [],
                types: [],
                acessibilidade: false,
                isVerified: false,
                id: null
            },
            event: {
                keyword: '',
                linguagens: [],
                from: '2010-01-01',
                to: '2014-10-10',
                classificacaoEtaria: null,
                isVerified: false,
            }
        };

    var diffFilter = function (input) {
        return _diffFilter(input, skeletonData);
    };

    var isEmpty = function (value) {
        if(typeof value === 'undefined' ||
           value === null) return true;

        if(angular.isObject(value)) {
            if(angular.equals(value, {}) ||
               angular.equals(value, []))
                return true;
        }

        return false;
    };

    var _diffFilter = function (input, skeleton) {
        // returns the difference from the input structure and skeleton
        // don't include nulls

        if(typeof input === 'undefined' || typeof skeleton === 'undefined' || input === skeleton) return;

        if(!angular.isObject(input)|| angular.isArray(skeleton)) {
            return input;
        }

        var output = {};

        angular.forEach(input, function(value, key){
            var currVal = _diffFilter(value, skeleton[key]);

            if(isEmpty(currVal)) return;
            this[key] = currVal;
        }, output);

        return output;
    };

    var deepExtend = function (skeleton, extension) {
        angular.forEach(extension, function(value, key){
            if(angular.isObject(value) && !angular.isArray(value)) {
                deepExtend(skeleton[key], value);
                delete extension[key];
            }
        });
        angular.extend(skeleton, extension);
        return skeleton;
    };

    var app = angular.module('search', ['ng-mapasculturais', 'SearchService', 'SearchMap', 'SearchSpatial', 'rison']);

    app.controller('SearchController', ['$scope', '$rootScope', '$location', '$rison', '$window', '$timeout', 'SearchService', function($scope, $rootScope, $location, $rison, $window, $timeout, SearchService){
        $scope.getName = function(valores, id){
            return valores.filter(function(e){if(e.id === id) return true;})[0].name;
        };

        $scope.isSelected = function(array, id){
            return (array.indexOf(id) !== -1);
        };

        $scope.toggleSelection = function(array, id){
            var index = array.indexOf(id);
            if(index !== -1){
                array.splice(index, 1);
            } else {
                array.push(id);
            }
        };

        $scope.toggleVerified = function () {
            angular.forEach($scope.data, function(value, key) {
                $scope.data[key].isVerified = !$scope.data[key].isVerified;
            });
        };

        $scope.hasFilter = function() {
            var ctx = {has: false};
            angular.forEach($scope.data, function(value, key) {
                if(key === 'global') return;
                this.has = this.has || !angular.equals(_diffFilter($scope.data[key], skeletonData[key]), {});
            }, ctx);

            return ctx.has ||
                   $scope.data.global.isVerified ||
                   $scope.data.global.locationFilters.enabled !== null;
        };

        $scope.cleanAllFilters = function () {
            angular.forEach($scope.data, function(value, key) {
                if(key === 'global') return;
                $scope.data[key] = angular.copy(skeletonData[key]);
            });
            $scope.data.global.isVerified = false;
            $scope.data.global.locationFilters = angular.copy(skeletonData.global.locationFilters);
        };

        $scope.cleanLocationFilters = function() {
            $scope.data.global.locationFilters = angular.copy(skeletonData.global.locationFilters);
        };

        $scope.tabClick = function(entity){
            var g = $scope.data.global;
            if(g.isCombined) {
                // combined search click:
                if(g.enabled[entity]){
                    // if the entity is already enabled and it's the last one enabled, avoid disabling
                    if(Object.keys(g.enabled).filter(function(e){if(g.enabled[e]) return e;}).length==1){
                        return;
                    }else{
                        g.enabled[entity] = false;
                    }
                }else{
                    g.enabled[entity] = true;
                }
            }else{
                g.filterEntity = entity;
                angular.forEach(g.enabled, function(value, key) {
                    g.enabled[key] = (key===entity);
                });
            }
        };

        $scope.tabOver = function(entity){
            if($scope.data.global.isCombined){
                $scope.data.global.filterEntity = entity;
            }
        };

        $scope.toggleCombined = function () {
            var g = $scope.data.global;
            if(g.isCombined) {
                g.isCombined = false;
                if(Object.keys(g.enabled).length > 1){
                    angular.forEach(g.enabled, function(value, key) {
                        g.enabled[key] = key===g.filterEntity;
                    });
                }
            }else{
                g.isCombined = true;
                angular.forEach(g.enabled, function(value, key) {
                    g.enabled[key] = true;
                });
            }
        };

        $scope.parseHash = function(){
            var newValue = $location.hash();

            if(newValue && newValue !== $rison.stringify(diffFilter($scope.data))){
                $scope.data = deepExtend(angular.copy(skeletonData), $rison.parse(newValue));
                $rootScope.$emit('searchDataChange', $scope.data);
            }
        };

        $scope.dataChange = function(newValue, oldValue){
            if(newValue === undefined) return;
            var serialized = $rison.stringify(diffFilter(newValue));

            if($location.hash() !== serialized){
                $location.hash(serialized);
                $timeout.cancel($scope.timer);
                $scope.timer = $timeout(function() {
                    $rootScope.$emit('searchDataChange', $scope.data);
                }, 1000);
            }
        };

        $scope.data = angular.copy(skeletonData);

        $scope.areas = MapasCulturais.taxonomyTerms.area.map(function(el, i){ return {id: i, name: el}; });
        $scope.linguagens = MapasCulturais.taxonomyTerms.linguagem.map(function(el, i){ return {id: i, name: el}; });
        MapasCulturais.entityTypes.agent.push({id:null, name: 'Todos'});
        $scope.types = MapasCulturais.entityTypes;

        $rootScope.$on('searchDataChange', function(ev, data) {
            console.log('searchDataChange emitted', data);
            SearchService(data);
        });

        $rootScope.$on('$locationChangeSuccess', $scope.parseHash);

        if($location.hash() === '') {
            $scope.tabClick('agent');
        } else {
            $scope.parseHash();
        }

        $scope.$watch('data', $scope.dataChange, true);

        $scope.numAgents = 0;
        $scope.numSpaces = 0;
        $scope.numEvents = 0;

        $rootScope.$on('searchCountResultsReady', function(ev, results){
            console.log('================= ', results);
            $scope.numAgents = results.agent;
            $scope.numSpaces = results.space;
            $scope.numEvents = results.event;
        });

    }]);
})(angular);
<|endoftext|>


<commit_before>exports.config = {
    files: {
        javascripts: {
            joinTo: "js/app.js"
        },
        stylesheets: {
            joinTo: "css/oration.css"
        }
    },
    conventions: {
        // This option sets where we should place non-css and non-js assets in.
        // By default, we set this to "/assets/static". Files in this directory
        // will be copied to `paths.public`, which is set below to "../public".
        assets: /^(static)/,
        ignored: /elm-stuff/
    },
    // paths configuration
    paths: {
        // Dependencies and current project directories to watch
        watched: ["static", "css", "js", "vendor", "elm"],
        // Where to compile files to
        public: "../public"
    },
    plugins: {
        babel: {
            // Do not use ES6 compiler in vendor code
            ignore: [/vendor/]
        },
        elmBrunch: {
            elmFolder: "elm",
            mainModules: ["Main.elm"],
            makeParameters: ["--warn","--debug"],
            outputFolder: "../js"
        }
    },
    modules: {
        autoRequire: {
            "js/app.js": ["js/app"]
        }
    }
};
<commit_msg>speed up compiliation by not transpiling the elm output<commit_after>exports.config = {
    files: {
        javascripts: {
            joinTo: "js/app.js"
        },
        stylesheets: {
            joinTo: "css/oration.css"
        }
    },
    conventions: {
        // This option sets where we should place non-css and non-js assets in.
        // By default, we set this to "/assets/static". Files in this directory
        // will be copied to `paths.public`, which is set below to "../public".
        assets: /^(static)/,
        ignored: /elm-stuff/
    },
    // paths configuration
    paths: {
        // Dependencies and current project directories to watch
        watched: ["static", "css", "js", "vendor", "elm"],
        // Where to compile files to
        public: "../public"
    },
    plugins: {
        babel: {
            // Do not use ES6 compiler in vendor code
            ignore: [/vendor/, /main.js$/]
        },
        elmBrunch: {
            elmFolder: "elm",
            mainModules: ["Main.elm"],
            makeParameters: ["--warn","--debug"],
            outputFolder: "../js"
        }
    },
    modules: {
        autoRequire: {
            "js/app.js": ["js/app"]
        }
    }
};
<|endoftext|>


<commit_before>function YouTube() {
  'use strict';
  this.provider = 'youtube';
  this.alternatives = ['youtu', 'ytimg'];
  this.defaultFormat = 'long';
  this.formats = {
    short: this.createShortUrl,
    long: this.createLongUrl,
    embed: this.createEmbedUrl,
    shortImage: this.createShortImageUrl,
    longImage: this.createLongImageUrl
  };
  this.imageQualities = {
    '0': '0',
    '1': '1',
    '2': '2',
    '3': '3',
    DEFAULT: 'default',
    HQDEFAULT: 'hqdefault',
    SDDEFAULT: 'sddefault',
    MQDEFAULT: 'mqdefault',
    MAXRESDEFAULT: 'maxresdefault',
  };
  this.defaultImageQuality = this.imageQualities.HQDEFAULT;
  this.mediaTypes = {
    VIDEO: 'video',
    PLAYLIST: 'playlist',
    SHARE: 'share'
  };
}

YouTube.prototype.parseUrl = function (url) {
  'use strict';
  var match = url.match(
    /(?:(?:v|vi|be|videos|embed)\/(?!videoseries)|(?:v|ci)=)([\w\-]{11})/i
  );
  return match ? match[1] : undefined;
};

YouTube.prototype.parseTime = function (params) {
  'use strict';
  params.start = getTime(params.start || params.t);
  delete params.t;
  return params;
};

YouTube.prototype.parseParameters = function (params, result) {
  'use strict';
  if (params.start || params.t) {
    params.start = getTime(params.start || params.t);
    delete params.t;
  }
  if (params.v === result.id) {
    delete params.v;
  }
  if (params.list === result.id) {
    delete params.list;
  }

  return params;
};

YouTube.prototype.parseMediaType = function (result) {
  'use strict';
  if (result.params.list) {
    result.list = result.params.list;
    delete result.params.list;
  }
  if (result.id && !result.params.ci) {
    result.mediaType = this.mediaTypes.VIDEO;
  } else if (result.list) {
    delete result.id;
    result.mediaType = this.mediaTypes.PLAYLIST;
  } else if (result.params.ci) {
    delete result.params.ci;
    result.mediaType = this.mediaTypes.SHARE;
  } else {
    return undefined;
  }
  return result;
};

YouTube.prototype.parse = function (url, params) {
  'use strict';
  var _this = this;
  var result = {
    params: params,
    id: _this.parseUrl(url)
  };
  result.params = _this.parseParameters(params, result);
  result = _this.parseMediaType(result);
  return result;
};

YouTube.prototype.createShortUrl = function (vi, params) {
  'use strict';
  var url = 'https://youtu.be/' + vi.id;
  if (params.start) {
    url += '#t=' + params.start;
  }
  return url;
};

YouTube.prototype.createLongUrl = function (vi, params) {
  'use strict';
  var url = '';
  var startTime = params.start;
  delete params.start;

  if (vi.mediaType === this.mediaTypes.PLAYLIST) {
    params.feature = 'share';
    url += 'https://youtube.com/playlist';
  } else if (vi.mediaType === this.mediaTypes.VIDEO) {
    params.v = vi.id;
    url += 'https://youtube.com/watch';
  } else if (vi.mediaType === this.mediaTypes.SHARE) {
    params.ci = vi.id;
    url += 'https://www.youtube.com/shared';
  }

  if (vi.list) {
    params.list = vi.list;
  }

  url += combineParams({
    params: params
  });

  if (vi.mediaType !== this.mediaTypes.PLAYLIST && startTime) {
    url += '#t=' + startTime;
  }
  return url;
};

YouTube.prototype.createEmbedUrl = function (vi, params) {
  'use strict';
  var url = '//youtube.com/embed';

  if (vi.mediaType === this.mediaTypes.PLAYLIST) {
    params.listType = 'playlist';
  } else {
    url += '/' + vi.id;
    //loop hack
    if (params.loop === '1') {
      params.playlist = vi.id;
    }
  }

  if (vi.list) {
    params.list = vi.list;
  }

  url += combineParams({
    params: params
  });

  return url;
};

YouTube.prototype.createImageUrl = function (baseUrl, vi, params) {
  'use strict';
  var url = baseUrl + vi.id + '/';
  var quality = params.imageQuality || this.defaultImageQuality;

  return url + quality + '.jpg';
};

YouTube.prototype.createShortImageUrl = function (vi, params) {
  'use strict';
  return this.createImageUrl('https://i.ytimg.com/vi/', vi, params);
};

YouTube.prototype.createLongImageUrl = function (vi, params) {
  'use strict';
  return this.createImageUrl('https://img.youtube.com/vi/', vi, params);
};

urlParser.bind(new YouTube());
<commit_msg>Removed unused function<commit_after>function YouTube() {
  'use strict';
  this.provider = 'youtube';
  this.alternatives = ['youtu', 'ytimg'];
  this.defaultFormat = 'long';
  this.formats = {
    short: this.createShortUrl,
    long: this.createLongUrl,
    embed: this.createEmbedUrl,
    shortImage: this.createShortImageUrl,
    longImage: this.createLongImageUrl
  };
  this.imageQualities = {
    '0': '0',
    '1': '1',
    '2': '2',
    '3': '3',
    DEFAULT: 'default',
    HQDEFAULT: 'hqdefault',
    SDDEFAULT: 'sddefault',
    MQDEFAULT: 'mqdefault',
    MAXRESDEFAULT: 'maxresdefault',
  };
  this.defaultImageQuality = this.imageQualities.HQDEFAULT;
  this.mediaTypes = {
    VIDEO: 'video',
    PLAYLIST: 'playlist',
    SHARE: 'share'
  };
}

YouTube.prototype.parseUrl = function (url) {
  'use strict';
  var match = url.match(
    /(?:(?:v|vi|be|videos|embed)\/(?!videoseries)|(?:v|ci)=)([\w\-]{11})/i
  );
  return match ? match[1] : undefined;
};

YouTube.prototype.parseParameters = function (params, result) {
  'use strict';
  if (params.start || params.t) {
    params.start = getTime(params.start || params.t);
    delete params.t;
  }
  if (params.v === result.id) {
    delete params.v;
  }
  if (params.list === result.id) {
    delete params.list;
  }

  return params;
};

YouTube.prototype.parseMediaType = function (result) {
  'use strict';
  if (result.params.list) {
    result.list = result.params.list;
    delete result.params.list;
  }
  if (result.id && !result.params.ci) {
    result.mediaType = this.mediaTypes.VIDEO;
  } else if (result.list) {
    delete result.id;
    result.mediaType = this.mediaTypes.PLAYLIST;
  } else if (result.params.ci) {
    delete result.params.ci;
    result.mediaType = this.mediaTypes.SHARE;
  } else {
    return undefined;
  }
  return result;
};

YouTube.prototype.parse = function (url, params) {
  'use strict';
  var _this = this;
  var result = {
    params: params,
    id: _this.parseUrl(url)
  };
  result.params = _this.parseParameters(params, result);
  result = _this.parseMediaType(result);
  return result;
};

YouTube.prototype.createShortUrl = function (vi, params) {
  'use strict';
  var url = 'https://youtu.be/' + vi.id;
  if (params.start) {
    url += '#t=' + params.start;
  }
  return url;
};

YouTube.prototype.createLongUrl = function (vi, params) {
  'use strict';
  var url = '';
  var startTime = params.start;
  delete params.start;

  if (vi.mediaType === this.mediaTypes.PLAYLIST) {
    params.feature = 'share';
    url += 'https://youtube.com/playlist';
  } else if (vi.mediaType === this.mediaTypes.VIDEO) {
    params.v = vi.id;
    url += 'https://youtube.com/watch';
  } else if (vi.mediaType === this.mediaTypes.SHARE) {
    params.ci = vi.id;
    url += 'https://www.youtube.com/shared';
  }

  if (vi.list) {
    params.list = vi.list;
  }

  url += combineParams({
    params: params
  });

  if (vi.mediaType !== this.mediaTypes.PLAYLIST && startTime) {
    url += '#t=' + startTime;
  }
  return url;
};

YouTube.prototype.createEmbedUrl = function (vi, params) {
  'use strict';
  var url = '//youtube.com/embed';

  if (vi.mediaType === this.mediaTypes.PLAYLIST) {
    params.listType = 'playlist';
  } else {
    url += '/' + vi.id;
    //loop hack
    if (params.loop === '1') {
      params.playlist = vi.id;
    }
  }

  if (vi.list) {
    params.list = vi.list;
  }

  url += combineParams({
    params: params
  });

  return url;
};

YouTube.prototype.createImageUrl = function (baseUrl, vi, params) {
  'use strict';
  var url = baseUrl + vi.id + '/';
  var quality = params.imageQuality || this.defaultImageQuality;

  return url + quality + '.jpg';
};

YouTube.prototype.createShortImageUrl = function (vi, params) {
  'use strict';
  return this.createImageUrl('https://i.ytimg.com/vi/', vi, params);
};

YouTube.prototype.createLongImageUrl = function (vi, params) {
  'use strict';
  return this.createImageUrl('https://img.youtube.com/vi/', vi, params);
};

urlParser.bind(new YouTube());
<|endoftext|>


<commit_before>/*
 * The contents of this file are subject to the OpenMRS Public License
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
curl(
	{ baseUrl: openhmis.url.resources },
	[
		openhmis.url.backboneBase + 'js/lib/jquery',
		openhmis.url.backboneBase + 'js/openhmis',
		openhmis.url.backboneBase + 'js/lib/backbone-forms',
		openhmis.url.backboneBase + 'js/model/location',
		openhmis.url.inventoryBase + 'js/model/stockroom',
        openhmis.url.inventoryBase + 'js/view/stockroom',
		openhmis.url.backboneBase + 'js/view/generic',

		openhmis.url.backboneBase + 'js/view/list',
		openhmis.url.backboneBase + 'js/view/editors',
		openhmis.url.inventoryBase + 'js/view/editors',
		openhmis.url.backboneBase + 'js/view/search',
		openhmis.url.inventoryBase + 'js/view/search'
	],
	function($, openhmis, Backbone) {
		$(function() {

			// Display current stockrooms into list
            openhmis.startAddEditScreen(openhmis.Stockroom, {
            	listView: openhmis.GenericSearchableListView,
				searchView: openhmis.LocationAndNameSearchView,
				listFields: ['name', 'location']
			});
		});
	}
);<commit_msg>standard view for adding stockroom (wip)<commit_after>/*
 * The contents of this file are subject to the OpenMRS Public License
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
curl(
	{ baseUrl: openhmis.url.resources },
	[
		openhmis.url.backboneBase + 'js/lib/jquery',
		openhmis.url.backboneBase + 'js/openhmis',
		openhmis.url.backboneBase + 'js/lib/backbone-forms',
		openhmis.url.backboneBase + 'js/model/location',
		openhmis.url.inventoryBase + 'js/model/stockroom',
        openhmis.url.inventoryBase + 'js/view/stockroom',
		openhmis.url.backboneBase + 'js/view/generic',

		openhmis.url.backboneBase + 'js/view/list',
		openhmis.url.backboneBase + 'js/view/editors',
		openhmis.url.inventoryBase + 'js/view/editors',
		openhmis.url.backboneBase + 'js/view/search',
		openhmis.url.inventoryBase + 'js/view/search'
	],
	function($, openhmis, Backbone) {
		$(function() {

			// Display current stockrooms into list
            openhmis.startAddEditScreen(openhmis.Stockroom, {
                listView: openhmis.GenericSearchableListView,
                searchView: openhmis.LocationAndNameSearchView,
                addEditViewType: openhmis.StockroomDetailView,
                listFields: ['name', 'location'],

			});
		});
	}
);<|endoftext|>


<commit_before>/** File: candy.js
 * Candy - Chats are not dead yet.
 *
 * Authors:
 *   - Troy McCabe <troy.mccabe@geeksquad.com>
 *
 * Copyright:
 *   (c) 2012 Geek Squad. All rights reserved.
 */
var CandyShop = (function(self) { return self; }(CandyShop || {}));

/** Class: CandyShop.NameComplete
 * Allows for completion of a name in the roster
 */
CandyShop.NameComplete = (function(self, Candy, $) {
	/** Object: _options
	 * Options:
	 *   (String) nameIdentifier - Prefix to append to a name to look for. '@' now looks for '@NICK', '' looks for 'NICK', etc. Defaults to '@'
	 *   (Integer) completeKeyCode - Which key to use to complete
	 */
	var _options = {
		nameIdentifier: '@',
		completeKeyCode: 9
	};

	/** Array: _nicks
	 * An array of nicks to complete from
	 * Populated after 'candy:core.presence'
	 */
	var _nicks = [];

	/** Function: init
	 * Initialize the NameComplete plugin
	 * Show options for auto completion of names
	 *
	 * Parameters:
	 *   (Object) options - Options to apply to this plugin
	 */
	self.init = function(options) {
		// apply the supplied options to the defaults specified
		$.extend(true, _options, options);

		// listen for keydown when autocomplete options exist
		$(document).on('keydown', 'input[name="message"]', function(e) {
			// if we hear the key code for completion
			if (e.which == _options.completeKeyCode) {
				// update the list of nicks to grab
				self.populateNicks();

				// set up the vars for this method
				// break it on spaces, and get the last word in the string
				var field = $(this);
				var msgParts = field.val().split(' ');
				var lastWord = msgParts[msgParts.length - 1];
				var matches = [];

				// go through each of the nicks and compare it
				$(_nicks).each(function(index, item) {
					// if we have results
					if (item.match(lastWord) !== null) {
						matches.push(item);
					}

				});

				// if we only have one match, no need to show the picker, just replace it
				// else show the picker of the name matches
				if (matches.length == 1) {
					self.replaceName(matches[0]);
				} else if (matches.length > 1) {
					self.showPicker(matches, field);
				}

				// don't perform any key actions
				e.preventDefault();
			}
		});
	}

	/** Function: keyDown
	 * The listener for keydown in the menu
	 */
	self.keyDown = function(e) {
		// get the menu and the content element
		var menu = $('#context-menu'),
			content = menu.find('ul'),
			selected = content.find('li.selected');

		if(menu.css('display') == 'none') {
			$(document).unbind('keydown', self.keyDown);
			return;
		}

		// switch the key code
		switch (e.which) {
			// up arrow
			case 38:
				// move the selected thing up
				content.find('li.selected').removeClass('selected').prev().addClass('selected');
				break;

			// down arrow
			case 40:
				// move the selected thing down
				content.find('li.selected').removeClass('selected').next().addClass('selected');
				break;

			// the key code for completion
			case _options.completeKeyCode:
			// esc key
			case 27:
			// delete Key
			case 8:
			case 46:
			case 13:
				if (e.which == _options.completeKeyCode || e.which == 13) {
					// get the text of the selected item
					var val = content.find('li.selected').text();
					// replace the last item with the selected item
					self.replaceName(val);
				}

				// remove the listener on the field
				$('input[name="message"]').unbind('keydown', self.keyDown);

				// hide the menu
				menu.hide();
				break;
		}

		// stop the action of any keys
		e.preventDefault();
	};

	/** Function: selectOnClick
	 * The listener for click on decision in the menu
	 *
	 * Parameters:
	 *   (Event) e - The click event
	 */
	self.selectOnClick = function(e) {
		self.replaceName($(e.currentTarget).text());
		$(document).unbind('keydown', self.keyDown);
		$('#context-menu').hide();
		$('input[name="message"]').focus();
		e.preventDefault();
	};

	/** Function: populateNicks
	 * Populate the collection of nicks to autocomplete from
	 */
	self.populateNicks = function() {
		// clear the nick collection
		_nicks = [];

		// grab the roster in the current room
		var roster = Candy.Core.getRoom(Candy.View.getCurrent().roomJid).getRoster().getAll();

		// iterate and add the nicks to the collection
		$.each(roster, function(index, item) {
			_nicks.push(_options.nameIdentifier + item.getNick());
		});
	}

	/** Function: replaceName
	 *
	 */
	self.replaceName = function(replaceText) {
		// get the parts of the message
		var msgParts = $('input[name="message"]').val().split(' ');

		// If the name is the first word, add a colon to the end
		if (msgParts.length==1) {
			replaceText += ": "
		} else {
			replaceText += " "
		}

		// replace the last part with the item
		msgParts[msgParts.length - 1] = replaceText;

		// put the string back together on spaces
		$('input[name="message"]').val(msgParts.join(' '));
	}

	/** Function: showPicker
	 * Show the picker for the list of names that match
	 */
	self.showPicker = function(matches, elem) {
		// get the element
		elem = $(elem);

		// get the necessary items
		var pos = elem.offset(),
			menu = $('#context-menu'),
			content = $('ul', menu),
			i;

		// clear the content if needed
		content.empty();

		// add the matches to the list
		for(i = 0; i < matches.length; i++) {
			content.append('
' + matches[i] + '
');
		}

		// select the first item
		$(content.find('li')[0]).addClass('selected');

		content.find('li').click(self.selectOnClick);

		// bind the keydown to move around the menu
		$('input[name="message"]').bind('keydown', self.keyDown);

		// estimate the left to the # of chars * 7...not sure?
		// get the top of the box to put this thing at
		var posLeft = elem.val().length * 7,
			posTop  = Candy.Util.getPosTopAccordingToWindowBounds(menu, pos.top);

		// show it
		menu.css({'left': posLeft, 'top': posTop.px, backgroundPosition: posLeft.backgroundPositionAlignment + ' ' + posTop.backgroundPositionAlignment});
		menu.fadeIn('fast');

		return true;
	};

	return self;
}(CandyShop.NameComplete || {}, Candy, jQuery));
<commit_msg>Case insensitive match on name<commit_after>/** File: candy.js
 * Candy - Chats are not dead yet.
 *
 * Authors:
 *   - Troy McCabe <troy.mccabe@geeksquad.com>
 *
 * Copyright:
 *   (c) 2012 Geek Squad. All rights reserved.
 */
var CandyShop = (function(self) { return self; }(CandyShop || {}));

/** Class: CandyShop.NameComplete
 * Allows for completion of a name in the roster
 */
CandyShop.NameComplete = (function(self, Candy, $) {
	/** Object: _options
	 * Options:
	 *   (String) nameIdentifier - Prefix to append to a name to look for. '@' now looks for '@NICK', '' looks for 'NICK', etc. Defaults to '@'
	 *   (Integer) completeKeyCode - Which key to use to complete
	 */
	var _options = {
		nameIdentifier: '@',
		completeKeyCode: 9
	};

	/** Array: _nicks
	 * An array of nicks to complete from
	 * Populated after 'candy:core.presence'
	 */
	var _nicks = [];

	/** Function: init
	 * Initialize the NameComplete plugin
	 * Show options for auto completion of names
	 *
	 * Parameters:
	 *   (Object) options - Options to apply to this plugin
	 */
	self.init = function(options) {
		// apply the supplied options to the defaults specified
		$.extend(true, _options, options);

		// listen for keydown when autocomplete options exist
		$(document).on('keydown', 'input[name="message"]', function(e) {
			// if we hear the key code for completion
			if (e.which == _options.completeKeyCode) {
				// update the list of nicks to grab
				self.populateNicks();

				// set up the vars for this method
				// break it on spaces, and get the last word in the string
				var field = $(this);
				var msgParts = field.val().split(' ');
				var lastWord = new RegExp( "^" + msgParts[msgParts.length - 1], "i");
				var matches = [];

				// go through each of the nicks and compare it
				$(_nicks).each(function(index, item) {
					// if we have results
					if (item.match(lastWord) !== null) {
						matches.push(item);
					}

				});

				// if we only have one match, no need to show the picker, just replace it
				// else show the picker of the name matches
				if (matches.length == 1) {
					self.replaceName(matches[0]);
				} else if (matches.length > 1) {
					self.showPicker(matches, field);
				}

				// don't perform any key actions
				e.preventDefault();
			}
		});
	}

	/** Function: keyDown
	 * The listener for keydown in the menu
	 */
	self.keyDown = function(e) {
		// get the menu and the content element
		var menu = $('#context-menu'),
			content = menu.find('ul'),
			selected = content.find('li.selected');

		if(menu.css('display') == 'none') {
			$(document).unbind('keydown', self.keyDown);
			return;
		}

		// switch the key code
		switch (e.which) {
			// up arrow
			case 38:
				// move the selected thing up
				content.find('li.selected').removeClass('selected').prev().addClass('selected');
				break;

			// down arrow
			case 40:
				// move the selected thing down
				content.find('li.selected').removeClass('selected').next().addClass('selected');
				break;

			// the key code for completion
			case _options.completeKeyCode:
			// esc key
			case 27:
			// delete Key
			case 8:
			case 46:
			case 13:
				if (e.which == _options.completeKeyCode || e.which == 13) {
					// get the text of the selected item
					var val = content.find('li.selected').text();
					// replace the last item with the selected item
					self.replaceName(val);
				}

				// remove the listener on the field
				$('input[name="message"]').unbind('keydown', self.keyDown);

				// hide the menu
				menu.hide();
				break;
		}

		// stop the action of any keys
		e.preventDefault();
	};

	/** Function: selectOnClick
	 * The listener for click on decision in the menu
	 *
	 * Parameters:
	 *   (Event) e - The click event
	 */
	self.selectOnClick = function(e) {
		self.replaceName($(e.currentTarget).text());
		$(document).unbind('keydown', self.keyDown);
		$('#context-menu').hide();
		$('input[name="message"]').focus();
		e.preventDefault();
	};

	/** Function: populateNicks
	 * Populate the collection of nicks to autocomplete from
	 */
	self.populateNicks = function() {
		// clear the nick collection
		_nicks = [];

		// grab the roster in the current room
		var roster = Candy.Core.getRoom(Candy.View.getCurrent().roomJid).getRoster().getAll();

		// iterate and add the nicks to the collection
		$.each(roster, function(index, item) {
			_nicks.push(_options.nameIdentifier + item.getNick());
		});
	}

	/** Function: replaceName
	 *
	 */
	self.replaceName = function(replaceText) {
		// get the parts of the message
		var msgParts = $('input[name="message"]').val().split(' ');

		// If the name is the first word, add a colon to the end
		if (msgParts.length==1) {
			replaceText += ": "
		} else {
			replaceText += " "
		}

		// replace the last part with the item
		msgParts[msgParts.length - 1] = replaceText;

		// put the string back together on spaces
		$('input[name="message"]').val(msgParts.join(' '));
	}

	/** Function: showPicker
	 * Show the picker for the list of names that match
	 */
	self.showPicker = function(matches, elem) {
		// get the element
		elem = $(elem);

		// get the necessary items
		var pos = elem.offset(),
			menu = $('#context-menu'),
			content = $('ul', menu),
			i;

		// clear the content if needed
		content.empty();

		// add the matches to the list
		for(i = 0; i < matches.length; i++) {
			content.append('
' + matches[i] + '
');
		}

		// select the first item
		$(content.find('li')[0]).addClass('selected');

		content.find('li').click(self.selectOnClick);

		// bind the keydown to move around the menu
		$('input[name="message"]').bind('keydown', self.keyDown);

		// estimate the left to the # of chars * 7...not sure?
		// get the top of the box to put this thing at
		var posLeft = elem.val().length * 7,
			posTop  = Candy.Util.getPosTopAccordingToWindowBounds(menu, pos.top);

		// show it
		menu.css({'left': posLeft, 'top': posTop.px, backgroundPosition: posLeft.backgroundPositionAlignment + ' ' + posTop.backgroundPositionAlignment});
		menu.fadeIn('fast');

		return true;
	};

	return self;
}(CandyShop.NameComplete || {}, Candy, jQuery));
<|endoftext|>


<commit_before>//  Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without modification,
//  are permitted provided that the following conditions are met:
//  1. Redistributions of source code must retain the above copyright notice, this
//  list of conditions and the following disclaimer.
//  2. Redistributions in binary form must reproduce the above copyright notice,
//  this list of conditions and the following disclaimer in the documentation and/or
//  other materials provided with the distribution.
//  3. Neither the name of the organization nor the names of its contributors may be
//  used to endorse or promote products derived from this software without specific
//  prior written permission.

window.process = {};

window.process._RJS_baseUrl = function(n)
{
    return "..";
};

window.process._RJS_rootDir = function(n)
{
    if (n == 2) return ".";
    if (n == 1) return "readium-shared-js";
    if (n == 0) return "readium-shared-js/readium-cfi-js";
};

window.process._RJS_isBrowser = true;

require.config({

    /* http://requirejs.org/docs/api.html#config-waitSeconds */
    waitSeconds: 1,

    paths:
    {
        "version":
            process._RJS_rootDir(2) + '/dev/version'
    }
});
<commit_msg>Introduce a new way to `require` plugins when using RequireJS (dev mode). This is to fix an issue with timing that existed previously.<commit_after>//  Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without modification,
//  are permitted provided that the following conditions are met:
//  1. Redistributions of source code must retain the above copyright notice, this
//  list of conditions and the following disclaimer.
//  2. Redistributions in binary form must reproduce the above copyright notice,
//  this list of conditions and the following disclaimer in the documentation and/or
//  other materials provided with the distribution.
//  3. Neither the name of the organization nor the names of its contributors may be
//  used to endorse or promote products derived from this software without specific
//  prior written permission.

window.process = {};

window.process._RJS_baseUrl = function(n)
{
    return "..";
};

window.process._RJS_rootDir = function(n)
{
    if (n == 2) return ".";
    if (n == 1) return "readium-shared-js";
    if (n == 0) return "readium-shared-js/readium-cfi-js";
};

// Used in readium-build-tools/pluginsConfigMaker
// and readium_shared_js/globalsSetup.
// Flag as not optimized by r.js
window._RJS_isBrowser = true;

require.config({

    /* http://requirejs.org/docs/api.html#config-waitSeconds */
    waitSeconds: 1,

    paths:
    {
        "version":
            process._RJS_rootDir(2) + '/dev/version'
    }
});
<|endoftext|>


<commit_before>'use strict'
const {custom = Symbol('unavailable: custom')} = require('util').inspect
const {stringify} = require('search-tree-utils')
const {assign, getPrototypeOf} = Object
const {iterator, toStringTag} = Symbol

class SearchTree extends Map {
  constructor (elements = []) {
    super()
    elements.forEach(x => this.set(...x))
  }

  has ([first, ...rest]) {
    const spval = super.get(first)

    return Boolean(spval && (
      rest.length
        ? spval.subtree.has(rest)
        : spval.exists
    ))
  }

  get ([first, ...rest]) {
    const spval = super.get(first)

    return spval
      ? (rest.length
        ? spval.subtree.get(rest)
        : spval.value
      )
      : undefined
  }

  set ([first, ...rest], value) {
    const spval = super.get(first)

    if (spval) {
      if (rest.length) {
        spval.subtree.set(rest, value)
      } else {
        const {subtree = new SearchTree()} = spval
        assign(spval, {subtree, exists: true, value})
      }
    } else {
      const {length} = rest
      const subtree = new SearchTree(length ? [[rest, value]] : [])
      super.set(first, {subtree, exists: !length, value, __proto__: null})
    }

    return this
  }

  delete ([first, ...rest]) {
    const spval = super.get(first)

    if (!spval) return false

    const {subtree} = spval

    if (rest.length) {
      if (subtree) {
        return subtree.delete(rest)
      } else {
        super.delete(first)
        return true
      }
    } else {
      if (subtree) {
        const {exists} = spval
        spval.exists = false
        return exists
      } else {
        super.delete(first)
        return true
      }
    }
  }

  clear () {
    super.clear()
    return this
  }

  get size () {
    let sz = 0

    for (const {1: spval} of super.entries()) {
      if (!spval) continue

      const {subtree, exists} = spval
      if (!subtree) continue

      sz += subtree.size + (exists ? 1 : 0)
    }

    return sz
  }

  * entries () {
    for (const [keyel, spval] of super.entries()) {
      if (!spval) continue

      const {subtree, exists, value} = spval

      if (exists) yield [keyel, value]

      if (subtree) {
        for (const [rest, value] of subtree) {
          yield [[keyel, ...rest], value]
        }
      }
    }
  }

  [iterator] () {
    return this.entries()
  }

  toString ({
    prefix = `${this[toStringTag]}\n`,

    suffix = '',

    arrow = ' => ',

    delimiter = ',\n  ',

    brackets: [
      openBracket = '{ ',
      closeBracket = ' }'
    ] = []
  } = {}) {
    const middle = Array.from(this)
      .map(x => x.map(stringify).join(arrow))
      .join(delimiter)

    return prefix + openBracket + middle + closeBracket + suffix
  }

  get [toStringTag] () {
    return this.constructor.name
  }

  get [custom] () {
    return this.toString()
  }

  _showInternalStructure () {
    return new Map(Array.from(super.entries())
      .map(([keyel, spval]) => {
        if (!spval) return [keyel, spval]

        const {subtree, exists, value} = spval

        return [
          keyel,
          subtree
            ? {
              subtree: subtree._showInternalStructure(),
              exists,
              value
            }
            : spval
        ]
      })
    )
  }

  get _interalStructure () {
    return this._showInternalStructure()
  }

  remove (key) {
    this.remove(key)
    return this
  }

  get length () {
    return this.size
  }

  get count () {
    return this.size
  }

  static get name () {
    return 'SearchTree'
  }

  static get [toStringTag] () {
    return `class ${this.name} extends ${getPrototypeOf(this).name}`
  }

  static toString () {
    return this[toStringTag]
  }

  static create (...args) {
    return new this(...args)
  }

  static get new () {
    return this.create()
  }
}

module.exports = SearchTree
<commit_msg>Add forEach() and map()<commit_after>'use strict'
const {custom = Symbol('unavailable: custom')} = require('util').inspect
const {stringify} = require('search-tree-utils')
const {assign, getPrototypeOf} = Object
const {iterator, toStringTag} = Symbol

function SearchTreeMapperBase (map, fn) {
  const mkmapfn = transform => () => new map.constructor(
    Array.from(map).map(([key, value]) => transform(fn(value, key, map), {key, value}))
  )

  assign(this, {
    pair: mkmapfn(pair => [...pair]),
    key: mkmapfn((key, {value}) => [key, value]),
    value: mkmapfn((value, {key}) => [key, value])
  })
}

class SearchTreeMapper extends SearchTreeMapperBase {
  static create (...args) {
    return new this(...args)
  }
}

class SearchTree extends Map {
  constructor (elements = []) {
    super()
    elements.forEach(x => this.set(...x))
  }

  has ([first, ...rest]) {
    const spval = super.get(first)

    return Boolean(spval && (
      rest.length
        ? spval.subtree.has(rest)
        : spval.exists
    ))
  }

  get ([first, ...rest]) {
    const spval = super.get(first)

    return spval
      ? (rest.length
        ? spval.subtree.get(rest)
        : spval.value
      )
      : undefined
  }

  set ([first, ...rest], value) {
    const spval = super.get(first)

    if (spval) {
      if (rest.length) {
        spval.subtree.set(rest, value)
      } else {
        const {subtree = new SearchTree()} = spval
        assign(spval, {subtree, exists: true, value})
      }
    } else {
      const {length} = rest
      const subtree = new SearchTree(length ? [[rest, value]] : [])
      super.set(first, {subtree, exists: !length, value, __proto__: null})
    }

    return this
  }

  delete ([first, ...rest]) {
    const spval = super.get(first)

    if (!spval) return false

    const {subtree} = spval

    if (rest.length) {
      if (subtree) {
        return subtree.delete(rest)
      } else {
        super.delete(first)
        return true
      }
    } else {
      if (subtree) {
        const {exists} = spval
        spval.exists = false
        return exists
      } else {
        super.delete(first)
        return true
      }
    }
  }

  clear () {
    super.clear()
    return this
  }

  get size () {
    let sz = 0

    for (const {1: spval} of super.entries()) {
      if (!spval) continue

      const {subtree, exists} = spval
      if (!subtree) continue

      sz += subtree.size + (exists ? 1 : 0)
    }

    return sz
  }

  * entries () {
    for (const [keyel, spval] of super.entries()) {
      if (!spval) continue

      const {subtree, exists, value} = spval

      if (exists) yield [keyel, value]

      if (subtree) {
        for (const [rest, value] of subtree) {
          yield [[keyel, ...rest], value]
        }
      }
    }
  }

  [iterator] () {
    return this.entries()
  }

  forEach (fn) {
    for (const [key, value] of this) {
      fn(value, key, this)
    }
    return this
  }

  map (fn) {
    const {Mapper = SearchTreeMapper} = this.constructor
    return new Mapper(this, fn)
  }

  toString ({
    prefix = `${this[toStringTag]}\n`,

    suffix = '',

    arrow = ' => ',

    delimiter = ',\n  ',

    brackets: [
      openBracket = '{ ',
      closeBracket = ' }'
    ] = []
  } = {}) {
    const middle = Array.from(this)
      .map(x => x.map(stringify).join(arrow))
      .join(delimiter)

    return prefix + openBracket + middle + closeBracket + suffix
  }

  get [toStringTag] () {
    return this.constructor.name
  }

  get [custom] () {
    return this.toString()
  }

  _showInternalStructure () {
    return new Map(Array.from(super.entries())
      .map(([keyel, spval]) => {
        if (!spval) return [keyel, spval]

        const {subtree, exists, value} = spval

        return [
          keyel,
          subtree
            ? {
              subtree: subtree._showInternalStructure(),
              exists,
              value
            }
            : spval
        ]
      })
    )
  }

  get _interalStructure () {
    return this._showInternalStructure()
  }

  remove (key) {
    this.remove(key)
    return this
  }

  get length () {
    return this.size
  }

  get count () {
    return this.size
  }

  static get name () {
    return 'SearchTree'
  }

  static get [toStringTag] () {
    return `class ${this.name} extends ${getPrototypeOf(this).name}`
  }

  static toString () {
    return this[toStringTag]
  }

  static create (...args) {
    return new this(...args)
  }

  static get new () {
    return this.create()
  }
}

SearchTree.Mapper = SearchTreeMapper

module.exports = SearchTree
<|endoftext|>


<commit_before>'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var _ = require('lodash');
_.str = require('underscore.string');

// Mix in non-conflicting functions to Underscore namespace and
// Generators.
//
// Examples
//
//    this._.humanize('stuff-dash')
//    this._.classify('hello-model');
//
_.mixin(_.str.exports());

var DrupalthemeGenerator = module.exports = function DrupalthemeGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.themeName = this.env.themeName || 'nameless';
  this.themeDesc = this.env.themeDesc || 'nameless theme description';
  this.themeMachineName = this.env.themeMachineName || 'nameless';

  this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(DrupalthemeGenerator, yeoman.generators.Base);

DrupalthemeGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  var prompts = [
    {
      name: 'drupalVersion',
      message: 'Which Drupal version?',
      type: 'list',
      choices: [{
        name: 'Drupal 7',
        value: 'd7'
      }]
    },
    {
      name: 'themeStyles',
      message: 'Add Sass, or Compass or NO css preprocessor support',
      type: 'list',
      choices: [{
        name: 'SCSS',
        value: 's'
      }, {
        name: 'COMPASS',
        value: 'c'
      }, {
        name: 'NO (plain CSS)',
        value: 'n'
      }]
    },
    {
      type: 'checkbox',
      name: 'features',
      message: 'What more would you like?',
      choices: [{
        name: 'Twitter Bootstrap for Sass/Compass',
        value: 'compassBootstrap',
        checked: false
      }, {
        name: 'Frondly - the (Drupal-)friendly front-end framework',
        value: 'frondly',
        checked: false
      }, {
        name: 'Modernizr',
        value: 'modernizr',
        checked: false
      }]
    }
  ];

  this.prompt(prompts, function (props) {

    var features = props.features;
    this.styleSASS = (props.themeStyles === 's') ? true : false;
    this.styleCOMPASS = (props.themeStyles === 'c') ? true : false;
    this.drupalVersion = props.drupalVersion;
    this.compassBootstrap = features.indexOf('compassBootstrap') !== -1;
    this.frondly = features.indexOf('frondly') !== -1;
    this.modernizr = features.indexOf('modernizr') !== -1;

    cb();
  }.bind(this));
};

DrupalthemeGenerator.prototype.app = function app() {
  this.mkdir('js');
  this.mkdir('css');
  this.mkdir('images');
  if (this.styleSASS || this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.mkdir('sass');
  }
};

DrupalthemeGenerator.prototype.themeStyles = function themeStyles() {
  this.template('_style.css', 'css/style.css');
  this.template('_editor.css', 'css/editor.css');
  if (this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.template('_config.rb', 'config.rb');
  }
  if (this.styleSASS || this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.template('__config.scss', 'sass/_config.scss');
    this.template('_editor.scss', 'sass/editor.scss');
    this.template('_style.scss', 'sass/style.scss');
  }
};

DrupalthemeGenerator.prototype.themeScripts = function themeScripts() {
  var tn = this.themeMachineName;
  this.template('_javascript.js', 'js/' + tn + '.js');
};

DrupalthemeGenerator.prototype.themeInfo = function themeInfo() {
  var tn = this.themeMachineName;
  // Drupal 7
  if (this.drupalVersion === 'd7') {
    this.template('d7/_theme.info', tn + '.info');
  }
  // Drupal 8

};

DrupalthemeGenerator.prototype.themeTemplates = function themeTemplates() {
  // Drupal 7
  if (this.drupalVersion === 'd7') {
    this.template('d7/_template.php', 'template.php');
    this.directory('d7/templates', 'templates');
  }
  // Drupal 8

};

DrupalthemeGenerator.prototype.themeImages = function themeImages() {
  this.copy('_screenshot.png', 'screenshot.png');
  this.copy('_logo.png', 'logo.png');
};

DrupalthemeGenerator.prototype.bowerFiles = function bowerFiles() {
  this.template('_bower.json', 'bower.json');
  this.copy('bowerrc', '.bowerrc');
};

DrupalthemeGenerator.prototype.packageFiles = function packageFiles() {
  this.packageInfo = {
    "name": this.themeName,
    "version": "0.0.0"
  };
  this.template('_package.json', 'package.json');
};
<commit_msg>use machine name for package<commit_after>'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var _ = require('lodash');
_.str = require('underscore.string');

// Mix in non-conflicting functions to Underscore namespace and
// Generators.
//
// Examples
//
//    this._.humanize('stuff-dash')
//    this._.classify('hello-model');
//
_.mixin(_.str.exports());

var DrupalthemeGenerator = module.exports = function DrupalthemeGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.themeName = this.env.themeName || 'nameless';
  this.themeDesc = this.env.themeDesc || 'nameless theme description';
  this.themeMachineName = this.env.themeMachineName || 'nameless';

  this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(DrupalthemeGenerator, yeoman.generators.Base);

DrupalthemeGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  var prompts = [
    {
      name: 'drupalVersion',
      message: 'Which Drupal version?',
      type: 'list',
      choices: [{
        name: 'Drupal 7',
        value: 'd7'
      }]
    },
    {
      name: 'themeStyles',
      message: 'Add Sass, or Compass or NO css preprocessor support',
      type: 'list',
      choices: [{
        name: 'SCSS',
        value: 's'
      }, {
        name: 'COMPASS',
        value: 'c'
      }, {
        name: 'NO (plain CSS)',
        value: 'n'
      }]
    },
    {
      type: 'checkbox',
      name: 'features',
      message: 'What more would you like?',
      choices: [{
        name: 'Twitter Bootstrap for Sass/Compass',
        value: 'compassBootstrap',
        checked: false
      }, {
        name: 'Frondly - the (Drupal-)friendly front-end framework',
        value: 'frondly',
        checked: false
      }, {
        name: 'Modernizr',
        value: 'modernizr',
        checked: false
      }]
    }
  ];

  this.prompt(prompts, function (props) {

    var features = props.features;
    this.styleSASS = (props.themeStyles === 's') ? true : false;
    this.styleCOMPASS = (props.themeStyles === 'c') ? true : false;
    this.drupalVersion = props.drupalVersion;
    this.compassBootstrap = features.indexOf('compassBootstrap') !== -1;
    this.frondly = features.indexOf('frondly') !== -1;
    this.modernizr = features.indexOf('modernizr') !== -1;

    cb();
  }.bind(this));
};

DrupalthemeGenerator.prototype.app = function app() {
  this.mkdir('js');
  this.mkdir('css');
  this.mkdir('images');
  if (this.styleSASS || this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.mkdir('sass');
  }
};

DrupalthemeGenerator.prototype.themeStyles = function themeStyles() {
  this.template('_style.css', 'css/style.css');
  this.template('_editor.css', 'css/editor.css');
  if (this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.template('_config.rb', 'config.rb');
  }
  if (this.styleSASS || this.styleCOMPASS || this.compassBootstrap || this.frondly) {
    this.template('__config.scss', 'sass/_config.scss');
    this.template('_editor.scss', 'sass/editor.scss');
    this.template('_style.scss', 'sass/style.scss');
  }
};

DrupalthemeGenerator.prototype.themeScripts = function themeScripts() {
  var tn = this.themeMachineName;
  this.template('_javascript.js', 'js/' + tn + '.js');
};

DrupalthemeGenerator.prototype.themeInfo = function themeInfo() {
  var tn = this.themeMachineName;
  // Drupal 7
  if (this.drupalVersion === 'd7') {
    this.template('d7/_theme.info', tn + '.info');
  }
  // Drupal 8

};

DrupalthemeGenerator.prototype.themeTemplates = function themeTemplates() {
  // Drupal 7
  if (this.drupalVersion === 'd7') {
    this.template('d7/_template.php', 'template.php');
    this.directory('d7/templates', 'templates');
  }
  // Drupal 8

};

DrupalthemeGenerator.prototype.themeImages = function themeImages() {
  this.copy('_screenshot.png', 'screenshot.png');
  this.copy('_logo.png', 'logo.png');
};

DrupalthemeGenerator.prototype.bowerFiles = function bowerFiles() {
  this.template('_bower.json', 'bower.json');
  this.copy('bowerrc', '.bowerrc');
};

DrupalthemeGenerator.prototype.packageFiles = function packageFiles() {
  this.packageInfo = {
    "name": this.themeMachineName,
    "version": "0.0.0"
  };
  this.template('_package.json', 'package.json');
};
<|endoftext|>