<commit_before>/** section: scripty2 ui
 * S2.UI.Multitouch
 * Multitouch extensions.
 * The `manipulate:update` event is fired when an element is "manipulated",
 * which means when it is panned, scaled or rotated. Consumers of this event
 * do not need to worry about how the system determines if a manipulation
 * takes place.
 *
 * For now, Multitouch support needs to explicitly enabled, by setting
 *
 *
 *
 * before the DOM is fully loaded (you can insert this snippet just before the
 * BODY tag ends).
 *
 * Currently, there's two different "input modes", that fire the event, with
 * two multitouch APIs supported:
 *
 *
 *
 * * Nokia's Starlight Multitouch API - on supported devices/browsers,
 *   touching an element with one or more fingers fire the manipulate:update event.
 *   Panning, scaling and rotation can take place at the same time.
 * * Apple's iPhone Touch API - on Safari mobile on iPhone and iPod touch,
 *   touching an element with one or more fingers fire the manipulate:update
 *   event. Panning, scaling and rotation can take place at the same time.
 * * Mouse dragging (with optional shift key) - on all other browsers,
 *   manipulate:update events are fired when clicking on an element with the mouse,
 *   and then moving the mouse with the mouse button held down. Pressing the shift key
 *   when clicking the element toggles to rotation/scale mode, from the default panning mode.
 *
 * In addition to the usual event information, the manipulate:update event sends along four
 * pieces of information in it's `memo` property:
 *
 *     { panX: 12, panY: -110, rotation: 1.5707633, scale: 1.2 }
 *     // panned 12px to the right, 110px up, about 90° rotated, scaled up by 20%
 *
 *
 * * `panX` and `panY` contain information about how an element was moved,
 *   relatively to it's original page position. These values are given in pixels.
 *   These panning coordinates persist between individual touch and dragging actions.
 *   If two fingers are used to drag, the panning is relative to the mid point
 *   between those two touches. On browsers or hardware without touch or multitouch support,
 *   dragging with the mouse initiates manipulate:update events that contain panX and panY information.
 * * `rotation` contains an element's rotation relative to it's original position
 *   (set with [[Element#transform]]). This value is given in radians. If multitouch is supported,
 *   the element can be rotated by using two fingers and making a rotation movement. On browsers or
 *   hardware without touch or multitouch support, dragging with the mouse while holding down the
 *   shift key initiates rotation (and scaling), relative to the element's mid-point.
 * * `scale` contains an element's scale factor, relative to it's original scale
 *   (set with Element#transform). This value is a factor of the original size,
 *   where 1 is equal to the original size, 2 is twice the size, 0.5 half the size, and so on.
 *   If multitouch is supported, the element can be scaled by using two fingers and making a
 *   pinch or reverse-pinch (expand) movement. On browsers or hardware without touch or multitouch
 *   support, dragging with the mouse while holding down the shift key initiates scaling
 *   (and rotation), relative to the element's mid-point.
 *
 * Example for observing manipulations and logging the components:
 *
 *     $('element_id').observe('manipulate:update', function(event){
 *       console.log(Object.toJSON(event.memo));
 *     });
**/

document.observe('dom:loaded',function(){
  if(!S2.enableMultitouchSupport) return;

  var b = $(document.body), sequenceId = 0;

  function initElementData(element){
    element._rotation = element._rotation || 0;
    element._scale = element._scale || 1;
    element._panX = element._panX || 0;
    element._panY = element._panY || 0;
    element._pans = [[0,0],[0,0],[0,0]];
    element._panidx = 1;
  }

  function setElementData(element, rotation, scale, panX, panY){
    element._rotation = rotation;
    element._scale = scale;
    element._panX = panX;
    element._panY = panY;
  }

  function fireEvent(element, data){
    element.fire('manipulate:update',
      Object.extend(data, { id: sequenceId }));
  }

  function setupIPhoneEvent(){
    var element, rotation, scale,
      touches = {}, t1 = null, t2 = null, state = 0, oX, oY,
      offsetX, offsetY, initialDistance, initialRotation;
    function updateTouches(touchlist){
      var i = touchlist.length;
      while(i--) touches[touchlist[i].identifier] = touchlist[i];
      var l = []; for(k in touches) l.push(k); l = l.sort();
      t1 = l.length > 0 ? l[0] : null;
      element = t1 ? touches[t1].target : null;
      if(element && element.nodeType==3) element = element.parentNode;
      t2 = l.length > 1 ? l[1] : null;
      if(state==0 && (t1&&t2)) {
        offsetX = (touches[t1].pageX-touches[t2].pageX).abs();
        offsetY = (touches[t1].pageY-touches[t2].pageY).abs();
        if(element) initElementData(element);
        initialDistance = Math.sqrt(offsetX*offsetX + offsetY*offsetY);
        initialRotation = Math.atan2(touches[t2].pageY-touches[t1].pageY,touches[t2].pageX-touches[t1].pageX);
        state = 1;
        return;
      }
      if(state==1 && !(t1&&t2)) {
        if(element) setElementData(element, rotation, scale);
        state = 0;
      }
    }
    function touchCount(){
      var c=0; for(k in touches) c++; return c;
    }

    b.observe('touchstart', function(event){
      var t = t1, o;
      updateTouches(event.changedTouches);
      if(t==null && t1) {
        o = element.viewportOffset();
        oX = o.left+(touches[t1].pageX-o.left), oY = o.top+(touches[t1].pageY-o.top);
      }
      event.stop();
    });
    b.observe('touchmove', function(event){
      updateTouches(event.changedTouches);
      if(t1&&!t2) {
        fireEvent(element, {
          panX: (element._panX||0)+touches[t1].pageX-oX,
          panY: (element._panY||0)+touches[t1].pageY-oY,
          scale: element._scale,
          rotation: element._rotation
        });
        event.stop();
        return;
      }
      if(!(t1&&t2)) return;
      var a = touches[t2].pageX-touches[t1].pageX,
        b = touches[t2].pageY-touches[t1].pageY,
        cX = (element._panX||0) + touches[t2].pageX - a/2 - oX,
        cY = (element._panY||0) + touches[t2].pageY - b/2 - oY,
        distance = Math.sqrt(a*a + b*b);

      scale = element._scale * distance/initialDistance;
      rotation = element._rotation + Math.atan2(b,a) - initialRotation;

      fireEvent(element, { rotation: rotation, scale: scale, panX: cX, panY: cY });
      event.stop();
    });
    ['touchcancel','touchend'].each(function(eventName){
      b.observe(eventName, function(event){
        var i = event.changedTouches.length;
        while(i--) delete(touches[event.changedTouches[i].identifier]);
        updateTouches([]);
        if(element) setElementData(element, rotation, scale);
      });
    });
  }

  function setupBridgedEvent(){
    var element, rotation, scale, panX, panY, active = false;
    b.observe('manipulatestart', function(event){
      // for now, always stop the default manipulation events
      // this prevents Starlight from zooming/panning the window
      // with touching

      event.stop();

      element = event.element();
      initElementData(element);
      active = true;
    });
    b.observe('manipulatemove', function(event){
      element = event.element();
      rotation = element._rotation + event.rotation;
      scale = element._scale * event.scale;
      panX = element._panX + event.panX;
      panY = element._panY + event.panY;

      fireEvent(element, {
        rotation: rotation, scale: scale,
        panX: panX, panY: panY,
        clientX: event.clientX, clientY: event.clientY
      });
      event.stop();
    }, false);
    b.observe('manipulateend', function(event){
      element = event.element();
      if(element) setElementData(element, rotation, scale, panX, panY);
      active = false;

      var speed = Math.sqrt(event.panSpeedX*event.panSpeedX +
          event.panSpeedY*event.panSpeedY);

      if(speed>25){
        //$('debug').innerHTML = speed+',x:'+event.panSpeedX+',y:'+event.panSpeedY;
        element.fire('manipulate:flick', {
          speed: speed,
          direction: Math.atan2(event.panSpeedY,event.panSpeedX)
        });
      }
    });
    b.observe('mousemove', function(event){
      event.stop();
    });
    b.observe('mousedown', function(event){
      event.stop();
    });
    b.observe('mouseup', function(event){
      event.stop();
    });
  }

  // when shift is pressed, do mouse-based manipulate scale/rotate events
  // if not, do mouse-based panning manipulate events
  // todo: refactoring and performance optimization
  function setupGenericEvent(){
    var mX, mY, active = false, listen = true, element, mode,
      initialDistance, initialRotation, oX, oY, rotation, scale, distance;
    function objectForScaleEvent(event){
      var o = element.viewportOffset(),
        a = (event.pageX-o.left)-mX,
        b = (event.pageY-o.top)-mY;
      distance = Math.sqrt(a*a + b*b);
      scale = element._scale * distance/initialDistance;
      rotation = element._rotation + Math.atan2(b,a) - initialRotation;
      return {
        rotation: rotation, scale: scale,
        panX: element._panX, panY: element._panY };
    }
    function objectForPanEvent(event){
      return {
        rotation: element._rotation, scale: element._scale,
        panX: element._panX+event.pageX-oX, panY: element._panY+event.pageY-oY };
    }
    b.observe('mousedown', function(event){
      mode = event.shiftKey ? 'scale' : 'pan';
      element = event.element();
      if(!(element && element.fire)) return;
      sequenceId++;
      active = true;
      initElementData(element);
      var o =  element.viewportOffset();
      mX = element.offsetWidth/2;
      mY = element.offsetHeight/2;
      var a = event.pageX-o.left-mX, b = event.pageY-o.top-mY;
      initialDistance = Math.sqrt(a*a+b*b);
      initialRotation = Math.atan2(b,a);
      oX = o.left+(event.pageX-o.left), oY = o.top+(event.pageY-o.top);
      event.stop();
    });
    b.observe('mousemove', function(event){
      if(!active) return;
      fireEvent(element, mode == 'scale' ? objectForScaleEvent(event) : objectForPanEvent(event));
    });
    b.observe('mouseup', function(event){
      if(!active) return;
      active = false;
      if(mode=='scale'){
        var o = objectForScaleEvent(event);
        fireEvent(element, o);
        element._rotation = o.rotation;
        element._scale = o.scale;
      } else {
        fireEvent(element, objectForPanEvent(event));
        element._panX = element._panX+event.pageX-oX;
        element._panY = element._panY+event.pageY-oY;
      }
    });
    b.observe('dragstart', function(event){ event.stop(); });
  }

  if(navigator.userAgent.match(/QtLauncher/))
    return setupBridgedEvent();

  if(navigator.userAgent.match(/Starlight/))
    return setupBridgedEvent();

  try {
    document.createEvent("ManipulateEvent");
    return setupBridgedEvent();
  } catch(e) {}

  try {
    document.createEvent("TouchEvent");
    return setupIPhoneEvent();
  } catch(e) {}

  return setupGenericEvent();
});<commit_msg>Additional sniff for Starlight<commit_after>/** section: scripty2 ui
 * S2.UI.Multitouch
 * Multitouch extensions.
 * The `manipulate:update` event is fired when an element is "manipulated",
 * which means when it is panned, scaled or rotated. Consumers of this event
 * do not need to worry about how the system determines if a manipulation
 * takes place.
 *
 * For now, Multitouch support needs to explicitly enabled, by setting
 *
 *
 *
 * before the DOM is fully loaded (you can insert this snippet just before the
 * BODY tag ends).
 *
 * Currently, there's two different "input modes", that fire the event, with
 * two multitouch APIs supported:
 *
 *
 *
 * * Nokia's Starlight Multitouch API - on supported devices/browsers,
 *   touching an element with one or more fingers fire the manipulate:update event.
 *   Panning, scaling and rotation can take place at the same time.
 * * Apple's iPhone Touch API - on Safari mobile on iPhone and iPod touch,
 *   touching an element with one or more fingers fire the manipulate:update
 *   event. Panning, scaling and rotation can take place at the same time.
 * * Mouse dragging (with optional shift key) - on all other browsers,
 *   manipulate:update events are fired when clicking on an element with the mouse,
 *   and then moving the mouse with the mouse button held down. Pressing the shift key
 *   when clicking the element toggles to rotation/scale mode, from the default panning mode.
 *
 * In addition to the usual event information, the manipulate:update event sends along four
 * pieces of information in it's `memo` property:
 *
 *     { panX: 12, panY: -110, rotation: 1.5707633, scale: 1.2 }
 *     // panned 12px to the right, 110px up, about 90° rotated, scaled up by 20%
 *
 *
 * * `panX` and `panY` contain information about how an element was moved,
 *   relatively to it's original page position. These values are given in pixels.
 *   These panning coordinates persist between individual touch and dragging actions.
 *   If two fingers are used to drag, the panning is relative to the mid point
 *   between those two touches. On browsers or hardware without touch or multitouch support,
 *   dragging with the mouse initiates manipulate:update events that contain panX and panY information.
 * * `rotation` contains an element's rotation relative to it's original position
 *   (set with [[Element#transform]]). This value is given in radians. If multitouch is supported,
 *   the element can be rotated by using two fingers and making a rotation movement. On browsers or
 *   hardware without touch or multitouch support, dragging with the mouse while holding down the
 *   shift key initiates rotation (and scaling), relative to the element's mid-point.
 * * `scale` contains an element's scale factor, relative to it's original scale
 *   (set with Element#transform). This value is a factor of the original size,
 *   where 1 is equal to the original size, 2 is twice the size, 0.5 half the size, and so on.
 *   If multitouch is supported, the element can be scaled by using two fingers and making a
 *   pinch or reverse-pinch (expand) movement. On browsers or hardware without touch or multitouch
 *   support, dragging with the mouse while holding down the shift key initiates scaling
 *   (and rotation), relative to the element's mid-point.
 *
 * Example for observing manipulations and logging the components:
 *
 *     $('element_id').observe('manipulate:update', function(event){
 *       console.log(Object.toJSON(event.memo));
 *     });
**/

