<commit_before>/* eslint key-spacing:0 */

/**
 * http://sailsjs.org/#/documentation/concepts/Routes/RouteTargetSyntax.html
 */

module.exports.routes = {
  'GET    /noo/user/status':                              'UserController.status',
  'GET    /noo/user/me':                                  'UserController.findSelf',
  'POST   /noo/user/password':                            'UserController.sendPasswordReset',
  'GET    /noo/user/:userId':                             'UserController.findOne',
  'POST   /noo/user':                                     'UserController.create',
  'POST   /noo/user/:userId':                             'UserController.update',
  'GET    /noo/user/:userId/contributions':               'UserController.contributions',
  'GET    /noo/user/:userId/thanks':                      'UserController.thanks',
  'GET    /noo/user/:userId/posts':                       'PostController.findForUser',
  'GET    /noo/user/:userId/followed-posts':              'PostController.findForFollowed',
  'GET    /noo/user/:userId/all-community-posts':         'PostController.findForAllForUser',
  'GET    /noo/user/:userId/onboarding':                  'OnboardingController.find',
  'POST   /noo/user/:userId/onboarding':                  'OnboardingController.update',

  'GET    /noo/community':                                'CommunityController.find',
  'POST   /noo/community':                                'CommunityController.create',
  'POST   /noo/community/code':                           'CommunityController.joinWithCode',
  'POST   /noo/community/validate':                       'CommunityController.validate',
  'GET    /noo/community/:communityId':                   'CommunityController.findOne',
  'POST   /noo/community/:communityId':                   'CommunityController.update',
  'GET    /noo/community/:communityId/settings':          'CommunityController.findSettings',
  'GET    /noo/community/:communityId/settings/slack':    'CommunityController.addSlack',
  'GET    /noo/community/:communityId/moderators':        'CommunityController.findModerators',
  'POST   /noo/community/:communityId/moderators':        'CommunityController.addModerator',
  'DELETE /noo/community/:communityId/moderator/:userId': 'CommunityController.removeModerator',
  'GET    /noo/community/:communityId/members':           'UserController.findForCommunity',
  'DELETE /noo/community/:communityId/member/:userId':    'CommunityController.removeMember',
  'GET    /noo/community/:communityId/posts':             'PostController.findForCommunity',
  'GET    /noo/community/:communityId/invitations':       'InvitationController.find',
  'POST   /noo/community/:communityId/invite':            'InvitationController.create',
  'GET    /noo/community/:communityId/activity':          'ActivityController.findForCommunity',
  'GET    /noo/community/:communityId/tags':              'TagController.findForCommunity',
  'DELETE /noo/community/:communityId/tag/:tagId':        'TagController.removeFromCommunity',

  'GET    /noo/post/:postId':                             'PostController.findOne',
  'POST   /noo/post/:postId/comment':                     'CommentController.create',
  'GET    /noo/post/:postId/comments':                    'CommentController.findForPost',
  'POST   /noo/post/:postId/follow':                      'PostController.follow',
  'POST   /noo/post/:postId/fulfill':                     'PostController.fulfill',
  'POST   /noo/post/:postId/vote':                        'PostController.vote',
  'GET    /noo/post/:postId/voters':                      'UserController.findForPostVote',
  'POST   /noo/post/:postId/complain':                    'PostController.complain',
  'POST   /noo/post/:postId/rsvp':                        'PostController.rsvp',
  'POST   /noo/post':                                     'PostController.create',
  'POST   /noo/post/:postId':                             'PostController.update',
  'DELETE /noo/post/:postId':                             'PostController.destroy',
  // these route names correspond with the different cases for subject in the
  // frontend fetchPosts action
  'POST   /noo/freshness/posts/community/:communityId':   'PostController.checkFreshnessForCommunity',
  'POST   /noo/freshness/posts/person/:userId':           'PostController.checkFreshnessForUser',
  'POST   /noo/freshness/posts/all-posts/:userId':        'PostController.checkFreshnessForAllForUser',
  'POST   /noo/freshness/posts/followed-posts/:userId':   'PostController.checkFreshnessForFollowed',
  'POST   /noo/freshness/posts/network/:networkId':       'PostController.checkFreshnessForNetwork',
  'POST   /noo/freshness/posts/tag/:tagName':             'PostController.checkFreshnessForTagInAllCommunities',

  'POST   /noo/comment/:commentId/thank':                 'CommentController.thank',
  'DELETE /noo/comment/:commentId':                       'CommentController.destroy',

  'DELETE /noo/membership/:communityId':                  'CommunityController.leave',
  'POST /noo/membership/:communityId':                    'CommunityController.updateMembership',

  'GET    /noo/activity':                                 'ActivityController.find',
  'POST   /noo/activity':                                 'ActivityController.update',
  'POST   /noo/activity/mark-all-read':                   'ActivityController.markAllRead',
  'POST   /noo/activity/:activityId':                     'ActivityController.update',

  'GET    /noo/network/:networkId':                       'NetworkController.findOne',
  'GET    /noo/network/:networkId/posts':                 'PostController.findForNetwork',
  'GET    /noo/network/:networkId/communities':           'CommunityController.findForNetwork',
  'GET    /noo/network/:networkId/members':               'UserController.findForNetwork',
  'POST   /noo/network':                                  'NetworkController.create',
  'POST   /noo/network/validate':                         'NetworkController.validate',
  'POST   /noo/network/:networkId':                       'NetworkController.update',

  'GET    /noo/community/:communityId/tag/:tagName':       'TagController.findOneInCommunity',
  'POST   /noo/community/:communityId/tag/:tagName/follow':'TagController.follow',
  'GET    /noo/community/:communityId/tags/followed':      'TagController.findFollowed',
  'GET    /noo/community/:communityId/tags/leftnav':       'TagController.findForLeftNav',
  'GET    /noo/tag/:tagName':                              'TagController.findOne',
  'GET    /noo/tag/:tagName/summary':                      'TagController.findOneSummary',
  'GET    /noo/tag/:tagName/posts':                        'PostController.findForTagInAllCommunities',
  'POST   /noo/community/:communityId/tag/:tagName/reset': 'TagController.resetNewPostCount',

  'GET    /noo/search':                                   'SearchController.show',
  'GET    /noo/search/fulltext':                          'SearchController.showFullText',
  'GET    /noo/autocomplete':                             'SearchController.autocomplete',

  'GET    /noo/invitation/:token':                        'InvitationController.findOne',
  'POST   /noo/invitation/:token':                        'InvitationController.use',

  'POST   /noo/waitlist':                                 'MessageController.createWaitlistRequest',

  'GET    /noo/admin/login':                              'AdminSessionController.create',
  'GET    /noo/admin/login/oauth':                        'AdminSessionController.oauth',
  'GET    /noo/admin/logout':                             'AdminSessionController.destroy',
  'GET    /noo/admin':                                    'AdminController.index',
  'GET    /noo/admin/metrics':                            'AdminController.metrics',
  'GET    /noo/admin/raw-metrics':                        'AdminController.rawMetrics',
  'GET    /noo/admin/login-as/:userId':                   'AdminController.loginAsUser',

  'POST   /noo/hook/comment':                             'CommentController.createFromEmail',
  'POST   /noo/hook/message':                             'MessageController.relayFromEmail',
  'POST   /noo/hook/post':                                'PostController.createFromEmail',
  'POST   /noo/hook/postForm':                            'PostController.createFromEmailForm',

  'POST   /noo/login':                                    'SessionController.create',
  'GET    /noo/login/token':                              'SessionController.createWithToken',
  'GET    /noo/login/google':                             'SessionController.startGoogleOAuth',
  'GET    /noo/login/google/oauth':                       'SessionController.finishGoogleOAuth',
  'GET    /noo/login/facebook':                           'SessionController.startFacebookOAuth',
  'GET    /noo/login/facebook/oauth':                     'SessionController.finishFacebookOAuth',
  'GET    /noo/login/linkedin':                           'SessionController.startLinkedinOAuth',
  'GET    /noo/login/linkedin/oauth':                     'SessionController.finishLinkedinOAuth',
  'GET    /noo/login/facebook-token/oauth':               'SessionController.finishFacebookTokenOAuth',
  'POST   /noo/login/facebook-token/oauth':               'SessionController.finishFacebookTokenOAuth',
  'GET    /noo/login/google-token/oauth':                 'SessionController.finishGoogleTokenOAuth',
  'POST   /noo/login/google-token/oauth':                 'SessionController.finishGoogleTokenOAuth',
  'GET    /noo/login/linkedin-token/oauth':               'SessionController.finishLinkedinTokenOAuth',
  'POST   /noo/login/linkedin-token/oauth':               'SessionController.finishLinkedinTokenOAuth',
  'GET    /noo/logout':                                   'SessionController.destroy',
  'DELETE /noo/session':                                  'SessionController.destroySession',

  'GET     /noo/nexudus':                                 'NexudusController.create',

  'POST    /noo/device':                                  'DeviceController.create',
  'DELETE  /noo/device/:token':                           'DeviceController.destroy',
  'POST    /noo/device/:token/update-badge-no':           'Device.updateBadgeNo',

  'POST    /noo/subscription':                            'SubscriptionController.create',

  'GET     /noo/mobile/auto-update-info':                 'MobileAppController.updateInfo',

  'GET     /noo/live-status/:communityId':                'LiveStatusController.show'
}
<commit_msg>fix route for tag summary<commit_after>/* eslint key-spacing:0 */

/**
 * http://sailsjs.org/#/documentation/concepts/Routes/RouteTargetSyntax.html
 */

