text
stringlengths 2
6.14k
|
|---|
/**
* Module dependencies.
*/
var api = require('lib/db-api');
var config = require('lib/config');
var express = require('express');
var jwt = require('lib/jwt');
var passport = require('passport');
var log = require('debug')('democracyos:auth:facebook:routes');
var User = require('lib/models').User;
var fbSignedParser = require('fb-signed-parser');
/**
* Expose auth app
*/
var app = module.exports = express();
/*
* Facebook Auth routes
*/
app.get('/auth/facebook',
passport.authenticate('facebook', {
scope: config.auth.facebook.permissions
})
);
app.get('/auth/facebook/callback',
passport.authenticate('facebook', { failureRedirect: '/' }),
function(req, res) {
// After successful authentication
// redirect to homepage.
log('Log in user %s', req.user.id);
var token = jwt.encodeToken(api.user.expose.confidential(req.user), config.jwtSecret);
return res.cookie('token', token.token, { expires: new Date(token.expires), httpOnly: true }).redirect('/');
}
);
app.post('/auth/facebook/deauthorize', function(req, res) {
log('Parsing call to "/auth/facebook/deauthorize".');
res.send(200);
var signedRequest = req.params.signed_request;
if (!signedRequest) return log('"signed_request" param not found.');
var data = fbSignedParser.parse(signedRequest, config.auth.facebook.clientSecret);
if (!data || !data.user || !data.user.id) {
return log('Invalid "signed_request" data: ', data);
}
setTimeout(function(){
deauthorizeUser(data.user.id)
}, 0);
});
function deauthorizeUser(userFacebookId) {
log('Deauthorizing user with facebook id "%s".', userFacebookId);
var profile = {
id: userFacebookId,
provider: 'facebook'
};
User.findByProvider(profile, function (err, user) {
if (err) {
return log('Error looking for user with facebook id "%s".', userFacebookId);
}
if (!user) {
return log('User with facebook id "%s" not found.', userFacebookId);
}
user.set('profiles.facebook.deauthorized', true);
return user.save(function(err){
if (err) return log(err);
log('Facebook login for user "%s" deauthorized.', user.id);
});
});
}
|
// © 2000 NEOSYS Software Ltd. All Rights Reserved.//**Start Encode**
function form_postinit() {
//enable/disable password changing button
neosyssetexpression('button_password', 'disabled', '!gusers_authorisation_update&&gkey!=gusername')
//force retrieval of own record
if (gro.dictitem('USER_ID').defaultvalue)
window.setTimeout('focuson("USER_NAME")', 100)
gwhatsnew = neosysgetcookie(glogincode, 'NEOSYS2', 'wn').toLowerCase()
if (gwhatsnew) {
if (window.location.href.toString().slice(0, 5) == 'file:') gwhatsnew = 'file:///' + gwhatsnew
else gwhatsnew = '..' + gwhatsnew.slice(gwhatsnew.indexOf('\\data\\'))
neosyssetcookie(glogincode, 'NEOSYS2', '', 'wn')
neosyssetcookie(glogincode, 'NEOSYS2', gwhatsnew, 'wn2')
window.setTimeout('windowopen(gwhatsnew)', 1000)
//windowopen(gwhatsnew)
}
$$('button_password').onclick = user_setpassword
return true
}
//just to avoid confirmation
function form_prewrite() {
return true
}
//in authorisation.js and users.htm
var gtasks_newpassword
function form_postwrite() {
//if change own password then login with the new one
//otherwise cannot continue/unlock document so the lock hangs
if (gtasks_newpassword) db.login(gusername, gtasks_newpassword)
gtasks_newpassword = false
//to avoid need full login to get new font/colors
neosyssetcookie(glogincode, 'NEOSYS2', gds.getx('SCREEN_BODY_COLOR'), 'fc')
neosyssetcookie(glogincode, 'NEOSYS2', gds.getx('SCREEN_FONT'), 'ff')
neosyssetcookie(glogincode, 'NEOSYS2', gds.getx('SCREEN_FONT_SIZE'), 'fs')
return true
}
function users_postdisplay() {
var signatureimageelement = document.getElementById('signature_image')
if (signatureimageelement) {
signatureimageelement.src = ''
signatureimageelement.height = 0
signatureimageelement.width = 0
signatureimageelement.src = '../images/'+gdataset+'SHARP/UPLOAD/USERS/' + gkey.neosysconvert(' ', '') + '_signature.jpg'
}
//show only first five lines
form_filter('refilter', 'LOGIN_DATE', '', 4)
var reminderdays = 6
var passwordexpires = gds.getx('PASSWORD_EXPIRY_DATE')
$passwordexpiryelement = $$('passwordexpiryelement')
$passwordexpiryelement.innerHTML = ''
if (passwordexpires) {
var expirydays = (neosysint(passwordexpires) - neosysdate())
if (expirydays <= reminderdays)
$passwordexpiryelement.innerHTML = '<font color=red> Password expires in ' + expirydays + ' days.</font>'
}
return true
}
function form_postread() {
window.setTimeout('users_postdisplay()', 10)
return true
}
function users_upload_signature() {
//return openwindow('EXECUTE\r\MEDIA\r\OPENMATERIAL',scheduleno+'.'+materialletter)
/*
params=new Object()
params.scheduleno=scheduleno
params.materialletter=materialletter
neosysshowmodaldialog('../NEOSYS/upload.htm',params)
*/
//images are not stored per dataset at the moment so that they can be
//nor are they stored per file or per key so that they can be easily saved into a shared folder instead of going by web upload
params = {}
params.database = gdataset
params.filename = 'USERS'
params.key = gkey.neosysconvert(' ', '') + '_signature'
params.versionno = ''//newarchiveno
params.updateallowed = true
params.deleteallowed = true
//params.allowimages = true
//we only allow one image type merely so that the signature file name
//is always know and doesnt need saving in the user file
//and no possibility of uploading two image files with different extensions
params.allowablefileextensions = 'jpg'
var targetfilename = neosysshowmodaldialog('../NEOSYS/upload.htm', params)
window.setTimeout('users_postdisplay()', 1)
if (!targetfilename)
return false
return true
}
function user_signature_onload(el) {
el.removeAttribute("width")
el.removeAttribute("height")
}
|
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
export { AnimationDriver, ɵAnimation, ɵAnimationStyleNormalizer, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer, ɵAnimationDriver, ɵNoopAnimationDriver, ɵAnimationEngine, ɵCssKeyframesDriver, ɵCssKeyframesPlayer, ɵcontainsElement, ɵinvokeQuery, ɵmatchesElement, ɵvalidateStyleProperty, ɵWebAnimationsDriver, ɵsupportsWebAnimations, ɵWebAnimationsPlayer, ɵallowPreviousPlayerStylesMerge } from './src/browser';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuaW1hdGlvbnMvYnJvd3Nlci9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFhQSx1WkFBYyxlQUFlLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgR29vZ2xlIEluYy4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoaXMgcGFja2FnZS5cbiAqL1xuZXhwb3J0ICogZnJvbSAnLi9zcmMvYnJvd3Nlcic7XG4iXX0=
|
'use strict';
const path = require('path'),
mongoose = require('mongoose'),
Promise = require('bluebird'),
errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')),
_ = require('lodash');
mongoose.Promise = Promise;
const User = mongoose.model('User');
const Project = mongoose.model('Project');
/**
* Patch Update User Fields
*/
exports.patchUser = (req, res) => {
_.extend(req.model, req.body)
.save()
.then(updatedUser => {
res.jsonp(updatedUser);
})
.catch(err => {
console.error('ERROR on patch update for user `err`:\n', err);
res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
});
};
/**
* Return list of projects by contributor - query param `publishedOnly`, if true, returns only published projects
*
* @param req
* @param req.query.publishedOnly
* @param res
*/
exports.getContributorProjects = (req, res) => {
const projectIdsArray = [];
const projectsArray = [];
req.model.associatedProjects.map(assocProjId => { projectIdsArray.push(assocProjId); });
Project.find({
'_id': { $in: projectIdsArray }
})
.then(projects => {
if (req.query.publishedOnly===true) {
projects.map(project => {
if(project.status[0]==='published') {
projectsArray.push(project);
}
});
projects = projectsArray;
}
res.jsonp(projects);
})
.catch(err => {
console.error('error:\n', err);
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
});
};
|
/*jshint unused:false*/
var chai = require('chai'),
expect = chai.expect;
var request = require('supertest');
module.exports = function() {
'use strict';
this.Then(/^The JSON is returned by issuing a "GET" at the specified uri:$/, function(json, callback) {
request(this.serverLocation)
.get('/hello')
.expect('Content-Type', /json/)
.expect(200)
.end(function(error, res) {
if(error) {
expect(false).to.equal(true, error);
}
else {
expect(res.body).to.deep.equal(JSON.parse(json));
}
callback();
});
});
};
|
/* global sinon, setup, teardown */
/**
* __init.test.js is run before every test case.
*/
window.debug = true;
var AScene = require('aframe').AScene;
beforeEach(function () {
this.sinon = sinon.sandbox.create();
// Stub to not create a WebGL context since Travis CI runs headless.
this.sinon.stub(AScene.prototype, 'attachedCallback');
});
afterEach(function () {
// Clean up any attached elements.
['canvas', 'a-assets', 'a-scene'].forEach(function (tagName) {
var els = document.querySelectorAll(tagName);
for (var i = 0; i < els.length; i++) {
els[i].parentNode.removeChild(els[i]);
}
});
AScene.scene = null;
this.sinon.restore();
});
|
"use strict";
var mathUtils = require("./math-utils");
exports.shuffle = function(array) {
var len = array.length;
for ( var i=0; i<len; i++ ) {
var rand = mathUtils.randomInt(0,len-1);
var temp = array[i];
array[i] = array[rand];
array[rand] = temp;
}
};
|
/* eslint quote-props: ["error", "consistent"] */
// Japanese Hirajoshi scale
// 1-4-2-1-4
// Gb G B Db D Gb
export default {
'a': { instrument: 'piano', note: 'a4' },
'b': { instrument: 'piano', note: 'eb3' },
'c': { instrument: 'piano', note: 'd6' },
'd': { instrument: 'piano', note: 'eb4' },
'e': { instrument: 'piano', note: 'd4' },
'f': { instrument: 'piano', note: 'bb5' },
'g': { instrument: 'piano', note: 'd7' },
'h': { instrument: 'piano', note: 'g3' },
'i': { instrument: 'piano', note: 'g5' },
'j': { instrument: 'piano', note: 'bb6' },
'k': { instrument: 'piano', note: 'eb6' },
'l': { instrument: 'piano', note: 'bb4' },
'm': { instrument: 'piano', note: 'a6' },
'n': { instrument: 'piano', note: 'a5' },
'o': { instrument: 'piano', note: 'd5' },
'p': { instrument: 'piano', note: 'a2' },
'q': { instrument: 'piano', note: 'bb2' },
'r': { instrument: 'piano', note: 'a3' },
's': { instrument: 'piano', note: 'd3' },
't': { instrument: 'piano', note: 'g4' },
'u': { instrument: 'piano', note: 'g6' },
'v': { instrument: 'piano', note: 'bb3' },
'w': { instrument: 'piano', note: 'eb5' },
'x': { instrument: 'piano', note: 'eb2' },
'y': { instrument: 'piano', note: 'g2' },
'z': { instrument: 'piano', note: 'eb7' },
'A': { instrument: 'celesta', note: 'a4' },
'B': { instrument: 'celesta', note: 'eb3' },
'C': { instrument: 'celesta', note: 'd6' },
'D': { instrument: 'celesta', note: 'eb4' },
'E': { instrument: 'celesta', note: 'd4' },
'F': { instrument: 'celesta', note: 'bb4' },
'G': { instrument: 'celesta', note: 'd2' },
'H': { instrument: 'celesta', note: 'g3' },
'I': { instrument: 'celesta', note: 'g5' },
'J': { instrument: 'celesta', note: 'bb6' },
'K': { instrument: 'celesta', note: 'eb6' },
'L': { instrument: 'celesta', note: 'bb5' },
'M': { instrument: 'celesta', note: 'a6' },
'N': { instrument: 'celesta', note: 'a5' },
'O': { instrument: 'celesta', note: 'd5' },
'P': { instrument: 'celesta', note: 'a7' },
'Q': { instrument: 'celesta', note: 'bb7' },
'R': { instrument: 'celesta', note: 'a3' },
'S': { instrument: 'celesta', note: 'd3' },
'T': { instrument: 'celesta', note: 'g4' },
'U': { instrument: 'celesta', note: 'g6' },
'V': { instrument: 'celesta', note: 'bb3' },
'W': { instrument: 'celesta', note: 'eb5' },
'X': { instrument: 'celesta', note: 'eb7' },
'Y': { instrument: 'celesta', note: 'g7' },
'Z': { instrument: 'celesta', note: 'eb2' },
'$': { instrument: 'swell', note: 'eb3' },
',': { instrument: 'swell', note: 'eb3' },
'/': { instrument: 'swell', note: 'bb3' },
'\\': { instrument: 'swell', note: 'eb3' },
':': { instrument: 'swell', note: 'g3' },
';': { instrument: 'swell', note: 'bb3' },
'-': { instrument: 'swell', note: 'bb3' },
'+': { instrument: 'swell', note: 'g3' },
'|': { instrument: 'swell', note: 'bb3' },
'{': { instrument: 'swell', note: 'bb3' },
'}': { instrument: 'swell', note: 'eb3' },
'[': { instrument: 'swell', note: 'g3' },
']': { instrument: 'swell', note: 'bb3' },
'%': { instrument: 'swell', note: 'bb3' },
'&': { instrument: 'swell', note: 'eb3' },
'*': { instrument: 'swell', note: 'eb3' },
'^': { instrument: 'swell', note: 'bb3' },
'#': { instrument: 'swell', note: 'g3' },
'!': { instrument: 'swell', note: 'g3' },
'@': { instrument: 'swell', note: 'eb3' },
'(': { instrument: 'swell', note: 'g3' },
')': { instrument: 'swell', note: 'eb3' },
'=': { instrument: 'swell', note: 'eb3' },
'~': { instrument: 'swell', note: 'g3' },
'`': { instrument: 'swell', note: 'eb3' },
'_': { instrument: 'swell', note: 'g3' },
'"': { instrument: 'swell', note: 'eb3' },
"'": { instrument: 'swell', note: 'bb3' },
'<': { instrument: 'swell', note: 'g3' },
'>': { instrument: 'swell', note: 'g3' },
'.': { instrument: 'swell', note: 'g3' },
'?': { instrument: 'swell', note: 'bb3' },
'0': { instrument: 'fluteorgan', note: 'd3' },
'1': { instrument: 'fluteorgan', note: 'eb3' },
'2': { instrument: 'fluteorgan', note: 'g3' },
'3': { instrument: 'fluteorgan', note: 'a3' },
'4': { instrument: 'fluteorgan', note: 'bb3' },
'5': { instrument: 'fluteorgan', note: 'd2' },
'6': { instrument: 'fluteorgan', note: 'eb2' },
'7': { instrument: 'fluteorgan', note: 'g2' },
'8': { instrument: 'fluteorgan', note: 'a2' },
'9': { instrument: 'fluteorgan', note: 'bb2' },
's1': { instrument: 'swell', note: 'eb3' },
's2': { instrument: 'swell', note: 'g3' },
's3': { instrument: 'swell', note: 'bb3' }
};
|
// ==========================================================================
// Project: SproutCore Metal
// Copyright: ©2011 Strobe Inc. and contributors.
// License: Licensed under MIT license (see license.js)
// ==========================================================================
require('sproutcore-metal');
function isEnumerable(obj, keyName) {
var keys = [];
for(var key in obj) {
if (obj.hasOwnProperty(key)) keys.push(key);
}
return keys.indexOf(keyName)>=0;
}
module("SC.platform.defineProperty()");
test("defining a simple property", function() {
var obj = {};
SC.platform.defineProperty(obj, 'foo', {
enumerable: true,
writable: true,
value: 'FOO'
});
equals(obj.foo, 'FOO', 'should have added property');
obj.foo = "BAR";
equals(obj.foo, 'BAR', 'writable defined property should be writable');
equals(isEnumerable(obj, 'foo'), true, 'foo should be enumerable');
});
test('defining a read only property', function() {
var obj = {};
SC.platform.defineProperty(obj, 'foo', {
enumerable: true,
writable: false,
value: 'FOO'
});
equals(obj.foo, 'FOO', 'should have added property');
obj.foo = "BAR";
if (SC.platform.defineProperty.isSimulated) {
equals(obj.foo, 'BAR', 'simulated defineProperty should silently work');
} else {
equals(obj.foo, 'FOO', 'real defined property should not be writable');
}
});
test('defining a non enumerable property', function() {
var obj = {};
SC.platform.defineProperty(obj, 'foo', {
enumerable: false,
writable: true,
value: 'FOO'
});
if (SC.platform.defineProperty.isSimulated) {
equals(isEnumerable(obj, 'foo'), true, 'simulated defineProperty will leave properties enumerable');
} else {
equals(isEnumerable(obj, 'foo'), false, 'real defineProperty will make property not-enumerable');
}
});
test('defining a getter/setter', function() {
var obj = {}, getCnt = 0, setCnt = 0, v = 'FOO';
var desc = {
enumerable: true,
get: function() { getCnt++; return v; },
set: function(val) { setCnt++; v = val; }
};
if (SC.platform.hasPropertyAccessors) {
SC.platform.defineProperty(obj, 'foo', desc);
equals(obj.foo, 'FOO', 'should return getter');
equals(getCnt, 1, 'should have invoked getter');
obj.foo = 'BAR';
equals(obj.foo, 'BAR', 'setter should have worked');
equals(setCnt, 1, 'should have invoked setter');
} else {
raises(function() {
SC.platform.defineProperty(obj, 'foo', desc);
}, Error, 'should throw exception if getters/setters not supported');
}
});
test('defining getter/setter along with writable', function() {
var obj ={};
raises(function() {
SC.platform.defineProperty(obj, 'foo', {
enumerable: true,
get: function() {},
set: function() {},
writable: true
});
}, Error, 'defining writable and get/set should throw exception');
});
test('defining getter/setter along with value', function() {
var obj ={};
raises(function() {
SC.platform.defineProperty(obj, 'foo', {
enumerable: true,
get: function() {},
set: function() {},
value: 'FOO'
});
}, Error, 'defining value and get/set should throw exception');
});
|
var Promise = require('ember-cli/lib/ext/promise');
module.exports = {
normalizeEntityName: function() {},
afterInstall: function() {
var addonContext = this;
return this.addBowerPackageToProject('jquery-ui', '1.10.1')
.then(function() {
return addonContext.addBowerPackageToProject('jquery-mousewheel', '~3.1.4');
})
.then(function() {
return addonContext.addBowerPackageToProject('taras/antiscroll', '92505e0e0d0ef9383630df509883bce558215b22');
});
}
};
|
///////////////////////
/// UTILS ///
///////////////////////
var u = {};
u.distance = function (p1, p2) {
var dx = p2.x - p1.x;
var dy = p2.y - p1.y;
return Math.sqrt((dx * dx) + (dy * dy));
};
u.angle = function(p1, p2) {
var dx = p2.x - p1.x;
var dy = p2.y - p1.y;
return u.degrees(Math.atan2(dy, dx));
};
u.findCoord = function(p, d, a) {
var b = {x: 0, y: 0};
a = u.radians(a);
b.x = p.x - d * Math.cos(a);
b.y = p.y - d * Math.sin(a);
return b;
};
u.radians = function(a) {
return a * (Math.PI / 180);
};
u.degrees = function(a) {
return a * (180 / Math.PI);
};
u.bindEvt = function (el, type, handler) {
if (el.addEventListener) {
el.addEventListener(type, handler, false);
} else if (el.attachEvent) {
el.attachEvent(type, handler);
}
};
u.unbindEvt = function (el, type, handler) {
if (el.removeEventListener) {
el.removeEventListener(type, handler);
} else if (el.detachEvent) {
el.detachEvent(type, handler);
}
};
u.trigger = function (el, type, data) {
var evt = new CustomEvent(type, data);
el.dispatchEvent(evt);
};
u.prepareEvent = function (evt) {
evt.preventDefault();
return isTouch ? evt.changedTouches : evt;
};
u.getScroll = function () {
var x = (window.pageXOffset !== undefined) ?
window.pageXOffset :
(document.documentElement || document.body.parentNode || document.body)
.scrollLeft;
var y = (window.pageYOffset !== undefined) ?
window.pageYOffset :
(document.documentElement || document.body.parentNode || document.body)
.scrollTop;
return {
x: x,
y: y
};
};
u.applyPosition = function (el, pos) {
if (pos.x && pos.y) {
el.style.left = pos.x + 'px';
el.style.top = pos.y + 'px';
} else if (pos.top || pos.right || pos.bottom || pos.left) {
el.style.top = pos.top;
el.style.right = pos.right;
el.style.bottom = pos.bottom;
el.style.left = pos.left;
}
};
u.getTransitionStyle = function (property, values, time) {
var obj = u.configStylePropertyObject(property);
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
if (typeof values === 'string') {
obj[i] = values + ' ' + time;
} else {
var st = '';
for (var j = 0, max = values.length; j < max; j += 1) {
st += values[j] + ' ' + time + ', ';
}
obj[i] = st.slice(0, -2);
}
}
}
return obj;
};
u.getVendorStyle = function (property, value) {
var obj = u.configStylePropertyObject(property);
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
obj[i] = value;
}
}
return obj;
};
u.configStylePropertyObject = function (prop) {
var obj = {};
obj[prop] = '';
var vendors = ['webkit', 'Moz', 'o'];
vendors.forEach(function (vendor) {
obj[vendor + prop.charAt(0).toUpperCase() + prop.slice(1)] = '';
});
return obj;
};
u.extend = function (objA, objB) {
for (var i in objB) {
if (objB.hasOwnProperty(i)) {
objA[i] = objB[i];
}
}
};
|
const core = require('brigadehub-core')
var pkg = require('./package.json')
var brigade = require('./brigade')()[0]
const bhConfig = {
dotenv: require('./dotenv')(),
info: '[Brigadehub]',
version: pkg.version,
brigade: brigade
}
core(bhConfig)
|
var searchData=
[
['player',['player',['../classplayer.html#a4c43d838817775e2a2b0241d30de4abc',1,'player']]]
];
|
const assert = require('assert');
const md5 = require('blueimp-md5');
const createApp = require('../../lib');
describe('tokenize service', () => {
it('tokenizes and stems', () => {
const app = createApp();
const text = `what's the weather in vancouver`;
const hash = md5(text);
return app.service('tokenize').create({ text }).then(data => {
assert.equal(data._id, hash, 'id is MD5 hash of the string');
assert.deepEqual(data, {
_id: '873dd3d48eed1d576a4d5b1dcacd2348',
text: 'what\'s the weather in vancouver',
tokens: [ 'what', 's', 'the', 'weather', 'in', 'vancouver' ],
stems: [ 'what', 's', 'the', 'weather', 'in', 'vancouv' ]
});
});
});
});
|
'use strict';
var getTemplatedStylesheet = require('./templatedStylesheet'),
path = require('path');
module.exports = getTemplatedStylesheet(path.join(__dirname, '/templates/stylus.tpl'));
|
import React from 'react'
import Icon from 'react-icon-base'
const MdTonality = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m32.9 23.4c0.1-0.6 0.2-1.2 0.3-1.8h-11.6v1.8h11.3z m-2.5 5c0.4-0.6 0.9-1.2 1.2-1.8h-10v1.8h8.8z m-8.8 4.8c1.8-0.2 3.4-0.8 4.9-1.6h-4.9v1.6z m0-16.6v1.8h11.6c-0.1-0.6-0.2-1.2-0.3-1.8h-11.3z m0-5v1.8h10c-0.4-0.6-0.8-1.2-1.2-1.8h-8.8z m0-4.8v1.6h4.9c-1.5-0.8-3.1-1.4-4.9-1.6z m-3.2 26.4v-26.4c-6.6 0.8-11.8 6.4-11.8 13.2s5.2 12.4 11.8 13.2z m1.6-29.8c9.2 0 16.6 7.4 16.6 16.6s-7.4 16.6-16.6 16.6-16.6-7.4-16.6-16.6 7.4-16.6 16.6-16.6z"/></g>
</Icon>
)
export default MdTonality
|
'use strict'
const dotenv = require('dotenv')
const ENV = process.env.NODE_ENV || 'development'
if (ENV === 'development') dotenv.load()
const config = {
ENV: process.env.NODE_ENV,
PORT: process.env.PORT,
PROXY_URI: process.env.PROXY_URI,
WEBHOOK_URL: process.env.WEBHOOK_URL,
BATTLESHIP_COMMAND_TOKEN: process.env.BATTLESHIP_COMMAND_TOKEN,
SLACK_TOKEN: process.env.SLACK_TOKEN,
ICON_EMOJI: ':passenger_ship:',
USERNAME: "Battleship"
}
module.exports = (key) => {
if (!key) return config
return config[key]
}
|
window.hideAlert = function () {
$('#alertMessage').addClass("hidden");
$('#alertMessage').text("");
};
window.showAlert = function (msg) {
$('#alertMessage').text(msg);
$('#alertMessage').addClass("alert-danger");
$('#alertMessage').removeClass("hidden");
$('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
};
window.showInfo = function (msg) {
$('#alertMessage').text(msg);
$('#alertMessage').removeClass("alert-danger");
$('#alertMessage').removeClass("hidden");
$('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
};
window.dataErrorAlert = function (data) {
switch (data.idError) {
case "InvalidFile":
showAlert(Resources["InvalidFile"]);
break;
case "InvalidReg":
showAlert(Resources["WrongRegExpMessage"]);
break;
case "NotFound":
showAlert(Resources["NoSearchResultsMessage"]);
break;
case "InvalidPassword":
showAlert(Resources["UnlockInvalidPassword"]);
break;
default:
showAlert(data.idError);
break;
}
};
window.handleError = function (xhr, exception) {
hideLoader();
$('#workButton').removeClass("hidden");
var msg = '';
if (xhr.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (xhr.status == 404) {
msg = 'Requested page not found. [404]';
} else if (xhr.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + xhr.responseText;
}
showAlert(msg);
};
|
// Design Basic Game Solo Challenge
// This is a solo challenge
// Your mission description:To complete a line of the same figure, horizontal, diagonal or vertical
// Overall mission: To win all the time :)
// Goals: make a line of the same kind before computer does
// Characters:You and the computer
// Objects:tic tac toe
// Functions:clear_board, refresh_board, turn
// Pseudocode
// Make a Tictactoe class
// Initialize the instance
// Paint the board
// Take a turn UNTIL someones win
// Check if some one won
// Clear the board
//
//
//
//
// Initial Code
turns = 0
board_state = [[" "," "," "],
[" "," "," "],
[" "," "," "]];
var Tictactoe = {
take_turn : function(user){
mark = prompt("It is your turn, where do you want to mark?");
horizontal = mark[1];
vertical = mark[0].toUpperCase();
if (vertical == "A"){
vertical = 0
} else if (vertical == "B"){
vertical = 1
} else {
vertical = 2
}
board_state[horizontal-1][vertical] = user
console.log(board_state)
},
print_board : function(){
line = ""
console.log(" A B C")
for (i in board_state){
new_line = "\n ═══╬═══╬═══\n"
for (x in board_state[i]){
ln = parseInt(i);
if (x == 0){line = (ln+1)+" "}
if (x == 2) {
if (i == 2){new_line = "\n"}
line += " "+board_state[i][x]+new_line;
} else {
line += " "+board_state[i][x]+" ║"
}
}
console.log(line);
}
}
}
alert ("Welcome to @cyberpolin's Tic Tac Toe\n So it is the turn of User 1, please select where you want to mark...")
Tictactoe.print_board()
while (turns < 9){
if (turns%2 == 0){
Tictactoe.take_turn("o");
} else {
Tictactoe.take_turn("x");
}
Tictactoe.print_board();
turns++;
}
// RELECTION
// What was the most difficult part of this challenge?
// Order my toughts to make the code works as i wannted, also as javascript is not a language thinked for terminal it was difficult to figure out how it was going to work.
// What did you learn about creating objects and functions that interact with one another?
// Is like in ruby, i think of them as just methods
// Did you learn about any new built-in methods you could use in your refactored solution? If so, what were they and how do they work?
// The only one i used was toUpperCase, ad they are like Ruby methods even tough Javascript have a different syntax.
// How can you access and manipulate properties of objects?
// like in Ruby object[property] = new_value, or the JS way object.property = new_value
// TODO'S
// Check if a place is marked already
// Check if you have winned
// Make it playable with computer
// MAKE IT GRAPHICAL!!!!
|
// GridFS
// Copyright(c) 2013 Siddharth Mahendraker <siddharth_mahen@me.com>
// MIT Licensed
exports.GridFS = require('./lib/GridFS');
exports.GridStream = require('./lib/GridStream');
|
// @flow
class A {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(function (z) {
this.y; // error, function has wrong this
});
}
}
class B {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(function (z) {
this.y; // ok, function gets passed correct this
}, this);
}
}
class C {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(z => {
this.y; // ok, arrow binds surrounding context this
});
}
}
|
import collectionClass from "./collections.class";
import collectionColor from "./collections.color";
function collectionBackgroundStyles(contentItem) {
return `
.${collectionClass(contentItem)} {
background-color: #${collectionColor(contentItem)};
}
`;
}
export default collectionBackgroundStyles;
|
version https://git-lfs.github.com/spec/v1
oid sha256:71736be070607c3c30f4c139b063edf1b1ffa587cf725a0acc1e06c6d3af0e48
size 53235
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
CurrentModel = mongoose.model('Attendance'),
Schedule = mongoose.model('Schedule'),
Group = mongoose.model('Group'),
_ = require('lodash');
exports.attendance = function(req, res, next, id) {
CurrentModel.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.attendance = item;
next();
});
};
exports.schedule = function(req, res, next, id) {
Schedule.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.schedule = item;
next();
});
};
exports.group = function(req, res, next, id) {
Group.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.group = item;
next();
});
};
exports.create = function(req, res) {
var value = new CurrentModel(req.body);
value.group = req.group;
value.schedule = req.schedule;
value.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: value
});
} else {
res.jsonp(value);
}
});
};
exports.update = function(req, res) {
var item = req.attendance;
item = _.extend(item, req.body);
item.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: item
});
} else {
res.jsonp(item);
}
});
};
exports.destroy = function(req, res) {
var item = req.attendance;
item.remove(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: item
});
} else {
res.jsonp(item);
}
});
};
exports.show = function(req, res) {
res.jsonp(req.attendance);
};
exports.all = function(req, res) {
CurrentModel.find({ group: req.group, schedule: req.schedule }).populate('participant', 'name email').exec(function(err, items) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(items);
}
});
};
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "m22 6.92-1.41-1.41-2.85 3.21C15.68 6.4 12.83 5 9.61 5 6.72 5 4.07 6.16 2 8l1.42 1.42C5.12 7.93 7.27 7 9.61 7c2.74 0 5.09 1.26 6.77 3.24l-2.88 3.24-4-4L2 16.99l1.5 1.5 6-6.01 4 4 4.05-4.55c.75 1.35 1.25 2.9 1.44 4.55H21c-.22-2.3-.95-4.39-2.04-6.14L22 6.92z"
}), 'MultilineChartOutlined');
exports.default = _default;
|
import dateformat from 'dateformat';
import { map } from "underscore";
import { getAccountById } from 'routes/root/routes/Banking/routes/Accounts/modules/accounts';
import { getCreditCardById, getPrepaidCardById } from 'routes/root/routes/Banking/routes/Cards/modules/cards';
import { getLoanById } from 'routes/root/routes/Banking/routes/Loans/modules/loans';
export const getDebitAccount = (debitAccountType, debitAccountId) => {
switch (debitAccountType) {
case "isAccount":
getAccountById(debitAccountId)
break;
case "isLoan":
getLoanById(debitAccountId)
break;
case "isCreditCard":
getCreditCardById(debitAccountId)
break;
case "isPrepaidCard":
getPrepaidCardById(debitAccountId)
break;
}
}
const findDebitAccount = (debitAccountType, debitAccountId, state) => {
let debitAccount = {};
switch (debitAccountType) {
case "isAccount":
debitAccount = state.accounts.accounts.filter((account) => account.id == debitAccountId)[0]
break;
case "isLoan":
debitAccount = state.loans.loans.filter((loan) => loan.id == debitAccountId)[0]
break;
case "isCreditCard":
debitAccount = state.cards.creditCards.filter((creditCard) => creditCard.id == debitAccountId)[0]
break;
case "isPrepaidCard":
debitAccount = state.cards.prepaidCards.filter((prepaidCard) => prepaidCard.id == debitAccountId)[0]
break;
}
return debitAccount;
}
export const getDebitAccountAvailableBalance = (debitAccountType, debitAccountId, state) => {
const debitAccount = findDebitAccount(debitAccountType, debitAccountId, state);
return getProductAvailableBalance(debitAccount, debitAccountType);
}
export const getProductAvailableBalance = (debitAccount, debitAccountType) => {
let availableBalance = 0;
switch (debitAccountType) {
case "isAccount":
availableBalance = debitAccount.ledgerBalance;
break;
case "isLoan":
case "isCreditCard":
case "isPrepaidCard":
availableBalance = debitAccount.availableBalance;
break;
}
return availableBalance;
}
export const getDebitAccountCurrency = (debitAccountType, debitAccountId, state) => {
return findDebitAccount(debitAccountType, debitAccountId, state).currency;
}
export const isValidDate = (date) => {
return new Date(date).setHours(0,0,0,0) >= new Date(dateformat()).setHours(0,0,0,0)
}
export const isValidInstallmentPaymentAmount = (product, amount, availableBalance) => {
return amount > 0 &&
(parseFloat(amount) <= product.nextInstallmentAmount ||
parseFloat(amount) <= product.debt) &&
parseFloat(amount) <= availableBalance
}
export const isValidInstallmentPaymentForm = (transactionForm) => {
return transactionForm.debitAccount.correct &&
transactionForm.amount.correct &&
transactionForm.date.correct
}
export const getPaymentType = (paymentMethod) => {
let paymentType = '';
switch (paymentMethod) {
case 'ΚΑΡΤΑ AGILE BANK':
paymentType = 'isCreditCardAgile';
break;
case 'ΚΑΡΤΑ ΑΛΛΗΣ ΤΡΑΠΕΖΗΣ':
paymentType = 'isCreditCardThirdParty';
break;
case 'ΔΑΝΕΙΟ AGILE BANK':
paymentType = 'isLoan';
break;
default:
paymentType = 'thirdPartyPayment';
}
return paymentType;
}
export const getCustomerName = (fullCustomerName) => {
return (fullCustomerName.firstName + ' ' + fullCustomerName.lastName)
.replace('ά', 'α')
.replace('έ', 'ε')
.replace('ί', 'ι')
.replace('ή', 'η')
.replace('ό', 'ο')
.replace('ύ', 'υ')
.replace('ώ', 'ω');
}
export const getActualFullName = (fullName, currentFullName) => {
const correctPattern = new RegExp("^[A-Za-zΑ-Ωα-ω ]+$");
return fullName = (correctPattern.test(fullName) || fullName == '' ? fullName : currentFullName).toUpperCase();
}
export const isValidFullName = (fullName) => fullName.split(' ').length == 2
export const isValidDebitAmount = (amount, availableBalance) => {
return amount > 0 && (parseFloat(amount)) <= availableBalance
}
export const isValidChargesBeneficiary = (beneficiary) => {
return beneficiary == 'both' || beneficiary == 'sender' || beneficiary == 'beneficiary'
}
export const findPaymentCharges = (paymentMethods, paymentName) => {
return map(paymentMethods, (paymentMethod) => paymentMethod.map(method => method))
.flatMap(paymentMethod => paymentMethod)
.filter(payment => payment.name == paymentName)[0].charges
}
export const findTransferCharges = (beneficiary) => {
let charges = 0;
switch (beneficiary) {
case 'both':
charges = 3;
break;
case 'sender':
charges = 6;
break;
case 'beneficiary':
charges = 0;
break;
}
return charges;
}
export const getImmediateText = (language) => {
let immediateText = '';
switch (language) {
case 'greek':
immediateText = 'ΑΜΕΣΑ';
break;
case 'english':
immediateText = 'IMMEDIATE';
break;
}
return immediateText;
}
export const formatCardNumber = (cardNumber) => {
return [...cardNumber].map(((num, key) => key % 4 == 0 && key != 0 ? ' ' + num : num ))
}
|
var assert = require('assert');
var num = require('../');
test('sub', function() {
assert.equal(num.sub(0, 0), '0');
assert.equal(num.sub('0', '-0'), '0');
assert.equal(num.sub('1.0', '-1.0'), '2.0');
assert.equal(num('987654321987654321.12345678901').sub(100.012), '987654321987654221.11145678901');
assert.equal(num(100.012).sub(num('987654321987654321.12345678901')), '-987654321987654221.11145678901');
});
test('sub#constness', function() {
var one = num(1.2);
var two = num(-1.2);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
one.sub(two);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
two.sub(one);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
});
|
console.log('argv[0]: '+process.argv[0]);
console.log('argv[1]: '+process.argv[1]);
|
'use strict';
var Crawler = require('../lib/crawler');
var expect = require('chai').expect;
var jsdom = require('jsdom');
var httpbinHost = 'localhost:8000';
describe('Errors', function() {
describe('timeout', function() {
var c = new Crawler({
timeout : 1500,
retryTimeout : 1000,
retries : 2,
jquery : false
});
it('should return a timeout error after ~5sec', function(done) {
// override default mocha test timeout of 2000ms
this.timeout(10000);
c.queue({
uri : 'http://'+httpbinHost+'/delay/15',
callback : function(error, response) //noinspection BadExpressionStatementJS,BadExpressionStatementJS
{
expect(error).not.to.be.null;
expect(error.code).to.equal("ETIMEDOUT");
//expect(response).to.be.undefined;
done();
}
});
});
it('should retry after a first timeout', function(done) {
// override default mocha test timeout of 2000ms
this.timeout(15000);
c.queue({
uri : 'http://'+httpbinHost+'/delay/1',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.body).to.be.ok;
done();
}
});
});
});
describe('error status code', function() {
var c = new Crawler({
jQuery : false
});
it('should not return an error on status code 400 (Bad Request)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/400',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(400);
done();
}
});
});
it('should not return an error on status code 401 (Unauthorized)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/401',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(401);
done();
}
});
});
it('should not return an error on status code 403 (Forbidden)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/403',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(403);
done();
}
});
});
it('should not return an error on a 404', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/404',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.statusCode).to.equal(404);
done();
}
});
});
it('should not return an error on a 500', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/500',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.statusCode).to.equal(500);
done();
}
});
});
it('should not failed on empty response', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/204',
callback : function(error) {
expect(error).to.be.null;
done();
}
});
});
it('should not failed on a malformed html if jquery is false', function(done) {
c.queue({
html : '<html><p>hello <div>dude</p></html>',
callback : function(error, response) {
expect(error).to.be.null;
expect(response).not.to.be.null;
done();
}
});
});
it('should not return an error on a malformed html if jQuery is jsdom', function(done) {
c.queue({
html : '<html><p>hello <div>dude</p></html>',
jQuery : jsdom,
callback : function(error, response) {
expect(error).to.be.null;
expect(response).not.to.be.undefined;
done();
}
});
});
});
});
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M21 3H3C2 3 1 4 1 5v14c0 1.1.9 2 2 2h18c1 0 2-1 2-2V5c0-1-1-2-2-2zM5 17l3.5-4.5 2.5 3.01L14.5 11l4.5 6H5z"
}), 'PhotoSizeSelectActual');
exports.default = _default;
|
const PlotCard = require('../../plotcard.js');
class RiseOfTheKraken extends PlotCard {
setupCardAbilities() {
this.interrupt({
when: {
onUnopposedWin: event => event.challenge.winner === this.controller
},
handler: () => {
this.game.addMessage('{0} uses {1} to gain an additional power from winning an unopposed challenge', this.controller, this);
this.game.addPower(this.controller, 1);
}
});
}
}
RiseOfTheKraken.code = '02012';
module.exports = RiseOfTheKraken;
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z"
}), 'AssessmentRounded');
|
SVG.G = SVG.invent({
// Initialize node
create: 'g'
// Inherit from
, inherit: SVG.Container
// Add class methods
, extend: {
// Move over x-axis
x: function(x) {
return x == null ? this.transform('x') : this.transform({ x: x - this.x() }, true)
}
// Move over y-axis
, y: function(y) {
return y == null ? this.transform('y') : this.transform({ y: y - this.y() }, true)
}
// Move by center over x-axis
, cx: function(x) {
return x == null ? this.gbox().cx : this.x(x - this.gbox().width / 2)
}
// Move by center over y-axis
, cy: function(y) {
return y == null ? this.gbox().cy : this.y(y - this.gbox().height / 2)
}
, gbox: function() {
var bbox = this.bbox()
, trans = this.transform()
bbox.x += trans.x
bbox.x2 += trans.x
bbox.cx += trans.x
bbox.y += trans.y
bbox.y2 += trans.y
bbox.cy += trans.y
return bbox
}
}
// Add parent method
, construct: {
// Create a group element
group: function() {
return this.put(new SVG.G)
}
}
})
|
'use strict';
module.exports = function generate_format(it, $keyword) {
var out = ' ';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
var $schema = it.schema[$keyword];
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
var $breakOnError = !it.opts.allErrors;
var $data = 'data' + ($dataLvl || '');
if (it.opts.format === false) {
if ($breakOnError) {
out += ' if (true) { ';
}
return out;
}
var $isData = it.opts.v5 && $schema && $schema.$data,
$schemaValue;
if ($isData) {
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
$schemaValue = 'schema' + $lvl;
} else {
$schemaValue = $schema;
}
var $unknownFormats = it.opts.unknownFormats,
$allowUnknown = Array.isArray($unknownFormats);
if ($isData) {
var $format = 'format' + $lvl;
out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var isObject' + ($lvl) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; if (isObject' + ($lvl) + ') { ';
if (it.async) {
out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';
}
out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
}
out += ' (';
if ($unknownFormats === true || $allowUnknown) {
out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';
if ($allowUnknown) {
out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';
}
out += ') || ';
}
out += ' (' + ($format) + ' && !(typeof ' + ($format) + ' == \'function\' ? ';
if (it.async) {
out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
} else {
out += ' ' + ($format) + '(' + ($data) + ') ';
}
out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';
} else {
var $format = it.formats[$schema];
if (!$format) {
if ($unknownFormats === true || ($allowUnknown && $unknownFormats.indexOf($schema) == -1)) {
throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');
} else {
if (!$allowUnknown) {
console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
if ($unknownFormats !== 'ignore') console.warn('In the next major version it will throw exception. See option unknownFormats for more information');
}
if ($breakOnError) {
out += ' if (true) { ';
}
return out;
}
}
var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;
if ($isObject) {
var $async = $format.async === true;
$format = $format.validate;
}
if ($async) {
if (!it.async) throw new Error('async format in sync schema');
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { ';
} else {
out += ' if (! ';
var $formatRef = 'formats' + it.util.getProperty($schema);
if ($isObject) $formatRef += '.validate';
if (typeof $format == 'function') {
out += ' ' + ($formatRef) + '(' + ($data) + ') ';
} else {
out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';
}
out += ') { ';
}
}
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';
if ($isData) {
out += '' + ($schemaValue);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should match format "';
if ($isData) {
out += '\' + ' + ($schemaValue) + ' + \'';
} else {
out += '' + (it.util.escapeQuotes($schema));
}
out += '"\' ';
}
if (it.opts.verbose) {
out += ' , schema: ';
if ($isData) {
out += 'validate.schema' + ($schemaPath);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' } ';
if ($breakOnError) {
out += ' else { ';
}
return out;
}
|
require(
[
'gui/Button'
],
function (Button) {
return;
var button = new Button({
main: $('#ui-button')
});
button.render();
}
);
|
var GUID = (function () {
function _GUID() {
return UUIDcreatePart(4) +
UUIDcreatePart(2) +
UUIDcreatePart(2) +
UUIDcreatePart(2) +
UUIDcreatePart(6);
};
function UUIDcreatePart(length) {
var uuidpart = "";
for (var i = 0; i < length; i++) {
var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
if (uuidchar.length == 1) {
uuidchar = "0" + uuidchar;
}
uuidpart += uuidchar;
}
return uuidpart;
}
return {
newGuid: _GUID
};
})();
var dataSource = (function () {
var tablesStorageKey = "60AE0285-40EE-4A2D-BA5F-F75D601593DD";
var globalData = [];
var tables = [
{
Id: 5,
Name: "Contact",
Schema: [
{
k: "name",
t: 1
},
{
k: "companyname",
t: 1
},
{
k: "position",
t: 1
}
],
Created: "2016-08-12T07:32:46.69"
},
{
Id: 6,
Name: "Profile",
Schema: [
{
k: "Name",
t: 1
},
{
k: "Age",
t: 2
},
{
k: "Gender",
t: 4
},
{
k: "Rating",
t: 3
},
{
k: "Created",
t: 5
}
],
Created: "2016-09-28T21:53:40.19"
}
];
function _loadData(){
globalData = JSON.parse(localStorage[tablesStorageKey] || "[]");
}
function _save()
{
localStorage[tablesStorageKey] = JSON.stringify(globalData);
}
function _getSchema(tableId) {
for (var t = 0; t < tables.length; t++)
if (tableId === tables[t].Id) return tables[t].Schema;
}
function _find(data) {
var skip = data.start;
var take = data.length;
return {
draw: data.draw,
recordsTotal: globalData.length,
recordsFiltered: globalData.length,
data: globalData.slice(skip, take + skip)
};
}
function _insert(data) {
var id = GUID.newGuid();
globalData.push([id, data.Name, data.Age, data.Gender, data.Rating, data.Created]);
_save()
return {
IsOk: true,
id: id
};
}
function _update(data) {
for (var t = 0; t < globalData.length; t++)
if (data._id === globalData[t][0]) {
globalData[t] = [data._id, data.Name, data.Age, data.Gender, data.Rating, data.Created];
_save()
return {
IsOk: true
};
}
return {
IsOk: false
};
}
function _delete(id) {
for (var t = 0; t < globalData.length; t++)
if (id === globalData[t][0]) {
globalData = globalData.filter(item => item !== globalData[t]);
_save();
return {
IsOk: true
};
}
return {
IsOk: false
};
}
_loadData();
return {
getSchema: _getSchema,
find: _find,
insert: _insert,
update: _update,
delete: _delete
};
})();
|
(function() {
'use strict';
angular
.module('app.core')
.constant('STATIC_URL', '/static/js/');
})();
|
$(document).ready(function(){
//Grabs url path
var url = window.location.pathname;
//Grabs current file name from URL
var url = url.substring(url.lastIndexOf('/')+1);
// now grab every link from the navigation
$('#navigation a').each(function(){
//Grab the current elements href tag value
var link = $(this).attr("href");
//Test if the url value and element value matches
if(url === link){
//Adds class to the current item
$(this).parent('li').addClass('active');
}
});
});
|
var fixDate = function(date) {
return date.Format('2006-01-02 15:04:05');
};
var entries = executeCommand('getEntries', {});
dbotCommands = [];
userCommands = [];
for (var i = 0; i < entries.length; i++) {
if (typeof entries[i].Contents == 'string' && entries[i].Contents.indexOf('!') === 0 && entries[i].Contents.indexOf('!listExecutedCommands') !== 0) {
if (entries[i].Metadata.User) {
if (args.source === 'All' || args.source === 'Manual') {
userCommands.push({
'Time': fixDate(entries[i].Metadata.Created),
'Entry ID': entries[i].ID,
'User': entries[i].Metadata.User,
'Command': entries[i].Contents
});
}
} else {
if (args.source === 'All' || args.source === 'Playbook') {
dbotCommands.push({
'Time': fixDate(entries[i].Metadata.Created),
'Entry ID': entries[i].ID,
'Playbook (Task)': entries[i].Metadata.EntryTask.PlaybookName + " (" + entries[i].Metadata.EntryTask.TaskName + ")",
'Command': entries[i].Contents
});
}
}
}
}
var md = '';
if (dbotCommands.length > 0) {
md += tableToMarkdown('DBot Executed Commands', dbotCommands, ['Time', 'Entry ID', 'Playbook (Task)', 'Command']) + '\n';
}
if (userCommands.length > 0) {
md += tableToMarkdown('User Executed Commands', userCommands, ['Time', 'Entry ID', 'User', 'Command']) + '\n';
}
if (md === '') {
md = 'No commands found\n';
}
return {ContentsFormat: formats.markdown, Type: entryTypes.note, Contents: md};
|
'use strict';
var canUseDOM = require('./canUseDOM');
var one = function() {
};
var on = function() {
};
var off = function() {
};
if (canUseDOM) {
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent';
var unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
var prefix = bind !== 'addEventListener' ? 'on' : '';
one = function(node, eventNames, eventListener) {
var typeArray = eventNames.split(' ');
var recursiveFunction = function(e) {
e.target.removeEventListener(e.type, recursiveFunction);
return eventListener(e);
};
for (var i = typeArray.length - 1; i >= 0; i--) {
this.on(node, typeArray[i], recursiveFunction);
}
};
/**
* Bind `node` event `eventName` to `eventListener`.
*
* @param {Element} node
* @param {String} eventName
* @param {Function} eventListener
* @param {Boolean} capture
* @return {Obejct}
* @api public
*/
on = function(node, eventName, eventListener, capture) {
node[bind](prefix + eventName, eventListener, capture || false);
return {
off: function() {
node[unbind](prefix + eventName, eventListener, capture || false);
}
};
}
/**
* Unbind `node` event `eventName`'s callback `eventListener`.
*
* @param {Element} node
* @param {String} eventName
* @param {Function} eventListener
* @param {Boolean} capture
* @return {Function}
* @api public
*/
off = function(node, eventName, eventListener, capture) {
node[unbind](prefix + eventName, eventListener, capture || false);
return eventListener;
};
}
module.exports = {
one: one,
on: on,
off: off
};
|
/**
* Logger configuration
*
* Configure the log level for your app, as well as the transport
* (Underneath the covers, Sails uses Winston for logging, which
* allows for some pretty neat custom transports/adapters for log messages)
*
* For more information on the Sails logger, check out:
* http://sailsjs.org/#documentation
*/
module.exports = {
// Valid `level` configs:
// i.e. the minimum log level to capture with sails.log.*()
//
// 'error' : Display calls to `.error()`
// 'warn' : Display calls from `.error()` to `.warn()`
// 'debug' : Display calls from `.error()`, `.warn()` to `.debug()`
// 'info' : Display calls from `.error()`, `.warn()`, `.debug()` to `.info()`
// 'verbose': Display calls from `.error()`, `.warn()`, `.debug()`, `.info()` to `.verbose()`
//
log: {
level: 'info'
}
};
|
var partialsTemp = [
"login",
"profile"
];
exports.partialRender = function (req, res) {
var pageIndex = req.params[0];
if (partialsTemp.indexOf("" + pageIndex) > -1) {
res.render("partials/" + pageIndex, {});
} else {
res.render("common/404", {});
}
};
|
/**
* Uploader implementation - with the Connection object in ExtJS 4
*
*/
Ext.define('MyApp.ux.panel.upload.uploader.ExtJsUploader', {
extend : 'MyApp.ux.panel.upload.uploader.AbstractXhrUploader',
requires : [ 'MyApp.ux.panel.upload.data.Connection' ],
config : {
/**
* @cfg {String} [method='PUT']
*
* The HTTP method to be used.
*/
method : 'PUT',
/**
* @cfg {Ext.data.Connection}
*
* If set, this connection object will be used when uploading files.
*/
connection : null
},
/**
* @property
* @private
*
* The connection object.
*/
conn : null,
/**
* @private
*
* Initializes and returns the connection object.
*
* @return {MyApp.ux.panel.upload.data.Connection}
*/
initConnection : function() {
var conn, url = this.url;
console.log('[ExtJsUploader initConnection params', this.params);
if (this.connection instanceof Ext.data.Connection) {
console.log('[ExtJsUploader] instanceof Connection');
conn = this.connection;
} else {
console.log('[ExtJsUploader] !! instanceof Connection');
if (this.params) {
url = Ext.urlAppend(url, Ext.urlEncode(this.params));
}
conn = Ext.create('MyApp.ux.panel.upload.data.Connection', {
disableCaching : true,
method : this.method,
url : url,
timeout : this.timeout,
defaultHeaders : {
'Content-Type' : this.contentType,
'X-Requested-With' : 'XMLHttpRequest'
}
});
}
return conn;
},
/**
* @protected
*/
initHeaders : function(item) {
console.log('[ExtJsUploader] initHeaders', item);
var headers = this.callParent(arguments);
headers['Content-Type'] = item.getType();
return headers;
},
/**
* Implements {@link MyApp.ux.panel.upload.uploader.AbstractUploader#uploadItem}
*
* @param {MyApp.ux.panel.upload.Item}
* item
*/
uploadItem : function(item) {
console.log('ExtJsUploader uploadItem', item);
var file = item.getFileApiObject();
if (!file) {
return;
}
item.setUploading();
// tony
this.params = {
folder : item.getRemoteFolder()
};
this.conn = this.initConnection();
/*
* Passing the File object directly as the "rawData" option. Specs: https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method
* http://dev.w3.org/2006/webapi/FileAPI/#blob
*/
console.log('ExtJsUploader conn', this.conn);
this.conn.request({
scope : this,
headers : this.initHeaders(item),
rawData : file,
timeout : MyApp.Const.JAVASCRIPT_MAX_NUMBER, // tony
success : Ext.Function.bind(this.onUploadSuccess, this, [ item ], true),
failure : Ext.Function.bind(this.onUploadFailure, this, [ item ], true),
progress : Ext.Function.bind(this.onUploadProgress, this, [ item ], true)
});
},
/**
* Implements {@link MyApp.ux.panel.upload.uploader.AbstractUploader#abortUpload}
*/
abortUpload : function() {
if (this.conn) {
/*
* If we don't suspend the events, the connection abortion will cause a failure event.
*/
this.suspendEvents();
console.log('abort conn', conn);
this.conn.abort();
this.resumeEvents();
}
}
});
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M9 10v4c0 .55.45 1 1 1s1-.45 1-1V4h2v10c0 .55.45 1 1 1s1-.45 1-1V4h1c.55 0 1-.45 1-1s-.45-1-1-1H9.17C7.08 2 5.22 3.53 5.02 5.61 4.79 7.99 6.66 10 9 10zm11.65 7.65-2.79-2.79c-.32-.32-.86-.1-.86.35V17H6c-.55 0-1 .45-1 1s.45 1 1 1h11v1.79c0 .45.54.67.85.35l2.79-2.79c.2-.19.2-.51.01-.7z"
}), 'FormatTextdirectionLToRRounded');
exports.default = _default;
|
var jazz = require("../lib/jazz");
var fs = require("fs");
var data = fs.readFileSync(__dirname + "/foreach_object.jazz", "utf8");
var template = jazz.compile(data);
template.eval({"doc": {
"title": "First",
"content": "Some content"
}}, function(data) { console.log(data); });
|
/**********************************************************************
map_GoogleV2.js
$Comment: provides JavaScript for Google Api V2 calls
$Source :map_GoogleV2.js,v $
$InitialAuthor: guenter richter $
$InitialDate: 2011/01/03 $
$Author: guenter richter $
$Id:map_GoogleV2.js 1 2011-01-03 10:30:35Z Guenter Richter $
Copyright (c) Guenter Richter
$Log:map_GoogleV2.js,v $
**********************************************************************/
/**
* @fileoverview This is the interface to the Google maps API v2
*
* @author Guenter Richter guenter.richter@maptune.com
* @version 0.9
*/
/* ...................................................................*
* global vars *
* ...................................................................*/
/* ...................................................................*
* Google directions *
* ...................................................................*/
function __directions_handleErrors(){
var result = $("#directions-result")[0];
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
result.innerHTML = ("Indirizzo sconosciuto. Forse è troppo nuovo o sbagliato.\n Codice errore: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
result.innerHTML = ("Richiesta non riuscita.\n Codice errore: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
result.innerHTML = ("Inserire indirizzi! \n Codice errore: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_BAD_KEY)
result.innerHTML = ("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
result.innerHTML = ("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
else result.innerHTML = ("Errore sconosciuto!");
}
function _map_setDirections(map,fromAddress, toAddress, toHidden, locale) {
var result = $("#directions-result")[0];
result.innerHTML = "";
gdir.loadFromWaypoints([fromAddress,toHidden],
{ "locale": locale, "preserveViewport":true });
}
function _map_setDestinationWaypoint(marker){
if ( marker ){
var form = $("#directionsform")[0];
if ( form ){
form.to.value = marker.data.name;
if ( marker.getLatLng ){
form.toHidden.value = marker.getLatLng();
}
else if( marker.getVertex ){
form.toHidden.value = marker.getVertex(0);
}
}
}
}
/**
* Is called 'onload' to start creating the map
*/
function _map_loadMap(target){
var __map = null;
// if google maps API v2 is loaded
if ( GMap2 ){
// check if browser can handle Google Maps
if ( !GBrowserIsCompatible()) {
alert("sorry - your browser cannot handle Google Maps !");
return null;
}
__map = new GMap2(target);
if ( __map ){
// configure user map interface
__map.addControl(new GMapTypeControl());
// map.addControl(new GMenuMapTypeControl());
__map.addControl(new GLargeMapControl3D());
__map.addControl(new GScaleControl());
__map.addMapType(G_PHYSICAL_MAP);
__map.addMapType(G_SATELLITE_3D_MAP);
__map.enableDoubleClickZoom();
__map.enableScrollWheelZoom();
}
}
return __map;
}
/**
* Is called to set up directions query
*/
function _map_addDirections(map,target){
if (map){
gdir = new GDirections(map,target);
GEvent.addListener(gdir, "error", __directions_handleErrors);
}
}
/**
* Is called to set up traffic information layer
*/
function _map_addTrafficLayer(map,target){
/* tbd */
}
/**
* Is called to set event handler
*/
function _map_addEventListner(map,szEvent,callback,mapUp){
if (map){
GEvent.addListener(map, szEvent, GEvent.callback(map,callback,mapUp) );
}
}
/**
* Is called 'onunload' to clear objects
*/
function _map_unloadMap(map){
if (map){
GUnload();
}
}
// set map center and zoom
//
function _map_setMapExtension(map,bBox){
if (map){
var mapCenter = { lon: (bBox[0] + (bBox[1]-bBox[0])/2) , lat: (bBox[2] + (bBox[3]-bBox[2])/2) };
var mapZoom = map.getBoundsZoomLevel(new GLatLngBounds( new GLatLng(bBox[2],bBox[0]),
new GLatLng(bBox[3],bBox[1]) ) );
map.setCenter(new GLatLng(mapCenter.lat, mapCenter.lon), mapZoom);
}
}
// get map zoom
//
function _map_getZoom(map){
if (map){
return map.getZoom();
}
return 0;
}
// get map center
//
function _map_getCenter(map){
if (map){
return map.getCenter();
}
return null;
}
// set map zoom
//
function _map_setZoom(map,nZoom){
if (map){
map.setZoom(nZoom);
}
}
// set map center
//
function _map_setCenter(map,center){
if (map){
map.setCenter(center);
}
}
// set map center and zoom
//
function _map_setCenterAndZoom(map,center,nZoom){
if (map){
map.setCenter(center,nZoom);
}
}
// create custom tooltip
//
function _map_createMyTooltip(marker, text, padding){
var tooltip = new Tooltip(marker, text, padding);
marker.tooltip = tooltip;
map.addOverlay(tooltip);
}
function _map_createMyTooltipListener(element, tooltip){
GEvent.addDomListener(element,'mouseover',GEvent.callback(tooltip,
Tooltip.prototype.show));
GEvent.addDomListener(element,'mouseout',GEvent.callback(tooltip,
Tooltip.prototype.hide));
}
// -----------------------------
// EOF
// -----------------------------
|
import InputValidator from "../../common/js/InputValidator.js";
import ObjectUtilities from "../../common/js/ObjectUtilities.js";
import Action from "./Action.js";
import DefaultFilters from "./DefaultFilters.js";
import InitialState from "./InitialState.js";
var Reducer = {};
Reducer.root = function(state, action)
{
LOGGER.debug("root() type = " + action.type);
if (typeof state === 'undefined')
{
return new InitialState();
}
var newFilters, newFilteredTableRow;
switch (action.type)
{
case Action.REMOVE_FILTERS:
newFilteredTableRow = [];
newFilteredTableRow = newFilteredTableRow.concat(state.tableRows);
return Object.assign(
{}, state,
{
filteredTableRows: newFilteredTableRow,
});
case Action.SET_DEFAULT_FILTERS:
newFilters = DefaultFilters.create();
return Object.assign(
{}, state,
{
filters: newFilters,
});
case Action.SET_FILTERS:
LOGGER.debug("Reducer filters = ");
Object.getOwnPropertyNames(action.filters).forEach(function(propertyName)
{
LOGGER.debug(propertyName + ": " + action.filters[propertyName]);
});
newFilters = Object.assign(
{}, state.filters);
newFilters = ObjectUtilities.merge(newFilters, action.filters);
newFilteredTableRow = Reducer.filterTableRow(state.tableRows, newFilters);
Reducer.saveToLocalStorage(newFilters);
return Object.assign(
{}, state,
{
filters: newFilters,
filteredTableRows: newFilteredTableRow,
});
case Action.TOGGLE_FILTER_SHOWN:
return Object.assign(
{}, state,
{
isFilterShown: !state.isFilterShown,
});
default:
LOGGER.warn("Reducer.root: Unhandled action type: " + action.type);
return state;
}
};
Reducer.filterTableRow = function(tableRows, filters)
{
InputValidator.validateNotNull("tableRows", tableRows);
InputValidator.validateNotNull("filters", filters);
var answer = [];
tableRows.forEach(function(data)
{
if (Reducer.passes(data, filters))
{
answer.push(data);
}
});
return answer;
};
Reducer.passes = function(data, filters)
{
InputValidator.validateNotNull("data", data);
InputValidator.validateNotNull("filters", filters);
var answer = true;
var propertyNames = Object.getOwnPropertyNames(filters);
for (var i = 0; i < propertyNames.length; i++)
{
var propertyName = propertyNames[i];
var filter = filters[propertyName];
if (!filter.passes(data))
{
answer = false;
break;
}
}
return answer;
};
Reducer.saveToLocalStorage = function(filters)
{
InputValidator.validateNotNull("filters", filters);
var filterObjects = [];
Object.getOwnPropertyNames(filters).forEach(function(columnKey)
{
var filter = filters[columnKey];
filterObjects.push(filter.toObject());
});
localStorage.filters = JSON.stringify(filterObjects);
};
export default Reducer;
|
ig.module(
'plusplus.config-user'
)
.defines(function() {
/**
* User configuration of Impact++.
* <span class="alert alert-info"><strong>Tip:</strong> it is recommended to modify this configuration file!</span>
* @example
* // in order to add your own custom configuration to Impact++
* // edit the file defining ig.CONFIG_USER, 'plusplus/config-user.js'
* // ig.CONFIG_USER is never modified by Impact++ (it is strictly for your use)
* // ig.CONFIG_USER is automatically merged over Impact++'s config
* @static
* @readonly
* @memberof ig
* @namespace ig.CONFIG_USER
* @author Collin Hover - collinhover.com
**/
ig.CONFIG_USER = {
// no need to do force entity extended checks, we won't mess it up
// because we know to have our entities extend ig.EntityExtended
FORCE_ENTITY_EXTENDED: false,
// auto sort
AUTO_SORT_LAYERS: true,
// fullscreen!
GAME_WIDTH_PCT: 1,
GAME_HEIGHT_PCT: 1,
// dynamic scaling based on dimensions in view (resolution independence)
GAME_WIDTH_VIEW: 352,
GAME_HEIGHT_VIEW: 208,
// clamped scaling is still dynamic, but within a range
// so we can't get too big or too small
SCALE_MIN: 1,
SCALE_MAX: 4,
// camera flexibility and smoothness
CAMERA: {
// keep the camera within the level
// (whenever possible)
//KEEP_INSIDE_LEVEL: true,
KEEP_CENTERED: false,
LERP: 0.025,
// trap helps with motion sickness
BOUNDS_TRAP_AS_PCT: true,
BOUNDS_TRAP_PCT_MINX: -0.2,
BOUNDS_TRAP_PCT_MINY: -0.3,
BOUNDS_TRAP_PCT_MAXX: 0.2,
BOUNDS_TRAP_PCT_MAXY: 0.3
},
// font and text settings
FONT: {
MAIN_NAME: "font_helloplusplus_white_16.png",
ALT_NAME: "font_helloplusplus_white_8.png",
CHAT_NAME: "font_helloplusplus_black_8.png",
// we can have the font be scaled relative to system
SCALE_OF_SYSTEM_SCALE: 0.5,
// and force a min / max
SCALE_MIN: 1,
SCALE_MAX: 2
},
// text bubble settings
TEXT_BUBBLE: {
// match the visual style
PIXEL_PERFECT: true
},
UI: {
// sometimes, we want to keep things at a static scale
// for example, UI is a possible target
SCALE: 3,
IGNORE_SYSTEM_SCALE: true
},
/*
// to try dynamic clamped UI scaling
// uncomment below and delete the UI settings above
UI: {
SCALE_MIN: 2,
SCALE_MAX: 4
}
*/
// UI should persist across all levels
UI_LAYER_CLEAR_ON_LOAD: false,
CHARACTER: {
// add some depth using offset
SIZE_OFFSET_X: 8,
SIZE_OFFSET_Y: 4
}
};
});
|
'use strict'
const path = require('path')
const hbs = require('express-hbs')
module.exports = function (app, express) {
hbs.registerHelper('asset', require('./helpers/asset'))
app.engine('hbs', hbs.express4({
partialsDir: path.resolve('app/client/views/partials'),
layoutsDir: path.resolve('app/client/views/layouts'),
beautify: app.locals.isProduction
}))
app.set('view engine', 'hbs')
app.set('views', path.resolve('app/client/views'))
app.use(express.static(path.resolve('app/public')))
return app
}
|
// Polyfills
if ( Number.EPSILON === undefined ) {
Number.EPSILON = Math.pow( 2, - 52 );
}
if ( Number.isInteger === undefined ) {
// Missing in IE
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
Number.isInteger = function ( value ) {
return typeof value === 'number' && isFinite( value ) && Math.floor( value ) === value;
};
}
//
if ( Math.sign === undefined ) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
Math.sign = function ( x ) {
return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x;
};
}
if ( 'name' in Function.prototype === false ) {
// Missing in IE
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
Object.defineProperty( Function.prototype, 'name', {
get: function () {
return this.toString().match( /^\s*function\s*([^\(\s]*)/ )[ 1 ];
}
} );
}
if ( Object.assign === undefined ) {
// Missing in IE
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
Object.assign = function ( target ) {
'use strict';
if ( target === undefined || target === null ) {
throw new TypeError( 'Cannot convert undefined or null to object' );
}
const output = Object( target );
for ( let index = 1; index < arguments.length; index ++ ) {
const source = arguments[ index ];
if ( source !== undefined && source !== null ) {
for ( const nextKey in source ) {
if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
output[ nextKey ] = source[ nextKey ];
}
}
}
}
return output;
};
}
|
import supertest from 'supertest';
import { publicChannelName, privateChannelName } from './channel.js';
import { roleNameUsers, roleNameSubscriptions, roleScopeUsers, roleScopeSubscriptions, roleDescription } from './role.js';
import { username, email, adminUsername, adminPassword } from './user.js';
export const request = supertest('http://localhost:3000');
const prefix = '/api/v1/';
export function wait(cb, time) {
return () => setTimeout(cb, time);
}
export const apiUsername = `api${ username }`;
export const apiEmail = `api${ email }`;
export const apiPublicChannelName = `api${ publicChannelName }`;
export const apiPrivateChannelName = `api${ privateChannelName }`;
export const apiRoleNameUsers = `api${ roleNameUsers }`;
export const apiRoleNameSubscriptions = `api${ roleNameSubscriptions }`;
export const apiRoleScopeUsers = `${ roleScopeUsers }`;
export const apiRoleScopeSubscriptions = `${ roleScopeSubscriptions }`;
export const apiRoleDescription = `api${ roleDescription }`;
export const reservedWords = [
'admin',
'administrator',
'system',
'user',
];
export const targetUser = {};
export const channel = {};
export const group = {};
export const message = {};
export const directMessage = {};
export const integration = {};
export const credentials = {
'X-Auth-Token': undefined,
'X-User-Id': undefined,
};
export const login = {
user: adminUsername,
password: adminPassword,
};
export function api(path) {
return prefix + path;
}
export function methodCall(methodName) {
return api(`method.call/${ methodName }`);
}
export function log(res) {
console.log(res.req.path);
console.log({
body: res.body,
headers: res.headers,
});
}
export function getCredentials(done = function() {}) {
request.post(api('login'))
.send(login)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
credentials['X-Auth-Token'] = res.body.data.authToken;
credentials['X-User-Id'] = res.body.data.userId;
})
.end(done);
}
|
'use strict';
// https://github.com/betsol/gulp-require-tasks
// Require the module.
const gulpRequireTasks = require('gulp-require-tasks');
const gulp = require('gulp');
const env = require('../index');
// Call it when necessary.
gulpRequireTasks({
// Pass any options to it. Please see below.
path: env.inConfigs('gulp', 'tasks')// This is default
});
gulp.task('default', ['scripts:build', 'json-copy:build']);
|
/**
* Gulp tasks for wrapping Browserify modules.
*/
const browserify = require("browserify");
const gulp = require("gulp");
const sourcemaps = require("gulp-sourcemaps");
const uglify = require("gulp-uglify");
const path = require("path");
const through2 = require("through2");
const buffer = require("vinyl-buffer");
const source = require("vinyl-source-stream");
const asyncUtil = require("../../util/async-util");
const clientPackages = require("../../util/client-packages");
const display = require("../../util/display");
const uc = require("../../util/unite-config");
gulp.task("build-bundle-app", async () => {
const uniteConfig = await uc.getUniteConfig();
const buildConfiguration = uc.getBuildConfiguration(uniteConfig, false);
if (buildConfiguration.bundle) {
display.info("Running", "Browserify for App");
const bApp = browserify({
debug: buildConfiguration.sourcemaps,
entries: `./${path.join(uniteConfig.dirs.www.dist, "entryPoint.js")}`
});
const vendorPackages = await clientPackages.getBundleVendorPackages(uniteConfig);
let hasStyleLoader = false;
Object.keys(vendorPackages).forEach((key) => {
bApp.exclude(key);
const idx = key.indexOf("systemjs");
if (idx >= 0 && !hasStyleLoader) {
hasStyleLoader = key === "systemjs-plugin-css";
}
});
bApp.transform("envify", {
NODE_ENV: buildConfiguration.minify ? "production" : "development",
global: true
});
bApp.transform("browserify-css", {
autoInject: hasStyleLoader
});
bApp.transform("stringify", {
appliesTo: {
includeExtensions: uniteConfig.viewExtensions.map(ext => `.${ext}`)
}
});
bApp.transform("babelify", {
global: true,
presets: ["@babel/preset-env"]
});
return asyncUtil.stream(bApp.bundle().on("error", (err) => {
display.error(err);
})
.pipe(source("app-bundle.js"))
.pipe(buffer())
.pipe(buildConfiguration.minify ? uglify()
.on("error", (err) => {
display.error(err.toString());
}) : through2.obj())
.pipe(buildConfiguration.sourcemaps ? sourcemaps.init({
loadMaps: true
}) : through2.obj())
.pipe(buildConfiguration.sourcemaps ?
sourcemaps.mapSources((sourcePath) => sourcePath.replace(/dist\//, "./")) : through2.obj())
.pipe(buildConfiguration.sourcemaps ? sourcemaps.write({
includeContent: true
}) : through2.obj())
.pipe(gulp.dest(uniteConfig.dirs.www.dist)));
}
});
// Generated by UniteJS
|
'use strict';
const BitcrusherProps = {
bits: {
type: 'number',
bounds: [1, 16],
defaultValue: 4
},
normfreq: {
type: 'number',
bounds: [0, 1],
step: 0.1,
defaultValue: 0.1
},
bufferSize: {
type: 'number',
bounds: [256, 16384],
defaultValue: 4096
},
bypass: {
type: 'number',
bounds: [0, 1],
defaultValue: 0
}
};
export default BitcrusherProps;
|
define({
"_widgetLabel": "Tra cứu Địa lý",
"description": "Duyệt đến hoặc Kéo <a href='./widgets/GeoLookup/data/sample.csv' tooltip='Download an example sheet' target='_blank'> trang tính </a> tại đây để mô phỏng và thêm các dữ liệu bản đồ vào trang tính đó.",
"selectCSV": "Chọn một CSV",
"loadingCSV": "Đang tải CSV",
"savingCSV": "Xuất CSV",
"clearResults": "Xóa",
"downloadResults": "Tải xuống",
"plotOnly": "Chỉ các Điểm Vẽ bản đồ",
"plottingRows": "Hàng vẽ bản đồ",
"projectionChoice": "CSV trong",
"projectionLat": "Vĩ độ/Kinh độ",
"projectionMap": "Phép chiếu Bản đồ",
"messages": "Thông báo",
"error": {
"fetchingCSV": "Đã xảy ra lỗi khi truy xuất các mục từ kho lưu trữ CSV: ${0}",
"fileIssue": "Không xử lý được tệp.",
"notCSVFile": "Hiện chỉ hỗ trợ các tệp được ngăn cách bằng dấu phẩy (.csv).",
"invalidCoord": "Trường vị trí không hợp lệ. Vui lòng kiểm tra tệp .csv.",
"tooManyRecords": "Rất tiếc, hiện không được có quá ${0} bản ghi.",
"CSVNoRecords": "Tệp không chứa bất kỳ hồ sơ nào.",
"CSVEmptyFile": "Không có nội dung trong tệp."
},
"results": {
"csvLoaded": "Đã tải ${0} bản ghi từ tệp CSV",
"recordsPlotted": "Đã định vị ${0}/${1} bản ghi trên bản đồ",
"recordsEnriched": "Đã xử lý ${0}/${1}, đã bổ sung ${2} so với ${3}",
"recordsError": "${0} bản ghi có lỗi",
"recordsErrorList": "Hàng ${0} có sự cố",
"label": "Kết quả CSV"
}
});
|
var chai = require("chai")
var should = chai.should();
chai.use(require("chai-http"));
var request = chai.request(require("./server"))
var db = require("mongojs")("test")
describe("CRUD Handler", () => {
before(done => {
done()
})
beforeEach(done => {
db.dropDatabase(done);
})
after(done => {
db.dropDatabase(done)
})
it("should save a document", (done) => {
var data = {
name: "test"
}
request.post("/test")
.send(data)
.end((err, res) => {
should.not.exist(err)
res.should.have.status(201);
res.body.should.be.an("object")
res.body.should.have.keys(['error', 'data'])
res.body.error.should.not.be.ok;
res.body.data.name.should.be.eql("test")
res.body.data.should.have.property("_id");
done()
})
})
it("should list all documents", (done ) => {
var list = [
{name: 'test21'}, {name: 'test22'}
]
db.collection("test").insert(list, (err, result) => {
request.get("/test")
.end((err, res) => {
should.not.exist(err)
res.should.have.status(200)
res.body.should.be.an("object")
res.body.should.have.keys(['error', 'data'])
res.body.error.should.not.be.ok;
res.body.data.should.have.keys(['count', 'list'])
res.body.data.count.should.be.eql(2)
res.body.data.list.length.should.be.eql(2)
done()
})
})
})
it("should get a single document", done => {
var doc = {
name: 'test3'
}
db.collection('test').insert(doc, (err, result ) => {
request.get("/test/" + result._id)
.end((err, res) => {
should.not.exist(err)
res.should.have.status(200)
res.body.should.be.an("object")
res.body.should.have.keys(['error', 'data'])
res.body.error.should.not.be.ok;
res.body.data.should.have.keys(['_id', 'name'])
res.body.data.name.should.be.eql(doc.name);
done()
})
})
})
it("should update an existing document", done => {
var doc = {
name: 'test3'
}
db.collection('test').insert(doc, (err, result ) => {
result.name = "test3_updated";
request.put("/test/" + result._id)
.send(result)
.end((err, res) => {
should.not.exist(err)
res.should.have.status(202)
res.body.should.be.an("object")
res.body.should.have.keys(['error', 'data'])
res.body.error.should.not.be.ok;
db.collection('test').findOne({_id: db.ObjectId(result._id)}, (err, result1) => {
should.not.exist(err)
result1.name.should.be.eql(result.name);
done()
})
})
})
})
it("should remove a document", done => {
var doc = {
name: 'test3'
}
db.collection('test').insert(doc, (err, result ) => {
request.delete("/test/" + result._id)
.end((err, res) => {
should.not.exist(err)
res.should.have.status(202)
res.body.should.be.an("object")
res.body.should.have.keys(['error', 'data'])
res.body.error.should.not.be.ok;
db.collection('test').findOne({_id: db.ObjectId(result._id)}, (err, result1) => {
should.not.exist(err)
should.not.exist(result1);
done()
})
})
})
})
})
|
"use strict";
devdiv.directive('devDiv', [function () {
return {
restrict: 'E',
link: function (scope, iElement, iAttrs) {
iElement.addClass("dev-div");
iElement.addClass("row");
}
};
}])
devdiv.controller('NameCtrl', function ($scope, $watch) {
});
|
/*globals describe, before, beforeEach, afterEach, it */
/*jshint expr:true*/
var testUtils = require('../../utils'),
should = require('should'),
// Stuff we are testing
dbAPI = require('../../../server/api/db'),
ModelTag = require('../../../server/models/tag'),
ModelPost = require('../../../server/models/post');
describe('DB API', function () {
// Keep the DB clean
before(testUtils.teardown);
afterEach(testUtils.teardown);
beforeEach(testUtils.setup('users:roles', 'posts', 'perms:db', 'perms:init'));
should.exist(dbAPI);
it('delete all content (owner)', function (done) {
return dbAPI.deleteAllContent(testUtils.context.owner).then(function (result) {
should.exist(result.db);
result.db.should.be.instanceof(Array);
result.db.should.be.empty;
}).then(function () {
return ModelTag.Tag.findAll(testUtils.context.owner).then(function (results) {
should.exist(results);
results.length.should.equal(0);
});
}).then(function () {
return ModelPost.Post.findAll(testUtils.context.owner).then(function (results) {
should.exist(results);
results.length.should.equal(0);
done();
});
}).catch(done);
});
it('delete all content (admin)', function (done) {
return dbAPI.deleteAllContent(testUtils.context.admin).then(function (result) {
should.exist(result.db);
result.db.should.be.instanceof(Array);
result.db.should.be.empty;
}).then(function () {
return ModelTag.Tag.findAll(testUtils.context.admin).then(function (results) {
should.exist(results);
results.length.should.equal(0);
});
}).then(function () {
return ModelPost.Post.findAll(testUtils.context.admin).then(function (results) {
should.exist(results);
results.length.should.equal(0);
done();
});
}).catch(done);
});
it('delete all content is denied (editor & author)', function (done) {
return dbAPI.deleteAllContent(testUtils.context.editor).then(function () {
done(new Error('Delete all content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.deleteAllContent(testUtils.context.author);
}).then(function () {
done(new Error('Delete all content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.deleteAllContent();
}).then(function () {
done(new Error('Delete all content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
done();
}).catch(done);
});
it('export content is denied (editor & author)', function (done) {
return dbAPI.exportContent(testUtils.context.editor).then(function () {
done(new Error('Export content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.exportContent(testUtils.context.author);
}).then(function () {
done(new Error('Export content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.exportContent();
}).then(function () {
done(new Error('Export content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
done();
}).catch(done);
});
it('import content is denied (editor & author)', function (done) {
return dbAPI.importContent(testUtils.context.editor).then(function () {
done(new Error('Import content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.importContent(testUtils.context.author);
}).then(function () {
done(new Error('Import content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
return dbAPI.importContent();
}).then(function () {
done(new Error('Import content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
done();
}).catch(done);
});
});
|
var Example = Example || {};
Example.staticFriction = function() {
var Engine = Matter.Engine,
Render = Matter.Render,
Runner = Matter.Runner,
Body = Matter.Body,
Composites = Matter.Composites,
Events = Matter.Events,
MouseConstraint = Matter.MouseConstraint,
Mouse = Matter.Mouse,
World = Matter.World,
Bodies = Matter.Bodies;
// create engine
var engine = Engine.create(),
world = engine.world;
// create renderer
var render = Render.create({
element: document.body,
engine: engine,
options: {
width: Math.min(document.documentElement.clientWidth, 800),
height: Math.min(document.documentElement.clientHeight, 600),
showVelocity: true
}
});
Render.run(render);
// create runner
var runner = Runner.create();
Runner.run(runner, engine);
// add bodies
var body = Bodies.rectangle(400, 500, 200, 60, { isStatic: true, chamfer: 10 }),
size = 50,
counter = -1;
var stack = Composites.stack(350, 470 - 6 * size, 1, 6, 0, 0, function(x, y) {
return Bodies.rectangle(x, y, size * 2, size, {
slop: 0.5,
friction: 1,
frictionStatic: Infinity
});
});
World.add(world, [
body,
stack,
// walls
Bodies.rectangle(400, 0, 800, 50, { isStatic: true }),
Bodies.rectangle(400, 600, 800, 50, { isStatic: true }),
Bodies.rectangle(800, 300, 50, 600, { isStatic: true }),
Bodies.rectangle(0, 300, 50, 600, { isStatic: true })
]);
Events.on(engine, 'beforeUpdate', function(event) {
counter += 0.014;
if (counter < 0) {
return;
}
var px = 400 + 100 * Math.sin(counter);
// body is static so must manually update velocity for friction to work
Body.setVelocity(body, { x: px - body.position.x, y: 0 });
Body.setPosition(body, { x: px, y: body.position.y });
});
// add mouse control
var mouse = Mouse.create(render.canvas),
mouseConstraint = MouseConstraint.create(engine, {
mouse: mouse,
constraint: {
stiffness: 0.2,
render: {
visible: false
}
}
});
World.add(world, mouseConstraint);
// keep the mouse in sync with rendering
render.mouse = mouse;
// fit the render viewport to the scene
Render.lookAt(render, {
min: { x: 0, y: 0 },
max: { x: 800, y: 600 }
});
// context for MatterTools.Demo
return {
engine: engine,
runner: runner,
render: render,
canvas: render.canvas,
stop: function() {
Matter.Render.stop(render);
Matter.Runner.stop(runner);
}
};
};
|
var searchData=
[
['vertical_5fline',['vertical_line',['../class_abstract_board.html#a78c4d43cc32d9dc74d73156497db6d3f',1,'AbstractBoard']]]
];
|
/**
* Created by huangyao on 14-10-1.
*/
var _ = require('lodash');
var color =require('colors');
var fs =require('fs');
var config = require('../config.js');
var path = require('path');
var mongoose = require("mongoose");
var lcommon = require('lush').common;
console.log(config.db);
mongoose.connect(config.db,function (err) {
if(err){
throw new Error('db connect error!\n'+err);
}
console.log('db connect success!'.yellow);
});
// console.log('point');
// var models = {
//
// init : function (callback) {
// fs.readdir(path+'/module',function (err,files) {
// if(err){
// throw err;
// }
// // console.log(files);
// return callback(files.filter(function (item) {
// return !(item === "index.js" || item === "." || item === "..");
// }));
// });
// },
// };
//
//
// models.init(function (files) {
// // console.log(files);
// for (var item in files) {
// //reuire all modules
// // console.log(lcommon.literat(files[item]).slice(0,-3));
// console.log(files[item]);
// item = files[item].split('.')[0];
// require('./'+ item);
// var m = lcommon.literat(item);
// console.log('loading and use ',m,' model');
// exports[m] = mongoose.model(m);
//
// // _.extend(models,file.exports);
// // console.log(file);
// }
// });
//
var models = fs.readdirSync(path.resolve('.','module'));
models.forEach(function(item,index){
if(item !== '.' && item !== '..' && item !== 'index.js'){
// console.log(item.indexOf('.js'));
//ends with .js
if(item.indexOf('.js') == (item.length-3)){
item = item.split('.')[0];
require('./'+ item);
var m = lcommon.literat(item);
console.log('loading and use ',m,' model');
exports[m] = mongoose.model(m);
}
}
});
|
version https://git-lfs.github.com/spec/v1
oid sha256:054dbc79bbfc64911008a1e140813a8705dfc5cff35cbffd8bf7bc1f74c446b6
size 5257
|
module.exports = require('./lib/dustjs-browserify');
|
version https://git-lfs.github.com/spec/v1
oid sha256:94e212e6fc0c837cd9fff7fca8feff0187a0a22a97c7bd4c6d8f05c5cc358519
size 3077
|
import React from 'react'
import Icon from 'react-icon-base'
const IoTshirtOutline = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m11.4 6.7l-8.1 2.4 0.8 2.5 3.1-0.3 3-0.4-0.2 3-1.1 19.9h17.2l-1.1-19.9-0.2-3 3 0.4 3.1 0.3 0.8-2.5-8.1-2.4c-0.5 0.6-1 1.1-1.6 1.5-1.2 0.8-2.7 1.2-4.5 1.2-2.7-0.1-4.6-0.9-6.1-2.7z m11.1-2.9l12.5 3.7-2.5 6.9-5-0.6 1.3 22.5h-22.5l1.2-22.5-5 0.6-2.5-6.9 12.5-3.7c1.1 2.1 2.4 3 5 3.1 2.6 0 3.9-1 5-3.1z"/></g>
</Icon>
)
export default IoTshirtOutline
|
declare module "react-apollo" {
declare function graphql(query: Object, options: Object): Function;
}
|
/**!
* urllib - test/fixtures/server.js
*
* Copyright(c) 2011 - 2014 fengmk2 and other contributors.
* MIT Licensed
*
* Authors:
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com)
*/
"use strict";
/**
* Module dependencies.
*/
var should = require('should');
var http = require('http');
var querystring = require('querystring');
var fs = require('fs');
var zlib = require('zlib');
var iconv = require('iconv-lite');
var server = http.createServer(function (req, res) {
// req.headers['user-agent'].should.match(/^node\-urllib\/\d+\.\d+\.\d+ node\//);
var chunks = [];
var size = 0;
req.on('data', function (buf) {
chunks.push(buf);
size += buf.length;
});
req.on('end', function () {
if (req.url === '/timeout') {
return setTimeout(function () {
res.end('timeout 500ms');
}, 500);
} else if (req.url === '/response_timeout') {
res.write('foo');
return setTimeout(function () {
res.end('timeout 700ms');
}, 700);
} else if (req.url === '/error') {
return res.destroy();
} else if (req.url === '/socket.destroy') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
res.destroy();
}, 300);
}, 200);
return;
} else if (req.url === '/socket.end') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
// res.end();
res.socket.end();
// res.socket.end('foosdfsdf');
}, 300);
}, 200);
return;
} else if (req.url === '/socket.end.error') {
res.write('foo haha\n');
setTimeout(function () {
res.write('foo haha 2');
setTimeout(function () {
res.socket.end('balabala');
}, 300);
}, 200);
return;
} else if (req.url === '/302') {
res.statusCode = 302;
res.setHeader('Location', '/204');
return res.end('Redirect to /204');
} else if (req.url === '/301') {
res.statusCode = 301;
res.setHeader('Location', '/204');
return res.end('I am 301 body');
} else if (req.url === '/303') {
res.statusCode = 303;
res.setHeader('Location', '/204');
return res.end('Redirect to /204');
} else if (req.url === '/307') {
res.statusCode = 307;
res.setHeader('Location', '/204');
return res.end('I am 307 body');
} else if (req.url === '/redirect_no_location') {
res.statusCode = 302;
return res.end('I am 302 body');
} else if (req.url === '/204') {
res.statusCode = 204;
return res.end();
} else if (req.url === '/loop_redirect') {
res.statusCode = 302;
res.setHeader('Location', '/loop_redirect');
return res.end('Redirect to /loop_redirect');
} else if (req.url === '/post') {
res.setHeader('X-Request-Content-Type', req.headers['content-type'] || '');
res.writeHeader(200);
return res.end(Buffer.concat(chunks));
} else if (req.url.indexOf('/get') === 0) {
res.writeHeader(200);
return res.end(req.url);
} else if (req.url === '/wrongjson') {
res.writeHeader(200);
return res.end(new Buffer('{"foo":""'));
} else if (req.url === '/wrongjson-gbk') {
res.setHeader('content-type', 'application/json; charset=gbk');
res.writeHeader(200);
return res.end(fs.readFileSync(__filename));
} else if (req.url === '/writestream') {
var s = fs.createReadStream(__filename);
return s.pipe(res);
} else if (req.url === '/auth') {
var auth = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(':');
res.writeHeader(200);
return res.end(JSON.stringify({user: auth[0], password: auth[1]}));
} else if (req.url === '/stream') {
res.writeHeader(200, {
'Content-Length': String(size)
});
for (var i = 0; i < chunks.length; i++) {
res.write(chunks[i]);
}
res.end();
return;
} else if (req.url.indexOf('/json_mirror') === 0) {
res.setHeader('Content-Type', req.headers['content-type'] || 'application/json');
if (req.method === 'GET') {
res.end(JSON.stringify({
url: req.url,
data: Buffer.concat(chunks).toString(),
}));
} else {
res.end(JSON.stringify(JSON.parse(Buffer.concat(chunks))));
}
return;
} else if (req.url.indexOf('/no-gzip') === 0) {
fs.createReadStream(__filename).pipe(res);
return;
} else if (req.url.indexOf('/gzip') === 0) {
res.setHeader('Content-Encoding', 'gzip');
fs.createReadStream(__filename).pipe(zlib.createGzip()).pipe(res);
return;
} else if (req.url === '/ua') {
res.end(JSON.stringify(req.headers));
return;
} else if (req.url === '/gbk/json') {
res.setHeader('Content-Type', 'application/json;charset=gbk');
var content = iconv.encode(JSON.stringify({hello: '你好'}), 'gbk');
return res.end(content);
} else if (req.url === '/gbk/text') {
res.setHeader('Content-Type', 'text/plain;charset=gbk');
var content = iconv.encode('你好', 'gbk');
return res.end(content);
} else if (req.url === '/errorcharset') {
res.setHeader('Content-Type', 'text/plain;charset=notfound');
return res.end('你好');
}
var url = req.url.split('?');
var get = querystring.parse(url[1]);
var ret;
if (chunks.length > 0) {
ret = Buffer.concat(chunks).toString();
} else {
ret = '<html><head><meta http-equiv="Content-Type" content="text/html;charset=##{charset}##">...</html>';
}
chunks = [];
res.writeHead(get.code ? get.code : 200, {
'Content-Type': 'text/html',
});
res.end(ret.replace('##{charset}##', get.charset ? get.charset : ''));
});
});
module.exports = server;
|
/**
* @license Highcharts JS v8.2.2 (2020-10-22)
* @module highcharts/modules/funnel3d
* @requires highcharts
* @requires highcharts/highcharts-3d
* @requires highcharts/modules/cylinder
*
* Highcharts funnel module
*
* (c) 2010-2019 Kacper Madej
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../Series/Funnel3DSeries.js';
|
FusionCharts.ready(function () {
var gradientCheckBox = document.getElementById('useGradient');
//Set event listener for radio button
if (gradientCheckBox.addEventListener) {
gradientCheckBox.addEventListener("click", changeGradient);
}
function changeGradient(evt, obj) {
//Set gradient fill for chart using usePlotGradientColor attribute
(gradientCheckBox.checked) ?revenueChart.setChartAttribute('usePlotGradientColor', 1) : revenueChart.setChartAttribute('usePlotGradientColor', 0);
};
var revenueChart = new FusionCharts({
type: 'column2d',
renderAt: 'chart-container',
width: '400',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Quarterly Revenue",
"subCaption": "Last year",
"xAxisName": "Quarter",
"yAxisName": "Amount (In USD)",
"theme": "fint",
"numberPrefix": "$",
//Removing default gradient fill from columns
"usePlotGradientColor": "1"
},
"data": [{
"label": "Q1",
"value": "1950000",
"color": "#008ee4"
}, {
"label": "Q2",
"value": "1450000",
"color": "#9b59b6"
}, {
"label": "Q3",
"value": "1730000",
"color": "#6baa01"
}, {
"label": "Q4",
"value": "2120000",
"color": "#e44a00"
}]
}
}).render();
});
|
/*!
* address.js - Description
* Copyright © 2012 by Ingenesis Limited. All rights reserved.
* Licensed under the GPLv3 {@see license.txt}
*/
(function($) {
jQuery.fn.upstate = function () {
if ( typeof regions === 'undefined' ) return;
$(this).change(function (e,init) {
var $this = $(this),
prefix = $this.attr('id').split('-')[0],
country = $this.val(),
state = $this.parents().find('#' + prefix + '-state'),
menu = $this.parents().find('#' + prefix + '-state-menu'),
options = '<option value=""></option>';
if (menu.length == 0) return true;
if (menu.hasClass('hidden')) menu.removeClass('hidden').hide();
if (regions[country] || (init && menu.find('option').length > 1)) {
state.setDisabled(true).addClass('_important').hide();
if (regions[country]) {
$.each(regions[country], function (value,label) {
options += '<option value="'+value+'">'+label+'</option>';
});
if (!init) menu.empty().append(options).setDisabled(false).show().focus();
if (menu.hasClass('auto-required')) menu.addClass('required');
} else {
if (menu.hasClass('auto-required')) menu.removeClass('required');
}
menu.setDisabled(false).show();
$('label[for='+state.attr('id')+']').attr('for',menu.attr('id'));
} else {
menu.empty().setDisabled(true).hide();
state.setDisabled(false).show().removeClass('_important');
$('label[for='+menu.attr('id')+']').attr('for',state.attr('id'));
if (!init) state.val('').focus();
}
}).trigger('change',[true]);
return $(this);
};
})(jQuery);
jQuery(document).ready(function($) {
var sameaddr = $('.sameaddress'),
shipFields = $('#shipping-address-fields'),
billFields = $('#billing-address-fields'),
keepLastValue = function () { // Save the current value of the field
$(this).attr('data-last', $(this).val());
};
// Handle changes to the firstname and lastname fields
$('#firstname,#lastname').each(keepLastValue).change(function () {
var namefield = $(this); // Reference to the modified field
lastfirstname = $('#firstname').attr('data-last'),
lastlastname = $('#lastname').attr('data-last'),
firstlast = ( ( $('#firstname').val() ).trim() + " " + ( $('#lastname').val() ).trim() ).trim();
namefield.val( (namefield.val()).trim() );
// Update the billing name and shipping name
$('#billing-name,#shipping-name').each(function() {
var value = $(this).val();
if ( value.trim().length == 0 ) {
// Empty billing or shipping name
$('#billing-name,#shipping-name').val(firstlast);
} else if ( '' != value && ( $('#firstname').val() == value || $('#lastname').val() == value ) ) {
// Only one name entered (so far), add the other name
$(this).val(firstlast);
} else if ( 'firstname' == namefield.attr('id') && value.indexOf(lastlastname) != -1 ) {
// firstname changed & last lastname matched
$(this).val( value.replace(lastfirstname, namefield.val()).trim() );
} else if ( 'lastname' == namefield.attr('id') && value.indexOf(lastfirstname) != -1 ) {
// lastname changed & last firstname matched
$(this).val( value.replace(lastlastname, namefield.val()).trim() );
}
});
}).change(keepLastValue);
// Update state/province
$('#billing-country,#shipping-country').upstate();
// Toggle same shipping address
sameaddr.change(function (e,init) {
var refocus = false,
bc = $('#billing-country'),
sc = $('#shipping-country'),
prime = 'billing' == sameaddr.val() ? shipFields : billFields,
alt = 'shipping' == sameaddr.val() ? shipFields : billFields;
if (sameaddr.is(':checked')) {
prime.removeClass('half');
alt.hide().find('.required').setDisabled(true);
} else {
prime.addClass('half');
alt.show().find('.disabled:not(._important)').setDisabled(false);
if (!init) refocus = true;
}
if (bc.is(':visible')) bc.trigger('change.localemenu',[init]);
if (sc.is(':visible')) sc.trigger('change.localemenu',[init]);
if (refocus) alt.find('input:first').focus();
}).trigger('change',[true])
.click(function () { $(this).change(); }); // For IE compatibility
});
|
var EFA = {
log: [],
/*
Prevent backspace being used as back button in infopath form in modal.
Source: http://johnliu.net/blog/2012/3/27/infopath-disabling-backspace-key-in-browser-form.html
grab a reference to the modal window object in SharePoint
*/
OpenPopUpPage: function( url ){
var options = SP.UI.$create_DialogOptions();
options.url = url;
var w = SP.UI.ModalDialog.showModalDialog(options);
/* Attempt to prevent backspace acting as navigation key on read only input - Doesn't currently work.
if (w) {
// get the modal window's iFrame element
var f = w.get_frameElement();
EFA.f = f;
// watch frame's readyState change - when page load is complete, re-attach keydown event
// on the new document
$(f).ready(function(){
var fwin = this.contentWindow || this.contentDocument;
$(fwin.document).on('focus',"input[readonly]",function(){ $(this).blur(); });
});
}*/
},
// get current user
checkCurrentUser: function (callback){
ExecuteOrDelayUntilScriptLoaded(checkCurrentUserLoaded, "sp.js");
function checkCurrentUserLoaded() {
var context = SP.ClientContext.get_current();
var siteColl = context.get_site();
var web = siteColl.get_rootWeb();
this._currentUser = web.get_currentUser();
context.load(this._currentUser);
context.executeQueryAsync(Function.createDelegate(this, callback),Function.createDelegate(this, callback));
}
},
CheckUserSucceeded: function(){
EFA['User'] = this._currentUser;
},
CheckUserfailed: function(){
//console.log('Failed to get user');
},
DoesUserHaveCreatePermissions: function(url, callback) {
var Xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\
<soap:Body>\
<DoesCurrentUserHavePermissionsToList xmlns=\"http://tempuri.org/\">\
<url>"+ url +"</url>\
</DoesCurrentUserHavePermissionsToList>\
</soap:Body>\
</soap:Envelope>";
$.ajax({
url: "/_layouts/EFA/EFAWebServices.asmx",
type: "POST",
dataType: "xml",
data: Xml,
complete: function(xData, Status){
if(Status != 'success')
throw "Failed to determine user permissions for " + url;
callback(xData);
},
contentType: "text/xml; charset=\"utf-8\""
});
}
};
/*
To access the mapping need to uses keys, therefore need to check if its available for browser and add it if not.
Then we can loop through the mapping like so:
$.each(keys(config.mapping), function(){ console.log(config.mapping[this.toString()]) });
using this to build the query and create the resultant html
*/
// SOURCE: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
if (!Object.keys) {
Object.keys = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
],
dontEnumsLength = dontEnums.length;
return function (obj) {
if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) throw new TypeError('Object.keys called on non-object');
var result = [];
for (var prop in obj) {
if (hasOwnProperty.call(obj, prop)) result.push(prop);
}
if (hasDontEnumBug) {
for (var i=0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) result.push(dontEnums[i]);
}
}
return result;
};
})();
}
/*
Array.indexOf for IE
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
*/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
'use strict';
if (this == null) {
throw new TypeError();
}
var n, k, t = Object(this),
len = t.length >>> 0;
if (len === 0) {
return -1;
}
n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n != n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
for (k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
/*
Test for Canvas Suppport
Source: http://stackoverflow.com/questions/2745432/best-way-to-detect-that-html5-canvas-is-not-supported/2746983#2746983
*/
function isCanvasSupported(){
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}
/*
Console.log() for IE 8
*/
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
var m = [
"log", "info", "warn", "error", "debug", "trace", "dir", "group",
"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
];
// define undefined methods as noops to prevent errors
for (var i = 0; i < m.length; i++) {
if (!window.console[m[i]]) {
window.console[m[i]] = function() {};
}
}
})();
|
var hilbert = (function() {
// From Mike Bostock: http://bl.ocks.org/597287
// Adapted from Nick Johnson: http://bit.ly/biWkkq
var pairs = [
[[0, 3], [1, 0], [3, 1], [2, 0]],
[[2, 1], [1, 1], [3, 0], [0, 2]],
[[2, 2], [3, 3], [1, 2], [0, 1]],
[[0, 0], [3, 2], [1, 3], [2, 3]]
];
// d2xy and rot are from:
// http://en.wikipedia.org/wiki/Hilbert_curve#Applications_and_mapping_algorithms
var rot = function(n, x, y, rx, ry) {
if (ry === 0) {
if (rx === 1) {
x = n - 1 - x;
y = n - 1 - y;
}
return [y, x];
}
return [x, y];
};
return {
xy2d: function(x, y, z) {
var quad = 0,
pair,
i = 0;
while (--z >= 0) {
pair = pairs[quad][(x & (1 << z) ? 2 : 0) | (y & (1 << z) ? 1 : 0)];
i = (i << 2) | pair[0];
quad = pair[1];
}
return i;
},
d2xy: function(z, t) {
var n = 1 << z,
x = 0,
y = 0;
for (var s = 1; s < n; s *= 2) {
var rx = 1 & (t / 2),
ry = 1 & (t ^ rx);
var xy = rot(s, x, y, rx, ry);
x = xy[0] + s * rx;
y = xy[1] + s * ry;
t /= 4;
}
return [x, y];
}
};
})();
|
describe('PastDateValidatorWidgetFactory', function() {
var Mock = {};
var factory;
var whoAmI;
beforeEach(function() {
angular.mock.module('studio');
mockElement();
inject(function(_$injector_) {
mockWidgetScope(_$injector_);
factory = _$injector_.get('PastDateValidatorWidgetFactory');
});
widget = factory.create(Mock.scope, Mock.element);
});
describe('Start a PastDate Factory Object', function() {
it('should return a PastDate Validator Object', function() {
pending();
});
it('should start the data field as date', function() {
expect(widget.data).toBeDefined();
expect(widget.data).toEqual(false);
});
});
describe('updates on data', function() {
xit('should model data value be equal to self value', function() {
// expect(Mock.question.fillingRules.options['pastDate'].data.reference).toEqual(widget.data);
});
it('should call updateFillingRules from parente widget', function() {
spyOn(Mock.parentWidget, 'updateFillingRules');
widget.updateData();
expect(Mock.parentWidget.updateFillingRules).toHaveBeenCalled();
});
});
function mockElement() {
Mock.element = {};
}
function mockWidgetScope($injector) {
Mock.scope = {
class: '',
$parent: {
widget: mockParentWidget($injector)
}
};
return Mock.scope;
}
function mockParentWidget($injector) {
mockQuestion($injector);
Mock.parentWidget = {
getItem: function() {
return Mock.question;
},
updateFillingRules: function() {}
};
return Mock.parentWidget;
}
function mockQuestion($injector) {
Mock.question = $injector.get('SurveyItemFactory').create('IntegerQuestion', 'Q1');
Mock.question.fillingRules.options.pastDate = $injector.get('RulesFactory').create('pastDate');
return Mock.question;
}
function mockAdd($injector) {
Mock.add = $injector.get('FillingRulesEditorWidgetFactory').create();
}
});
|
'use strict';
var env = process.env.NODE_ENV || 'development',
config = require('./config'),
B = require('bluebird'),
_ = require('underscore'),
L = require('./logger'),
S = require('underscore.string'),
nodemailer = require('nodemailer'),
smtpTransport = require('nodemailer-smtp-pool');
var Mailer = function (options) {
var opts = _.extend({}, config.mail, options);
this.transporter = B.promisifyAll(nodemailer.createTransport(smtpTransport(opts)));
};
Mailer.prototype.send = function (options) {
var that = this;
return that.transporter.sendMailAsync(options);
};
module.exports = Mailer;
|
Template.reassign_modal.helpers({
fields: function() {
var userOptions = null;
var showOrg = true;
var instance = WorkflowManager.getInstance();
var space = db.spaces.findOne(instance.space);
var flow = db.flows.findOne({
'_id': instance.flow
});
var curSpaceUser = db.space_users.findOne({
space: instance.space,
'user': Meteor.userId()
});
var organizations = db.organizations.find({
_id: {
$in: curSpaceUser.organizations
}
}).fetch();
if (space.admins.contains(Meteor.userId())) {
} else if (WorkflowManager.canAdmin(flow, curSpaceUser, organizations)) {
var currentStep = InstanceManager.getCurrentStep()
userOptions = ApproveManager.getNextStepUsers(instance, currentStep._id).getProperty("id").join(",")
showOrg = Session.get("next_step_users_showOrg")
} else {
userOptions = "0"
showOrg = false
}
var multi = false;
var c = InstanceManager.getCurrentStep();
if (c && c.step_type == "counterSign") {
multi = true;
}
return new SimpleSchema({
reassign_users: {
autoform: {
type: "selectuser",
userOptions: userOptions,
showOrg: showOrg,
multiple: multi
},
optional: true,
type: String,
label: TAPi18n.__("instance_reassign_user")
}
});
},
values: function() {
return {};
},
current_step_name: function() {
var s = InstanceManager.getCurrentStep();
var name;
if (s) {
name = s.name;
}
return name || '';
}
})
Template.reassign_modal.events({
'show.bs.modal #reassign_modal': function(event) {
var reassign_users = $("input[name='reassign_users']")[0];
reassign_users.value = "";
reassign_users.dataset.values = '';
$(reassign_users).change();
},
'click #reassign_help': function(event, template) {
Steedos.openWindow(t("reassign_help"));
},
'click #reassign_modal_ok': function(event, template) {
var val = AutoForm.getFieldValue("reassign_users", "reassign");
if (!val) {
toastr.error(TAPi18n.__("instance_reassign_error_users_required"));
return;
}
var reason = $("#reassign_modal_text").val();
var user_ids = val.split(",");
InstanceManager.reassignIns(user_ids, reason);
Modal.hide(template);
},
})
|
'use strict';
/**
* Types of events
* @readonly
* @enum {number}
*/
var EventTypes = {
// Channel Events
/**
* A channel got connected
* @type {EventType}
*/
CONNECT: "connect",
/**
* A channel got disconnected
*/
DISCONNECT: "disconnect",
/**
* A channel got reconnected
*/
RECONNECT: "reconnect",
/**
* A channel is attempting to reconnect
*/
RECONNECTATTEMPT: "reconnect_attempt",
/**
* chatMode
*/
CHATMODE: "chatMode",
/**
* A list of current users in a channel
*/
CHANNELUSERS: "channelUsers",
/**
* A server message
*/
SERVERMESSAGE: "srvMsg",
/**
* A user message
*/
USERMESSAGE: "userMsg",
/**
* A /me message
*/
MEMESSAGE: "meMsg",
/**
* A /me message
*/
WHISPER: "whisper",
/**
* A global message
*/
GLOBALMESSAGE: "globalMsg",
/**
* An instruction/request to clear chat history
*/
CLEARCHAT: "clearChat",
/**
* A request for built-in command help
*/
COMMANDHELP: "commandHelp",
/**
* Whether or not mod tools should be visible
*/
MODTOOLSVISIBLE: "modToolsVisible",
/**
* A list of current mods in a channel
*/
MODLIST: "modList",
/**
* The color of the bot's name in chat
*/
COLOR: "color",
/**
* The online state of a stream
*/
ONLINESTATE: "onlineState",
/**
* A list of users included in a raffle
*/
RAFFLEUSERS: "raffleUsers",
/**
* The winner of a raffle
*/
WONRAFFLE: "wonRaffle",
/**
* runPoll
*/
RUNPOLL: "runPoll",
/**
* showPoll
*/
SHOWPOLL: "showPoll",
/**
* pollVotes
*/
POLLVOTES: "pollVotes",
/**
* voteResponse
*/
VOTERESPONSE: "voteResponse",
/**
* finishPoll
*/
FINISHPOLL: "finishPoll",
/**
* gameMode
*/
GAMEMODE: "gameMode",
/**
* adultMode
*/
ADULTMODE: "adultMode",
/**
* commissionsAvailable
*/
COMMISSIONSAVAILABLE: "commissionsAvailable",
/**
* clearUser
*/
CLEARUSER: "clearUser",
/**
* removeMsg
*/
REMOVEMESSAGE: "removeMsg",
/**
* A PTVAdmin? warning that a channel has adult content but is not in adult mode.
*/
WARNADULT: "warnAdult",
/**
* A PTVAdmin? warning that a channel has gaming content but is not in gaming mode.
*/
WARNGAMING: "warnGaming",
/**
* A PTVAdmin? warning that a channel has movie content.
*/
WARNMOVIES: "warnMovies",
/**
* The multistream status of a channel
*/
MULTISTATUS: "multiStatus",
/**
* Emitted after replaying chat history
*/
ENDHISTORY: "endHistory",
/**
* A list of people being ignored
*/
IGNORES: "ignores",
// Bot Events
/**
* The bot threw an exception
*/
EXCEPTION: "exception",
/**
* A bot command
*/
CHATCOMMAND: "chatCommand",
/**
* A console command
*/
CONSOLECOMMAND: "consoleCommand",
/**
* A command needs completing
*/
COMMANDCOMPLETION: "commandCompletion",
/**
* A plugin was loaded
*/
PLUGINLOADED: "pluginLoaded",
/**
* A plugin was started
*/
PLUGINSTARTED: "pluginStarted",
/**
* A plugin was loaded
*/
PLUGINUNLOADED: "pluginUnloaded",
/**
* A plugin was started
*/
PLUGINSTOPPED: "pluginStopped",
/**
* Used to query plugins if they want to add a cli option/flag
*/
CLIOPTIONS: "CLIOptions"
};
module.exports = EventTypes;
|
var translations = {
'es': {
'One moment while we<br>log you in':
'Espera un momento mientras<br>iniciamos tu sesión',
'You are now connected to the network':
'Ahora estás conectado a la red',
'Account signups/purchases are disabled in preview mode':
'La inscripciones de cuenta/compras están desactivadas en el modo de vista previa.',
'Notice':
'Aviso',
'Day':
'Día',
'Days':
'Días',
'Hour':
'Hora',
'Hours':
'Horas',
'Minutes':
'Minutos',
'Continue':
'Continuar',
'Thank You for Trying TWC WiFi':
'Gracias por probar TWC WiFi',
'Please purchase a TWC Access Pass to continue using WiFi':
'Adquiere un Pase de acceso (Access Pass) de TWC para continuar usando la red WiFi',
'Your TWC Access Pass has expired. Please select a new Access Pass Now.':
'Tu Access Pass (Pase de acceso) de TWC ha vencido. Selecciona un nuevo Access Pass (Pase de acceso) ahora.',
'Your account information has been pre-populated into the form. If you wish to change any information, you may edit the form before completing the order.':
'El formulario ha sido llenado con la información de tu cuenta. Si deseas modificar algún dato, puedes editar el formulario antes de completar la solicitud.',
'Your Password':
'Tu contraseña',
'Proceed to Login':
'Proceder con el inicio de sesión',
'Payment portal is not available at this moment':
'',
'Redirecting to Payment portal...':
'',
'Could not log you into the network':
'No se pudo iniciar sesión en la red'
}
}
function translate(text, language) {
if (language == 'en')
return text;
if (!translations[language])
return text;
if (!translations[language][text])
return text;
return translations[language][text] || text;
}
|
var
assert = require('assert'),
path = require('path'),
exec = require('child_process').exec,
tmp = require('../lib/tmp');
// make sure that we do not test spam the global tmp
tmp.TMP_DIR = './tmp';
function _spawnTestWithError(testFile, params, cb) {
_spawnTest(true, testFile, params, cb);
}
function _spawnTestWithoutError(testFile, params, cb) {
_spawnTest(false, testFile, params, cb);
}
function _spawnTest(passError, testFile, params, cb) {
var
node_path = process.argv[0],
command = [ node_path, path.join(__dirname, testFile) ].concat(params).join(' ');
exec(command, function _execDone(err, stdout, stderr) {
if (passError) {
if (err) {
return cb(err);
} else if (stderr.length > 0) {
return cb(stderr.toString());
}
}
return cb(null, stdout.toString());
});
}
function _testStat(stat, mode) {
assert.equal(stat.uid, process.getuid(), 'should have the same UID');
assert.equal(stat.gid, process.getgid(), 'should have the same GUID');
assert.equal(stat.mode, mode);
}
function _testPrefix(prefix) {
return function _testPrefixGenerated(err, name) {
assert.equal(path.basename(name).slice(0, prefix.length), prefix, 'should have the provided prefix');
};
}
function _testPrefixSync(prefix) {
return function _testPrefixGeneratedSync(result) {
if (result instanceof Error) {
throw result;
}
_testPrefix(prefix)(null, result.name, result.fd);
};
}
function _testPostfix(postfix) {
return function _testPostfixGenerated(err, name) {
assert.equal(name.slice(name.length - postfix.length, name.length), postfix, 'should have the provided postfix');
};
}
function _testPostfixSync(postfix) {
return function _testPostfixGeneratedSync(result) {
if (result instanceof Error) {
throw result;
}
_testPostfix(postfix)(null, result.name, result.fd);
};
}
function _testKeep(type, keep, cb) {
_spawnTestWithError('keep.js', [ type, keep ], cb);
}
function _testKeepSync(type, keep, cb) {
_spawnTestWithError('keep-sync.js', [ type, keep ], cb);
}
function _testGraceful(type, graceful, cb) {
_spawnTestWithoutError('graceful.js', [ type, graceful ], cb);
}
function _testGracefulSync(type, graceful, cb) {
_spawnTestWithoutError('graceful-sync.js', [ type, graceful ], cb);
}
function _assertName(err, name) {
assert.isString(name);
assert.isNotZero(name.length, 'an empty string is not a valid name');
}
function _assertNameSync(result) {
if (result instanceof Error) {
throw result;
}
var name = typeof(result) == 'string' ? result : result.name;
_assertName(null, name);
}
function _testName(expected){
return function _testNameGenerated(err, name) {
assert.equal(expected, name, 'should have the provided name');
};
}
function _testNameSync(expected){
return function _testNameGeneratedSync(result) {
if (result instanceof Error) {
throw result;
}
_testName(expected)(null, result.name, result.fd);
};
}
function _testUnsafeCleanup(unsafe, cb) {
_spawnTestWithoutError('unsafe.js', [ 'dir', unsafe ], cb);
}
function _testIssue62(cb) {
_spawnTestWithoutError('issue62.js', [], cb);
}
function _testUnsafeCleanupSync(unsafe, cb) {
_spawnTestWithoutError('unsafe-sync.js', [ 'dir', unsafe ], cb);
}
function _testIssue62Sync(cb) {
_spawnTestWithoutError('issue62-sync.js', [], cb);
}
module.exports.testStat = _testStat;
module.exports.testPrefix = _testPrefix;
module.exports.testPrefixSync = _testPrefixSync;
module.exports.testPostfix = _testPostfix;
module.exports.testPostfixSync = _testPostfixSync;
module.exports.testKeep = _testKeep;
module.exports.testKeepSync = _testKeepSync;
module.exports.testGraceful = _testGraceful;
module.exports.testGracefulSync = _testGracefulSync;
module.exports.assertName = _assertName;
module.exports.assertNameSync = _assertNameSync;
module.exports.testName = _testName;
module.exports.testNameSync = _testNameSync;
module.exports.testUnsafeCleanup = _testUnsafeCleanup;
module.exports.testIssue62 = _testIssue62;
module.exports.testUnsafeCleanupSync = _testUnsafeCleanupSync;
module.exports.testIssue62Sync = _testIssue62Sync;
|
function assign(taskID, assignedTo)
{
$('.assign').width(150);
$('.assign').height(40);
$('.assign').load(createLink('user', 'ajaxGetUser', 'taskID=' + taskID + '&assignedTo=' + assignedTo));
}
function setComment()
{
$('#comment').toggle();
}
|
(function() {
'use strict';
angular
.module('editor.database', [])
.config(function($indexedDBProvider) {
$indexedDBProvider
.connection('otus-studio')
.upgradeDatabase(1, function(event, db, tx) {
var store = db.createObjectStore('survey_template', { keyPath: 'template_oid'});
store.createIndex('contributor_idx', 'contributor', { unique: false });
});
});
}());
|
/* Image.js
*
* copyright (c) 2010-2017, Christian Mayer and the CometVisu contributers.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/**
*
*/
qx.Class.define('cv.parser.widgets.Image', {
type: "static",
/*
******************************************************
STATICS
******************************************************
*/
statics: {
/**
* Parses the widgets XML configuration and extracts the given information
* to a simple key/value map.
*
* @param xml {Element} XML-Element
* @param path {String} internal path of the widget
* @param flavour {String} Flavour of the widget
* @param pageType {String} Page type (2d, 3d, ...)
*/
parse: function (xml, path, flavour, pageType) {
var data = cv.parser.WidgetParser.parseElement(this, xml, path, flavour, pageType, this.getAttributeToPropertyMappings());
cv.parser.WidgetParser.parseRefresh(xml, path);
return data;
},
getAttributeToPropertyMappings: function () {
return {
'width' : { "default": "100%" },
'height' : {},
'src' : {},
'widthfit' : { target: 'widthFit', transform: function(value) {
return value === "true";
}}
};
}
},
defer: function(statics) {
// register the parser
cv.parser.WidgetParser.addHandler("image", statics);
}
});
|
/*
* Meran - MERAN UNLP is a ILS (Integrated Library System) wich provides Catalog,
* Circulation and User's Management. It's written in Perl, and uses Apache2
* Web-Server, MySQL database and Sphinx 2 indexing.
* Copyright (C) 2009-2013 Grupo de desarrollo de Meran CeSPI-UNLP
*
* This file is part of Meran.
*
* Meran is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Meran is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Meran. If not, see <http://www.gnu.org/licenses/>.
*/
define([],function(){
'use strict'
/**
* Implements unique() using the browser's sort().
*
* @param a
* The array to sort and strip of duplicate values.
* Warning: this array will be modified in-place.
* @param compFn
* A custom comparison function that accepts two values a and
* b from the given array and returns -1, 0, 1 depending on
* whether a < b, a == b, a > b respectively.
*
* If no compFn is provided, the algorithm will use the
* browsers default sort behaviour and loose comparison to
* detect duplicates.
* @return
* The given array.
*/
function sortUnique(a, compFn){
var i;
if (compFn) {
a.sort(compFn);
for (i = 1; i < a.length; i++) {
if (0 === compFn(a[i], a[i - 1])) {
a.splice(i--, 1);
}
}
} else {
a.sort();
for (i = 1; i < a.length; i++) {
// Use loosely typed comparsion if no compFn is given
// to avoid sortUnique( [6, "6", 6] ) => [6, "6", 6]
if (a[i] == a[i - 1]) {
a.splice(i--, 1);
}
}
}
return a;
}
/**
* Shallow comparison of two arrays.
*
* @param a, b
* The arrays to compare.
* @param equalFn
* A custom comparison function that accepts two values a and
* b from the given arrays and returns true or false for
* equal and not equal respectively.
*
* If no equalFn is provided, the algorithm will use the strict
* equals operator.
* @return
* True if all items in a and b are equal, false if not.
*/
function equal(a, b, equalFn) {
var i = 0, len = a.length;
if (len !== b.length) {
return false;
}
if (equalFn) {
for (; i < len; i++) {
if (!equalFn(a[i], b[i])) {
return false;
}
}
} else {
for (; i < len; i++) {
if (a[i] !== b[i]) {
return false;
}
}
}
return true;
}
/**
* ECMAScript map replacement
* See https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map
* And http://es5.github.com/#x15.4.4.19
* It's not exactly according to standard, but it does exactly what one expects.
*/
function map(a, fn) {
var i, len, result = [];
for (i = 0, len = a.length; i < len; i++) {
result.push(fn(a[i]));
}
return result;
}
function mapNative(a, fn) {
// Call map directly on the object instead of going through
// Array.prototype.map. This avoids the problem that we may get
// passed an array-like object (NodeList) which may cause an
// error if the implementation of Array.prototype.map can only
// deal with arrays (Array.prototype.map may be native or
// provided by a javscript framework).
return a.map(fn);
}
return {
sortUnique: sortUnique,
equal: equal,
map: Array.prototype.map ? mapNative : map
};
});
|
/*global define*/
/*global test*/
/*global equal*/
define(['models/config'], function (Model) {
'use strict';
module('Config model');
test('Can be created with default values', function() {
var note = new Model();
equal(note.get('name'), '', 'For default config name is empty');
equal(note.get('value'), '', 'For default config value is empty');
});
test('Update attributes', function(){
var note = new Model();
note.set('name', 'new-config');
equal(note.get('name'), 'new-config');
equal(note.get('value'), '', 'For default config value is empty');
});
});
|
var searchData=
[
['operator_2a',['operator*',['../class_complex.html#a789de21d72aa21414c26e0dd0966313a',1,'Complex']]],
['operator_2b',['operator+',['../class_complex.html#a5a7bc077499ace978055b0e6b9072ee9',1,'Complex']]],
['operator_5e',['operator^',['../class_complex.html#a952d42791b6b729c16406e21f9615f9f',1,'Complex']]]
];
|
Bitrix 17.0.9 Business Demo = f37a7cf627b2ec3aa4045ed4678789ad
|
define(
"dojo/cldr/nls/nb/gregorian", //begin v1.x content
{
"dateFormatItem-Ehm": "E h.mm a",
"days-standAlone-short": [
"sø.",
"ma.",
"ti.",
"on.",
"to.",
"fr.",
"lø."
],
"months-format-narrow": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"field-second-relative+0": "nå",
"quarters-standAlone-narrow": [
"1",
"2",
"3",
"4"
],
"field-weekday": "Ukedag",
"dateFormatItem-yQQQ": "QQQ y",
"dateFormatItem-yMEd": "E d.MM.y",
"field-wed-relative+0": "onsdag denne uken",
"dateFormatItem-GyMMMEd": "E d. MMM y G",
"dateFormatItem-MMMEd": "E d. MMM",
"field-wed-relative+1": "onsdag neste uke",
"eraNarrow": [
"f.Kr.",
"fvt.",
"e.Kr.",
"vt"
],
"dateFormatItem-yMM": "MM.y",
"field-tue-relative+-1": "tirsdag sist uke",
"days-format-short": [
"sø.",
"ma.",
"ti.",
"on.",
"to.",
"fr.",
"lø."
],
"dateFormat-long": "d. MMMM y",
"field-fri-relative+-1": "fredag sist uke",
"field-wed-relative+-1": "onsdag sist uke",
"months-format-wide": [
"januar",
"februar",
"mars",
"april",
"mai",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"desember"
],
"dateTimeFormat-medium": "{1}, {0}",
"dayPeriods-format-wide-pm": "p.m.",
"dateFormat-full": "EEEE d. MMMM y",
"field-thu-relative+-1": "torsdag sist uke",
"dateFormatItem-Md": "d.M.",
"dayPeriods-format-abbr-am": "a.m.",
"dateFormatItem-yMd": "d.M.y",
"dateFormatItem-yM": "M.y",
"field-era": "Tidsalder",
"months-standAlone-wide": [
"januar",
"februar",
"mars",
"april",
"mai",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"desember"
],
"timeFormat-short": "HH.mm",
"quarters-format-wide": [
"1. kvartal",
"2. kvartal",
"3. kvartal",
"4. kvartal"
],
"timeFormat-long": "HH.mm.ss z",
"dateFormatItem-yMMM": "MMM y",
"dateFormatItem-yQQQQ": "QQQQ y",
"field-year": "År",
"dateFormatItem-MMdd": "d.M.",
"field-hour": "Time",
"months-format-abbr": [
"jan.",
"feb.",
"mar.",
"apr.",
"mai",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"des."
],
"field-sat-relative+0": "lørdag denne uken",
"field-sat-relative+1": "lørdag neste uke",
"timeFormat-full": "HH.mm.ss zzzz",
"field-day-relative+0": "i dag",
"field-day-relative+1": "i morgen",
"field-thu-relative+0": "torsdag denne uken",
"dateFormatItem-GyMMMd": "d. MMM y G",
"field-day-relative+2": "i overmorgen",
"field-thu-relative+1": "torsdag neste uke",
"dateFormatItem-H": "HH",
"months-standAlone-abbr": [
"jan",
"feb",
"mar",
"apr",
"mai",
"jun",
"jul",
"aug",
"sep",
"okt",
"nov",
"des"
],
"quarters-format-abbr": [
"K1",
"K2",
"K3",
"K4"
],
"quarters-standAlone-wide": [
"1. kvartal",
"2. kvartal",
"3. kvartal",
"4. kvartal"
],
"dateFormatItem-Gy": "y G",
"dateFormatItem-M": "L.",
"days-standAlone-wide": [
"søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"
],
"timeFormat-medium": "HH.mm.ss",
"field-sun-relative+0": "søndag denne uken",
"dateFormatItem-Hm": "HH.mm",
"quarters-standAlone-abbr": [
"K1",
"K2",
"K3",
"K4"
],
"field-sun-relative+1": "søndag neste uke",
"eraAbbr": [
"f.Kr.",
"e.Kr."
],
"field-minute": "Minutt",
"field-dayperiod": "AM/PM",
"days-standAlone-abbr": [
"sø.",
"ma.",
"ti.",
"on.",
"to.",
"fr.",
"lø."
],
"dateFormatItem-d": "d.",
"dateFormatItem-ms": "mm.ss",
"quarters-format-narrow": [
"1",
"2",
"3",
"4"
],
"field-day-relative+-1": "i går",
"dateFormatItem-h": "h a",
"dateTimeFormat-long": "{1} 'kl.' {0}",
"dayPeriods-format-narrow-am": "a",
"field-day-relative+-2": "i forgårs",
"dateFormatItem-MMMd": "d. MMM",
"dateFormatItem-MEd": "E d.M",
"dateTimeFormat-full": "{1} {0}",
"field-fri-relative+0": "fredag denne uken",
"dateFormatItem-yMMMM": "MMMM y",
"field-fri-relative+1": "fredag neste uke",
"field-day": "Dag",
"days-format-wide": [
"søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"
],
"field-zone": "Tidssone",
"dateFormatItem-y": "y",
"months-standAlone-narrow": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"field-year-relative+-1": "i fjor",
"field-month-relative+-1": "forrige måned",
"dateFormatItem-hm": "h.mm a",
"dayPeriods-format-abbr-pm": "p.m.",
"days-format-abbr": [
"søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."
],
"eraNames": [
"f.Kr.",
"e.Kr."
],
"dateFormatItem-yMMMd": "d. MMM y",
"days-format-narrow": [
"S",
"M",
"T",
"O",
"T",
"F",
"L"
],
"days-standAlone-narrow": [
"S",
"M",
"T",
"O",
"T",
"F",
"L"
],
"dateFormatItem-MMM": "LLL",
"field-month": "Måned",
"field-tue-relative+0": "tirsdag denne uken",
"field-tue-relative+1": "tirsdag neste uke",
"dayPeriods-format-wide-am": "a.m.",
"dateFormatItem-EHm": "E HH.mm",
"field-mon-relative+0": "mandag denne uken",
"field-mon-relative+1": "mandag neste uke",
"dateFormat-short": "dd.MM.y",
"dateFormatItem-EHms": "E HH.mm.ss",
"dateFormatItem-Ehms": "E h.mm.ss a",
"field-second": "Sekund",
"field-sat-relative+-1": "lørdag sist uke",
"dateFormatItem-yMMMEd": "E d. MMM y",
"field-sun-relative+-1": "søndag sist uke",
"field-month-relative+0": "denne måneden",
"field-month-relative+1": "neste måned",
"dateFormatItem-Ed": "E d.",
"dateTimeFormats-appendItem-Timezone": "{0} {1}",
"field-week": "Uke",
"dateFormat-medium": "d. MMM y",
"field-year-relative+0": "i år",
"field-week-relative+-1": "forrige uke",
"field-year-relative+1": "neste år",
"dayPeriods-format-narrow-pm": "p",
"dateTimeFormat-short": "{1}, {0}",
"dateFormatItem-Hms": "HH.mm.ss",
"dateFormatItem-hms": "h.mm.ss a",
"dateFormatItem-GyMMM": "MMM y G",
"field-mon-relative+-1": "mandag sist uke",
"field-week-relative+0": "denne uken",
"field-week-relative+1": "neste uke"
}
//end v1.x content
);
|
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['button-content'],
audio: Ember.inject.service(),
soundName: null,
rate: 1,
preloadSounds: function() {
this.get('audio');
}.on('init'),
actions: {
play() {
this.get('audio').play(this.get('soundName'), this.get('rate'));
}
}
});
|
import {createBrowserHistory} from 'history';
import stringUtil from '@shared/util/stringUtil';
import ConfigStore from '../stores/ConfigStore';
const history = createBrowserHistory({basename: stringUtil.withoutTrailingSlash(ConfigStore.getBaseURI())});
export default history;
|
asm(1000){
var a = 1;
};
|
/*! @license Firebase v4.3.1
Build: rev-b4fe95f
Terms: https://firebase.google.com/terms/ */
"use strict";
//# sourceMappingURL=requestmaker.js.map
|
var searchData=
[
['save_5fcomments',['save_comments',['../useful__functions_8php.html#af56aec073a82606e9a7dac498de28d96',1,'useful_functions.php']]],
['save_5fexperiment_5flist',['save_experiment_list',['../choose__experiments_8php.html#a5d24f39ae6c336d7828523216bce6fae',1,'choose_experiments.php']]],
['save_5fsessions',['save_sessions',['../useful__functions_8php.html#a38a4632f417ceaa2f1c09c3ed0494d5e',1,'useful_functions.php']]],
['save_5fsignup_5fto_5fdb',['save_signup_to_db',['../useful__functions_8php.html#a0dca9d754b1a0d7b5401c446878844c5',1,'useful_functions.php']]],
['save_5fuser_5fexpt_5fchoices',['save_user_expt_choices',['../useful__functions_8php.html#a461a04526110df604708381a9eac7da8',1,'useful_functions.php']]],
['signup_5fexists',['signup_exists',['../useful__functions_8php.html#a7cf6d3ac90a6fca8c3f595e68b6e62cc',1,'useful_functions.php']]]
];
|
'use strict';
var async = require('async');
var nconf = require('nconf');
var querystring = require('querystring');
var meta = require('../meta');
var pagination = require('../pagination');
var user = require('../user');
var topics = require('../topics');
var plugins = require('../plugins');
var helpers = require('./helpers');
var unreadController = module.exports;
unreadController.get = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1;
var results;
var cid = req.query.cid;
var filter = req.query.filter || '';
var settings;
async.waterfall([
function (next) {
plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
},
function (data, _next) {
if (!data.filters[filter]) {
return next();
}
async.parallel({
watchedCategories: function (next) {
helpers.getWatchedCategories(req.uid, cid, next);
},
settings: function (next) {
user.getSettings(req.uid, next);
},
}, _next);
},
function (_results, next) {
results = _results;
settings = results.settings;
var start = Math.max(0, (page - 1) * settings.topicsPerPage);
var stop = start + settings.topicsPerPage - 1;
var cutoff = req.session.unreadCutoff ? req.session.unreadCutoff : topics.unreadCutoff();
topics.getUnreadTopics({
cid: cid,
uid: req.uid,
start: start,
stop: stop,
filter: filter,
cutoff: cutoff,
}, next);
},
function (data, next) {
user.blocks.filter(req.uid, data.topics, function (err, filtered) {
data.topics = filtered;
next(err, data);
});
},
function (data) {
data.title = meta.config.homePageTitle || '[[pages:home]]';
data.pageCount = Math.max(1, Math.ceil(data.topicCount / settings.topicsPerPage));
data.pagination = pagination.create(page, data.pageCount, req.query);
if (settings.usePagination && (page < 1 || page > data.pageCount)) {
req.query.page = Math.max(1, Math.min(data.pageCount, page));
return helpers.redirect(res, '/unread?' + querystring.stringify(req.query));
}
data.categories = results.watchedCategories.categories;
data.allCategoriesUrl = 'unread' + helpers.buildQueryString('', filter, '');
data.selectedCategory = results.watchedCategories.selectedCategory;
data.selectedCids = results.watchedCategories.selectedCids;
if (req.originalUrl.startsWith(nconf.get('relative_path') + '/api/unread') || req.originalUrl.startsWith(nconf.get('relative_path') + '/unread')) {
data.title = '[[pages:unread]]';
data.breadcrumbs = helpers.buildBreadcrumbs([{ text: '[[unread:title]]' }]);
}
data.filters = helpers.buildFilters('unread', filter, req.query);
data.selectedFilter = data.filters.find(function (filter) {
return filter && filter.selected;
});
res.render('unread', data);
},
], next);
};
unreadController.unreadTotal = function (req, res, next) {
var filter = req.query.filter || '';
async.waterfall([
function (next) {
plugins.fireHook('filter:unread.getValidFilters', { filters: Object.assign({}, helpers.validFilters) }, next);
},
function (data, _next) {
if (!data.filters[filter]) {
return next();
}
topics.getTotalUnread(req.uid, filter, _next);
},
function (data) {
res.json(data);
},
], next);
};
|
(function () {
'use strict';
angular.module('driver.tools.export', [
'ui.bootstrap',
'ui.router',
'driver.customReports',
'driver.resources',
'angular-spinkit',
]);
})();
|
"use strict";
exports.__esModule = true;
var vueClient_1 = require("../../bibliotheque/vueClient");
console.log("* Chargement du script");
/* Test - déclaration d'une variable externe - Possible
cf. declare
*/
function centreNoeud() {
return JSON.parse(vueClient_1.contenuBalise(document, 'centre'));
}
function voisinsNoeud() {
var v = JSON.parse(vueClient_1.contenuBalise(document, 'voisins'));
var r = [];
var id;
for (id in v) {
r.push(v[id]);
}
return r;
}
function adresseServeur() {
return vueClient_1.contenuBalise(document, 'adresseServeur');
}
/*
type CanalChat = CanalClient<FormatMessageTchat>;
// A initialiser
var canal: CanalChat;
var noeud: Noeud<FormatSommetTchat>;
function envoyerMessage(texte: string, destinataire: Identifiant) {
let msg: MessageTchat = creerMessageCommunication(noeud.centre().enJSON().id, destinataire, texte);
console.log("- Envoi du message brut : " + msg.brut());
console.log("- Envoi du message net : " + msg.net());
canal.envoyerMessage(msg);
initialiserEntree('message_' + destinataire, "");
}
// A exécuter après chargement de la page
function initialisation(): void {
console.log("* Initialisation après chargement du DOM ...")
noeud = creerNoeud<FormatSommetTchat>(centreNoeud(), voisinsNoeud(), creerSommetTchat);
canal = new CanalClient<FormatMessageTchat>(adresseServeur());
canal.enregistrerTraitementAReception((m: FormatMessageTchat) => {
let msg = new MessageTchat(m);
console.log("- Réception du message brut : " + msg.brut());
console.log("- Réception du message net : " + msg.net());
posterNL('logChats', msg.net());
});
console.log("* ... du noeud et du canal côté client en liaison avec le serveur : " + adresseServeur());
// Gestion des événements pour les éléments du document.
//document.getElementById("boutonEnvoi").addEventListener("click", <EventListenerOrEventListenerObject>(e => {alert("click!");}), true);
let id: Identifiant;
let v = noeud.voisins();
for (id in v) {
console.log("id : " +id);
let idVal = id;
gererEvenementElement("boutonEnvoi_" + idVal, "click", e => {
console.log("id message_" + idVal);
console.log("entree : " + recupererEntree("message_" + idVal));
envoyerMessage(recupererEntree("message_" + idVal), idVal);
});
}
<form id="envoi">
<input type="text" id="message_id1">
<input class="button" type="button" id="boutonEnvoi_id1" value="Envoyer un message à {{nom id1}}."
onClick="envoyerMessage(this.form.message.value, "id1")">
</form>
console.log("* ... et des gestionnaires d'événements sur des éléments du document.");
}
// Gestion des événements pour le document
console.log("* Enregistrement de l'initialisation");
gererEvenementDocument('DOMContentLoaded', initialisation);
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', initialisation());
</script>
*/
//# sourceMappingURL=clientChat.js.map
|
(function ($) {
function FewbricksDevHelper() {
var $this = this;
/**
*
*/
this.init = function() {
$this.cssClassFull = 'fewbricks-info-pane--full';
if(!$this.initMainElm()) {
return;
}
$this.initToggler();
$this.$mainElm.show();
}
/**
*
*/
this.initMainElm = function() {
$this.$mainElm = $('#fewbricks-info-pane');
if($this.$mainElm.length === 0) {
return false;
}
if(typeof fewbricksInfoPane !== 'undefined' && typeof fewbricksInfoPane.startHeight !== 'undefined') {
$this.toggleMainElm(fewbricksInfoPane.startHeight);
}
return true;
}
/**
*
*/
this.initToggler = function() {
$('[data-fewbricks-info-pane-toggler]')
.unbind('click')
.on('click', function() {
let height = $(this).attr('data-fewbricks-info-pane-height');
$this.toggleMainElm(height);
document.cookie = 'fewbricks_info_pane_height=' + height;
});
}
/**
*
*/
this.toggleMainElm = function(height) {
if(height === 'minimized') {
$this.$mainElm.attr('style', function(i, style)
{
return style && style.replace(/height[^;]+;?/g, '');
});
} else {
$this.$mainElm.height(height + 'vh');
}
}
/**
*
* @returns {*|boolean}
*/
this.mainElmIsFull = function() {
return $this.$mainElm.hasClass($this.cssClassFull);
}
}
$(document).ready(function () {
(new FewbricksDevHelper()).init();
});
})(jQuery);
|
/**
* ...
* @author paul
*/
function initCBX(object, id, options) {
var design = "assets";
if(object == null){
jQuery.noConflict();
var cboxClass;
cboxClass = jQuery(id).attr("class");
if(jQuery.browser.msie && parseInt(jQuery.browser.version)<8 ){
jQuery(id).colorbox();
}
else{
if(cboxClass.indexOf("cboxElement") == -1){
if(options.classes.image.id){
jQuery('.'+options.classes.image.id).colorbox({transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
if(options.classes.video){
if(options.classes.video.id){
jQuery('.'+options.classes.video.id).colorbox({iframe:true, innerWidth:options.classes.video.innerWidth, innerHeight:options.classes.video.innerHeight, transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
}
if(options.classes.swf){
if(options.classes.swf.id){
var cbxSWFSrc = jQuery('.'+options.classes.swf.id).attr("href");
var objEmbd = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+options.classes.video.innerWidth+'" HEIGHT="'+options.classes.video.innerHeight+'" id="cbxSWF" ALIGN="">'+
'<PARAM NAME=movie VALUE="'+cbxSWFSrc+'">' +
'<PARAM NAME=quality VALUE=high>' +
'<PARAM NAME=wmode VALUE=transparent>'+
'<PARAM NAME=bgcolor VALUE=#333399>'+
'<EMBED src="'+cbxSWFSrc+'" quality=high wmode=transparent WIDTH="'+options.classes.video.innerWidth+'" HEIGHT="'+options.classes.video.innerHeight+'" NAME="Yourfilename" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'+
'</OBJECT>';
jQuery('.'+options.classes.swf.id).colorbox({html:objEmbd, transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
}
}
}
jQuery(id).trigger('click');
return;
}
loadjQuery = function(filename) {
loadjQuery.getScript(object.path+"/"+filename);
loadjQuery.retry(0);
}
loadColorbox = function(filename) {
loadColorbox.getScript(object.path+"/"+filename);
loadColorbox.retry(0);
}
loadjQuery.getScript = function(filename) {
if(typeof jQuery == "undefined"){
var script = document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("src", filename);
document.getElementsByTagName("head")[0].appendChild(script);
}
}
loadColorbox.getScript = function(filename) {
if(typeof jQuery.colorbox == "undefined"){
var link = document.createElement('link');
link.setAttribute('media', 'screen');
link.setAttribute('href', object.path+'/'+design+'/colorbox.css');
link.setAttribute('rel', 'stylesheet');
document.getElementsByTagName("head")[0].appendChild(link);
var script = document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("src", filename);
document.getElementsByTagName("head")[0].appendChild(script);
}
}
loadjQuery.retry = function(time_elapsed) {
if (typeof jQuery == "undefined") {
if (time_elapsed <= 5000) {
setTimeout("loadjQuery.retry(" + (time_elapsed + 200) + ")", 200);
}
}
else {
if(typeof jQuery.colorbox == "undefined"){
loadColorbox("jquery.colorbox-min.js");
}
}
}
loadColorbox.retry = function(time_elapsed) {
if (typeof jQuery.colorbox == "undefined") {
if (time_elapsed <= 5000) {
setTimeout("loadColorbox.retry(" + (time_elapsed + 200) + ")", 200);
}
}
}
if(typeof jQuery == "undefined"){
loadjQuery("jquery-1.7.2.min.js");
}
else if(typeof jQuery.colorbox == "undefined"){
loadColorbox("jquery.colorbox-min.js");
}
}
|
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'newpage', 'eo', {
toolbar: 'Nova Paĝo'
} );
|
var searchData=
[
['transfer_20commands',['Transfer Commands',['../group___d_a_p__transfer__gr.html',1,'']]]
];
|
// @flow
import React, { Component } from 'react'
import { withStyles } from 'material-ui/styles'
import Profile from 'models/Profile'
import IconButton from 'material-ui/IconButton'
import Typography from 'material-ui/Typography'
import FontAwesome from 'react-fontawesome'
import Avatar from 'components/common/Avatar'
import Pubkey from 'components/common/Pubkey'
import InsetText from 'components/common/InsetText'
class ShowProfile extends Component {
props: {
profile: Profile,
onEditClick: () => any
}
render() {
const { classes, profile } = this.props
return (
<div>
<div className={classes.header}>
<div className={classes.lateral} />
<Typography className={classes.identity}>{profile.identity}</Typography>
<IconButton className={classes.lateral} onClick={this.props.onEditClick}><FontAwesome name="pencil" /></IconButton>
</div>
{ profile.avatarUrl
? <Avatar person={profile} className={classes.avatar} />
: <div className={classes.noAvatar}><Typography>No avatar</Typography></div>
}
<InsetText text={profile.bio} placeholder='No biography' />
<Typography align="center" variant="body2">
Share your Arbore ID
</Typography>
<Pubkey pubkey={profile.pubkey} />
</div>
)
}
}
const style = theme => ({
header: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
margin: '10px 0 20px',
},
avatar: {
width: '200px !important',
height: '200px !important',
margin: 'auto',
userSelect: 'none',
pointerEvents: 'none',
},
noAvatar: {
width: 200,
height: 200,
borderRadius: '50%',
backgroundColor: theme.palette.background.dark,
margin: 'auto',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
},
identity: {
margin: '0 10px 0 !important',
fontSize: '2em !important',
textAlign: 'center',
flexGrow: 1,
},
lateral: {
width: '20px !important',
},
})
export default withStyles(style)(ShowProfile)
|
{
"": {
"domain": "ckan",
"lang": "cs_CZ",
"plural-forms": "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
},
"An Error Occurred": [
null,
"Nastala chyba"
],
"Are you sure you want to perform this action?": [
null,
"Jste si jistí, že chcete provést tuto akci?"
],
"Cancel": [
null,
"Zrušit"
],
"Confirm": [
null,
"Potvrdit"
],
"Edit": [
null,
"Upravit"
],
"Failed to load data API information": [
null,
"Pokus o získání informací pomocí API selhal"
],
"Follow": [
null,
"Sledovat"
],
"Hide": [
null,
"Skrýt"
],
"Image": [
null,
"Obrázek"
],
"Input is too short, must be at least one character": [
null,
"Zadaný vstup je příliš krátký, musíte zadat alespoň jeden znak"
],
"Link": [
null,
"Odkaz"
],
"Link to a URL on the internet (you can also link to an API)": [
null,
"Odkaz na internetovou URL adresu (můžete také zadat odkaz na API)"
],
"Loading...": [
null,
"Nahrávám ..."
],
"No matches found": [
null,
"Nenalezena žádná shoda"
],
"Please Confirm Action": [
null,
"Prosím potvrďte akci"
],
"Remove": [
null,
"Odstranit"
],
"Reorder resources": [
null,
"Změnit pořadí zdrojů"
],
"Reset this": [
null,
"Resetovat"
],
"Resource uploaded": [
null,
"Zdroj nahrán"
],
"Save order": [
null,
"Uložit pořadí"
],
"Saving...": [
null,
"Ukládám..."
],
"Show more": [
null,
"Ukázat více"
],
"Start typing…": [
null,
"Začněte psát..."
],
"There are unsaved modifications to this form": [
null,
"Tento formulář obsahuje neuložené změny"
],
"There is no API data to load for this resource": [
null,
"Tento zdroj neobsahuje žádná data, která lze poskytnou přes API"
],
"URL": [
null,
"URL"
],
"Unable to authenticate upload": [
null,
"Nastala chyba autentizace při nahrávání dat"
],
"Unable to get data for uploaded file": [
null,
"Nelze získat data z nahraného souboru"
],
"Unable to upload file": [
null,
"Nelze nahrát soubor"
],
"Unfollow": [
null,
"Přestat sledovat"
],
"Upload": [
null,
"Nahrát"
],
"Upload a file": [
null,
"Nahrát soubor"
],
"Upload a file on your computer": [
null,
"Nahrát soubor na Váš počítač"
],
"You are uploading a file. Are you sure you want to navigate away and stop this upload?": [
null,
"Právě nahráváte soubor. Jste si opravdu jistí, že chcete tuto stránku opustit a ukončit tak nahrávání?"
],
"show less": [
null,
"ukázat méně"
],
"show more": [
null,
"ukázat více"
]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.