document.observe('dom:loaded',function(){
  if(!S2.enableMultitouchSupport) return;

  var b = $(document.body), sequenceId = 0;

  function initElementData(element){
    element._rotation = element._rotation || 0;
    element._scale = element._scale || 1;
    element._panX = element._panX || 0;
    element._panY = element._panY || 0;
    element._pans = [[0,0],[0,0],[0,0]];
    element._panidx = 1;
  }

  function setElementData(element, rotation, scale, panX, panY){
    element._rotation = rotation;
    element._scale = scale;
    element._panX = panX;
    element._panY = panY;
  }

  function fireEvent(element, data){
    element.fire('manipulate:update',
      Object.extend(data, { id: sequenceId }));
  }

  function setupIPhoneEvent(){
    var element, rotation, scale,
      touches = {}, t1 = null, t2 = null, state = 0, oX, oY,
      offsetX, offsetY, initialDistance, initialRotation;
    function updateTouches(touchlist){
      var i = touchlist.length;
      while(i--) touches[touchlist[i].identifier] = touchlist[i];
      var l = []; for(k in touches) l.push(k); l = l.sort();
      t1 = l.length > 0 ? l[0] : null;
      element = t1 ? touches[t1].target : null;
      if(element && element.nodeType==3) element = element.parentNode;
      t2 = l.length > 1 ? l[1] : null;
      if(state==0 && (t1&&t2)) {
        offsetX = (touches[t1].pageX-touches[t2].pageX).abs();
        offsetY = (touches[t1].pageY-touches[t2].pageY).abs();
        if(element) initElementData(element);
        initialDistance = Math.sqrt(offsetX*offsetX + offsetY*offsetY);
        initialRotation = Math.atan2(touches[t2].pageY-touches[t1].pageY,touches[t2].pageX-touches[t1].pageX);
        state = 1;
        return;
      }
      if(state==1 && !(t1&&t2)) {
        if(element) setElementData(element, rotation, scale);
        state = 0;
      }
    }
    function touchCount(){
      var c=0; for(k in touches) c++; return c;
    }

    b.observe('touchstart', function(event){
      var t = t1, o;
      updateTouches(event.changedTouches);
      if(t==null && t1) {
        o = element.viewportOffset();
        oX = o.left+(touches[t1].pageX-o.left), oY = o.top+(touches[t1].pageY-o.top);
      }
      event.stop();
    });
    b.observe('touchmove', function(event){
      updateTouches(event.changedTouches);
      if(t1&&!t2) {
        fireEvent(element, {
          panX: (element._panX||0)+touches[t1].pageX-oX,
          panY: (element._panY||0)+touches[t1].pageY-oY,
          scale: element._scale,
          rotation: element._rotation
        });
        event.stop();
        return;
      }
      if(!(t1&&t2)) return;
      var a = touches[t2].pageX-touches[t1].pageX,
        b = touches[t2].pageY-touches[t1].pageY,
        cX = (element._panX||0) + touches[t2].pageX - a/2 - oX,
        cY = (element._panY||0) + touches[t2].pageY - b/2 - oY,
        distance = Math.sqrt(a*a + b*b);

      scale = element._scale * distance/initialDistance;
      rotation = element._rotation + Math.atan2(b,a) - initialRotation;

      fireEvent(element, { rotation: rotation, scale: scale, panX: cX, panY: cY });
      event.stop();
    });
    ['touchcancel','touchend'].each(function(eventName){
      b.observe(eventName, function(event){
        var i = event.changedTouches.length;
        while(i--) delete(touches[event.changedTouches[i].identifier]);
        updateTouches([]);
        if(element) setElementData(element, rotation, scale);
      });
    });
  }

  function setupBridgedEvent(){
    var element, rotation, scale, panX, panY, active = false;
    b.observe('manipulatestart', function(event){
      // for now, always stop the default manipulation events
      // this prevents Starlight from zooming/panning the window
      // with touching

      event.stop();

      element = event.element();
      initElementData(element);
      active = true;
    });
    b.observe('manipulatemove', function(event){
      element = event.element();
      rotation = element._rotation + event.rotation;
      scale = element._scale * event.scale;
      panX = element._panX + event.panX;
      panY = element._panY + event.panY;

      fireEvent(element, {
        rotation: rotation, scale: scale,
        panX: panX, panY: panY,
        clientX: event.clientX, clientY: event.clientY
      });
      event.stop();
    }, false);
    b.observe('manipulateend', function(event){
      element = event.element();
      if(element) setElementData(element, rotation, scale, panX, panY);
      active = false;

      var speed = Math.sqrt(event.panSpeedX*event.panSpeedX +
          event.panSpeedY*event.panSpeedY);

      if(speed>25){
        //$('debug').innerHTML = speed+',x:'+event.panSpeedX+',y:'+event.panSpeedY;
        element.fire('manipulate:flick', {
          speed: speed,
          direction: Math.atan2(event.panSpeedY,event.panSpeedX)
        });
      }
    });
    b.observe('mousemove', function(event){
      event.stop();
    });
    b.observe('mousedown', function(event){
      event.stop();
    });
    b.observe('mouseup', function(event){
      event.stop();
    });
  }

  // when shift is pressed, do mouse-based manipulate scale/rotate events
  // if not, do mouse-based panning manipulate events
  // todo: refactoring and performance optimization
  function setupGenericEvent(){
    var mX, mY, active = false, listen = true, element, mode,
      initialDistance, initialRotation, oX, oY, rotation, scale, distance;
    function objectForScaleEvent(event){
      var o = element.viewportOffset(),
        a = (event.pageX-o.left)-mX,
        b = (event.pageY-o.top)-mY;
      distance = Math.sqrt(a*a + b*b);
      scale = element._scale * distance/initialDistance;
      rotation = element._rotation + Math.atan2(b,a) - initialRotation;
      return {
        rotation: rotation, scale: scale,
        panX: element._panX, panY: element._panY };
    }
    function objectForPanEvent(event){
      return {
        rotation: element._rotation, scale: element._scale,
        panX: element._panX+event.pageX-oX, panY: element._panY+event.pageY-oY };
    }
    b.observe('mousedown', function(event){
      mode = event.shiftKey ? 'scale' : 'pan';
      element = event.element();
      if(!(element && element.fire)) return;
      sequenceId++;
      active = true;
      initElementData(element);
      var o =  element.viewportOffset();
      mX = element.offsetWidth/2;
      mY = element.offsetHeight/2;
      var a = event.pageX-o.left-mX, b = event.pageY-o.top-mY;
      initialDistance = Math.sqrt(a*a+b*b);
      initialRotation = Math.atan2(b,a);
      oX = o.left+(event.pageX-o.left), oY = o.top+(event.pageY-o.top);
      event.stop();
    });
    b.observe('mousemove', function(event){
      if(!active) return;
      fireEvent(element, mode == 'scale' ? objectForScaleEvent(event) : objectForPanEvent(event));
    });
    b.observe('mouseup', function(event){
      if(!active) return;
      active = false;
      if(mode=='scale'){
        var o = objectForScaleEvent(event);
        fireEvent(element, o);
        element._rotation = o.rotation;
        element._scale = o.scale;
      } else {
        fireEvent(element, objectForPanEvent(event));
        element._panX = element._panX+event.pageX-oX;
        element._panY = element._panY+event.pageY-oY;
      }
    });
    b.observe('dragstart', function(event){ event.stop(); });
  }

  if(navigator.userAgent.match(/SLBrowser/))
    return setupBridgedEvent();

  if(navigator.userAgent.match(/QtLauncher/))
    return setupBridgedEvent();

  if(navigator.userAgent.match(/Starlight/))
    return setupBridgedEvent();

  try {
    document.createEvent("ManipulateEvent");
    return setupBridgedEvent();
  } catch(e) {}

  try {
    document.createEvent("TouchEvent");
    return setupIPhoneEvent();
  } catch(e) {}

  return setupGenericEvent();
});<|endoftext|>


<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';

import LoginTopBar from '../containers/LoginTopBar';
import PublicFooter from '../components/PublicFooter';
import MailChimpInputSection from '../components/homepage/MailChimpInputSection';

export class About extends Component {

  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const { fetchHome, loadData} = this.props;