module.exports.routes = {
  'GET    /noo/user/status':                              'UserController.status',
  'GET    /noo/user/me':                                  'UserController.findSelf',
  'POST   /noo/user/password':                            'UserController.sendPasswordReset',
  'GET    /noo/user/:userId':                             'UserController.findOne',
  'POST   /noo/user':                                     'UserController.create',
  'POST   /noo/user/:userId':                             'UserController.update',
  'GET    /noo/user/:userId/contributions':               'UserController.contributions',
  'GET    /noo/user/:userId/thanks':                      'UserController.thanks',
  'GET    /noo/user/:userId/posts':                       'PostController.findForUser',
  'GET    /noo/user/:userId/followed-posts':              'PostController.findForFollowed',
  'GET    /noo/user/:userId/all-community-posts':         'PostController.findForAllForUser',
  'GET    /noo/user/:userId/onboarding':                  'OnboardingController.find',
  'POST   /noo/user/:userId/onboarding':                  'OnboardingController.update',

  'GET    /noo/community':                                'CommunityController.find',
  'POST   /noo/community':                                'CommunityController.create',
  'POST   /noo/community/code':                           'CommunityController.joinWithCode',
  'POST   /noo/community/validate':                       'CommunityController.validate',
  'GET    /noo/community/:communityId':                   'CommunityController.findOne',
  'POST   /noo/community/:communityId':                   'CommunityController.update',
  'GET    /noo/community/:communityId/settings':          'CommunityController.findSettings',
  'GET    /noo/community/:communityId/settings/slack':    'CommunityController.addSlack',
  'GET    /noo/community/:communityId/moderators':        'CommunityController.findModerators',
  'POST   /noo/community/:communityId/moderators':        'CommunityController.addModerator',
  'DELETE /noo/community/:communityId/moderator/:userId': 'CommunityController.removeModerator',
  'GET    /noo/community/:communityId/members':           'UserController.findForCommunity',
  'DELETE /noo/community/:communityId/member/:userId':    'CommunityController.removeMember',
  'GET    /noo/community/:communityId/posts':             'PostController.findForCommunity',
  'GET    /noo/community/:communityId/invitations':       'InvitationController.find',
  'POST   /noo/community/:communityId/invite':            'InvitationController.create',
  'GET    /noo/community/:communityId/activity':          'ActivityController.findForCommunity',
  'GET    /noo/community/:communityId/tags':              'TagController.findForCommunity',
  'DELETE /noo/community/:communityId/tag/:tagId':        'TagController.removeFromCommunity',

  'GET    /noo/post/:postId':                             'PostController.findOne',
  'POST   /noo/post/:postId/comment':                     'CommentController.create',
  'GET    /noo/post/:postId/comments':                    'CommentController.findForPost',
  'POST   /noo/post/:postId/follow':                      'PostController.follow',
  'POST   /noo/post/:postId/fulfill':                     'PostController.fulfill',
  'POST   /noo/post/:postId/vote':                        'PostController.vote',
  'GET    /noo/post/:postId/voters':                      'UserController.findForPostVote',
  'POST   /noo/post/:postId/complain':                    'PostController.complain',
  'POST   /noo/post/:postId/rsvp':                        'PostController.rsvp',
  'POST   /noo/post':                                     'PostController.create',
  'POST   /noo/post/:postId':                             'PostController.update',
  'DELETE /noo/post/:postId':                             'PostController.destroy',
  // these route names correspond with the different cases for subject in the
  // frontend fetchPosts action
  'POST   /noo/freshness/posts/community/:communityId':   'PostController.checkFreshnessForCommunity',
  'POST   /noo/freshness/posts/person/:userId':           'PostController.checkFreshnessForUser',
  'POST   /noo/freshness/posts/all-posts/:userId':        'PostController.checkFreshnessForAllForUser',
  'POST   /noo/freshness/posts/followed-posts/:userId':   'PostController.checkFreshnessForFollowed',
  'POST   /noo/freshness/posts/network/:networkId':       'PostController.checkFreshnessForNetwork',
  'POST   /noo/freshness/posts/tag/:tagName':             'PostController.checkFreshnessForTagInAllCommunities',

  'POST   /noo/comment/:commentId/thank':                 'CommentController.thank',
  'DELETE /noo/comment/:commentId':                       'CommentController.destroy',

  'DELETE /noo/membership/:communityId':                  'CommunityController.leave',
  'POST /noo/membership/:communityId':                    'CommunityController.updateMembership',

  'GET    /noo/activity':                                 'ActivityController.find',
  'POST   /noo/activity':                                 'ActivityController.update',
  'POST   /noo/activity/mark-all-read':                   'ActivityController.markAllRead',
  'POST   /noo/activity/:activityId':                     'ActivityController.update',

  'GET    /noo/network/:networkId':                       'NetworkController.findOne',
  'GET    /noo/network/:networkId/posts':                 'PostController.findForNetwork',
  'GET    /noo/network/:networkId/communities':           'CommunityController.findForNetwork',
  'GET    /noo/network/:networkId/members':               'UserController.findForNetwork',
  'POST   /noo/network':                                  'NetworkController.create',
  'POST   /noo/network/validate':                         'NetworkController.validate',
  'POST   /noo/network/:networkId':                       'NetworkController.update',

  'GET    /noo/community/:communityId/tag/:tagName':        'TagController.findOneInCommunity',
  'POST   /noo/community/:communityId/tag/:tagName/follow': 'TagController.follow',
  'GET    /noo/community/:communityId/tags/followed':       'TagController.findFollowed',
  'GET    /noo/community/:communityId/tags/leftnav':        'TagController.findForLeftNav',
  'GET    /noo/tag/:tagName':                               'TagController.findOne',
  'GET    /noo/community/:communityId/tag/:tagName/summary':'TagController.findOneSummary',
  'GET    /noo/tag/:tagName/posts':                         'PostController.findForTagInAllCommunities',
  'POST   /noo/community/:communityId/tag/:tagName/reset':  'TagController.resetNewPostCount',

  'GET    /noo/search':                                   'SearchController.show',
  'GET    /noo/search/fulltext':                          'SearchController.showFullText',
  'GET    /noo/autocomplete':                             'SearchController.autocomplete',

  'GET    /noo/invitation/:token':                        'InvitationController.findOne',
  'POST   /noo/invitation/:token':                        'InvitationController.use',

  'POST   /noo/waitlist':                                 'MessageController.createWaitlistRequest',

  'GET    /noo/admin/login':                              'AdminSessionController.create',
  'GET    /noo/admin/login/oauth':                        'AdminSessionController.oauth',
  'GET    /noo/admin/logout':                             'AdminSessionController.destroy',
  'GET    /noo/admin':                                    'AdminController.index',
  'GET    /noo/admin/metrics':                            'AdminController.metrics',
  'GET    /noo/admin/raw-metrics':                        'AdminController.rawMetrics',
  'GET    /noo/admin/login-as/:userId':                   'AdminController.loginAsUser',

  'POST   /noo/hook/comment':                             'CommentController.createFromEmail',
  'POST   /noo/hook/message':                             'MessageController.relayFromEmail',
  'POST   /noo/hook/post':                                'PostController.createFromEmail',
  'POST   /noo/hook/postForm':                            'PostController.createFromEmailForm',

  'POST   /noo/login':                                    'SessionController.create',
  'GET    /noo/login/token':                              'SessionController.createWithToken',
  'GET    /noo/login/google':                             'SessionController.startGoogleOAuth',
  'GET    /noo/login/google/oauth':                       'SessionController.finishGoogleOAuth',
  'GET    /noo/login/facebook':                           'SessionController.startFacebookOAuth',
  'GET    /noo/login/facebook/oauth':                     'SessionController.finishFacebookOAuth',
  'GET    /noo/login/linkedin':                           'SessionController.startLinkedinOAuth',
  'GET    /noo/login/linkedin/oauth':                     'SessionController.finishLinkedinOAuth',
  'GET    /noo/login/facebook-token/oauth':               'SessionController.finishFacebookTokenOAuth',
  'POST   /noo/login/facebook-token/oauth':               'SessionController.finishFacebookTokenOAuth',
  'GET    /noo/login/google-token/oauth':                 'SessionController.finishGoogleTokenOAuth',
  'POST   /noo/login/google-token/oauth':                 'SessionController.finishGoogleTokenOAuth',
  'GET    /noo/login/linkedin-token/oauth':               'SessionController.finishLinkedinTokenOAuth',
  'POST   /noo/login/linkedin-token/oauth':               'SessionController.finishLinkedinTokenOAuth',
  'GET    /noo/logout':                                   'SessionController.destroy',
  'DELETE /noo/session':                                  'SessionController.destroySession',

  'GET     /noo/nexudus':                                 'NexudusController.create',

  'POST    /noo/device':                                  'DeviceController.create',
  'DELETE  /noo/device/:token':                           'DeviceController.destroy',
  'POST    /noo/device/:token/update-badge-no':           'Device.updateBadgeNo',

  'POST    /noo/subscription':                            'SubscriptionController.create',

  'GET     /noo/mobile/auto-update-info':                 'MobileAppController.updateInfo',

  'GET     /noo/live-status/:communityId':                'LiveStatusController.show'
}
<|endoftext|>


<commit_before>module.exports = function(app, Instagram, io) {
	app.get('/', function(req, res){
			res.render('index.ejs', {
			layout:false,
			locals: {
				errorMessage: "Poop",
				ngController: "leanMeanApp"
				 }
			});
	});
	app.get('/subscribe', function(req, res){
			Instagram.subscriptions.handshake(req, res);
	});
	app.post('/subscribe', function(req, res){
			//io.sockets.emit('alert', "PICTURE~");
			req.body.forEach(function(notificationOjb){
			    // Every notification object contains the id of the geography
			    // that has been updated, and the photo can be obtained from
			    // that geography
			    https.get({
			      host: 'api.instagram.com',
			      path: '/v1/geographies/' + notificationOjb.object_id + '/media/recent' +
			      '?' + querystring.stringify({client_id: process.env.instagram_client_id,count: 1}),
			    }, function(res){
			      var raw = "";

			      res.on('data', function(chunk) {
			        raw += chunk;
			      });

			      // When the whole body has arrived, it has to be a valid JSON, with data,
			      // and the first photo of the date must to have a location attribute.
			      // If so, the photo is emitted through the websocket
			      res.on('end', function() {
			        var response = JSON.parse(raw);
			        if(response['data'].length > 0 && response['data'][0]['location'] != null) {
			          io.sockets.emit('photo', raw);
			        } else {
			          console.log("ERROR: %s", util.inspect(response['meta']));
			        }
			      });

			    });
			  });

			  response.writeHead(200);
	});

}

<commit_msg>init17<commit_after>module.exports = function(app, Instagram, io) {
	app.get('/', function(req, res){
			res.render('index.ejs', {
			layout:false,
			locals: {
				errorMessage: "Poop",
				ngController: "leanMeanApp"
				 }
			});
	});
	app.get('/subscribe', function(req, res){
			Instagram.subscriptions.handshake(req, res);
	});
	app.post('/subscribe', function(req, res){
			//io.sockets.emit('alert', "PICTURE~");
			req.body.forEach(function(data){
			     io.sockets.emit('photo', raw);
			     io.sockets.emit('alert', "PICTURE~kk");
			  });

	});

}

<|endoftext|>


<commit_before>
/*!
 * Connect - Redis
 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
 * MIT Licensed
 * Modifications by Greg Heartsfield <scsibug@imap.cc>
 *
 */

/**
 * Module dependencies.
 */