    if (loadData) {
      fetchHome();
    }
  }

  render() {
    return (

        <LoginTopBar />

About

While the Internet has been very good so far at helping people do things together, it is still very difficult for groups to collect money and use it transparently. As a result, we see initiatives, projects, movements popping up here and there that disappear quickly from lack of funding. Imagine how many wonderful things don’t happen in the world because funding - which is oxygen for most organizations - is difficult to sustain. Without an easy way to raise and spend money, it’s hard to manage and grow many of these seeds of an idea that could change the world.

Meetups, open source projects, parent associations, neighborhood associations, pet projects, clubs, unions, movements, non-profits, business incubators - in order to operate, all of them are forced to use a physical glass jar, ask a sponsor to directly pay their expenses or front the huge overhead of setting up and managing a corporation or a non-profit. It’s either inefficient and opaque or it’s overkill.

OpenCollective enables groups to quickly set up a collective, raise funds and manage them transparently.

We want all those seeds to have a chance to grow, to bring their ideas to life. We believe everyone should have the tools to create the organizations of tomorrow. And we are dedicating ourselves to making that happen!

Contact us: info@opencollective.com

Read more: our blog or with our essays:

A New Form of Association For the Internet Generation - Part 1

A New Form of Association For the Internet Generation - Part 2

            Download the Open Collective Logo in high resolution: svg - png

Our Founding Team

Xavier Damman

Founder/CEO

Pia Mancini

Cofounder

Aseem Sood

Cofounder

We are passionate about how we can use technology to empower people to do more. So far, the Internet has been pretty good at helping people get together and do amazing things together. But once there is money involved, it is still a huge pain. It doesn't have to be that way.

Stay posted

Stay posted on our news and progress.

          <MailChimpInputSection mcListId="14d6233180" />

Stay in touch or get in touch!

            Blog
            Open Source
            Community Guidelines

        <PublicFooter />

    )
  }
}

export default connect(mapStateToProps, {})(About);

function mapStateToProps() {
  return {};
}
<commit_msg>add .com to email address<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';

import LoginTopBar from '../containers/LoginTopBar';
import PublicFooter from '../components/PublicFooter';
import MailChimpInputSection from '../components/homepage/MailChimpInputSection';

export class About extends Component {

  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const { fetchHome, loadData} = this.props;

    if (loadData) {
      fetchHome();
    }
  }

  render() {
    return (

        <LoginTopBar />

About

While the Internet has been very good so far at helping people do things together, it is still very difficult for groups to collect money and use it transparently. As a result, we see initiatives, projects, movements popping up here and there that disappear quickly from lack of funding. Imagine how many wonderful things don’t happen in the world because funding - which is oxygen for most organizations - is difficult to sustain. Without an easy way to raise and spend money, it’s hard to manage and grow many of these seeds of an idea that could change the world.

Meetups, open source projects, parent associations, neighborhood associations, pet projects, clubs, unions, movements, non-profits, business incubators - in order to operate, all of them are forced to use a physical glass jar, ask a sponsor to directly pay their expenses or front the huge overhead of setting up and managing a corporation or a non-profit. It’s either inefficient and opaque or it’s overkill.

OpenCollective enables groups to quickly set up a collective, raise funds and manage them transparently.

We want all those seeds to have a chance to grow, to bring their ideas to life. We believe everyone should have the tools to create the organizations of tomorrow. And we are dedicating ourselves to making that happen!

Contact us: info@opencollective.com

Read more: our blog or with our essays:

A New Form of Association For the Internet Generation - Part 1

A New Form of Association For the Internet Generation - Part 2

            Download the Open Collective Logo in high resolution: svg - png

Our Founding Team

Xavier Damman

Founder/CEO

Pia Mancini

Cofounder

Aseem Sood

Cofounder

We are passionate about how we can use technology to empower people to do more. So far, the Internet has been pretty good at helping people get together and do amazing things together. But once there is money involved, it is still a huge pain. It doesn't have to be that way.

Stay posted

Stay posted on our news and progress.

          <MailChimpInputSection mcListId="14d6233180" />

Stay in touch or get in touch!

            Blog
            Open Source
            Community Guidelines

        <PublicFooter />

    )
  }
}

export default connect(mapStateToProps, {})(About);

function mapStateToProps() {
  return {};
}
<|endoftext|>


<commit_before>import Android from './android.jsx';

export default Android;<commit_msg>Update index file from android <commit_after>import Sumsung from './sumsung';
import HTC from './htc';
import Nexus from './nexus';

export default {
  Sumsung,
  HTC,
  Nexus
};
<|endoftext|>


<commit_before>const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu } = Components;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

const PREF_ROOT = "extensions.logview.";
const PREF_PRIORITY = PREF_ROOT + "priority";
const PREF_PARSE_JS = PREF_ROOT + "parse_js";
const PREF_HIDE_CONTENT = PREF_ROOT + "hide_content";

const CONSOLE_TAG = "GeckoConsole";

var gWindow = null;
var gMenu = null;
var gPrefPriority;
var gPrefParseJS;
var gPrefHideContent;
var gLastTimestamp = Date.now();

// [JavaScript Warning: "foo bar"]
// [JavaScript Error: "foo bar"]
const RE_JSCONSOLE = /^\[?(.+?):([^\/].+?)\]?$/;
const RE_JSCONTENT = /https?:\/\/|RFC 5746|"downloadable font:/;

function getWindow(fn) {
  if (!gWindow) {
    gWindow = Services.wm.getMostRecentWindow("navigator:browser");
  }

  if (gWindow) {
    return fn(gWindow);
  }

  // Wait for a window.
  let listener = {
    onOpenWindow: function(window) {
      let domWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
      let onLoad = () => {
        if (!gWindow) {
          gWindow = domWindow;
        }
        fn(gWindow);
        domWindow.removeEventListener("UIReady", onLoad);
      };
      domWindow.addEventListener("UIReady", onLoad);
      Services.wm.removeListener(listener);
    },
  };
  Services.wm.addListener(listener);
}

function showLogs() {
  getWindow(function(window) {
    var browserApp = window.BrowserApp;
    if (!browserApp) {
      return;
    }
    browserApp.tabs.forEach((tab) => {
      if (!browserApp || tab.window.location.href !== "about:logs") {
        return;
      }
      browserApp.selectTab(tab);
      browserApp = null;
    });
    browserApp && browserApp.addTab("about:logs");
  });
}

function logCallback(log) {
  if (gPrefHideContent && log.tag === CONSOLE_TAG) {
    if (RE_JSCONTENT.test(log.message)) {
      return;
    }
  }

  if (gPrefParseJS && log.tag === CONSOLE_TAG) {
    let parts = RE_JSCONSOLE.exec(log.message.trim());
    if (parts && parts.length >= 3) {
      log.tag = parts[1].trim();
      log.message = parts[2].trim();
      if (log.tag.indexOf("Warning") >= 0) {
        log.priority = Logs.LOG_WARN;
      } else if (log.tag.indexOf("Error") >= 0) {
        log.priority = Logs.LOG_ERROR;
      } else {
        log.priority = Logs.LOG_INFO;
      }
    }
  }

  if (log.priority < gPrefPriority) {
    return;
  }

  let time = Date.now();
  if (time - gLastTimestamp < 100) {
    return;
  }
  gLastTimestamp = time;

  let title = Logs.getPriorityLabel(log.priority) + "/" + log.tag;
  let linebreak = log.message.indexOf("\n");
  let options = {
    button: {
      label: "View",
      callback: () => {
        new Prompt({
          title: title,
          message: log.message,
          buttons: ["Show logs", "Close"],
        }).show((data) => {
          if (data.button === 0) {
            showLogs();
          }
        });
      },
    },
  };

  getWindow(function(window) {
    window.NativeWindow.toast.show(
      title + ": " + (linebreak < 0 ? log.message : log.message.substr(0, linebreak)),
      "short", options);
  });
}

const OBSERVER = {
  observe: function(subject, topic, data) {
    if (topic != "nsPref:changed") {
      return;
    }

    if (data === PREF_PRIORITY) {
      try {
        gPrefPriority = Services.prefs.getIntPref(PREF_PRIORITY);
      } catch (e) {
      }
    } else if (data === PREF_PARSE_JS) {
      try {
        gPrefParseJS = Services.prefs.getBoolPref(PREF_PARSE_JS);
      } catch (e) {
      }
    } else if (data === PREF_HIDE_CONTENT) {
      try {
        gPrefHideContent = Services.prefs.getBoolPref(PREF_HIDE_CONTENT);
      } catch (e) {
      }
    }
  },
};

// Taken from https://github.com/staktrace/aboutlogcat
function AboutModule() {
}

AboutModule.prototype = {
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
  classDescription: "about:logs",
  classID: Components.ID("{f2e5dc15-d060-4c30-ae6d-61c953297e63}"),
  contractID: "@mozilla.org/network/protocol/about;1?what=logs",

  newChannel: function(uri) {
    var channel = Services.io.newChannel("chrome://logview/content/aboutLogs.html", null, null);
    channel.originalURI = uri;
    return channel;
  },

  getURIFlags: function(uri) {
    return Ci.nsIAboutModule.ALLOW_SCRIPT;
  }
};

const ABOUT_FACTORY =
  XPCOMUtils.generateNSGetFactory([AboutModule])(AboutModule.prototype.classID);

/**
 * bootstrap.js API
 */
function startup(aData, aReason) {
  Cu.import("chrome://logview/content/Logs.jsm");

  let prefs = Services.prefs.getDefaultBranch("");
  prefs.setIntPref(PREF_PRIORITY, gPrefPriority = Logs.LOG_ERROR);
  prefs.setBoolPref(PREF_PARSE_JS, gPrefParseJS = true);
  prefs.setBoolPref(PREF_HIDE_CONTENT, gPrefHideContent = true);

  [
    PREF_PRIORITY,
    PREF_PARSE_JS,
    PREF_HIDE_CONTENT,

  ].forEach((pref) => {
    OBSERVER.observe(null, "nsPref:changed", pref);
  });

  Logs.init();
  Logs.listen(logCallback);
  Services.prefs.addObserver(PREF_ROOT, OBSERVER, false);

  Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
    AboutModule.prototype.classID, AboutModule.prototype.classDescription,
    AboutModule.prototype.contractID, ABOUT_FACTORY);

  getWindow((window) => {
    gMenu = window.NativeWindow.menu.add({
      name: "Logs",
      parent: window.NativeWindow.menu.toolsMenuID,
      callback: showLogs
    });
  });
}

function shutdown(aData, aReason) {
  if (gMenu != null) {
    getWindow((window) => {
      window.NativeWindow.menu.remove(gMenu);
    });
  }

  Cm.unregisterFactory(AboutModule.prototype.classID, ABOUT_FACTORY);

  Services.prefs.removeObserver(PREF_ROOT, OBSERVER);
  Logs.unlisten(logCallback);
  Logs.term();
}

function install(aData, aReason) {
}

function uninstall(aData, aReason) {
}
<commit_msg>Improve showLogs logic<commit_after>const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu } = Components;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

const PREF_ROOT = "extensions.logview.";
const PREF_PRIORITY = PREF_ROOT + "priority";
const PREF_PARSE_JS = PREF_ROOT + "parse_js";
const PREF_HIDE_CONTENT = PREF_ROOT + "hide_content";

const CONSOLE_TAG = "GeckoConsole";

var gWindow = null;
var gMenu = null;
var gPrefPriority;
var gPrefParseJS;
var gPrefHideContent;
var gLastTimestamp = Date.now();

// [JavaScript Warning: "foo bar"]
// [JavaScript Error: "foo bar"]
const RE_JSCONSOLE = /^\[?(.+?):([^\/].+?)\]?$/;
const RE_JSCONTENT = /https?:\/\/|RFC 5746|"downloadable font:/;

function getWindow(fn) {
  if (!gWindow) {
    gWindow = Services.wm.getMostRecentWindow("navigator:browser");
  }

  if (gWindow) {
    return fn(gWindow);
  }

  // Wait for a window.
  let listener = {
    onOpenWindow: function(window) {
      let domWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
      let onLoad = () => {
        if (!gWindow) {
          gWindow = domWindow;
        }
        fn(gWindow);
        domWindow.removeEventListener("UIReady", onLoad);
      };
      domWindow.addEventListener("UIReady", onLoad);
      Services.wm.removeListener(listener);
    },
  };
  Services.wm.addListener(listener);
}

function showLogs() {
  getWindow(function(window) {
    let browserApp = window.BrowserApp;
    if (!browserApp) {
      return;
    }
    let isLogsTab = (tab) => {
      if (tab.window.location.href !== "about:logs") {
        return false;
      }
      browserApp.selectTab(tab);
      return true;
    };
    if (!browserApp.tabs.some(isLogsTab)) {
      browserApp.addTab("about:logs");
    }
  });
}

function logCallback(log) {
  if (gPrefHideContent && log.tag === CONSOLE_TAG) {
    if (RE_JSCONTENT.test(log.message)) {
      return;
    }
  }

  if (gPrefParseJS && log.tag === CONSOLE_TAG) {
    let parts = RE_JSCONSOLE.exec(log.message.trim());
    if (parts && parts.length >= 3) {
      log.tag = parts[1].trim();
      log.message = parts[2].trim();
      if (log.tag.indexOf("Warning") >= 0) {
        log.priority = Logs.LOG_WARN;
      } else if (log.tag.indexOf("Error") >= 0) {
        log.priority = Logs.LOG_ERROR;
      } else {
        log.priority = Logs.LOG_INFO;
      }
    }
  }

  if (log.priority < gPrefPriority) {
    return;
  }

  let time = Date.now();
  if (time - gLastTimestamp < 100) {
    return;
  }
  gLastTimestamp = time;

  let title = Logs.getPriorityLabel(log.priority) + "/" + log.tag;
  let linebreak = log.message.indexOf("\n");
  let options = {
    button: {
      label: "View",
      callback: () => {
        new Prompt({
          title: title,
          message: log.message,
          buttons: ["Show logs", "Close"],
        }).show((data) => {
          if (data.button === 0) {
            showLogs();
          }
        });
      },
    },
  };

  getWindow(function(window) {
    window.NativeWindow.toast.show(
      title + ": " + (linebreak < 0 ? log.message : log.message.substr(0, linebreak)),
      "short", options);
  });
}

const OBSERVER = {
  observe: function(subject, topic, data) {
    if (topic != "nsPref:changed") {
      return;
    }

    if (data === PREF_PRIORITY) {
      try {
        gPrefPriority = Services.prefs.getIntPref(PREF_PRIORITY);
      } catch (e) {
      }
    } else if (data === PREF_PARSE_JS) {
      try {
        gPrefParseJS = Services.prefs.getBoolPref(PREF_PARSE_JS);
      } catch (e) {
      }
    } else if (data === PREF_HIDE_CONTENT) {
      try {
        gPrefHideContent = Services.prefs.getBoolPref(PREF_HIDE_CONTENT);
      } catch (e) {
      }
    }
  },
};

// Taken from https://github.com/staktrace/aboutlogcat
function AboutModule() {
}

AboutModule.prototype = {
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
  classDescription: "about:logs",
  classID: Components.ID("{f2e5dc15-d060-4c30-ae6d-61c953297e63}"),
  contractID: "@mozilla.org/network/protocol/about;1?what=logs",

  newChannel: function(uri) {
    var channel = Services.io.newChannel("chrome://logview/content/aboutLogs.html", null, null);
    channel.originalURI = uri;
    return channel;
  },

  getURIFlags: function(uri) {
    return Ci.nsIAboutModule.ALLOW_SCRIPT;
  }
};

const ABOUT_FACTORY =
  XPCOMUtils.generateNSGetFactory([AboutModule])(AboutModule.prototype.classID);

/**
 * bootstrap.js API
 */
function startup(aData, aReason) {
  Cu.import("chrome://logview/content/Logs.jsm");

  let prefs = Services.prefs.getDefaultBranch("");
  prefs.setIntPref(PREF_PRIORITY, gPrefPriority = Logs.LOG_ERROR);
  prefs.setBoolPref(PREF_PARSE_JS, gPrefParseJS = true);
  prefs.setBoolPref(PREF_HIDE_CONTENT, gPrefHideContent = true);

  [
    PREF_PRIORITY,
    PREF_PARSE_JS,
    PREF_HIDE_CONTENT,

  ].forEach((pref) => {
    OBSERVER.observe(null, "nsPref:changed", pref);
  });

  Logs.init();
  Logs.listen(logCallback);
  Services.prefs.addObserver(PREF_ROOT, OBSERVER, false);

  Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
    AboutModule.prototype.classID, AboutModule.prototype.classDescription,
    AboutModule.prototype.contractID, ABOUT_FACTORY);

  getWindow((window) => {
    gMenu = window.NativeWindow.menu.add({
      name: "Logs",
      parent: window.NativeWindow.menu.toolsMenuID,
      callback: showLogs
    });
  });
}

function shutdown(aData, aReason) {
  if (gMenu != null) {
    getWindow((window) => {
      window.NativeWindow.menu.remove(gMenu);
    });
  }

  Cm.unregisterFactory(AboutModule.prototype.classID, ABOUT_FACTORY);

  Services.prefs.removeObserver(PREF_ROOT, OBSERVER);
  Logs.unlisten(logCallback);
  Logs.term();
}

function install(aData, aReason) {
}

function uninstall(aData, aReason) {
}
<|endoftext|>


<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';

import FlatButton from 'material-ui/FlatButton';
import Cookies from 'js-cookie';
import IconButton from 'material-ui/IconButton';
import { Link } from 'react-router-dom';
import { compose } from 'react-apollo';

// graphql
import { tenantsQuery } from '../../graphql/methods/tenants';
import { settingsQuery } from '../../graphql/methods/settings';

// layouts:
import ModalLogin from '../../modules/login/ModalLogin';
import ModalSignup from '../../modules/login/ModalSignup';
import ModalForgotPwd from '../../modules/login/ModalForgotPwd';
import LeftMenu from './leftMenu/LeftMenu';
import CommentarySearchToolbar from './search/CommentarySearchToolbar';
import CommentarySearchPanel from './search/CommentarySearchPanel';
import ProfileAvatarButton from './user/ProfileAvatarButton';
import Utils from '../../lib/utils';

/*
	helpers
*/
const styles = {
	flatButton: {
		width: 'auto',
		minWidth: 'none',
		height: '80px',
		padding: '25px 5px',
	},
	flatIconButton: {
		padding: '10px 20px',
		width: 'auto',
		minWidth: 'none',
		height: '55px',
	},
	leftMenuToggle: {
		padding: '5px 10px',
		width: 'auto',
		minWidth: 'none',
		height: 'auto',
		margin: '24px 20px',
	},
	lineSearch: {
		width: 250,
		padding: '10px 15px',
	},
};

/*
	BEGIN Header
*/
class Header extends Component {

	constructor(props) {
		super(props);
		const user = Cookies.get('user');
		this.state = {
			leftMenuOpen: false,
			rightMenuOpen: false,
			searchEnabled: props.initialSearchEnabled,
			searchDropdownOpen: '',
			subworks: [],
			activeWork: '',
			modalLoginLowered: false,
			modalSignupLowered: !!props.showSignup,
			modalForgotPwdLowered: !!props.showForgotPwd,
			tenantId: sessionStorage.getItem('tenantId'),
			user: user ? JSON.parse(user) : undefined
		};

		// methods:
		this.toggleSearchMode = this.toggleSearchMode.bind(this);
		this.toggleLeftMenu = this.toggleLeftMenu.bind(this);
		this.closeLeftMenu = this.closeLeftMenu.bind(this);
		this.toggleRightMenu = this.toggleRightMenu.bind(this);
		this.closeRightMenu = this.closeRightMenu.bind(this);
		this.toggleSearchDropdown = this.toggleSearchDropdown.bind(this);
		this.toggleWorkSearchTerm = this.toggleWorkSearchTerm.bind(this);
		this.showLoginModal = this.showLoginModal.bind(this);
		this.showSignupModal = this.showSignupModal.bind(this);
		this.closeLoginModal = this.closeLoginModal.bind(this);
		this.closeSignupModal = this.closeSignupModal.bind(this);
		this.closeForgotPwdModal = this.closeForgotPwdModal.bind(this);
	}

	toggleSearchMode() {

		const { addCommentPage } = this.props;
		const { searchEnabled } = this.state;

		if (window.location.pathname.indexOf('/commentary') === 0 || addCommentPage) {
			this.setState({
				searchEnabled: !searchEnabled,
			});
		} else window.location.href = '/commentary';
	}

	toggleLeftMenu() {
		this.setState({
			leftMenuOpen: !this.state.leftMenuOpen,
		});
	}

	closeLeftMenu() {
		this.setState({
			leftMenuOpen: false,
		});
	}

	toggleRightMenu() {
		this.setState({
			rightMenuOpen: !this.state.rightMenuOpen,
		});
	}

	closeRightMenu() {
		this.setState({
			rightMenuOpen: false,
		});
	}

	toggleSearchDropdown(targetDropdown) {

		const { searchDropdownOpen } = this.state;

		if (searchDropdownOpen === targetDropdown) {
			this.setState({
				searchDropdownOpen: '',
			});
		} else {
			this.setState({
				searchDropdownOpen: targetDropdown,
			});
		}
	}

	toggleWorkSearchTerm(key, value) {

		const { toggleSearchTerm } = this.props;
		const { activeWork } = this.state;

		value.subworks.forEach((subwork, subworkIndex) => {
			value.subworks[subworkIndex].work = value;
		});

		if (activeWork === value.slug) {
			this.setState({
				subworks: [],
				activeWork: '',
			});
		} else {
			value.subworks.sort((a, b) => {
				if (a.n  b.n) {
					return 1;
				}
				return 0;
			});
			this.setState({
				subworks: value.subworks,
				activeWork: value.slug,
			});
		}

		toggleSearchTerm(key, value);
	}

	showLoginModal() {
		this.setState({
			modalLoginLowered: true,
		});
	}

	showSignupModal() {
		this.setState({
			modalSignupLowered: true,
		});
	}

	closeLoginModal() {
		this.setState({
			modalLoginLowered: false,
		});
	}

	closeSignupModal() {
		if (this.props.showSignup) {
			this.props.history.push('/');
		}
		this.setState({
			modalSignupLowered: false,
		});
	}