var Store = require('connect').session.Store;
var redis = require('./redisclient');

/**
 * Initialize RedisStore with the given `options`.
 *
 * @param {Object} options
 * @api public
 */

var RedisStore = module.exports = function RedisStore(options) {
  options = options || {};
  Store.call(this, options);
  this.client = redis.initSessionClient();
};

/**
 * Inherit from `Store`.
 */

RedisStore.prototype.__proto__ = Store.prototype;

/**
 * Attempt to fetch session by the given `hash`.
 *
 * @param {String} hash
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.get = function(hash, fn){
  this.client.get(hash, function(err, data){
    try {
      fn(null, data
        ? JSON.parse(data.toString())
        : data);
    } catch (err) {
      fn(err);
    }
  });
};

/**
 * Commit the given `sess` object associated with the given `hash`.
 *
 * @param {String} hash
 * @param {Session} sess
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.set = function(hash, sess, fn){
  var self = this;
  try {
    this.client.setex(hash, self.maxAge / 1000 | 0, JSON.stringify(sess), function(){
      fn && fn.apply(this, arguments);
    });
  } catch (err) {
    fn && fn(err);
  }
};

/**
 * Destroy the session associated with the given `hash`.
 *
 * @param {String} hash
 * @api public
 */

RedisStore.prototype.destroy = function(hash, fn){
  this.client.del(hash, fn);
};

/**
 * Fetch number of sessions.
 *
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.length = function(fn){
  this.client.dbsize(fn);
};

/**
 * Clear all sessions.
 *
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.clear = function(fn){
  this.client.flushdb(fn);
};<commit_msg>Logging for errors in redis session store.<commit_after>
/*!
 * Connect - Redis
 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
 * MIT Licensed
 * Modifications by Greg Heartsfield <scsibug@imap.cc>
 *
 */

/**
 * Module dependencies.
 */

var Store = require('connect').session.Store;
var redis = require('./redisclient');

/**
 * Initialize RedisStore with the given `options`.
 *
 * @param {Object} options
 * @api public
 */

var RedisStore = module.exports = function RedisStore(options) {
  options = options || {};
  Store.call(this, options);
  this.client = redis.initSessionClient();
};

/**
 * Inherit from `Store`.
 */

RedisStore.prototype.__proto__ = Store.prototype;

/**
 * Attempt to fetch session by the given `hash`.
 *
 * @param {String} hash
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.get = function(hash, fn){
  this.client.get(hash, function(err, data){
    try {
      fn(null, data
        ? JSON.parse(data.toString())
        : data);
    } catch (err) {
      console.log("ERROR with RedisStore.get",err);
      fn(err);
    }
  });
};

/**
 * Commit the given `sess` object associated with the given `hash`.
 *
 * @param {String} hash
 * @param {Session} sess
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.set = function(hash, sess, fn){
  var self = this;
  try {
    this.client.setex(hash, self.maxAge / 1000 | 0, JSON.stringify(sess), function(){
      fn && fn.apply(this, arguments);
    });
  } catch (err) {
    console.log("ERROR with RedisStore.set",err);
    fn && fn(err);
  }
};

/**
 * Destroy the session associated with the given `hash`.
 *
 * @param {String} hash
 * @api public
 */

RedisStore.prototype.destroy = function(hash, fn){
  this.client.del(hash, fn);
};

/**
 * Fetch number of sessions.
 *
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.length = function(fn){
  this.client.dbsize(fn);
};

/**
 * Clear all sessions.
 *
 * @param {Function} fn
 * @api public
 */

RedisStore.prototype.clear = function(fn){
  this.client.flushdb(fn);
};<|endoftext|>


<commit_before>// ==UserScript==
// @name          GitHub Toggle Expanders
// @version       1.0.1
// @description   A userscript that toggles all expanders when one expander is shift-clicked
// @license       https://creativecommons.org/licenses/by-sa/4.0/
// @namespace     https://github.com/Mottie
// @include       https://github.com/*
// @run-at        document-idle
// @author        Rob Garrison
// @updateURL     https://raw.githubusercontent.com/Mottie/GitHub-userscripts/master/github-toggle-expanders.user.js
// @downloadURL   https://raw.githubusercontent.com/Mottie/GitHub-userscripts/master/github-toggle-expanders.user.js
// ==/UserScript==
/* jshint esnext:true, unused:true */
(() => {
	"use strict";

	function toggle(el) {
		const selector = ".commits-list-item, .js-details-container",
			state = closest(el, selector).classList.contains("open");
		Array.from(document.querySelectorAll(selector)).forEach(el => {
			el.classList[state ? "add" : "remove"]("open");
		});
	}

	function closest(el, selector) {
		while (el && el.nodeName !== "BODY" && !el.matches(selector)) {
			el = el.parentNode;
		}
		return el && el.matches(selector) ? el : [];
	}

	document.body.addEventListener("click", event => {
		const target = event.target;
		if (
			target && event.getModifierState("Shift") &&
			target.matches(".ellipsis-expander")
		) {
			// give GitHub time to add the class
			setTimeout(() => {
				toggle(target);
			}, 100);
		}
	});

})();
<commit_msg>Toggle-Expanders: Target selectors inside of commit lists. Fixes #8<commit_after>// ==UserScript==
// @name          GitHub Toggle Expanders
// @version       1.0.2
// @description   A userscript that toggles all expanders when one expander is shift-clicked
// @license       https://creativecommons.org/licenses/by-sa/4.0/
// @namespace     https://github.com/Mottie
// @include       https://github.com/*
// @run-at        document-idle
// @author        Rob Garrison
// @updateURL     https://raw.githubusercontent.com/Mottie/GitHub-userscripts/master/github-toggle-expanders.user.js
// @downloadURL   https://raw.githubusercontent.com/Mottie/GitHub-userscripts/master/github-toggle-expanders.user.js
// ==/UserScript==
/* jshint esnext:true, unused:true */
(() => {
	"use strict";

	function toggle(el) {
		const state = closest(el, ".commits-list-item, .js-details-container")
			.classList.contains("open"),
			// target buttons inside commits_bucket - fixes #8
			selector = `.commits-listing .commits-list-item,
				#commits_bucket .js-details-container`;
		Array.from(document.querySelectorAll(selector)).forEach(el => {
			el.classList[state ? "add" : "remove"]("open");
		});
	}

	function closest(el, selector) {
		while (el && el.nodeName !== "BODY" && !el.matches(selector)) {
			el = el.parentNode;
		}
		return el && el.matches(selector) ? el : [];
	}

	document.body.addEventListener("click", event => {
		const target = event.target;
		if (
			target && event.getModifierState("Shift") &&
			target.matches(".ellipsis-expander")
		) {
			// give GitHub time to add the class
			setTimeout(() => {
				toggle(target);
			}, 100);
		}
	});

})();
<|endoftext|>


<commit_before>/* performance benchmark */
/* This script expects node.js */

'use strict';

var FastPriorityQueue = require('../FastPriorityQueue.js');
var PriorityQueue = require('js-priority-queue');
var Heap = require('heap');
var Benchmark = require('benchmark');
var os = require('os');
var binaryheapx = require('binaryheapx').Constructor;
var pq = require('priority_queue');
var jsHeap = require('js-heap');
var qp = require('queue-priority');
var priorityqueuejs = require('priorityqueuejs');
var qheap = require('qheap');
var BinaryHeap = require('yabh');

// very fast semi-random function
function rand(i) {
  i = i + 10000;
  i = i ^ (i << 16);
  i = (i >> 5) ^ i ;
  return i & 0xFF;
}
var defaultcomparator = function(a, b) {
  return a < b;
};

function basictest() {
  var b1 = new FastPriorityQueue(defaultcomparator);
  var b2 = new Heap(function(a, b) {
    return a - b;
  });
  for (var i = 0 ; i < 2000  ; i++) {
    b1.add(rand(i));
    b2.push(rand(i));
  }
  for (i = 128 ; i < 128 * 10  ; i++) {
    b1.add(rand(i));
    b2.push(rand(i));
    var x1 = b1.poll();
    var x2 = b2.pop();
    if (x1 != x2) throw 'bug ' + x1 + ' ' + x2;
  }

}