	closeForgotPwdModal() {
		if (this.props.showForgotPwd) {
			this.props.history.push('/');
		}
		this.setState({
			modalForgotPwdLowered: false,
		});
	}
	componentWillReceiveProps(nextProps) {
		this.setState({
			settings: nextProps.settingsQuery.loading ? {} : nextProps.settingsQuery.settings.find(x => x.tenantId === this.state.tenantId),
			tenant: this.props.tenantsQuery.loading ? {} : this.props.tenantsQuery.tenants.find(x => x._id === this.state.tenantId),
		});
	}
	render() {

		const { filters, isOnHomeView, isTest, toggleSearchTerm, handleChangeTextsearch, handleChangeLineN, addCommentPage, selectedWork } = this.props;
		const { leftMenuOpen, rightMenuOpen, searchEnabled, modalLoginLowered, settings, tenant, user } = this.state;
		const modalSignupLowered = this.state.modalSignupLowered || this.props.showSignup;
		const modalForgotPwdLowered = this.state.modalForgotPwdLowered || this.props.showForgotPwd;
		return (

				<LeftMenu
					open={leftMenuOpen}
					closeLeftMenu={this.closeLeftMenu}
				/>

				{!isOnHomeView && (
					toggleSearchTerm
					&& handleChangeTextsearch
					&& handleChangeLineN
				) ?
					<CommentarySearchPanel
						toggleSearchTerm={toggleSearchTerm}
						handleChangeTextsearch={handleChangeTextsearch}
						handleChangeLineN={handleChangeLineN}
						open={rightMenuOpen}
						closeRightMenu={this.closeRightMenu}
						filters={filters}
						isTest={isTest}
					/>
				: ''}

					{!searchEnabled ?

								<IconButton
									className="left-drawer-toggle"
									iconClassName="material-icons"
									style={styles.leftMenuToggle}
									onClick={this.toggleLeftMenu}>
										menu
								</IconButton>

								{tenant && tenant.isAnnotation ?

{settings ? settings.name : undefined}

								:
									<Link to="/" className="header-home-link">

{settings ? settings.name : undefined}

									</Link>
								}

								{tenant && !tenant.isAnnotation &&

										<IconButton
											className="search-button right-drawer-toggle"
											iconClassName="material-icons"
											onClick={this.toggleRightMenu}>
												search
										</IconButton>

								}

									{tenant && !tenant.isAnnotation &&

											<Link to="/commentary">
												<FlatButton
													label="Commentary"
													style={styles.flatButton}
												/>
											</Link>
											<Link to={settings && settings.aboutURL ? settings.aboutURL : '/about'}>
												<FlatButton
													label="About"
													style={styles.flatButton}
												/>
											</Link>

									}
									{user ?

                                            {   this.state.user &&
                                                Utils.userInRole(this.state.user, ['editor', 'admin', 'commenter'])
                                            ?

													{tenant && !tenant.isAnnotation &&

															<Link to="/commentary/create">
																<FlatButton
																	label="Add Comment"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>
															<Link to="/tags/create">
																<FlatButton
																	label="Add Tag"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>
															<Link to="/textNodes/edit">
																<FlatButton
																	label="Add Translation"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>

													}
													<ProfileAvatarButton
														showUserDropdown={this.showUserDropdown}
														hideUserDropdown={this.hideUserDropdown}
													/>

												:

													<ProfileAvatarButton
														showUserDropdown={this.showUserDropdown}
														hideUserDropdown={this.hideUserDropdown}
													/>

											}

									:

											<Link to={tenant && tenant.isAnnotation ? '/sign-in' : ''}>
												<FlatButton
													label="Login"
													onClick={tenant && !tenant.isAnnotation ? this.showLoginModal : undefined}
													style={styles.flatButton}
													className="account-button account-button-login"
												/>
											</Link>
											<Link to={tenant && tenant.isAnnotation ? '/sign-up' : ''}>
												<FlatButton
													label="Join the Community"
													onClick={tenant && !tenant.isAnnotation ? this.showSignupModal : undefined}
													style={styles.flatButton}
													className="account-button account-button-login"
												/>
											</Link>

									}
									{tenant && !tenant.isAnnotation &&

											<IconButton
												className="search-button"
												iconClassName="material-icons"
												onClick={this.toggleSearchMode}>
													search
											</IconButton>

									}

					:

							{tenant && !tenant.isAnnotation &&

 {/* Search toolbar for /commentary */}

										<IconButton
											className="left-drawer-toggle"
											iconClassName="material-icons"
											style={styles.leftMenuToggle}
											onClick={this.toggleLeftMenu}>
												menu
										</IconButton>

											<IconButton
												className="search-button right-drawer-toggle"
												onClick={this.toggleRightMenu}
												iconClassName="material-icons">
												search
											</IconButton>

										{!isOnHomeView && (
											toggleSearchTerm
											&& handleChangeLineN
										) ?

												<CommentarySearchToolbar
													toggleSearchTerm={toggleSearchTerm}
													handleChangeTextsearch={handleChangeTextsearch}
													handleChangeLineN={handleChangeLineN}
													filters={filters}
													addCommentPage={addCommentPage}
													isTest={isTest}
													selectedWork={selectedWork}
												/>

													<IconButton
														className="search-button"
														onClick={this.toggleSearchMode}
														iconClassName="material-icons">
														search
													</IconButton>

										: ''}

							}

					}

				{!user && modalLoginLowered &&
					<ModalLogin
						lowered={modalLoginLowered}
						closeModal={this.closeLoginModal}
						signupModal={this.showSignupModal}
						history={this.props.history}
					/>
				}
				{!user && modalSignupLowered &&
					<ModalSignup
						lowered={modalSignupLowered}
						closeModal={this.closeSignupModal}
						loginModal={this.showLoginModal}
					/>
				}
				{!user && modalForgotPwdLowered &&
				<ModalForgotPwd
					lowered={modalForgotPwdLowered}
					signupModal={this.showSignupModal}
					closeModal={this.closeForgotPwdModal}
				/>
				}

		);
	}
}
/*
	END Header
*/
Header.propTypes = {
	filters: PropTypes.any, // eslint-disable-line react/forbid-prop-types
	toggleSearchTerm: PropTypes.func,
	handleChangeTextsearch: PropTypes.func,
	handleChangeLineN: PropTypes.func,
	initialSearchEnabled: PropTypes.bool,
	addCommentPage: PropTypes.bool,
	isOnHomeView: PropTypes.bool,
	isTest: PropTypes.bool,
	selectedWork: PropTypes.object,
	tenantsQuery: PropTypes.object,
	settingsQuery: PropTypes.object,

	// from creatContainer:
	settings: PropTypes.shape({
		name: PropTypes.string,
	}),
	tenant: PropTypes.shape({
		subdomain: PropTypes.string,
		isAnnotation: PropTypes.bool,
	}),
	showSignup: PropTypes.func,
	showForgotPwd: PropTypes.func,
	history: PropTypes.any,
	user: PropTypes.object

};
Header.defaultProps = {
	filters: [],
	initialSearchEnabled: false,
	addCommentPage: false,
	isOnHomeView: false,
};
export default compose(
	tenantsQuery,
	settingsQuery
)(Header);
<commit_msg>fix addComment bug<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';

import FlatButton from 'material-ui/FlatButton';
import Cookies from 'js-cookie';
import IconButton from 'material-ui/IconButton';
import { Link } from 'react-router-dom';
import { compose } from 'react-apollo';

// graphql
import { tenantsQuery } from '../../graphql/methods/tenants';
import { settingsQuery } from '../../graphql/methods/settings';

// layouts:
import ModalLogin from '../../modules/login/ModalLogin';
import ModalSignup from '../../modules/login/ModalSignup';
import ModalForgotPwd from '../../modules/login/ModalForgotPwd';
import LeftMenu from './leftMenu/LeftMenu';
import CommentarySearchToolbar from './search/CommentarySearchToolbar';
import CommentarySearchPanel from './search/CommentarySearchPanel';
import ProfileAvatarButton from './user/ProfileAvatarButton';
import Utils from '../../lib/utils';

/*
	helpers
*/
const styles = {
	flatButton: {
		width: 'auto',
		minWidth: 'none',
		height: '80px',
		padding: '25px 5px',
	},
	flatIconButton: {
		padding: '10px 20px',
		width: 'auto',
		minWidth: 'none',
		height: '55px',
	},
	leftMenuToggle: {
		padding: '5px 10px',
		width: 'auto',
		minWidth: 'none',
		height: 'auto',
		margin: '24px 20px',
	},
	lineSearch: {
		width: 250,
		padding: '10px 15px',
	},
};

/*
	BEGIN Header
*/
class Header extends Component {

	constructor(props) {
		super(props);
		const user = Cookies.get('user');
		this.state = {
			leftMenuOpen: false,
			rightMenuOpen: false,
			searchEnabled: props.initialSearchEnabled,
			searchDropdownOpen: '',
			subworks: [],
			activeWork: '',
			modalLoginLowered: false,
			modalSignupLowered: !!props.showSignup,
			modalForgotPwdLowered: !!props.showForgotPwd,
			tenantId: sessionStorage.getItem('tenantId'),
			user: user ? JSON.parse(user) : undefined
		};

		// methods:
		this.toggleSearchMode = this.toggleSearchMode.bind(this);
		this.toggleLeftMenu = this.toggleLeftMenu.bind(this);
		this.closeLeftMenu = this.closeLeftMenu.bind(this);
		this.toggleRightMenu = this.toggleRightMenu.bind(this);
		this.closeRightMenu = this.closeRightMenu.bind(this);
		this.toggleSearchDropdown = this.toggleSearchDropdown.bind(this);
		this.toggleWorkSearchTerm = this.toggleWorkSearchTerm.bind(this);
		this.showLoginModal = this.showLoginModal.bind(this);
		this.showSignupModal = this.showSignupModal.bind(this);
		this.closeLoginModal = this.closeLoginModal.bind(this);
		this.closeSignupModal = this.closeSignupModal.bind(this);
		this.closeForgotPwdModal = this.closeForgotPwdModal.bind(this);
	}

	toggleSearchMode() {

		const { addCommentPage } = this.props;
		const { searchEnabled } = this.state;

		if (window.location.pathname.indexOf('/commentary') === 0 || addCommentPage) {
			this.setState({
				searchEnabled: !searchEnabled,
			});
		} else window.location.href = '/commentary';
	}

	toggleLeftMenu() {
		this.setState({
			leftMenuOpen: !this.state.leftMenuOpen,
		});
	}

	closeLeftMenu() {
		this.setState({
			leftMenuOpen: false,
		});
	}

	toggleRightMenu() {
		this.setState({
			rightMenuOpen: !this.state.rightMenuOpen,
		});
	}

	closeRightMenu() {
		this.setState({
			rightMenuOpen: false,
		});
	}

	toggleSearchDropdown(targetDropdown) {

		const { searchDropdownOpen } = this.state;

		if (searchDropdownOpen === targetDropdown) {
			this.setState({
				searchDropdownOpen: '',
			});
		} else {
			this.setState({
				searchDropdownOpen: targetDropdown,
			});
		}
	}

	toggleWorkSearchTerm(key, value) {

		const { toggleSearchTerm } = this.props;
		const { activeWork } = this.state;

		value.subworks.forEach((subwork, subworkIndex) => {
			value.subworks[subworkIndex].work = value;
		});

		if (activeWork === value.slug) {
			this.setState({
				subworks: [],
				activeWork: '',
			});
		} else {
			value.subworks.sort((a, b) => {
				if (a.n  b.n) {
					return 1;
				}
				return 0;
			});
			this.setState({
				subworks: value.subworks,
				activeWork: value.slug,
			});
		}

		toggleSearchTerm(key, value);
	}

	showLoginModal() {
		this.setState({
			modalLoginLowered: true,
		});
	}

	showSignupModal() {
		this.setState({
			modalSignupLowered: true,
		});
	}

	closeLoginModal() {
		this.setState({
			modalLoginLowered: false,
		});
	}

	closeSignupModal() {
		if (this.props.showSignup) {
			this.props.history.push('/');
		}
		this.setState({
			modalSignupLowered: false,
		});
	}

	closeForgotPwdModal() {
		if (this.props.showForgotPwd) {
			this.props.history.push('/');
		}
		this.setState({
			modalForgotPwdLowered: false,
		});
	}
	componentWillReceiveProps(nextProps) {
		this.setState({
			settings: nextProps.settingsQuery.loading ? {} : nextProps.settingsQuery.settings.find(x => x.tenantId === this.state.tenantId),
			tenant: this.props.tenantsQuery.loading ? {} : this.props.tenantsQuery.tenants.find(x => x._id === this.state.tenantId),
		});
	}
	render() {

		const { filters, isOnHomeView, isTest, toggleSearchTerm, handleChangeTextsearch, handleChangeLineN, addCommentPage, selectedWork } = this.props;
		const { leftMenuOpen, rightMenuOpen, searchEnabled, modalLoginLowered, settings, tenant, user } = this.state;
		const modalSignupLowered = this.state.modalSignupLowered || this.props.showSignup;
		const modalForgotPwdLowered = this.state.modalForgotPwdLowered || this.props.showForgotPwd;
		return (

				<LeftMenu
					open={leftMenuOpen}
					closeLeftMenu={this.closeLeftMenu}
				/>

				{!isOnHomeView && (
					toggleSearchTerm
					&& handleChangeTextsearch
					&& handleChangeLineN
				) ?
					<CommentarySearchPanel
						toggleSearchTerm={toggleSearchTerm}
						handleChangeTextsearch={handleChangeTextsearch}
						handleChangeLineN={handleChangeLineN}
						open={rightMenuOpen}
						closeRightMenu={this.closeRightMenu}
						filters={filters}
						isTest={isTest}
					/>
				: ''}

					{!searchEnabled ?

								<IconButton
									className="left-drawer-toggle"
									iconClassName="material-icons"
									style={styles.leftMenuToggle}
									onClick={this.toggleLeftMenu}>
										menu
								</IconButton>

								{tenant && tenant.isAnnotation ?

{settings ? settings.name : undefined}

								:
									<Link to="/" className="header-home-link">

{settings ? settings.name : undefined}

									</Link>
								}

								{tenant && !tenant.isAnnotation &&

										<IconButton
											className="search-button right-drawer-toggle"
											iconClassName="material-icons"
											onClick={this.toggleRightMenu}>
												search
										</IconButton>

								}

									{tenant && !tenant.isAnnotation &&

											<Link to="/commentary">
												<FlatButton
													label="Commentary"
													style={styles.flatButton}
												/>
											</Link>
											<Link to={settings && settings.aboutURL ? settings.aboutURL : '/about'}>
												<FlatButton
													label="About"
													style={styles.flatButton}
												/>
											</Link>

									}
									{user ?

                                            {   this.state.user &&
                                                Utils.userInRole(this.state.user, ['editor', 'admin', 'commenter'])
                                            ?

													{tenant && !tenant.isAnnotation &&

															<Link to="/commentary/create">
																<FlatButton
																	label="Add Comment"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>
															<Link to="/tags/create">
																<FlatButton
																	label="Add Tag"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>
															<Link to="/textNodes/edit">
																<FlatButton
																	label="Add Translation"
																	className=""
																	style={styles.flatButton}
																/>
															</Link>

													}
													<ProfileAvatarButton
														showUserDropdown={this.showUserDropdown}
														hideUserDropdown={this.hideUserDropdown}
													/>

												:

													<ProfileAvatarButton
														showUserDropdown={this.showUserDropdown}
														hideUserDropdown={this.hideUserDropdown}
													/>

											}

									:

											{ isOnHomeView ?
											<Link to={tenant && tenant.isAnnotation ? '/sign-in' : ''}>
												<FlatButton
													label="Login"
													onClick={tenant && !tenant.isAnnotation ? this.showLoginModal : undefined}
													style={styles.flatButton}
													className="account-button account-button-login"
												/>
											</Link>: ''}
											<Link to={tenant && tenant.isAnnotation ? '/sign-up' : ''}>
												<FlatButton
													label="Join the Community"
													onClick={tenant && !tenant.isAnnotation ? this.showSignupModal : undefined}
													style={styles.flatButton}
													className="account-button account-button-login"
												/>
											</Link>

									}
									{tenant && !tenant.isAnnotation &&

											<IconButton
												className="search-button"
												iconClassName="material-icons"
												onClick={this.toggleSearchMode}>
													search
											</IconButton>

									}

					:

							{tenant && !tenant.isAnnotation &&

 {/* Search toolbar for /commentary */}

										<IconButton
											className="left-drawer-toggle"
											iconClassName="material-icons"
											style={styles.leftMenuToggle}
											onClick={this.toggleLeftMenu}>
												menu
										</IconButton>

											<IconButton
												className="search-button right-drawer-toggle"
												onClick={this.toggleRightMenu}
												iconClassName="material-icons">
												search
											</IconButton>

										{!isOnHomeView && (
											toggleSearchTerm
											&& handleChangeLineN
										) ?

												<CommentarySearchToolbar
													toggleSearchTerm={toggleSearchTerm}
													handleChangeTextsearch={handleChangeTextsearch}
													handleChangeLineN={handleChangeLineN}
													filters={filters}
													addCommentPage={addCommentPage}
													isTest={isTest}
													selectedWork={selectedWork}
												/>

													<IconButton
														className="search-button"
														onClick={this.toggleSearchMode}
														iconClassName="material-icons">
														search
													</IconButton>

										: ''}

							}

					}

				{!user && modalLoginLowered &&
					<ModalLogin
						lowered={modalLoginLowered}
						closeModal={this.closeLoginModal}
						signupModal={this.showSignupModal}
						history={this.props.history}
					/>
				}
				{!user && modalSignupLowered &&
					<ModalSignup
						lowered={modalSignupLowered}
						closeModal={this.closeSignupModal}
						loginModal={this.showLoginModal}
					/>
				}
				{!user && modalForgotPwdLowered &&
				<ModalForgotPwd
					lowered={modalForgotPwdLowered}
					signupModal={this.showSignupModal}
					closeModal={this.closeForgotPwdModal}
				/>
				}

		);
	}
}
/*
	END Header
*/
Header.propTypes = {
	filters: PropTypes.any, // eslint-disable-line react/forbid-prop-types
	toggleSearchTerm: PropTypes.func,
	handleChangeTextsearch: PropTypes.func,
	handleChangeLineN: PropTypes.func,
	initialSearchEnabled: PropTypes.bool,
	addCommentPage: PropTypes.bool,
	isOnHomeView: PropTypes.bool,
	isTest: PropTypes.bool,
	selectedWork: PropTypes.object,
	tenantsQuery: PropTypes.object,
	settingsQuery: PropTypes.object,

	// from creatContainer:
	settings: PropTypes.shape({
		name: PropTypes.string,
	}),
	tenant: PropTypes.shape({
		subdomain: PropTypes.string,
		isAnnotation: PropTypes.bool,
	}),
	showSignup: PropTypes.func,
	showForgotPwd: PropTypes.func,
	history: PropTypes.any,
	user: PropTypes.object

};
Header.defaultProps = {
	filters: [],
	initialSearchEnabled: false,
	addCommentPage: false,
	isOnHomeView: false,
};
export default compose(
	tenantsQuery,
	settingsQuery
)(Header);
<|endoftext|>


<commit_before>export { default as AutocompleteInput } from "./AutocompleteInput";
export { default as Input } from "./Input";
<commit_msg>ui: export AutocompleteDropdown from text index<commit_after>export { default as AutocompleteInput } from "./AutocompleteInput";
export { default as AutocompleteDropdown } from "./AutocompleteDropdown";
export { default as Input } from "./Input";
<|endoftext|>


<commit_before>/* vim: set ts=2 ft=javascript */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
const Cm = Components.manager;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");

var sLibrary;
var sCallbacks = new Array();

function GetBinaryFile()
{
  if (ctypes.voidptr_t.size == 4) {
    return FileUtils.getFile("ProfD", ["extensions", "toast-alert@wontfix.net", "ToastNotification.dll"]);
  }
  return FileUtils.getFile("ProfD", ["extensions", "toast-alert@wontfix.net", "ToastNotification64.dll"]);
}

function IsSupported()
{
  if (!sLibrary) {
    sLibrary = ctypes.open(GetBinaryFile().path);
  }

  var setAppId = sLibrary.declare("SetAppId",
                                 ctypes.winapi_abi,
                                 ctypes.bool);
  return setAppId();
}

function ToastAlertService()
{
}

ToastAlertService.prototype = {
  showAlert: function(aAlert, aListener) {
    if (!aAlert) {
      return;
    }
    showNativeAlert(aAlert.imageURL,
                    aAlert.title,
                    aAlert.text,
                    aAlert.textClickable,
                    aAlert.cookie,
                    aListener,
                    aAlert.name);
  },

  showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable,
                                  aCookie, aListener, aName, aDir, aLang,
                                  aData, aPrincipal, aInPrivateBrowsing,
                                  aRequireInteraction) {
    showNativeAlert(aImageUrl, aTitle, aText, aTextClickable, aCookie, aListener, aName);
  }

  showNativeAlert: function(aImageUrl, aTitle, aText, aTextClickable,
                            aCookie, aListener, aName) {
    var callbackPtr = ctypes.FunctionType(ctypes.stdcall_abi, ctypes.void_t).ptr;

    var DisplayToastNotification = sLibrary.declare("DisplayToastNotification",
                                     ctypes.winapi_abi,
                                     ctypes.bool,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     callbackPtr,
                                     callbackPtr);

    var callbackClick = null;
    if (aTextClickable) {
      callbackClick = callbackPtr(function() {
        if (this.listener) {
          this.listener.observe(null, "alertclickcallback", this.cookie);
        }
      },
      { listener: aListener, cookie: aCookie });
    }

    var callbackClose = callbackPtr(function() {
      if (this.listener) {
        this.listener.observe(null, "alertfinished", this.cookie);
      }
      sCallbacks.forEach(function(element) {
        if (element.name === this.name) {
          sCallbacks.pop(element);
        }
      });
    },
    { listener: aListener, cookie: aCookie, name: aName });

    // keep callback objects for GC
    sCallbacks.push({click: callbackClick, close: callbackClose, name: aName});

    if (!DisplayToastNotification(aTitle, aText, aImageUrl, aName, callbackClick, callbackClose)) {
    	throw Cr.NS_ERROR_FAILURE;
    }

    if (aListener) {
      aListener.observe(null, "alertshow", aCookie);
    }
  },

  closeAlert: function(aName, aPrincipal) {
    var CloseToastNotification = sLibrary.declare("CloseToastNotification",
                                     ctypes.winapi_abi,
                                     ctypes.bool,
                                     ctypes.jschar.ptr);
    CloseToastNotification(aName);
  },

  showPersistentNofitication: function(aPersistentData, aAlert, aAlertListener) {
    sowAlert(aAlert, aAlertListener);
  },

  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),

  classDescription: "alert service using Windows 8 native toast",
  contractID: "@mozilla.org/system-alerts-service;1",
  classID: Components.ID("{6270a80b-07e3-481b-804a-644ed6bc991d}"),
};