function QueueEnqueueBench() {
  console.log('starting dynamic queue/enqueue benchmark');
  var suite = new Benchmark.Suite();
  // add tests
  var b = new BinaryHeap();
  for (var i = 0 ; i < 128  ; i++) {
    b.push(rand(i));
  }
  for (i = 128 ; i < 128 * 10  ; i++) {
    b.push(rand(i));
    b.pop();
  }

  var ms = suite
    .add('FastPriorityQueue', function() {
      var b = new FastPriorityQueue(defaultcomparator);
      for (var i = 0 ; i < 128  ; i++) {
        b.add(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.add(rand(i));
        b.poll();
      }
      return b;
    })
   .add('js-priority-queue', function() {
      var b = new PriorityQueue({comparator: function(a, b) {
        return b - a;
      }
                                });
      for (var i = 0 ; i < 128  ; i++) {
        b.queue(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.queue(rand(i));
        b.dequeue();
      }
      return b;
    })
    .add('heap.js', function() {
      var b = new Heap(function(a, b) {
        return a - b;
      });
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('binaryheapx', function() {
      var b = new binaryheapx();
      for (var i = 0 ; i < 128  ; i++) {
        b.add(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.add(rand(i));
        b.pop();
      }
      return b;
    })
    .add('priority_queue', function() {
      var b = new pq.PriorityQueue();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.shift();
      }
      return b;
    })
    .add('js-heap', function() {
      var b = new jsHeap();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('queue-priority', function() {
      var b = new qp();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('priorityqueuejs', function() {
      var b = new priorityqueuejs();
      for (var i = 0 ; i < 128  ; i++) {
        b.enq(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.enq(rand(i));
        b.deq();
      }
      return b;
    })
    .add('qheap', function() {
      var b = new qheap();
      for (var i = 0 ; i < 128  ; i++) {
        b.insert(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.insert(rand(i));
        b.remove();
      }
      return b;
    })
    .add('yabh', function() {
      var b = new BinaryHeap();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    // add listeners
    .on('cycle', function(event) {
      console.log(String(event.target));
    })
    .on('complete', function() {
      console.log('Fastest is ' + this.filter('fastest').map('name'));
    })
    // run async
    .run({'async': false});
}

var main = function() {
  basictest();
  console.log('Platform: ' + process.platform + ' ' + os.release() + ' ' + process.arch);
  console.log(os.cpus()[0]['model']);
  console.log('Node version ' + process.versions.node + ', v8 version ' + process.versions.v8);
  console.log();
  console.log('Comparing against: ');
  console.log('js-priority-queue: https://github.com/adamhooper/js-priority-queue', require("js-priority-queue/package.json").version);
  console.log('heap.js: https://github.com/qiao/heap.js', require("heap/package.json").version);
  console.log('binaryheapx: https://github.com/xudafeng/BinaryHeap', require("binaryheapx/package.json").version);
  console.log('priority_queue: https://github.com/agnat/js_priority_queue', require("priority_queue/package.json").version);
  console.log('js-heap: https://github.com/thauburger/js-heap', require("js-heap/package.json").version);
  console.log('queue-priority: https://github.com/augustohp/Priority-Queue-NodeJS', require("queue-priority/package.json").version);
  console.log('priorityqueuejs: https://github.com/janogonzalez/priorityqueuejs', require("priorityqueuejs/package.json").version);
  console.log('qheap: https://github.com/andrasq/node-qheap',  require("qheap/package.json").version);
  console.log('yabh: https://github.com/jmdobry/yabh',  require("yabh/package.json").version);
  console.log('');
  QueueEnqueueBench();
  console.log('');
};

if (require.main === module) {
  main();
}
<commit_msg>Removing fastest output as it is creating trouble.<commit_after>/* performance benchmark */
/* This script expects node.js */

'use strict';

var FastPriorityQueue = require('../FastPriorityQueue.js');
var PriorityQueue = require('js-priority-queue');
var Heap = require('heap');
var Benchmark = require('benchmark');
var os = require('os');
var binaryheapx = require('binaryheapx').Constructor;
var pq = require('priority_queue');
var jsHeap = require('js-heap');
var qp = require('queue-priority');
var priorityqueuejs = require('priorityqueuejs');
var qheap = require('qheap');
var BinaryHeap = require('yabh');

// very fast semi-random function
function rand(i) {
  i = i + 10000;
  i = i ^ (i << 16);
  i = (i >> 5) ^ i ;
  return i & 0xFF;
}
var defaultcomparator = function(a, b) {
  return a < b;
};

function basictest() {
  var b1 = new FastPriorityQueue(defaultcomparator);
  var b2 = new Heap(function(a, b) {
    return a - b;
  });
  for (var i = 0 ; i < 2000  ; i++) {
    b1.add(rand(i));
    b2.push(rand(i));
  }
  for (i = 128 ; i < 128 * 10  ; i++) {
    b1.add(rand(i));
    b2.push(rand(i));
    var x1 = b1.poll();
    var x2 = b2.pop();
    if (x1 != x2) throw 'bug ' + x1 + ' ' + x2;
  }

}

function QueueEnqueueBench() {
  console.log('starting dynamic queue/enqueue benchmark');
  var suite = new Benchmark.Suite();
  // add tests
  var b = new BinaryHeap();
  for (var i = 0 ; i < 128  ; i++) {
    b.push(rand(i));
  }
  for (i = 128 ; i < 128 * 10  ; i++) {
    b.push(rand(i));
    b.pop();
  }

  var ms = suite
    .add('FastPriorityQueue', function() {
      var b = new FastPriorityQueue(defaultcomparator);
      for (var i = 0 ; i < 128  ; i++) {
        b.add(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.add(rand(i));
        b.poll();
      }
      return b;
    })
   .add('js-priority-queue', function() {
      var b = new PriorityQueue({comparator: function(a, b) {
        return b - a;
      }
                                });
      for (var i = 0 ; i < 128  ; i++) {
        b.queue(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.queue(rand(i));
        b.dequeue();
      }
      return b;
    })
    .add('heap.js', function() {
      var b = new Heap(function(a, b) {
        return a - b;
      });
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('binaryheapx', function() {
      var b = new binaryheapx();
      for (var i = 0 ; i < 128  ; i++) {
        b.add(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.add(rand(i));
        b.pop();
      }
      return b;
    })
    .add('priority_queue', function() {
      var b = new pq.PriorityQueue();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.shift();
      }
      return b;
    })
    .add('js-heap', function() {
      var b = new jsHeap();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('queue-priority', function() {
      var b = new qp();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    .add('priorityqueuejs', function() {
      var b = new priorityqueuejs();
      for (var i = 0 ; i < 128  ; i++) {
        b.enq(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.enq(rand(i));
        b.deq();
      }
      return b;
    })
    .add('qheap', function() {
      var b = new qheap();
      for (var i = 0 ; i < 128  ; i++) {
        b.insert(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.insert(rand(i));
        b.remove();
      }
      return b;
    })
    .add('yabh', function() {
      var b = new BinaryHeap();
      for (var i = 0 ; i < 128  ; i++) {
        b.push(rand(i));
      }
      for (i = 128 ; i < 128 * 10  ; i++) {
        b.push(rand(i));
        b.pop();
      }
      return b;
    })
    // add listeners
    .on('cycle', function(event) {
      console.log(String(event.target));
    })
    // run async
    .run({'async': false});
}

var main = function() {
  basictest();
  console.log('Platform: ' + process.platform + ' ' + os.release() + ' ' + process.arch);
  console.log(os.cpus()[0]['model']);
  console.log('Node version ' + process.versions.node + ', v8 version ' + process.versions.v8);
  console.log();
  console.log('Comparing against: ');
  console.log('js-priority-queue: https://github.com/adamhooper/js-priority-queue', require("js-priority-queue/package.json").version);
  console.log('heap.js: https://github.com/qiao/heap.js', require("heap/package.json").version);
  console.log('binaryheapx: https://github.com/xudafeng/BinaryHeap', require("binaryheapx/package.json").version);
  console.log('priority_queue: https://github.com/agnat/js_priority_queue', require("priority_queue/package.json").version);
  console.log('js-heap: https://github.com/thauburger/js-heap', require("js-heap/package.json").version);
  console.log('queue-priority: https://github.com/augustohp/Priority-Queue-NodeJS', require("queue-priority/package.json").version);
  console.log('priorityqueuejs: https://github.com/janogonzalez/priorityqueuejs', require("priorityqueuejs/package.json").version);
  console.log('qheap: https://github.com/andrasq/node-qheap',  require("qheap/package.json").version);
  console.log('yabh: https://github.com/jmdobry/yabh',  require("yabh/package.json").version);
  console.log('');
  QueueEnqueueBench();
  console.log('');
};

if (require.main === module) {
  main();
}
<|endoftext|>


<commit_before>import React from 'react';
import { NavigationLink, RefreshLink, NavigationBackLink } from 'navigation-react';

var Listing = ({ people, stateNavigator }) => {
    var rows = people.map((person) => (

                <NavigationLink
                    stateKey="person"
                    navigationData={{ id: person.id }}
                    stateNavigator={stateNavigator}>
                    {person.name}
                </NavigationLink>

            {person.dateOfBirth}

    ));
    return (

                        Name
                        Date of Birth

{rows}

                Go to page
                <RefreshLink
                    navigationData={{ pageNumber: 1 }}
                    disableActive={true}
                    stateNavigator={stateNavigator}>
                    1
                </RefreshLink>
                <RefreshLink
                    navigationData={{ pageNumber: 2 }}
                    disableActive={true}
                    stateNavigator={stateNavigator}>
                    2
                </RefreshLink>

    );
};

var Details = ({ person, store, stateNavigator }) => {
    var handleChange = (event) => {
        store.dispatch({
            type: 'EDIT',
            id: person.id,
            name: event.target.value
        });
    };
    return (

            <NavigationBackLink
                distance={1}
                stateNavigator={stateNavigator}>
                Person Search
            </NavigationBackLink>

{person.name}

Date of Birth

                <input value={person.name} onChange={handleChange} />

Email

{person.email}

Phone

{person.phone}

    );
};

export { Listing, Details };<commit_msg>Added label for input<commit_after>import React from 'react';
import { NavigationLink, RefreshLink, NavigationBackLink } from 'navigation-react';

var Listing = ({ people, stateNavigator }) => {
    var rows = people.map((person) => (

                <NavigationLink
                    stateKey="person"
                    navigationData={{ id: person.id }}
                    stateNavigator={stateNavigator}>
                    {person.name}
                </NavigationLink>

            {person.dateOfBirth}

    ));
    return (

                        Name
                        Date of Birth

{rows}

                Go to page
                <RefreshLink
                    navigationData={{ pageNumber: 1 }}
                    disableActive={true}
                    stateNavigator={stateNavigator}>
                    1
                </RefreshLink>
                <RefreshLink
                    navigationData={{ pageNumber: 2 }}
                    disableActive={true}
                    stateNavigator={stateNavigator}>
                    2
                </RefreshLink>

    );
};

var Details = ({ person, store, stateNavigator }) => {
    var handleChange = (event) => {
        store.dispatch({
            type: 'EDIT',
            id: person.id,
            name: event.target.value
        });
    };
    return (

            <NavigationBackLink
                distance={1}
                stateNavigator={stateNavigator}>
                Person Search
            </NavigationBackLink>

{person.name}

                Date of Birth
                <input id="name" value={person.name} onChange={handleChange} />

Email

{person.email}

Phone

{person.phone}

    );
};

export { Listing, Details };<|endoftext|>


<commit_before>import React from 'react';
import {NavigationMotion} from 'navigation-react-mobile';
import ZoomShared from './ZoomShared';

export default ({stateNavigator}) => (
  <NavigationMotion
    startStateKey="grid"
    unmountedStyle={{opacity: 0}}
    mountedStyle={{opacity: 1}}
    crumbStyle={{opacity: 0}}
    style={{flex: 1}}
    sharedElementMotion={props => <ZoomShared {...props} />}
    stateNavigator={stateNavigator}>
    {({opacity}, scene, url) => (

        {scene}

    )}
  </NavigationMotion>
);
<commit_msg>Swapped url for key in scene<commit_after>import React from 'react';
import {NavigationMotion} from 'navigation-react-mobile';
import ZoomShared from './ZoomShared';

export default ({stateNavigator}) => (
  <NavigationMotion
    startStateKey="grid"
    unmountedStyle={{opacity: 0}}
    mountedStyle={{opacity: 1}}
    crumbStyle={{opacity: 0}}
    style={{flex: 1}}
    sharedElementMotion={props => <ZoomShared {...props} />}
    stateNavigator={stateNavigator}>
    {({opacity}, scene, key) => (

        {scene}

    )}
  </NavigationMotion>
);
<|endoftext|>


<commit_before>import express from 'express'
import models from './models';
import bodyParser from 'body-parser';
import users from './routes/users';
import cookieParser from 'cookie-parser';
import cookieSession from 'cookie-session';
import engine from 'ejs-mate';
import sessions from './routes/sessions'
import methodOverride from 'method-override'

const app = express();

app.engine('ejs', engine);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.use(methodOverride('_method'))

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
	extended: true
}));
app.use(cookieParser('S3CR37'));
app.use(cookieSession({
	name:'session',
	keys: ['key1', 'key2']
}))
app.set('port', process.env.PORT || 3000);

app.locals.userId = null

app.get('/', (req, res) => {
	res.render('index', {userId: req.session.userId})
});

app.use('/users', users())
app.use('/sessions', sessions())

app.listen(app.get('port'), () => {
	console.log("listening on port " + app.get('port'));
});
<commit_msg>Add comments for different parts of entry and updated server listener to be within sequelize sync callback<commit_after>import express from 'express'
import models from './models';
import bodyParser from 'body-parser';
import users from './routes/users';
import cookieParser from 'cookie-parser';
import cookieSession from 'cookie-session';
import engine from 'ejs-mate';
import sessions from './routes/sessions'
import methodOverride from 'method-override'

const app = express();

// temp front-end views
app.engine('ejs', engine);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.use(methodOverride('_method'))

// Required middlewares
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
	extended: true
}));
app.use(cookieParser('S3CR37'));
app.use(cookieSession({
	name:'session',
	keys: ['key1', 'key2']
}))

//setting port
app.set('port', process.env.PORT || 3000);

app.locals.userId = null

//index page
app.get('/', (req, res) => {
	res.render('index', {userId: req.session.userId})
});

//other routes
app.use('/users', users())
app.use('/sessions', sessions())

//sync model and listen to server after promise for sync resolves
models.sequelize.sync().then(() => {
	app.listen(app.get('port'), () => {
		console.log("listening on port " + app.get('port'));
	});
})
<|endoftext|>


<commit_before>'use strict';

module.exports = Lists;

/**
 * Lists.
 * @constructor
 * @param {Client} client - Instance of an API client.
 */
function Lists(client) {
  /**
   * Returns all lists you have in your account. Also basic summary for each list including the ID.
   * @param {number} [limit] - Sets the limit of results in one page (default 1000).
   * @param {number} [page] - You can navigate through records by increasing page number.
   */
  this.getAll = (limit, page) => {
    return client.Get('/lists/', {
      limit: limit,
      page: page
    });
  };

  /**
   * Retrieve stats about sent messages.
   * @param {number} id - The ID of the list you want the stas for.
   */
  this.getDetails = () => {
    //
  };

  /**
   * Create new list.
   * @param {string} name - The name of the new list you want to create.
   */
  this.addList = () => {
    //
  };

  /**
   * Update existing list.
   * @param {number} id - The ID of the list you want to change.
   * @param {string} name - The new name of the list you want to change.
   */
  this.updateList = () => {
    //
  };

  /**
   * Delete the list
   * @param {number} id - The ID of the list you want to remove.
   */
  this.removeList = () => {
    //
  };

  /**
   * Returns all active subscribers in a given list.
   * @param {number} id - The ID of the list you want stats for.
   * @param {number} limit - Sets the limit of results in one page (default 1000).
   * @param {number} page - You can navigate through records by increasing page number.
   */
  this.getActiveSubscribers = (id, limit, page) => {
    //
  };

  /**
   * Get bounced subscribers.
   */
  this.getBouncedSubscribers = () => {
    //
  };
}
<commit_msg>Added missing parameters.<commit_after>'use strict';

module.exports = Lists;

/**
 * Lists.
 * @constructor
 * @param {Client} client - Instance of an API client.
 */
function Lists(client) {
  /**
   * Returns all lists you have in your account. Also basic summary for each list including the ID.
   * @param {number} [limit] - Sets the limit of results in one page (default 1000).
   * @param {number} [page] - You can navigate through records by increasing page number.
   */
  this.getAll = (limit, page) => {
    return client.Get('/lists/', {
      limit: limit,
      page: page
    });
  };

  /**
   * Retrieve stats about sent messages.
   * @param {number} id - The ID of the list you want the stas for.
   */
  this.getDetails = (id) => {
    //
  };

  /**
   * Create new list.
   * @param {string} name - The name of the new list you want to create.
   */
  this.addList = (name) => {
    //
  };

  /**
   * Update existing list.
   * @param {number} id - The ID of the list you want to change.
   * @param {string} name - The new name of the list you want to change.
   */
  this.updateList = (id, name) => {
    //
  };

  /**
   * Delete the list
   * @param {number} id - The ID of the list you want to remove.
   */
  this.removeList = (id) => {
    //
  };

  /**
   * Returns all active subscribers in a given list.
   * @param {number} id - The ID of the list you want stats for.
   * @param {number} limit - Sets the limit of results in one page (default 1000).
   * @param {number} page - You can navigate through records by increasing page number.
   */
  this.getActiveSubscribers = (id, limit, page) => {
    //
  };

  /**
   * Get bounced subscribers.
   */
  this.getBouncedSubscribers = () => {
    //
  };
}
<|endoftext|>


<commit_before>///<reference path="jquery-1.6.2-vsdoc.js"/>
///<reference path="OrderMockup.js"/>

//Self-Executing Anonymous Function
//Adding New Functionality to Purchasing for Edit
(function (purchasing, $, undefined) {
    //Private Property
    var routingAdjusted = false;
    var startingLineItemCount = 3;
    var startingOrderSplitCount = 3; //TODO: move these into a public var?  or options or something?  Statics maybe?
    var startingLineItemSplitCount = 2;

    //Public Method
    purchasing.initEdit = function () {
        loadLineItemsAndSplits(); //TODO: better name?
    };

    function loadLineItemsAndSplits() {
        //Place a 'loading line items' ui block
        $.getJSON(purchasing._getOption("GetLineItemsAndSplitsUrl"), null, function (result) {
            console.log(result);
            var newLineItemsNeeded = result.lineItems.length - startingLineItemCount;

            if (newLineItemsNeeded > 0) { //Add the number of new line items needed so we have enough
                for (var j = 0; j < newLineItemsNeeded; j++) {
                    $("#add-line-item").trigger('createline');
                }
            }

            var isLineItemSplit = result.splitType === "Line";

            if (isLineItemSplit) {
                $("#split-by-line").trigger('click', { prompt: false });
            } else {
                createSplits(result);
            }

            //TODO: do this with the unserialize plugin??
            //Go through each line item and bind it to the ui
            for (var i = 0; i < result.lineItems.length; i++) {
                var prefix = "items[" + i + "].";

                for (var prop in result.lineItems[i]) {
                    var inputName = prefix + purchasing.lowerCaseFirstLetter(prop);

                    $(document.getElementsByName(inputName)).val(result.lineItems[i][prop]);
                }

                if (isLineItemSplit) {
                    var splitsForThisLine = $.map(result.splits, function (val) {
                        return val.LineItemId === result.lineItems[i]["Id"] ? val : null;
                    });

                    console.log("splits for line", splitsForThisLine);

                    var numNewSplitsNeeded = splitsForThisLine.length - startingLineItemSplitCount;

                    if (numNewSplitsNeeded > 0) { //Add the number of splits to this line item so we have enough
                        var splitButton = $(".sub-line-item-split-body[data-line-item-id='" + i + "']").next().find(".add-line-item-split");

                        for (var k = 0; k < numNewSplitsNeeded; k++) {
                            splitButton.trigger('createsplit');
                        }
                    }
                }
            }
        });
    }

    //Create splits for order splits and no split cases
    function createSplits(data) {
        if (data.splitType === "Order") {
            $("#split-order").trigger('click', { prompt: false });

            var newSplitsNeeded = data.splits.length - startingOrderSplitCount;

            if (newSplitsNeeded > 0) {
                for (var j = 0; j < newSplitsNeeded; j++) {
                    $("#add-order-split").trigger('createsplit');
                }
            }

            //TODO: actually bind the data
        }
        else if (data.splitType === "None") {
            var singleSplit = data.splits[0];

            if (singleSplit.Account !== null) {//we have account info, bind
                var $accountSelect = $("select[name=Account]"); //TODO: maybe use class instead?

                if (!purchasing.selectListContainsValue($accountSelect, singleSplit.Account)) {
                    //Add the account to the list if it is not already in the select
                    $("#select-option-template").tmpl({ id: singleSplit.Account, name: singleSplit.Account }).appendTo($accountSelect);
                }

                $accountSelect.val(singleSplit.Account);
                $("select[name=SubAccount]").val(singleSplit.SubAccount); //TODO: handle sub account
                $("select[name=Project]").val(singleSplit.Project);
            }
        }
    }

    purchasing.lowerCaseFirstLetter = function (w) {
        return w.charAt(0).toLowerCase() + w.slice(1);
    };

    purchasing.selectListContainsValue = function ($select, val) {
        var exists = false;
        $select.find("option").each(function () {
            if (this.value === val) {
                exists = true;
                console.log("value of option", this.value);
            }
        });

        return exists;
    };

} (window.purchasing = window.purchasing || {}, jQuery));
<commit_msg>now binding account/subaccount/project works, even with subloading, on non-split orders<commit_after>///<reference path="jquery-1.6.2-vsdoc.js"/>
///<reference path="OrderMockup.js"/>

//Self-Executing Anonymous Function
//Adding New Functionality to Purchasing for Edit
(function (purchasing, $, undefined) {
    //Private Property
    var routingAdjusted = false;
    var startingLineItemCount = 3;
    var startingOrderSplitCount = 3; //TODO: move these into a public var?  or options or something?  Statics maybe?
    var startingLineItemSplitCount = 2;

    //Public Method
    purchasing.initEdit = function () {
        loadLineItemsAndSplits(); //TODO: better name?
    };

    function loadLineItemsAndSplits() {
        //Place a 'loading line items' ui block
        $.getJSON(purchasing._getOption("GetLineItemsAndSplitsUrl"), null, function (result) {
            console.log(result);
            var newLineItemsNeeded = result.lineItems.length - startingLineItemCount;

            if (newLineItemsNeeded > 0) { //Add the number of new line items needed so we have enough
                for (var j = 0; j < newLineItemsNeeded; j++) {
                    $("#add-line-item").trigger('createline');
                }
            }

            var isLineItemSplit = result.splitType === "Line";

            if (isLineItemSplit) {
                $("#split-by-line").trigger('click', { prompt: false });
            } else {
                createSplits(result);
            }

            //TODO: do this with the unserialize plugin??
            //Go through each line item and bind it to the ui
            for (var i = 0; i < result.lineItems.length; i++) {
                var prefix = "items[" + i + "].";

                for (var prop in result.lineItems[i]) {
                    var inputName = prefix + purchasing.lowerCaseFirstLetter(prop);

                    $(document.getElementsByName(inputName)).val(result.lineItems[i][prop]);
                }

                if (isLineItemSplit) {
                    var splitsForThisLine = $.map(result.splits, function (val) {
                        return val.LineItemId === result.lineItems[i]["Id"] ? val : null;
                    });

                    console.log("splits for line", splitsForThisLine);

                    var numNewSplitsNeeded = splitsForThisLine.length - startingLineItemSplitCount;

                    if (numNewSplitsNeeded > 0) { //Add the number of splits to this line item so we have enough
                        var splitButton = $(".sub-line-item-split-body[data-line-item-id='" + i + "']").next().find(".add-line-item-split");

                        for (var k = 0; k < numNewSplitsNeeded; k++) {
                            splitButton.trigger('createsplit');
                        }
                    }
                }
            }
        });
    }

    //Create splits for order splits and no split cases
    function createSplits(data) {
        if (data.splitType === "Order") {
            $("#split-order").trigger('click', { prompt: false });

            var newSplitsNeeded = data.splits.length - startingOrderSplitCount;

            if (newSplitsNeeded > 0) {
                for (var j = 0; j < newSplitsNeeded; j++) {
                    $("#add-order-split").trigger('createsplit');
                }
            }

            //TODO: actually bind the data
        }
        else if (data.splitType === "None") {
            var singleSplit = data.splits[0];

            if (singleSplit.Account !== null) {//we have account info, bind
                var $accountSelect = $("select[name=Account]"); //TODO: maybe use class instead?

                if (!purchasing.selectListContainsValue($accountSelect, singleSplit.Account)) {
                    //Add the account to the list if it is not already in the select
                    $("#select-option-template").tmpl({ id: singleSplit.Account, name: singleSplit.Account }).appendTo($accountSelect);
                }

                $accountSelect.val(singleSplit.Account);
                $("input[name=Project]").val(singleSplit.Project);

                if (singleSplit.SubAccount != null) {
                    var $subAccountSelect = $("select[name=SubAccount]");
                    loadSubAccountsAndBind(singleSplit.Account, singleSplit.SubAccount, $subAccountSelect); //TODO: refactor into OrderMockup.js?
                }
            }
        }
    }

    //TODO: only call if subaccount != null, maybe refactor to move redundant code to OrderMockup.js
    function loadSubAccountsAndBind(account, subAccount, $subAccountSelect) {
        $.getJSON(purchasing._getOption("KfsSearchSubAccountsUrl"), { accountNumber: account }, function (result) {
            $subAccountSelect.find("option:not(:first)").remove();

            if (result.length > 0) {
                var data = $.map(result, function (n, i) { return { name: n.Name, id: n.Id }; });

                $("#select-option-template").tmpl(data).appendTo($subAccountSelect);
            }

            if (!purchasing.selectListContainsValue($subAccountSelect, subAccount)) {
                //If we still don't have the necessary value in sub account, add it in (shouldn't happen?)
                $("#select-option-template").tmpl({ id: subAccount, name: subAccount }).appendTo($subAccountSelect);
            }

            $subAccountSelect.val(subAccount);
            $subAccountSelect.removeAttr("disabled");
        });
    }

    purchasing.lowerCaseFirstLetter = function (w) {
        return w.charAt(0).toLowerCase() + w.slice(1);
    };

    purchasing.selectListContainsValue = function ($select, val) {
        var exists = false;
        $select.find("option").each(function () {
            if (this.value === val) {
                exists = true;
                console.log("value of option", this.value);
            }
        });

        return exists;
    };

} (window.purchasing = window.purchasing || {}, jQuery));
<|endoftext|>


<commit_before>exports.run = async (client, msg) => {
  const message = await msg.sendMessage("Ping?");
  return msg.sendMessage(`Pong! (Roundtrip took: ${message.createdTimestamp - msg.createdTimestamp}ms. Heartbeat: ${client.ping}ms.)`);
};

exports.conf = {
  enabled: true,
  runIn: ["text", "dm", "group"],
  aliases: [],
  permLevel: 0,
  botPerms: [],
  requiredFuncs: [],
};

exports.help = {
  name: "ping",
  description: "Ping/Pong command. I wonder what this does? /sarcasm",
  usage: "",
  usageDelim: "",
};
<commit_msg>Rounded heartbeat ping (#207)<commit_after>exports.run = async (client, msg) => {
  const message = await msg.sendMessage("Ping?");
  return msg.sendMessage(`Pong! (Roundtrip took: ${message.createdTimestamp - msg.createdTimestamp}ms. Heartbeat: ${Math.round(client.ping)}ms.)`);
};

exports.conf = {
  enabled: true,
  runIn: ["text", "dm", "group"],
  aliases: [],
  permLevel: 0,
  botPerms: [],
  requiredFuncs: [],
};

exports.help = {
  name: "ping",
  description: "Ping/Pong command. I wonder what this does? /sarcasm",
  usage: "",
  usageDelim: "",
};
<|endoftext|>


<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import {connectToStores} from 'fluxible-addons-react';
import {defineMessages} from 'react-intl';
import DeckList from './DeckList';
import Carousel from './Carousel';
import {NavLink, navigateAction} from 'fluxible-router';
import SearchBox from '../Search/AutocompleteComponents/HeaderSearchBox';
import LocaleSwitcher from '../LocaleSwitcher/LocaleSwitcher';
import {Button} from 'semantic-ui-react';
import updateTrap from '../../actions/loginModal/updateTrap';
import UserProfileStore from '../../stores/UserProfileStore';

class Home extends React.Component {

    constructor(props) {
        super(props);

        this.messages = defineMessages({
            welcome: {
                id: 'home.welcome',
                defaultMessage: 'Welcome to SlideWiki'
            },
            signUp: {
                id: 'home.signUp',
                defaultMessage: 'Sign Up'
            },
            learnMore: {
                id: 'home.learnMore',
                defaultMessage: 'Learn More'
            },
            findSlides: {
                id: 'home.findSlides',
                defaultMessage: 'Find slides'
            },
            findSlidesSubtitle: {
                id: 'home.findSlidesSubtitle',
                defaultMessage: 'Explore the deck lorem ipsum'           // TODO: change lorem ipsums
            },
            findSlidesContent: {
                id: 'home.findSlidesContent',
                defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eget elit sapien. Nunc semper urna in lectus consectetur fermentum. Vestibulum eu sem pulvinar, sollicitudin ipsum eu, porttitor elit. Maecenas bibendum congue lectus, viligula finibus, sit amet aliquam n ipsum eu, porttitor elit. Maecenas bibendum congue lectus, viligula finibus, sit amet.'           // TODO: change lorem ipsums
            },
            createSlides: {
                id: 'home.createSlides',
                defaultMessage: 'Create slides'
            },
            createSlidesSubtitle: {
                id: 'home.createSlidesSubtitle',
                defaultMessage: 'Learn how to create slides with SlideWiki'
            },
            createSlidesContent: {
                id: 'home.createSlidesContent',
                defaultMessage: 'Create a new deck or import existing slides from PowerPoint (*.pptx) or OpenDocument Presentation (*.odp) files. Your imported slides will be converted into HTML slides to allow you to continue to edit and add new slides.'
            },
            sharingSlides: {
                id: 'home.sharingSlides',
                defaultMessage: 'Sharing slides'
            },
            sharingSlidesSubtitle: {
                id: 'home.sharingSlidesSubtitle',
                defaultMessage: 'Present, Share and Communicate'
            },
            sharingSlidesContent: {
                id: 'home.sharingSlidesContent',
                defaultMessage: 'There are many ways that you and your students can engage and interact with slides and decks. Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes\' view. Share decks via social media or email.'
            },
            getStarted: {
                id: 'home.getStarted',
                defaultMessage: 'Get started right away.'
            },
            signIn: {
                id: 'home.signIn',
                defaultMessage: 'Sign in'
            },
            getStartedDescription: {
                id: 'home.getStartedDescription',
                defaultMessage: 'Create an account to start creating and sharing your decks. '
            },
            decks: {
                id: 'home.decks',
                defaultMessage: 'Decks, lorem ipsum dolor sit amet, consectetur adipiscing elit', // TODO: remove lorem ipsums
            },
            schools: {
                id: 'home.schools',
                defaultMessage: 'Schools'
            },
            schoolsContent: {
                id: 'home.schoolsContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            colleges: {
                id: 'home.colleges',
                defaultMessage: 'Colleges'
            },
            collegesContent: {
                id: 'home.collegesContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            training: {
                id: 'home.training',
                defaultMessage: 'Training'
            },
            trainingContent: {
                id: 'home.trainingContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            slideWikiEnjoy: {
                id: 'home.slideWikiEnjoy',
                defaultMessage: 'SlideWiki...Create, Share and Enjoy Presentations'
            },
            slideWikiAbout: {
                id: 'home.slideWikiAbout',
                defaultMessage: 'About SlideWiki'
            },
            slideWikiAboutContent: {
                id: 'home.slideWikiAboutContent',
                defaultMessage: 'SlideWiki is an open source development project, funded from the European Union\'s Horizon 2020 research and innovation programme. The project involves 17 partners to develop, test and trial SlideWiki. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eget elit sapien. Nunc semper urna in lectus consectetur fermentum. Vestibulum eu sem pulvinar, sollicitudin ipsum eu, porttitor elit. Maecenas bibendum congue lectus, vitae. SlideWiki is an open source development project, funded from the European Union\'s Horizon 2020 research and innovation programme. The project involves 17 partners to develop, test and trial SlideWiki. To find out more or get involved'
            },      //TODO: remove lorem ipsums
            slideWikiAboutVisit: {
                id: 'home.slideWikiAboutVisit',
                defaultMessage: 'visit the project webiste.'
            },
            myDecks: {
                id: 'home.myDecks',
                defaultMessage: 'My Decks.'
            }
        });
    }

    openFeatured(e){
        this.context.executeAction(navigateAction, {
            url: '/featured'
        });
    };

    handleSignUpButton() {
        this.context.executeAction(navigateAction, {
            url: '/signup'
        });
    }

    handleLoginButton() {
        this.context.executeAction(updateTrap,{activeTrap:true});
        //hidden the other page elements to readers
        $('#app').attr('aria-hidden','true');
        $('.ui.login.modal').modal('toggle');

        this.closeSidebar({target: ''});
    }

    render() {
        let signInStyle = {cursor: 'pointer'};
        let signInOrMyDecksElement = this.props.UserProfileStore.username === '' ?
            {this.context.intl.formatMessage(this.messages.signIn)} :
            <NavLink className="item" href={'/user/' + this.props.UserProfileStore.username}>
                {this.context.intl.formatMessage(this.messages.myDecks)}
            </NavLink>;
        return (

                {/**/}

{this.context.intl.formatMessage(this.messages.welcome)}

                                        <SearchBox type='home'/>

                                            <button className='home primary button' onClick={this.handleSignUpButton.bind(this)}>
                                                {this.context.intl.formatMessage(this.messages.signUp)}
                                            </button>
                                            <button className='home secondary  button'>
                                                {this.context.intl.formatMessage(this.messages.learnMore)}
                                            </button>

                {/**/}

Learn more about SlideWiki

{this.context.intl.formatMessage(this.messages.findSlides)}

{this.context.intl.formatMessage(this.messages.findSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.findSlidesContent)}

{this.context.intl.formatMessage(this.messages.createSlides)}Create slides

{this.context.intl.formatMessage(this.messages.findSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.findSlidesContent)}

{this.context.intl.formatMessage(this.messages.sharingSlides)}

{this.context.intl.formatMessage(this.messages.sharingSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.sharingSlidesContent)}

                                {this.context.intl.formatMessage(this.messages.getStarted)}{' '}
                                    {signInOrMyDecksElement}

{this.context.intl.formatMessage(this.messages.getStartedDescription)}

                   {/* */}

{this.context.intl.formatMessage(this.messages.decks)}

                                                        {this.context.intl.formatMessage(this.messages.schools)}

{this.context.intl.formatMessage(this.messages.schoolsContent)}

                                                        {this.context.intl.formatMessage(this.messages.colleges)}

{this.context.intl.formatMessage(this.messages.collegesContent)}

                                                        {this.context.intl.formatMessage(this.messages.training)}

{this.context.intl.formatMessage(this.messages.trainingContent)}

                    {/**/}

                    {/**/}

{this.context.intl.formatMessage(this.messages.slideWikiEnjoy)}

              // TODO: refactor this section to be a separated component based on a Carousel SWIK-2316

Featured deck

Introduction to Algebra

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur egestas in sapien in bibendum. Nam vulputate nunc a dictum aliquet. Morbi hendrerit enim in dolor condimentum faucibus.

                                                Read more...

Creator:soeren

Date:20/08/2018

                                                24
                                                7

                                            See  all decks

{this.context.intl.formatMessage(this.messages.slideWikiAbout)}

{this.context.intl.formatMessage(this.messages.slideWikiAboutContent)} {this.context.intl.formatMessage(this.messages.slideWikiAboutVisit)}

                    {/**/}

                {/**/}

        );
    }
}

Home.contextTypes = {
    intl: PropTypes.object.isRequired,
    getUser: PropTypes.func.isRequired,
    executeAction: PropTypes.func.isRequired
};

Home = connectToStores(Home, [UserProfileStore], (context, props) => {
    return {
        UserProfileStore: context.getStore(UserProfileStore).getState()
    };
});

export default Home;

//export default Home;
<commit_msg>Adding functionality to the learn more button<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import {connectToStores} from 'fluxible-addons-react';
import {defineMessages} from 'react-intl';
import DeckList from './DeckList';
import Carousel from './Carousel';
import {NavLink, navigateAction} from 'fluxible-router';
import SearchBox from '../Search/AutocompleteComponents/HeaderSearchBox';
import LocaleSwitcher from '../LocaleSwitcher/LocaleSwitcher';
import {Button} from 'semantic-ui-react';
import updateTrap from '../../actions/loginModal/updateTrap';
import UserProfileStore from '../../stores/UserProfileStore';

class Home extends React.Component {

    constructor(props) {
        super(props);

        this.messages = defineMessages({
            welcome: {
                id: 'home.welcome',
                defaultMessage: 'Welcome to SlideWiki'
            },
            signUp: {
                id: 'home.signUp',
                defaultMessage: 'Sign Up'
            },
            learnMore: {
                id: 'home.learnMore',
                defaultMessage: 'Learn More'
            },
            findSlides: {
                id: 'home.findSlides',
                defaultMessage: 'Find slides'
            },
            findSlidesSubtitle: {
                id: 'home.findSlidesSubtitle',
                defaultMessage: 'Explore the deck lorem ipsum'           // TODO: change lorem ipsums
            },
            findSlidesContent: {
                id: 'home.findSlidesContent',
                defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eget elit sapien. Nunc semper urna in lectus consectetur fermentum. Vestibulum eu sem pulvinar, sollicitudin ipsum eu, porttitor elit. Maecenas bibendum congue lectus, viligula finibus, sit amet aliquam n ipsum eu, porttitor elit. Maecenas bibendum congue lectus, viligula finibus, sit amet.'           // TODO: change lorem ipsums
            },
            createSlides: {
                id: 'home.createSlides',
                defaultMessage: 'Create slides'
            },
            createSlidesSubtitle: {
                id: 'home.createSlidesSubtitle',
                defaultMessage: 'Learn how to create slides with SlideWiki'
            },
            createSlidesContent: {
                id: 'home.createSlidesContent',
                defaultMessage: 'Create a new deck or import existing slides from PowerPoint (*.pptx) or OpenDocument Presentation (*.odp) files. Your imported slides will be converted into HTML slides to allow you to continue to edit and add new slides.'
            },
            sharingSlides: {
                id: 'home.sharingSlides',
                defaultMessage: 'Sharing slides'
            },
            sharingSlidesSubtitle: {
                id: 'home.sharingSlidesSubtitle',
                defaultMessage: 'Present, Share and Communicate'
            },
            sharingSlidesContent: {
                id: 'home.sharingSlidesContent',
                defaultMessage: 'There are many ways that you and your students can engage and interact with slides and decks. Use the Slideshow mode to view a deck as a slideshow. Includes a timer and speaker notes\' view. Share decks via social media or email.'
            },
            getStarted: {
                id: 'home.getStarted',
                defaultMessage: 'Get started right away.'
            },
            signIn: {
                id: 'home.signIn',
                defaultMessage: 'Sign in'
            },
            getStartedDescription: {
                id: 'home.getStartedDescription',
                defaultMessage: 'Create an account to start creating and sharing your decks. '
            },
            decks: {
                id: 'home.decks',
                defaultMessage: 'Decks, lorem ipsum dolor sit amet, consectetur adipiscing elit', // TODO: remove lorem ipsums
            },
            schools: {
                id: 'home.schools',
                defaultMessage: 'Schools'
            },
            schoolsContent: {
                id: 'home.schoolsContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            colleges: {
                id: 'home.colleges',
                defaultMessage: 'Colleges'
            },
            collegesContent: {
                id: 'home.collegesContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            training: {
                id: 'home.training',
                defaultMessage: 'Training'
            },
            trainingContent: {
                id: 'home.trainingContent',
                defaultMessage: 'Decks for teachers and students. Proin ultricies malesuada mi, id tincidunt ligula imperdiet non. Etiam tristique, odio vitae accumsan hendrerit, libero augue.' // TODO: remove lorem ipsums
            },
            slideWikiEnjoy: {
                id: 'home.slideWikiEnjoy',
                defaultMessage: 'SlideWiki...Create, Share and Enjoy Presentations'
            },
            slideWikiAbout: {
                id: 'home.slideWikiAbout',
                defaultMessage: 'About SlideWiki'
            },
            slideWikiAboutContent: {
                id: 'home.slideWikiAboutContent',
                defaultMessage: 'SlideWiki is an open source development project, funded from the European Union\'s Horizon 2020 research and innovation programme. The project involves 17 partners to develop, test and trial SlideWiki. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eget elit sapien. Nunc semper urna in lectus consectetur fermentum. Vestibulum eu sem pulvinar, sollicitudin ipsum eu, porttitor elit. Maecenas bibendum congue lectus, vitae. SlideWiki is an open source development project, funded from the European Union\'s Horizon 2020 research and innovation programme. The project involves 17 partners to develop, test and trial SlideWiki. To find out more or get involved'
            },      //TODO: remove lorem ipsums
            slideWikiAboutVisit: {
                id: 'home.slideWikiAboutVisit',
                defaultMessage: 'visit the project webiste.'
            },
            myDecks: {
                id: 'home.myDecks',
                defaultMessage: 'My Decks.'
            }
        });
    }

    openFeatured(e){
        this.context.executeAction(navigateAction, {
            url: '/featured'
        });
    };

    handleSignUpButton() {
        this.context.executeAction(navigateAction, {
            url: '/signup'
        });
    }

    handleLoginButton() {
        this.context.executeAction(updateTrap,{activeTrap:true});
        //hidden the other page elements to readers
        $('#app').attr('aria-hidden','true');
        $('.ui.login.modal').modal('toggle');

        this.closeSidebar({target: ''});
    }

    scrollToLearnMore() {
        let pos = $('#learnMore').position();
        if (window.innerWidth > 1200) {
            pos.top = pos.top - 346;
        } else if (window.innerWidth > 990) {
            pos.top = pos.top -300;
        }
        window.scroll(pos);
        $('#learnMore').focus();
    }

    render() {
        let signInStyle = {cursor: 'pointer'};
        let signInOrMyDecksElement = this.props.UserProfileStore.username === '' ?
            {this.context.intl.formatMessage(this.messages.signIn)} :
            <NavLink className="item" href={'/user/' + this.props.UserProfileStore.username}>
                {this.context.intl.formatMessage(this.messages.myDecks)}
            </NavLink>;
        return (

                {/**/}

{this.context.intl.formatMessage(this.messages.welcome)}

                                        <SearchBox type='home'/>

                                            <button className='home primary button' onClick={this.handleSignUpButton.bind(this)}>
                                                {this.context.intl.formatMessage(this.messages.signUp)}
                                            </button>
                                            <button className='home secondary  button' onClick={this.scrollToLearnMore.bind(this)}>
                                                {this.context.intl.formatMessage(this.messages.learnMore)}
                                            </button>

                {/**/}

Learn more about SlideWiki

{this.context.intl.formatMessage(this.messages.findSlides)}

{this.context.intl.formatMessage(this.messages.findSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.findSlidesContent)}

{this.context.intl.formatMessage(this.messages.createSlides)}Create slides

{this.context.intl.formatMessage(this.messages.findSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.findSlidesContent)}

{this.context.intl.formatMessage(this.messages.sharingSlides)}

{this.context.intl.formatMessage(this.messages.sharingSlidesSubtitle)}

{this.context.intl.formatMessage(this.messages.sharingSlidesContent)}

                                {this.context.intl.formatMessage(this.messages.getStarted)}{' '}
                                    {signInOrMyDecksElement}

{this.context.intl.formatMessage(this.messages.getStartedDescription)}

                   {/* */}

{this.context.intl.formatMessage(this.messages.decks)}

                                                        {this.context.intl.formatMessage(this.messages.schools)}

{this.context.intl.formatMessage(this.messages.schoolsContent)}

                                                        {this.context.intl.formatMessage(this.messages.colleges)}

{this.context.intl.formatMessage(this.messages.collegesContent)}

                                                        {this.context.intl.formatMessage(this.messages.training)}

{this.context.intl.formatMessage(this.messages.trainingContent)}

                    {/**/}

                    {/**/}

{this.context.intl.formatMessage(this.messages.slideWikiEnjoy)}

              {/*TODO: refactor this section to be a separated component based on a Carousel SWIK-2316*/}

Featured deck

Introduction to Algebra

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur egestas in sapien in bibendum. Nam vulputate nunc a dictum aliquet. Morbi hendrerit enim in dolor condimentum faucibus.

                                                Read more...

Creator:soeren

Date:20/08/2018

                                                24
                                                7

                                            See  all decks

{this.context.intl.formatMessage(this.messages.slideWikiAbout)}

{this.context.intl.formatMessage(this.messages.slideWikiAboutContent)} {this.context.intl.formatMessage(this.messages.slideWikiAboutVisit)}

                    {/**/}

                {/**/}

        );
    }
}

Home.contextTypes = {
    intl: PropTypes.object.isRequired,
    getUser: PropTypes.func.isRequired,
    executeAction: PropTypes.func.isRequired
};

Home = connectToStores(Home, [UserProfileStore], (context, props) => {
    return {
        UserProfileStore: context.getStore(UserProfileStore).getState()
    };
});

export default Home;

//export default Home;
<|endoftext|>


<commit_before>var XPCOMCoreVersion = '0.4.1'; // DO NOT REMOVE THIS COMMENT OR MOVE THIS LINE. THIS LINE IS AUTO-GENERATED FROM A RAKE TASK. @XPCOMCORE_VERSION@
const $Cc = Components.classes;
const $Ci = Components.interfaces;

var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
var libRoot = ioService.newURI("resource://xpcomcore/lib", null, null).QueryInterface($Ci.nsIFileURL).file.path;
var binRoot = ioService.newURI("resource://xpcomcore/bin", null, null).QueryInterface($Ci.nsIFileURL).file.path;

// NOTE - XPCOMCore is a singleton
var XPCOMCore = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };

  // Private method that does the work of loading the XPCOMCore kernel
  // into the given scope.
  var loadKernel = function(importScope) {
    var loader = $Cc["@mozilla.org/moz/jssubscript-loader;1"].getService($Ci.mozIJSSubScriptLoader);
    loader.loadSubScript("resource://xpcomcore/lib/kernel.js", importScope);
  };

  // Private method to actually kick off the importing of kernel into the given
  // import scope.
  var import = function(importScope, importKernel) {
    if (importScope.__XPCOMCoreLoaded__) {
      return false;
    } else {
      loadKernel(importScope);
      // FIXME - defineGetter explodes when it's a 'Window' object for some reason. Fine for
      // ChromeWindow and fine for BackstagePass though. Weird.
      // importScope.__defineGetter__('__XPCOMCoreLoaded__', function() { return true; });
      importScope.__XPCOMCoreLoaded__ = true;
      // Automatically mix Kernel into the scope if importKernel is true
      if (importKernel) { importScope.Kernel(importScope); };
      return true;
    }
  };

  // FIXME - hack. hijacking the nsIWritableVariant interface so we can have a constructor that works
  // FIXME - and to boot, for reasons i dont understand, we wrap the scope in another object, hence the options
  // hash. which might be useful anyway.
  this.setFromVariant = function(options) {
    if (!options.scope) { return false; }
    return import(options.scope, !(options.importKernel === false));
  };

  arguments.callee.__singletonInstance__ = this;
  // HACK HACK HACK - this is so we can get a reference to the real constructor
  // from the bootstrapper.
  this.__specialConstructor__ = arguments.callee;
};

// FIXME - maybe? might not really be a 'bug'
// Bahaha - we rely on http://mxr.mozilla.org/mozilla1.8/source/js/src/xpconnect/src/xpcwrappedjsclass.cpp#528
// (as written about in http://weblogs.mozillazine.org/weirdal/archives/019778.html) to expose a getProperty
// method on this object to allow for getting arbitrary properties.
var XPCOMCoreInterfaces = [$Ci.nsIClassInfo, $Ci.nsIPropertyBag, $Ci.nsIWritableVariant];

XPCOMCore.prototype = {
  classDescription: "XPCOMCore Core Object",
  contractID: "@conflagrationjs.org/xpcomcore/core;1",
  classID: Components.ID("{f562f600-9c25-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCoreConfig"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreInterfaces.length;
    return XPCOMCoreInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON,

  get version() { return new String(XPCOMCoreVersion); },
  get libRoot() { return new String(libRoot); },
  get binRoot() { return new String(binRoot); }

};

var XPCOMCoreConstructorInterfaces = [$Ci.nsIClassInfo, $Ci.nsIXPCConstructor, $Ci.nsIXPCScriptable];

// Singleton
var XPCOMCoreConstructor = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };
  var ctor = Components.Constructor("@conflagrationjs.org/xpcomcore/core;1", Components.interfaces.nsIWritableVariant, "setFromVariant");
  arguments.callee.__singletonInstance__ = ctor;
  return ctor;
};

XPCOMCoreConstructor.prototype = {
  classDescription: "XPCOMCore Core Object Constructor Hack",
  contractID: "@conflagrationjs.org/xpcomcore/core-constructor;1",
  classID: Components.ID("{b5762b40-a0ec-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreConstructorInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCore"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreConstructorInterfaces.length;
    return XPCOMCoreConstructorInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON
}

NSGetModule = function(compMgr, fileSpec) {
  return XPCOMUtils.generateModule([XPCOMCore, XPCOMCoreConstructor]);
};<commit_msg>Whoops. Makes the component actually work<commit_after>Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var XPCOMCoreVersion = '0.4.1'; // DO NOT REMOVE THIS COMMENT OR MOVE THIS LINE. THIS LINE IS AUTO-GENERATED FROM A RAKE TASK. @XPCOMCORE_VERSION@
const $Cc = Components.classes;
const $Ci = Components.interfaces;

var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
var libRoot = ioService.newURI("resource://xpcomcore/lib", null, null).QueryInterface($Ci.nsIFileURL).file.path;
var binRoot = ioService.newURI("resource://xpcomcore/bin", null, null).QueryInterface($Ci.nsIFileURL).file.path;

// NOTE - XPCOMCore is a singleton
var XPCOMCore = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };

  // Private method that does the work of loading the XPCOMCore kernel
  // into the given scope.
  var loadKernel = function(importScope) {
    var loader = $Cc["@mozilla.org/moz/jssubscript-loader;1"].getService($Ci.mozIJSSubScriptLoader);
    loader.loadSubScript("resource://xpcomcore/lib/kernel.js", importScope);
  };

  // Private method to actually kick off the importing of kernel into the given
  // import scope.
  var import = function(importScope, importKernel) {
    if (importScope.__XPCOMCoreLoaded__) {
      return false;
    } else {
      loadKernel(importScope);
      // FIXME - defineGetter explodes when it's a 'Window' object for some reason. Fine for
      // ChromeWindow and fine for BackstagePass though. Weird.
      // importScope.__defineGetter__('__XPCOMCoreLoaded__', function() { return true; });
      importScope.__XPCOMCoreLoaded__ = true;
      // Automatically mix Kernel into the scope if importKernel is true
      if (importKernel) { importScope.Kernel(importScope); };
      return true;
    }
  };

  // FIXME - hack. hijacking the nsIWritableVariant interface so we can have a constructor that works
  // FIXME - and to boot, for reasons i dont understand, we wrap the scope in another object, hence the options
  // hash. which might be useful anyway.
  this.setFromVariant = function(options) {
    if (!options.scope) { return false; }
    return import(options.scope, !(options.importKernel === false));
  };

  arguments.callee.__singletonInstance__ = this;
  // HACK HACK HACK - this is so we can get a reference to the real constructor
  // from the bootstrapper.
  this.__specialConstructor__ = arguments.callee;
};

// FIXME - maybe? might not really be a 'bug'
// Bahaha - we rely on http://mxr.mozilla.org/mozilla1.8/source/js/src/xpconnect/src/xpcwrappedjsclass.cpp#528
// (as written about in http://weblogs.mozillazine.org/weirdal/archives/019778.html) to expose a getProperty
// method on this object to allow for getting arbitrary properties.
var XPCOMCoreInterfaces = [$Ci.nsIClassInfo, $Ci.nsIPropertyBag, $Ci.nsIWritableVariant];

XPCOMCore.prototype = {
  classDescription: "XPCOMCore Core Object",
  contractID: "@conflagrationjs.org/xpcomcore/core;1",
  classID: Components.ID("{f562f600-9c25-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCoreConfig"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreInterfaces.length;
    return XPCOMCoreInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON,

  get version() { return new String(XPCOMCoreVersion); },
  get libRoot() { return new String(libRoot); },
  get binRoot() { return new String(binRoot); }

};

var XPCOMCoreConstructorInterfaces = [$Ci.nsIClassInfo, $Ci.nsIXPCConstructor, $Ci.nsIXPCScriptable];

// Singleton
var XPCOMCoreConstructor = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };
  var ctor = Components.Constructor("@conflagrationjs.org/xpcomcore/core;1", Components.interfaces.nsIWritableVariant, "setFromVariant");
  arguments.callee.__singletonInstance__ = ctor;
  return ctor;
};

XPCOMCoreConstructor.prototype = {
  classDescription: "XPCOMCore Core Object Constructor Hack",
  contractID: "@conflagrationjs.org/xpcomcore/core-constructor;1",
  classID: Components.ID("{b5762b40-a0ec-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreConstructorInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCore"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreConstructorInterfaces.length;
    return XPCOMCoreConstructorInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON
}

NSGetModule = function(compMgr, fileSpec) {
  return XPCOMUtils.generateModule([XPCOMCore, XPCOMCoreConstructor]);
};<|endoftext|>