var alertService = new ToastAlertService;

var factory = {
  createInstance: function(aOuter, aIid) {
    if (aOuter) {
      throw Cr.NS_ERROR_NO_AGGREGATION;
    }
    return alertService.QueryInterface(aIid);
  },
  lockFactory: function(aLock) {
    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
  },
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};

function registerComponents()
{
  let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
  registrar.registerFactory(alertService.classID,
                            alertService.classDescription,
                            alertService.contractID,
                            factory);
}

function unregisterComponents()
{
  if (sLibrary) {
    sLibrary.close();
    sLibrary = null;
  }
  try {
    let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
    registrar.unregisterFactory(alertService.classID, factory);
  } catch (e) {
  	// ignore error
  }
}

function install(aData, aReason)
{
}

function uninstall(aData, aReason)
{
}

function startup(aData, aReason)
{
  if (!IsSupported()) {
    return;
  }
  registerComponents();
}

function shutdown(aData, aReason)
{
  unregisterComponents();
}
<commit_msg>Fix undefined error<commit_after>/* vim: set ts=2 ft=javascript */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
const Cm = Components.manager;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");

var sLibrary;
var sCallbacks = new Array();

function GetBinaryFile()
{
  if (ctypes.voidptr_t.size == 4) {
    return FileUtils.getFile("ProfD", ["extensions", "toast-alert@wontfix.net", "ToastNotification.dll"]);
  }
  return FileUtils.getFile("ProfD", ["extensions", "toast-alert@wontfix.net", "ToastNotification64.dll"]);
}

function IsSupported()
{
  if (!sLibrary) {
    sLibrary = ctypes.open(GetBinaryFile().path);
  }

  var setAppId = sLibrary.declare("SetAppId",
                                 ctypes.winapi_abi,
                                 ctypes.bool);
  return setAppId();
}

function ToastAlertService()
{
}

ToastAlertService.prototype = {
  showAlert: function(aAlert, aListener) {
    if (!aAlert) {
      return;
    }
    this.showNativeAlert(aAlert.imageURL,
                         aAlert.title,
                         aAlert.text,
                         aAlert.textClickable,
                         aAlert.cookie,
                         aListener,
                         aAlert.name);
  },

  showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable,
                                  aCookie, aListener, aName, aDir, aLang,
                                  aData, aPrincipal, aInPrivateBrowsing,
                                  aRequireInteraction) {
    this.showNativeAlert(aImageUrl, aTitle, aText, aTextClickable, aCookie, aListener, aName);
  },

  showNativeAlert: function(aImageUrl, aTitle, aText, aTextClickable,
                            aCookie, aListener, aName) {
    var callbackPtr = ctypes.FunctionType(ctypes.stdcall_abi, ctypes.void_t).ptr;

    var DisplayToastNotification = sLibrary.declare("DisplayToastNotification",
                                     ctypes.winapi_abi,
                                     ctypes.bool,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     ctypes.jschar.ptr,
                                     callbackPtr,
                                     callbackPtr);

    var callbackClick = null;
    if (aTextClickable) {
      callbackClick = callbackPtr(function() {
        if (this.listener) {
          this.listener.observe(null, "alertclickcallback", this.cookie);
        }
      },
      { listener: aListener, cookie: aCookie });
    }
    var callbackClose = callbackPtr(function() {
      if (this.listener) {
        this.listener.observe(null, "alertfinished", this.cookie);
      }
      sCallbacks.forEach(function(element) {
        if (element.name === this.name) {
          sCallbacks.pop(element);
        }
      });
    },
    { listener: aListener, cookie: aCookie, name: aName });

    // keep callback objects for GC
    sCallbacks.push({click: callbackClick, close: callbackClose, name: aName});

    if (!DisplayToastNotification(aTitle, aText, aImageUrl, aName, callbackClick, callbackClose)) {
    	throw Cr.NS_ERROR_FAILURE;
    }

    if (aListener) {
      aListener.observe(null, "alertshow", aCookie);
    }
  },

  closeAlert: function(aName, aPrincipal) {
    var CloseToastNotification = sLibrary.declare("CloseToastNotification",
                                     ctypes.winapi_abi,
                                     ctypes.bool,
                                     ctypes.jschar.ptr);
    CloseToastNotification(aName);
  },

  showPersistentNofitication: function(aPersistentData, aAlert, aAlertListener) {
    sowAlert(aAlert, aAlertListener);
  },

  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),

  classDescription: "alert service using Windows 8 native toast",
  contractID: "@mozilla.org/system-alerts-service;1",
  classID: Components.ID("{6270a80b-07e3-481b-804a-644ed6bc991d}"),
};

var alertService = new ToastAlertService;

var factory = {
  createInstance: function(aOuter, aIid) {
    if (aOuter) {
      throw Cr.NS_ERROR_NO_AGGREGATION;
    }
    return alertService.QueryInterface(aIid);
  },
  lockFactory: function(aLock) {
    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
  },
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};

function registerComponents()
{
  let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
  registrar.registerFactory(alertService.classID,
                            alertService.classDescription,
                            alertService.contractID,
                            factory);
}

function unregisterComponents()
{
  if (sLibrary) {
    sLibrary.close();
    sLibrary = null;
  }
  try {
    let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
    registrar.unregisterFactory(alertService.classID, factory);
  } catch (e) {
  	// ignore error
  }
}

function install(aData, aReason)
{
}

function uninstall(aData, aReason)
{
}

function startup(aData, aReason)
{
  if (!IsSupported()) {
    return;
  }
  registerComponents();
}

function shutdown(aData, aReason)
{
  unregisterComponents();
}
<|endoftext|>


<commit_before>import React, { Component } from 'react';
import KioskGroup from './kioskGroup';

export default class MainInterface extends Component {
  constructor(props) {
    super(props);

    const tempKiosk = [
      { id: 1, mall: 'Westfield San Francisco', city: 'San Francisco', state: 'CA', zip: 94103, batteriesInUse: 7, batteriesToReplenish: 17, batteriesInStock: 18 },
      { id: 2, mall: 'Westfield Santa Ana', city: 'Santa Ana', state: 'CA', zip: 92307, batteriesInUse: 19, batteriesToReplenish: 12, batteriesInStock: 38 },
      { id: 3, mall: 'Westfield San Leandro', city: 'San Leandro', state: 'CA', zip: 92222, batteriesInUse: 44, batteriesToReplenish: 33, batteriesInStock: 12 },
      { id: 4, mall: 'The Grove', city: 'San Diego', state: 'CA', zip: 97118, batteriesInUse: 3, batteriesToReplenish: 1, batteriesInStock: 50 },
      { id: 5, mall: 'Angel Park Mall', city: 'Los Angeles', state: 'CA', zip: 90199, batteriesInUse: 1, batteriesToReplenish: 9, batteriesInStock: 5 },
      { id: 6, mall: 'The Great Mall', city: 'AnytownUSA', state: 'CA', zip: 42497, batteriesInUse: 7, batteriesToReplenish: 17, batteriesInStock: 18 },
    ];

    this.state = {
      kiosk: tempKiosk,
    };

    console.log('thisstatekiosk', this.state.kiosk);
  }

  render() {
    return (

        <KioskGroup
          kiosk={this.state.kiosk}
        />

    );
  }
}
<commit_msg>Adding online/offline color status<commit_after>import React, { Component } from 'react';
import KioskGroup from './kioskGroup';

export default class MainInterface extends Component {
  constructor(props) {
    super(props);

    const tempKiosk = [
      { id: 1, mall: 'Westfield San Francisco', city: 'San Francisco', state: 'CA', zip: 94103, batteriesInUse: 7, batteriesToReplenish: 17, batteriesInStock: 18, online: true },
      { id: 2, mall: 'Westfield Santa Ana', city: 'Santa Ana', state: 'CA', zip: 92307, batteriesInUse: 19, batteriesToReplenish: 12, batteriesInStock: 38, online: true },
      { id: 3, mall: 'Westfield San Leandro', city: 'San Leandro', state: 'CA', zip: 92222, batteriesInUse: 44, batteriesToReplenish: 33, batteriesInStock: 12, online: true },
      { id: 4, mall: 'The Grove', city: 'San Diego', state: 'CA', zip: 97118, batteriesInUse: 3, batteriesToReplenish: 1, batteriesInStock: 50, online: true },
      { id: 5, mall: 'Angel Park Mall', city: 'Los Angeles', state: 'CA', zip: 90199, batteriesInUse: 1, batteriesToReplenish: 9, batteriesInStock: 5, online: true },
      { id: 6, mall: 'The Great Mall', city: 'AnytownUSA', state: 'CA', zip: 42497, batteriesInUse: 7, batteriesToReplenish: 17, batteriesInStock: 18, online: true },
    ];

    this.state = {
      kiosk: tempKiosk,
    };

    console.log('thisstatekiosk', this.state.kiosk);
  }

  render() {
    return (

        <KioskGroup
          kiosk={this.state.kiosk}
        />

    );
  }
}
<|endoftext|>


<commit_before>'use strict';

/* global Vue */

Vue.component('view-login', {
    template: '#view-login-template',
    data: function () {
        return {
            busy: false,
            error: false,
            username: '',
            password: '',
            users: []
        };
    },
    methods: {
        login: function () {
            var that = this;

            that.busy = true;
            that.error = false;

            that.$root.Core.session.login(that.username, that.password, function (error, user) {
                that.busy = false;

                if (error) {
                    that.error = true;
                    that.username = '';
                    that.password = '';

                    Vue.nextTick(function () { $('#inputUsername').focus(); });

                    return console.error('Login failed:', error.status ? error.status : error);
                }

                that.error = false;

                // TODO should be a signal/slot
                that.$root.main();
            });
        }
    },
    ready: function () {
        var that = this;

        this.$root.Core.users.list(function (error, result) {
            that.users = result;
            console.log(result)
        });

        Vue.nextTick(function () { $('#inputUsername').focus(); });
    }
});
<commit_msg>Remove console.log<commit_after>'use strict';

/* global Vue */

Vue.component('view-login', {
    template: '#view-login-template',
    data: function () {
        return {
            busy: false,
            error: false,
            username: '',
            password: '',
            users: []
        };
    },
    methods: {
        login: function () {
            var that = this;

            that.busy = true;
            that.error = false;

            that.$root.Core.session.login(that.username, that.password, function (error, user) {
                that.busy = false;

                if (error) {
                    that.error = true;
                    that.username = '';
                    that.password = '';

                    Vue.nextTick(function () { $('#inputUsername').focus(); });

                    return console.error('Login failed:', error.status ? error.status : error);
                }

                that.error = false;

                // TODO should be a signal/slot
                that.$root.main();
            });
        }
    },
    ready: function () {
        var that = this;

        this.$root.Core.users.list(function (error, result) {
            that.users = result;
        });

        Vue.nextTick(function () { $('#inputUsername').focus(); });
    }
});
<|endoftext|>


<commit_before>/*

  Gekko is a Bitcoin trading bot for popular Bitcoin exchanges written
  in node, it features multiple trading methods using technical analysis.

  Disclaimer:

  USE AT YOUR OWN RISK!

  The author of this project is NOT responsible for any damage or loss caused
  by this software. There can be bugs and the bot may not perform as expected
  or specified. Please consider testing it first with paper trading /
  backtesting on historical data. Also look at the code to see what how
  it's working.

*/

var util = require('./core/util');
var dirs = util.dirs();

var _ = require('lodash');
var async = require('async');

var log = require(dirs.core + 'log');

var moduleHelper = require(dirs.core + 'moduleHelper');

// if the user just wants to see the current version
if(util.getArgument('v')) {
  util.logVersion();
  util.die();
}

// make sure the current node version is recent enough
if(!util.recentNode())
  util.die([
    'Your local version of nodejs is to old. ',
    'You have ',
    process.version,
    ' and you need atleast ',
    util.getRequiredNodeVersion()
  ].join(''));

var config = util.getConfig();

// Temporary checks to make sure everything we need is
// up to date and present on the system.

// temp at Fri Jan 17 16:00:19 CET 2014
if(config.normal)
  util.die('Please update your config! config.normal is now called config.watch');
if(config.EMA)
  util.die('Please update your config! EMA is now called DEMA');
// temp at Wed Jan 22 12:18:08 CET 2014
if(!config.profitSimulator.slippage)
  util.die('Please update your config! The profit simulator is missing slippage');
// temp at Sun Feb  9 17:13:45 CET 2014
if(!config.DEMA.thresholds)
  util.die('Please update your config!');
// temp at Sun Feb 23 14:39:09 CET 2014
if(!config.RSI)
  util.die('Please update your config!');

if(
  config.trader.enabled &&
  !config['I understand that Gekko only automates MY OWN trading strategies']
)
  util.die('Do you understand what Gekko will do with your money? Read this first:\n\nhttps://github.com/askmike/gekko/issues/201');

// START

log.info('Gekko v' + util.getVersion(), 'started');
log.info('I\'m gonna make you rich, Bud Fox.', '\n\n');

// currently we only support a single
// market and a single advisor.

// make sure the monitoring exchange is configured correctly for monitoring

var exchangeChecker = require(dirs.core + 'exchangeChecker');
var invalid = exchangeChecker.cantMonitor(config.watch);

var BudFox = require(dirs.budfox + 'budfox');

function StringifyStream(){
    require('stream').Transform.call(this);
    this._readableState.objectMode = false;
    this._writableState.objectMode = true;
}
require('util').inherits(StringifyStream, require('stream').Transform);
StringifyStream.prototype._transform = function(obj, encoding, cb){
    this.push(JSON.stringify(obj) + '\n');
    cb();
};

new BudFox(config.watch)
  .start()
  .pipe(new require('stringify-stream')())
  .pipe(process.stdout);

return;

var modules = [];
var emitters = {};

// load each module (plugins and internal parts)
var loadModules = function(next) {
  // get internal modules
  var moduleSettings = _.map(require(dirs.core + 'modules'), function(s) {
    s.internal = true;
    s.path = dirs.core + s.slug;
    return s;
  });

  // transform plugins into modules
  var pluginSettings = _.map(require(dirs.gekko + 'plugins'), function(s) {
    s.path = dirs.plugins + s.slug;
    return s;
  });

  // only load enabled plugin
  pluginSettings = _.filter(pluginSettings, function(s) {
    return s.enabled;
  });

  // append enabled plugins to modules
  moduleSettings = moduleSettings.concat(pluginSettings);

  // load all modules
  async.mapSeries(
    moduleSettings,
    moduleHelper.load,
    function(error, _modules) {
      if(error)
        return util.die(error);

      modules = _modules;
      next();
    }
  );
};

// Emitters are modules that emit events to which others can subscribe.
var setupEmitters = function(next) {

  _.each(modules, function(module) {
    if(module.meta.emits)
      emitters[module.meta.slug] = module;
  });

  next();
}

var subscribeModules = function(next) {

  var subscriptions = require(dirs.core + 'subscriptions');

  _.each(modules, function(module) {
    _.each(subscriptions, function(sub) {

      if(_.has(module, sub.handler)) {

        // if the actor wants to listen
        // to something disabled
        if(!emitters[sub.emitter]) {
          if(!module.meta.internal)
            return log.warn([
              module.meta.name,
              'wanted to listen to the',
              sub.emitter + ',',
              'however the',
              sub.emitter,
              'is disabled.'
            ].join(' '))

          return;
        }

        // attach handler
        emitters[sub.emitter]
          .on(sub.event,
            util.defer(
              module[
                sub.handler
              ])
            );
      }

    });
  });

  next();
}

log.info('Setting up Gekko in', util.gekkoMode(), 'mode');
log.empty();

async.series(
  [
    loadModules,
    setupEmitters,
    subscribeModules
  ],
  function() {
    // everything is setup!
    emitters.heart.start();
  }
);<commit_msg>cleanup<commit_after>/*

  Gekko is a Bitcoin trading bot for popular Bitcoin exchanges written
  in node, it features multiple trading methods using technical analysis.

  Disclaimer:

  USE AT YOUR OWN RISK!

  The author of this project is NOT responsible for any damage or loss caused
  by this software. There can be bugs and the bot may not perform as expected
  or specified. Please consider testing it first with paper trading /
  backtesting on historical data. Also look at the code to see what how
  it's working.

*/

var util = require('./core/util');
var dirs = util.dirs();

var _ = require('lodash');
var async = require('async');

var log = require(dirs.core + 'log');

var moduleHelper = require(dirs.core + 'moduleHelper');

// if the user just wants to see the current version
if(util.getArgument('v')) {
  util.logVersion();
  util.die();
}

// make sure the current node version is recent enough
if(!util.recentNode())
  util.die([
    'Your local version of nodejs is to old. ',
    'You have ',
    process.version,
    ' and you need atleast ',
    util.getRequiredNodeVersion()
  ].join(''));

var config = util.getConfig();

// Temporary checks to make sure everything we need is
// up to date and present on the system.

// temp at Fri Jan 17 16:00:19 CET 2014
if(config.normal)
  util.die('Please update your config! config.normal is now called config.watch');
if(config.EMA)
  util.die('Please update your config! EMA is now called DEMA');
// temp at Wed Jan 22 12:18:08 CET 2014
if(!config.profitSimulator.slippage)
  util.die('Please update your config! The profit simulator is missing slippage');
// temp at Sun Feb  9 17:13:45 CET 2014
if(!config.DEMA.thresholds)
  util.die('Please update your config!');
// temp at Sun Feb 23 14:39:09 CET 2014
if(!config.RSI)
  util.die('Please update your config!');

if(
  config.trader.enabled &&
  !config['I understand that Gekko only automates MY OWN trading strategies']
)
  util.die('Do you understand what Gekko will do with your money? Read this first:\n\nhttps://github.com/askmike/gekko/issues/201');

// START

log.info('Gekko v' + util.getVersion(), 'started');
log.info('I\'m gonna make you rich, Bud Fox.', '\n\n');

// currently we only support a single
// market and a single advisor.

// make sure the monitoring exchange is configured correctly for monitoring

var exchangeChecker = require(dirs.core + 'exchangeChecker');
var invalid = exchangeChecker.cantMonitor(config.watch);

var BudFox = require(dirs.budfox + 'budfox');

new BudFox(config.watch)
  .start()
  .pipe(new require('stringify-stream')())
  .pipe(process.stdout);

return;

var modules = [];
var emitters = {};

// load each module (plugins and internal parts)
var loadModules = function(next) {
  // get internal modules
  var moduleSettings = _.map(require(dirs.core + 'modules'), function(s) {
    s.internal = true;
    s.path = dirs.core + s.slug;
    return s;
  });

  // transform plugins into modules
  var pluginSettings = _.map(require(dirs.gekko + 'plugins'), function(s) {
    s.path = dirs.plugins + s.slug;
    return s;
  });

  // only load enabled plugin
  pluginSettings = _.filter(pluginSettings, function(s) {
    return s.enabled;
  });

  // append enabled plugins to modules
  moduleSettings = moduleSettings.concat(pluginSettings);

  // load all modules
  async.mapSeries(
    moduleSettings,
    moduleHelper.load,
    function(error, _modules) {
      if(error)
        return util.die(error);

      modules = _modules;
      next();
    }
  );
};

// Emitters are modules that emit events to which others can subscribe.
var setupEmitters = function(next) {

  _.each(modules, function(module) {
    if(module.meta.emits)
      emitters[module.meta.slug] = module;
  });

  next();
}

var subscribeModules = function(next) {

  var subscriptions = require(dirs.core + 'subscriptions');

  _.each(modules, function(module) {
    _.each(subscriptions, function(sub) {

      if(_.has(module, sub.handler)) {

        // if the actor wants to listen
        // to something disabled
        if(!emitters[sub.emitter]) {
          if(!module.meta.internal)
            return log.warn([
              module.meta.name,
              'wanted to listen to the',
              sub.emitter + ',',
              'however the',
              sub.emitter,
              'is disabled.'
            ].join(' '))

          return;
        }

        // attach handler
        emitters[sub.emitter]
          .on(sub.event,
            util.defer(
              module[
                sub.handler
              ])
            );
      }

    });
  });

  next();
}

log.info('Setting up Gekko in', util.gekkoMode(), 'mode');
log.empty();

async.series(
  [
    loadModules,
    setupEmitters,
    subscribeModules
  ],
  function() {
    // everything is setup!
    emitters.heart.start();
  }
);<|endoftext|>


<commit_before>var rHyphen = /-(.)/g;

module.exports = function camelize(string) {
  return string.replace(rHyphen, (_, char) => char.toUpperCase())
}<commit_msg>fix: "char" → "chr"<commit_after>var rHyphen = /-(.)/g;

module.exports = function camelize(string) {
  return string.replace(rHyphen, (_, chr) => chr.toUpperCase())
}
<|endoftext|>


<commit_before>import { module } from 'angular';

require('./navbar.less');

export default module('app.components.navbar', []).component('navbar', {
  template: require('./navbar.html'),
});
<commit_msg>navbar: collapse by default on mobile<commit_after>import { module } from 'angular';

require('./navbar.less');

export default module('app.components.navbar', []).component('navbar', {
  controller: class NavbarCtrl {
    constructor() {
      this.collapsed = true;
    }
  },
  template: require('./navbar.html'),
});
<|endoftext|>