code
stringlengths 2
1.05M
| repo_name
stringlengths 5
114
| path
stringlengths 4
991
| language
stringclasses 1
value | license
stringclasses 15
values | size
int32 2
1.05M
|
|---|---|---|---|---|---|
var Promise = require('bluebird')
, path = require('path')
, async = require('async')
, spawn = require('child_process').spawn
, readline = require('readline')
, fs = Promise.promisifyAll(require('fs'))
, install = GLOBAL.lib.install
, _bower = GLOBAL.lib.util.bower
, utils = GLOBAL.lib.utils
, os = require('os')
, isWin = /^win32/.test(os.platform());
Promise.longStackTraces();
/**
* Helper function for running clever-install if there are modules to install
*
* @param {Object} projectFolder location returned by util.locations.get()
* @param {String[]} modules
* @return {Promise}
* @api public
*/
exports.setupModules = function(projectFolder, modules) {
return new Promise(function(resolve, reject) {
var cwd = process.cwd();
process.chdir(projectFolder.moduleDir);
install
.run(modules)
.then(function() {
process.chdir(cwd);
resolve();
}, function(err) {
process.chdir(cwd);
reject(err);
});
});
};
/**
* Installs module bower components within the frontend seed's component dir
*
* @param {Object} projectFolder Object returned from util.locations.get()
* @return {Promise} Promise from bluebird
* @api public
*/
exports.installBowerComponents = function(projectFolder) {
return new Promise(function(resolve, reject) {
var bowerRC = path.join(projectFolder.moduleDir, '.bowerrc')
, _bowerRC = fs.readFileSync(bowerRC);
_bowerRC = JSON.parse(_bowerRC);
if (program.verbose) {
utils.info(' Installing bower components for ' + projectFolder.moduleDir + '...');
}
_bower.install(projectFolder.moduleDir, function (err) {
if (!!err) {
return reject(err);
}
async.filter(
fs.readdirSync(path.join(projectFolder.moduleDir, projectFolder.modulePath)),
function(dir, next) {
fs.exists(path.join(projectFolder.moduleDir, projectFolder.modulePath, dir, 'bower.json'), next);
},
function (modules, err) {
if (!!err) {
return reject(err);
}
if (modules.length < 1) {
return resolve();
}
async.each(
modules,
function(moduleDir, callback) {
utils.running('Installing bower components for ' + moduleDir + '...' );
if (program.verbose) {
utils.info(' Installing bower components for ' + moduleDir + '...');
} else {
utils.info(' Installing bower components for ' + moduleDir.split('/').pop() + '...');
}
_bower.install(
path.join(projectFolder.moduleDir, projectFolder.modulePath, moduleDir),
{
cwd: path.join(projectFolder.moduleDir, projectFolder.modulePath, moduleDir),
directory: path.relative(path.join(projectFolder.moduleDir, projectFolder.modulePath, moduleDir), [ projectFolder.moduleDir ].concat(_bowerRC.directory.split('/')).join(path.sep)),
env: process.env
},
function(err) {
callback(err);
}
);
},
function(moduleErr) {
if (!!moduleErr) {
return reject(moduleErr);
}
resolve();
}
);
}
);
});
});
};
/**
* Looks into package.json within the seed's module directory
* and finds each (dev)dependency and installs individually
* due to use using the --prefix flag for NPM
*
* @param {Object} project
* @param {String} modulePath
* @param {Object} programOptions program instance sent by commander
* @return {Promise}
* @api public
*/
exports.installModule = function(project, modulePath) {
return new Promise(function(resolve, reject) {
var projectFolder = project.moduleDir
, moduleDir = path.join(project.moduleDir, project.modulePath)
, jsonPath = path.resolve(path.join(modulePath, 'package.json'))
, deps = [];
if (!fs.existsSync(jsonPath)) {
return resolve();
}
var jsonFile = require(jsonPath);
jsonFile.dependencies = jsonFile.dependencies || {};
jsonFile.devDependencies = jsonFile.devDependencies || {};
Object.keys(jsonFile.dependencies).forEach(function(k) {
deps.push(k + '@' + jsonFile.dependencies[ k ]);
});
Object.keys(jsonFile.devDependencies).forEach(function(k) {
deps.push(k + '@' + jsonFile.devDependencies[ k ]);
});
utils.info(' Installing NPM modules for ' + modulePath.split(path.sep).pop() + '...');
async.waterfall(
[
function installNpmDependencies(callback) {
var opts = {cwd: moduleDir, env: process.env}
, args = ['install', '--prefix', projectFolder].concat(deps)
, cmd = !isWin ? 'npm' : 'npm.cmd';
if (!program.verbose) {
args.push('--silent');
}
var posixProc = spawn(cmd, args, opts)
, exitHdlr = process.kill.bind(process, posixProc)
, error = '';
process.on('SIGTERM', exitHdlr);
if (!!program.verbose) {
readline
.createInterface({
input : posixProc.stdout,
terminal : false
})
.on('line', function(line) {
console.log(' ' + line);
});
}
posixProc.on('error', function(err) {
error += err;
});
posixProc.on('close', function(code) {
process.removeListener('SIGTERM', exitHdlr);
if (code !== 0 || !!error) {
callback(error);
} else {
callback(null);
}
});
},
function installBowerDependencies(callback) {
if (program.verbose) {
utils.success(' Finished installing NPM packages for ' + modulePath.split(path.sep).pop() + '...');
}
var bowerPath = path.resolve(path.join(projectFolder, 'bower.json'));
// backend folder?
if (!fs.existsSync(bowerPath)) {
utils.success(' Successfully installed ' + modulePath.split(path.sep).pop() + '...');
return callback(null);
}
utils.info(' Installing bower components for ' + modulePath.split(path.sep).pop() + '...');
_bower.install(modulePath, function(_err) {
if (!!_err) {
return callback(_err);
}
utils.success(' Successfully installed ' + modulePath.split(path.sep).pop() + '...');
callback(null);
});
}
],
function checkInstallation(err) {
if (!!err) {
resolve();
} else {
reject(err);
}
}
);
});
};
|
GrimDerp/cleverstack-cli
|
lib/project.js
|
JavaScript
|
mit
| 6,995
|
import Service from '@ember/service';
import $ from 'jquery';
import { run } from '@ember/runloop';
export default Service.extend({
init() {
this._super(...arguments);
this.setupMouseEventsFromIframe();
},
handleMouseEvents(m, mouseEvent) {
const event = $.Event(mouseEvent, {
pageX: m.pageX + $("#dummy-content-iframe").offset().left,
pageY: m.pageY + $("#dummy-content-iframe").offset().top
});
$(window).trigger(event);
},
setupMouseEventsFromIframe() {
window.addEventListener('message', (m) => {
run(() => {
if(typeof m.data==='object' && 'mousemove' in m.data) {
this.handleMouseEvents(m.data.mousemove, 'mousemove');
}
if(typeof m.data==='object' && 'mouseup' in m.data) {
this.handleMouseEvents(m.data.mouseup, 'mousemove');
}
});
});
}
});
|
ember-cli/ember-twiddle
|
app/services/resizeable-columns.js
|
JavaScript
|
mit
| 870
|
define(['angular'],function(){
'use strict';
console.log('home');
// home controller module
var homeController = angular.module('iWay.controllers.home', []);
// home controller
homeController.controller('homeCtrl',['$scope',function($scope){
$scope.user = {
name: 'Home',
age: 22,
};
console.log($scope.user);
}]);
});// end for define
|
s9013/Sparrow
|
src/main/webapp/js/home/controller.js
|
JavaScript
|
mit
| 376
|
var P = require('bluebird');
var user = require('../lib/user');
var users = require('../lib/db').get('users');
P.promisifyAll(users);
var validates = 0;
users.findAsync({}).then(function(users) {
return users.map(function(u) {
var uzer = user.fromModel(u);
return uzer.summary().then(function(summary) {
return [u.login, uzer.addFollowers(summary.amount)];
});
});
}).map(function(result) {
console.log(result[0], result[1].follows);
}).then(function() {
process.exit(0);
});
|
legoboy0215/ghfollowers
|
scripts/fix_followers.js
|
JavaScript
|
mit
| 504
|
const _engine = Symbol('engine')
const functionize = val => (typeof val === 'function' ? val : () => val)
class Workflow {
constructor (engine, name, config) {
Object.defineProperty(this, '_state', {
value: name
})
this[_engine] = engine
const _config = Object.keys(config).reduce((workflowConfig, key) => {
workflowConfig[key] = functionize(config[key])
return workflowConfig
}, {})
Object.assign(this, _config)
}
/**
* Invokes a workflow action with object context. Makes sure invocation is wrapped in promise
*
* @param {string} action
* @param {any} obj
* @returns
* @memberof Workflow
*/
invoke (action, obj) {
return Promise.resolve(this[action](obj))
}
/**
* Validates that a workflow can execute
* Checks if `obj` is in `state` and that `action` exists on workflow
*
* @param {any} obj
* @param {string} state
* @param {string} action
* @memberof Workflow
*/
validate (obj, state, action) {
return Promise.resolve(this._detect(obj))
.then(
inState =>
inState
? Promise.resolve()
: Promise.reject(new Error(`Object not in state [${state}]`))
)
.then(
() =>
this[action]
? Promise.resolve(this)
: Promise.reject(
new Error(`Action [${action}] not defined for state [${state}]`)
)
)
}
currentStatesFor (obj) {
return this[_engine].currentStatesFor(obj)
}
// if user doesn't assign a detect to workflow then call global engine detect
_detect (obj) {
return this[_engine]._detect.call(this, obj)
}
}
module.exports = Workflow
|
tvalletta/mutada
|
lib/workflow.js
|
JavaScript
|
mit
| 1,698
|
/* globals suite,Stamplay,setup,sinon,teardown,test,assert,_ */
suite('Stamplay Query ', function () {
var stamplayUrl = 'https://stamplay.stamplayapp.com'
//For each test
setup('Stamplay Query', function () {
this.xhr = sinon.useFakeXMLHttpRequest();
this.request;
var _this = this;
this.xhr.onCreate = function (xhr) {
_this.request = xhr;
};
});
suite('Property', function(){
var query = Stamplay.Query('object', 'tag')
test('has model property', function(){
assert.equal(query.model, 'object');
})
test('has instance property', function(){
assert.equal(query.instance, 'tag');
})
test('has paginationQuery property', function(){
assert.typeOf(query.paginationQuery, 'String');
})
test('has sortQuery property', function(){
assert.typeOf(query.sortQuery, 'String');
})
test('has selectionQuery property', function(){
assert.typeOf(query.selectionQuery, 'String');
})
test('has populateQuery property', function(){
assert.typeOf(query.populateQuery, 'String');
})
test('has populateOwnerQuery property', function(){
assert.typeOf(query.populateOwnerQuery, 'String');
})
test('has whereQuery property', function(){
assert.typeOf(query.whereQuery, 'Array');
})
test('has executable property', function(){
assert.typeOf(query.executable, 'String');
})
})
suite('Function', function(){
test('has between method', function () {
var query = Stamplay.Query('object', 'tag').between('a', 1, 5);
assert.isObject(query.whereQuery[0].a);
assert.equal(query.whereQuery[0].a.$gte, 1);
assert.equal(query.whereQuery[0].a.$lte, 5);
});
test('has gte method', function () {
var query = Stamplay.Query('object', 'tag').greaterThanOrEqual('a', 1);
assert.isObject(query.whereQuery[0].a);
assert.equal(query.whereQuery[0].a.$gte, 1);
});
test('has gt method', function () {
var query = Stamplay.Query('object', 'tag').greaterThan('a', 2);
assert.isObject(query.whereQuery[0].a);
assert.equal(query.whereQuery[0].a.$gt, 2);
});
test('has lt method', function () {
var query = Stamplay.Query('object', 'tag').lessThan('a', 1);
assert.isObject(query.whereQuery[0].a);
assert.equal(query.whereQuery[0].a.$lt, 1);
});
test('has lte method', function () {
var query = Stamplay.Query('object', 'tag').lessThanOrEqual('b', 3);
assert.isObject(query.whereQuery[0].b);
assert.equal(query.whereQuery[0].b.$lte, 3);
});
test('has equalTo method', function () {
var query = Stamplay.Query('object', 'tag').equalTo('b', 'b');
assert.isObject(query.whereQuery[0]);
assert.equal(query.whereQuery[0].b, 'b');
});
test('has notEqualTo method', function () {
var query = Stamplay.Query('object', 'tag').notEqualTo('b', 'a');
assert.isObject(query.whereQuery[0]);
assert.equal(query.whereQuery[0].b.$ne, 'a');
});
test('has sortAscending method', function () {
var query = Stamplay.Query('object', 'tag').sortAscending('b');
assert.equal(query.sortQuery, '&sort=b');
});
test('has sortDescending method', function () {
var query = Stamplay.Query('object', 'tag').sortDescending('b');
assert.equal(query.sortQuery, '&sort=-b');
});
test('has exists method', function () {
var query = Stamplay.Query('object', 'tag').exists('b');
assert.isObject(query.whereQuery[0].b);
assert.equal(query.whereQuery[0].b.$exists, true);
});
test('has notExists method', function () {
var query = Stamplay.Query('object', 'tag').notExists('b');
assert.isObject(query.whereQuery[0].b);
assert.equal(query.whereQuery[0].b.$exists, false);
});
test('has regex method', function () {
var query = Stamplay.Query('object', 'tag').regex('b', '.*a.*', 'i');
assert.isObject(query.whereQuery[0].b);
assert.equal(query.whereQuery[0].b.$regex, '.*a.*');
});
test('has or method', function () {
var a = Stamplay.Query('object', 'tag').notExists('b');
var b = Stamplay.Query('object', 'tag').equalTo('c', 'c');
var query = Stamplay.Query('object', 'tag').or(a,b)
assert.isArray(query.whereQuery[0].$or);
assert.equal(query.whereQuery[0].$or[0].b.$exists, false);
assert.equal(query.whereQuery[0].$or[1].c, 'c');
var c = Stamplay.Query('object', 'tag').notExists('d');
var d = Stamplay.Query('object', 'tag').equalTo('e', 'e');
var queryWithArray = Stamplay.Query('object', 'tag').or([c, d]);
assert.isArray(queryWithArray.whereQuery[0].$or);
assert.equal(queryWithArray.whereQuery[0].$or[0].d.$exists, false);
assert.equal(queryWithArray.whereQuery[0].$or[1].e, 'e');
});
test('has pagination method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').pagination);
});
test('has populate method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').populate);
});
test('has populateOwner method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').populateOwner);
});
test('has select method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').select);
});
test('has exec method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').exec);
});
test('has near method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').near);
});
test('has nearSphere method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').near);
});
test('has geoIntersects method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').geoIntersects);
});
test('has geoWithinGeometry method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').geoWithinGeometry);
});
test('has geoWithinCenterSphere method', function () {
assert.isFunction( Stamplay.Query('object', 'tag').geoWithinCenterSphere);
});
})
suite('Exec', function(){
test('exec() equal works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').equalTo('pippo', 'pippo');
query.exec(function(err,result){
done()
})
assert.equal(this.request.url, stamplayUrl + '/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":"pippo"}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() equal works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').equalTo('pippo', 'pippo');
query.exec().then(function(err,result){done()})
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":"pippo"}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() notEqualTo works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').notEqualTo('a', 2);
query.exec(function(err,result){
done()
})
assert.equal(this.request.url, stamplayUrl + '/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$ne":2}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() notEqualTo works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').notEqualTo('a', 2);
query.exec().then(function(err,result){done()})
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$ne":2}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() gte works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').greaterThanOrEqual('a', 4);
query.exec(function (err,result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$gte":4}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() gte works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').greaterThanOrEqual('a', 4);
query.exec().then(function (result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$gte":4}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() lte works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').lessThanOrEqual('a', 2);
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$lte":2}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() lte works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').lessThanOrEqual('a', 2);
query.exec().then(function (result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"a":{"$lte":2}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $exists works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo');
query.exec(function (err, result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $regex works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').regex('pippo','^a','i');
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$regex":"^a","$options":"i"}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $regex works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').regex('pippo','^a','i');
query.exec(function (err, result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$regex":"^a","$options":"i"}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $exists works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo');
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() pagination works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').pagination(1,2);
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&page=1&per_page=2');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() pagination works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').pagination(1,2);
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&page=1&per_page=2');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() populate works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').populate();
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&populate=true');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() populate works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').populate();
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&populate=true');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() populateOwner works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').populateOwner();
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&populate_owner=true');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() populateOwner works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').populateOwner();
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&populate_owner=true');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() select works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').select('a','b');
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&select=a,b');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() select works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').exists('pippo').select('a','c');
query.exec().then(function (result) {
done()
});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"pippo":{"$exists":true}}&select=a,c');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() near works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').near('Point', [1,2], 1, 2);
query.exec(function (err, result) {done()});
var urlPath = '/tag?where={"_geolocation":{"$near":{"$geometry":{"type":"Point","coordinates":[1,2]},"$maxDistance":1,"$minDistance":2}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() near works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').near('Point', [1,2], 1, 2);
query.exec().then(function (result) {
done()
});
var urlPath = '/tag?where={"_geolocation":{"$near":{"$geometry":{"type":"Point","coordinates":[1,2]},"$maxDistance":1,"$minDistance":2}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() nearSphere works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').nearSphere('Point', [1,2], 1, 2);
query.exec(function (err, result) {done()});
var urlPath = '/tag?where={"_geolocation":{"$nearSphere":{"$geometry":{"type":"Point","coordinates":[1,2]},"$maxDistance":1,"$minDistance":2}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() nearSphere works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').nearSphere('Point', [1,2], 1, 2);
query.exec().then(function (result) {
done()
});
var urlPath = '/tag?where={"_geolocation":{"$nearSphere":{"$geometry":{"type":"Point","coordinates":[1,2]},"$maxDistance":1,"$minDistance":2}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoIntersects works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').geoIntersects('Point', [1,2]);
query.exec(function (err, result) {done()});
var urlPath = '/tag?where={"_geolocation":{"$geoIntersects":{"$geometry":{"type":"Point","coordinates":[1,2]}}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoIntersects works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').geoIntersects('Point', [1,2]);
query.exec().then(function (result) {
done()
});
var urlPath = '/tag?where={"_geolocation":{"$geoIntersects":{"$geometry":{"type":"Point","coordinates":[1,2]}}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoWithinGeometry works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').geoWithinGeometry('Point', [1,2]);
query.exec(function (err, result) {done()});
var urlPath = '/tag?where={"_geolocation":{"$geoWithin":{"$geometry":{"type":"Point","coordinates":[1,2]}}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoWithinGeometry works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').geoWithinGeometry('Point', [1,2]);
query.exec().then(function (result) {
done()
});
var urlPath = '/tag?where={"_geolocation":{"$geoWithin":{"$geometry":{"type":"Point","coordinates":[1,2]}}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoWithinCenterSphere works (callback)', function (done) {
var query = Stamplay.Query('object', 'tag').geoWithinCenterSphere([1,2],2);
query.exec(function (err, result) {done()});
var urlPath = '/tag?where={"_geolocation":{"$geoWithin":{"$centerSphere":[[1,2],2]}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() geoWithinCenterSphere works (promise)', function (done) {
var query = Stamplay.Query('object', 'tag').geoWithinCenterSphere([1,2],2);
query.exec().then(function (result) {
done()
});
var urlPath = '/tag?where={"_geolocation":{"$geoWithin":{"$centerSphere":[[1,2],2]}}}'
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + urlPath);
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $or works (callback)', function (done) {
var query1 = Stamplay.Query('object', 'tag').notExists('b');
var query2 = Stamplay.Query('object', 'tag').equalTo('c', 'c');
var query = Stamplay.Query('object', 'tag').or(query1, query2);
query.exec(function (err, result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"$or":[{"b":{"$exists":false}},{"c":"c"}]}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $or works (promise)', function (done) {
var query1 = Stamplay.Query('object', 'tag').notExists('b');
var query2 = Stamplay.Query('object', 'tag').equalTo('c', 'c');
var query = Stamplay.Query('object', 'tag').or(query1, query2);
query.exec().then(function (result) {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"$or":[{"b":{"$exists":false}},{"c":"c"}]}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $or works with array (callback)', function (done) {
var query1 = Stamplay.Query('object', 'tag').notExists('b');
var query2 = Stamplay.Query('object', 'tag').equalTo('c', 'c');
var query = Stamplay.Query('object', 'tag').or([query1, query2]);
query.exec(function () {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"$or":[{"b":{"$exists":false}},{"c":"c"}]}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
test('exec() $or works with array (promise)', function (done) {
var query1 = Stamplay.Query('object', 'tag').notExists('b');
var query2 = Stamplay.Query('object', 'tag').equalTo('c', 'c');
var query = Stamplay.Query('object', 'tag').or([query1, query2]);
query.exec().then(function () {done()});
assert.equal(this.request.url, stamplayUrl +'/api/cobject/' + Stamplay.VERSION + '/tag?where={"$or":[{"b":{"$exists":false}},{"c":"c"}]}');
this.request.respond(200, {
"Content-Type": "application/json"
}, '{}');
});
})
})
|
Stamplay/stamplay-js-sdk
|
tests/query.js
|
JavaScript
|
mit
| 22,541
|
angular.module('baasic.mobileApp')
.directive('baasicBlogList', ['$parse',
function baasicBlogList($parse) {
'use strict';
var pageSizeFn;
return {
restrict: 'AE',
scope: true,
compile: function (elem, attrs) {
if (attrs.pageSize) {
pageSizeFn = $parse(attrs.pageSize);
} else {
pageSizeFn = function () { return 7; };
} //blogova po stranici
},
controller: ['$scope', '$stateParams', 'baasicBlogService',
function baasicBlogListCtrl($scope, $stateParams, blogService) {
function loadBlogs() {
$scope.$root.loader.suspend();
blogService.find({
statuses: ['published'],
page: $stateParams.page || 1,
rpp: pageSizeFn($scope),
orderBy: 'publishDate',
orderDirection: 'desc'
})
.success(function parseBlogList(blogList) {
$scope.pagerData = {
currentPage: blogList.page,
pageSize: blogList.recordsPerPage,
totalRecords: blogList.totalRecords
};
$scope.blogList = blogList;
$scope.hasBlogs = blogList.totalRecords > 0;
})
.error(function (error) {
console.log(error); // jshint ignore: line
})
.finally(function () {
$scope.$root.loader.resume();
});
}
$scope.hasBlogs = true;
loadBlogs();
}
],
templateUrl: 'templates/blog/blog-list.html'
};
}
]
);
|
Baasic/baasic-starterkit-angularjs-app-webiste
|
src/app/blog/blog-list.directive.js
|
JavaScript
|
mit
| 2,303
|
var lodash = require("lodash"),
gulp = require("gulp"),
sprintf = require('sprintf-js').sprintf,
chalk = require('chalk'),
nconf = require('nconf'),
forever = require('forever-monitor'),
paths = require('../gulp-common.js').Paths;
// Server stuff
nconf.file('tmp/forever.json');
var server = null;
var StartForever = function () {
// Start forever
server.start();
// Save foreverPid and pid to tmp file
nconf.set('child-pid', server.data.pid);
nconf.save();
}
var CleanServer = function (done) {
if (!server) {
// We should look for pids from temp file to clean up previously aborted run
var childPid = nconf.get('child-pid');
// If forever is already running, shut it down
forever.kill(childPid);
// Reset pids
nconf.set('child-pid', 0);
nconf.save();
// Callback
if (done) done();
}
else {
// Just cleanly stop the server!
if (server.data.running) {
server.stop()
.once('stop', function () {
// Reset pids
nconf.set('child-pid', 0);
nconf.save();
// Callback
if (done) done();
});
}
else {
// Callback
if (done) done();
}
}
}
gulp.task('Clean:Server', function (done) {
CleanServer(done);
});
gulp.task('Run:Server', ['Clean:Server'], function (done) {
// If first run
if (!server) {
// Initialize forever
server = new (forever.Monitor)('app.js', {
sourceDir: 'server/',
watch: false,
killTree: true
});
// Set up catch on stderr
server.on('stderr', function (data) {
server.stop()
.once('stop', function (process) {
console.log(sprintf('[%s] Stopping server due to error. Waiting for changes to attempt restart...', chalk.red('STDERR')));
});
});
}
// Go!
StartForever();
// Callback
done();
});
|
greymind/generator-greymind
|
app/templates/tasks/run-server.js
|
JavaScript
|
mit
| 1,905
|
import feathers from 'feathers';
import morgan from 'morgan';
import session from 'express-session';
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import hooks from 'feathers-hooks';
import rest from 'feathers-rest';
import socketio from 'feathers-socketio';
import isPromise from 'is-promise';
import PrettyError from 'pretty-error';
import publicConfig from '../src/config';
import config from './config';
import middleware from './middleware';
import services from './services';
import * as actions from './actions';
import { mapUrl } from './utils/url.js';
import auth, { socketAuth } from './services/authentication';
const pretty = new PrettyError();
const app = feathers();
app.set('config', config)
.use(morgan('dev'))
.use(cookieParser())
.use(session({
secret: 'react and redux rule!!!!',
resave: false,
saveUninitialized: false,
cookie: { maxAge: 60000 }
}))
.use(bodyParser.urlencoded({ extended: true }))
.use(bodyParser.json());
const actionsHandler = (req, res, next) => {
const splittedUrlPath = req.url.split('?')[0].split('/').slice(1);
const { action, params } = mapUrl(actions, splittedUrlPath);
const catchError = error => {
console.error('API ERROR:', pretty.render(error));
res.status(error.status || 500).json(error);
};
req.app = app;
if (action) {
try {
const handle = action(req, params);
(isPromise(handle) ? handle : Promise.resolve(handle))
.then(result => {
if (result instanceof Function) {
result(res);
} else {
res.json(result);
}
})
.catch(reason => {
if (reason && reason.redirect) {
res.redirect(reason.redirect);
} else {
catchError(reason);
}
});
} catch (error) {
catchError(error);
}
} else {
next();
}
};
app.configure(hooks())
.configure(rest())
.configure(socketio({ path: '/ws' }))
.configure(auth)
.use(actionsHandler)
.configure(services)
.configure(middleware);
if (publicConfig.apiPort) {
app.listen(publicConfig.apiPort, err => {
if (err) {
console.error(err);
}
console.info('----\n==> 🌎 API is running on port %s', publicConfig.apiPort);
console.info('==> 💻 Send requests to http://%s:%s', publicConfig.apiHost, publicConfig.apiPort);
});
} else {
console.error('==> ERROR: No APIPORT environment variable has been specified');
}
const bufferSize = 100;
const messageBuffer = new Array(bufferSize);
let messageIndex = 0;
app.io.use(socketAuth(app));
app.io.on('connection', socket => {
const user = socket.feathers.user ? { ...socket.feathers.user, password: undefined } : undefined;
socket.emit('news', { msg: '\'Hello World!\' from server', user });
socket.on('history', () => {
for (let index = 0; index < bufferSize; index++) {
const msgNo = (messageIndex + index) % bufferSize;
const msg = messageBuffer[msgNo];
if (msg) {
socket.emit('msg', msg);
}
}
});
socket.on('msg', data => {
const message = { ...data, id: messageIndex };
messageBuffer[messageIndex % bufferSize] = message;
messageIndex++;
app.io.emit('msg', message);
});
});
|
Rosita13/react-redux
|
api/api.js
|
JavaScript
|
mit
| 3,286
|
/******************************************************************************
* Copyright © 2013-2015 The Nxt Core Developers. *
* *
* See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Nxt software, including this file, may be copied, modified, propagated, *
* or distributed except according to the terms contained in the LICENSE.txt *
* file. *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
/**
* @depends {nrs.js}
* @depends {nrs.modals.js}
*/
var NRS = (function(NRS, $, undefined) {
$("#account_info_modal").on("show.bs.modal", function(e) {
$("#account_info_name").val(NRS.accountInfo.name);
$("#account_info_description").val(NRS.accountInfo.description);
});
NRS.forms.setAccountInfoComplete = function(response, data) {
var name = $.trim(String(data.name));
if (name) {
$("#account_name").html(name.escapeHTML()).removeAttr("data-i18n");
} else {
$("#account_name").html($.t("no_name_set")).attr("data-i18n", "no_name_set");
}
var description = $.trim(String(data.description));
setTimeout(function() {
NRS.accountInfo.description = description;
NRS.accountInfo.name = name;
}, 1000);
}
return NRS;
}(NRS || {}, jQuery));
|
jonesnxt/Jay-NRS
|
js/nrs.modals.accountinfo.js
|
JavaScript
|
mit
| 1,982
|
/*
|--------------------------------------------------------------------------
| Slider
|--------------------------------------------------------------------------
*/
APP.component.Slider = {
init: function () {
this.sliderPrincipal();
},
sliderPrincipal: function () {
$('.bx-slider').bxSlider({
auto: true,
speed: 1000,
onSliderLoad: function () {
$(".slider").css("visibility", "visible");
}
});
},
};
|
delfelipe/gulp-quickstart
|
src/js/components/_slider.js
|
JavaScript
|
mit
| 520
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M5 5h7V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h7v-2H5V5zm16 7-4-4v3H9v2h8v3l4-4z"
}), 'LogoutTwoTone');
|
oliviertassinari/material-ui
|
packages/mui-icons-material/lib/esm/LogoutTwoTone.js
|
JavaScript
|
mit
| 264
|
/* */
require("../../modules/es6.object.get-own-property-descriptor");
var $Object = require("../../modules/_core").Object;
module.exports = function getOwnPropertyDescriptor(it, key) {
return $Object.getOwnPropertyDescriptor(it, key);
};
|
jdanyow/aurelia-plunker
|
jspm_packages/npm/core-js@2.1.0/library/fn/object/get-own-property-descriptor.js
|
JavaScript
|
mit
| 242
|
import React, { Component } from 'react';
const cursors = [];
let visibility = true;
const update = () => {
return setTimeout(() => {
visibility = !visibility;
cursors.forEach(cursor => cursor.updateVisibility(visibility));
update();
}, 500);
};
update();
class Cursor extends Component {
state = {
visibility: true,
timeout: null
};
static defaultProps = {
x: 0,
y: 0,
width: 2,
height: 30,
color: 'rgb(0, 208, 208)'
};
componentDidMount() {
cursors.push(this);
}
componentWillUnmount() {
const index = cursors.indexOf(this);
cursors.splice(index, 1);
}
updateVisibility(visibility) {
this.setState({ visibility });
}
render() {
const { x, y, width, height, color } = this.props;
const { visibility } = this.state;
const style = {
position: 'absolute',
left: x,
top: y,
width,
height,
visibility: visibility ? 'visible' : 'hidden',
backgroundColor: color
};
return <div style={style}></div>;
}
}
export { Cursor as default };
|
Khan/algebra-tool
|
src/ui/cursor.js
|
JavaScript
|
mit
| 1,232
|
define(["dojo/dom", "dojo/dom-construct", "dojo/window", "dojo/_base/declare","dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/text!./ShortMenuWidget/templates/ShortMenuWidget.templ", "dojo/dom-style", "dojo/_base/fx", "dojo/_base/lang"],
function(dom, domConstruct, win, declare, WidgetBase, TemplatedMixin, template, domStyle, baseFx, lang){
return declare([WidgetBase, TemplatedMixin], {
// Some default values for our author
// These typically map to whatever you're handing into the constructor
//vs: win.getBox(),
name: "noname",
widthMenu: "202",
heightHeader: "0",
layout: null,
// Using require.toUrl, we can get a path to our AuthorWidget's space
// and we want to have a default avatar, just in case
//avatar: require.toUrl("custom/AuthorWidget/images/defaultAvatar.png"),
//bio: "",
// Our template - important!
templateString: template,
// A class to be applied to the root node in our template
baseClass: "shortMenuWidget",
// A reference to our background animation
mouseAnim: null,
// Colors for our background animation
baseBackgroundColor: "#fff",
mouseBackgroundColor: "#def",
postCreate: function(){
// Get a DOM node reference for the root of our widget
var domNode = this.domNode;
//var vs = win.getBox();
// Run any parent postCreate processes - can be done at any point
this.inherited(arguments);
// Set our DOM node's background color to white -
// smoothes out the mouseenter/leave event animations
domStyle.set(domNode, "backgroundColor", "white");
domStyle.set(domNode,"width","177px");
domStyle.set(domNode,"height","34px");
domStyle.set(domNode,"bottom", "12px");
domStyle.set(domNode,"right", "12px");
domStyle.set(domNode,"zIndex", "1000");
}
});
});
|
Bonome/pauline-desgrandchamp.com
|
widgets/ShortMenuWidget.js
|
JavaScript
|
mit
| 2,083
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _core = require("@mason-cli/core");
class MakeSeedCommand extends _core.Command {
constructor(Mason) {
super();
this.mason = Mason;
}
static help() {
console.log(`Alias for "mason scaffold seed"`);
}
async run() {
let argv = ["scaffold", "seed", "-i", "-f"];
// Extract the extra input
let i = 0;
process.argv.forEach(arg => {
if (i > 2) {
argv.push(arg);
}
i++;
});
// Re-run the command
const input = new _core.Input(argv);
return await this.mason.run(input.command(), input.all());
}
}
exports.default = MakeSeedCommand;
|
aewing/mason
|
packages/plugin-knex/lib/commands/make-seed.js
|
JavaScript
|
mit
| 695
|
define(function(require) {
var Require = require('./Require');
/**
* @ngInject
*/
function RequireProvider() {
this.config = {
directives: {},
services: {},
factories: {},
values: {},
filters: {}
};
// These are set in the config phase
this.$compileProvider = null;
this.$controllerProvider = null;
this.$filterProvider = null;
this.$provide = null;
}
RequireProvider.prototype.mergeConfig = function(config, base) {
this.mergeDirectivesConfig_(config['directives'], base);
this.mergeFiltersConfig_(config['filters'], base);
this.mergeServicesConfig_('values', config, base);
this.mergeServicesConfig_('services', config, base);
this.mergeServicesConfig_('factories', config, base);
};
RequireProvider.prototype.normalizeConfig_ = function(config) {
var normalizedConfig = {};
if (Array.isArray(config)) {
config.forEach(function(name) {
normalizedConfig[name] = true;
});
} else {
normalizedConfig = config || {};
}
return normalizedConfig;
};
/**
* {
* "filters": ["one", "two"]
* }
*
* is shorthand for
*
* {
* "filters": {
* "one": true,
* "two": true
* }
* }
*
* is shorthand for
*
* {
* "filters": {
* "one": "{{base}}/filters/one",
* "two": "{{base}}/filters/two"
* }
* }
*/
RequireProvider.prototype.mergeFiltersConfig_ = function(config, base) {
var filtersConfig = this.normalizeConfig_(config);
Object.keys(filtersConfig).forEach(function(name) {
var module = filtersConfig[name];
if (module === true) {
module = base + '/filters/' + name;
}
this.config['filters'][name] = module;
}.bind(this));
};
/**
*
* @param {Object} config
*
* {
* "directives": ["one", "two"]
* }
*
* is shorthand for
*
* {
* "directives": {
* "one": true,
* "two": true
* }
* }
*
* is shorthand for
*
* {
* "directives": {
* "one": "{{base}}/directives/one/directive",
* "two": "{{base}}/directives/two/directive"
* }
* }
*
* @param {string} base An AMD namespace for the default modules.
*
*/
RequireProvider.prototype.mergeDirectivesConfig_ = function(config, base) {
var directivesConfig = this.normalizeConfig_(config);
Object.keys(directivesConfig).forEach(function(name) {
var module = directivesConfig[name];
if (module === true) {
module = base + '/directives/' + name + '/directive';
}
this.config['directives'][name] = module;
}.bind(this));
};
/**
* @param {string} type "services," "factories," or "values"
* @param {Object} config
*
* {
* "services": ["serviceName"],
* "factories": ["serviceName"],
* "values": ["serviceName"]
* }
*
* is shorthand for
*
* {
* "services": { "serviceName": true },
* "factories": { "serviceName": true },
* "values": { "serviceName": true }
* }
*
* is shorthand for
*
* {
* "services": { "serviceName": "{{base}}/services/ServiceName" },
* "factories": { "serviceName": "{{base}}/factories/serviceName" },
* "values": { "serviceName": "{{base}}/values/serviceName" }
* }
*
* NB: The "services" option capitalizes ServiceName, since it is meant
* to be a constructor function (i.e. a class).
*
* NB: Providers and constants are not supported for lazy-loading. Register
* those in the traditional, synchronous way.
*
* @param {string} base An AMD namespace for the default modules
*/
RequireProvider.prototype.mergeServicesConfig_ = function(type, config, base) {
var servicesConfig = this.normalizeConfig_(config[type]);
Object.keys(servicesConfig).forEach(function(name) {
this.config['values'][name] = false;
this.config['services'][name] = false;
this.config['factories'][name] = false;
// Capitalize service names ('someService' => 'SomeService')
var moduleName = type !== 'services' ? name :
name.charAt(0).toUpperCase() + name.slice(1)
var module = servicesConfig[name];
if (module === true) {
module = base + '/' + type + '/' + moduleName;
}
this.config[type][name] = module;
}.bind(this));
};
/**
* @ngInject
*/
RequireProvider.prototype.$get = function($q, $injector) {
return new Require(this.config, $q, $injector, this.$compileProvider,
this.$controllerProvider, this.$filterProvider, this.$provide);
};
return RequireProvider;
});
|
ewinslow/ng-elgg
|
vendors/assets/ngRequire/RequireProvider.js
|
JavaScript
|
mit
| 5,202
|
import Promise from 'bluebird';
import nconf from 'nconf';
import R from 'ramda';
function avatar(client, evt, suffix) {
if (!suffix && !evt.message.mentions.length) {
if (!evt.message.author.avatarURL) return Promise.resolve('You are naked.');
return Promise.resolve(`Your avatar:\n${evt.message.author.avatarURL}`);
} else if (evt.message.mentions.length) {
return Promise.resolve(evt.message.mentions)
.map(user => {
if (!user.avatarURL) return `${user.username} is naked.`;
return `${user.username}'s avatar:\n${user.avatarURL}`;
});
}
if (evt.message.channel.isPrivate) return Promise.resolve(`Sorry, we can\'t get ${suffix} avatar from a direct message. Try in a channel instead!`);
const user = R.find(R.propEq('username', suffix))(evt.message.guild.members);
if (!user) return;
if (!user.avatarURL) return Promise.resolve(`${user.username} is naked.`);
return Promise.resolve(`${user.username}'s avatar:\n${user.avatarURL}`);
}
function channelinfo(client, evt, suffix) {
const channelinfo = [];
if (evt.message.channel.isPrivate) {
channelinfo.push(`\`\`\`ruby
ID: ${evt.message.channel.id}
Type: Direct Message
New_Messages: ${evt.message.channel.messages.length} (since the bot was restarted)
Created: ${new Date(evt.message.channel.createdAt).toGMTString()}
\`\`\``);
} else if (!suffix && evt.message.content.indexOf('<#') === -1) {
channelinfo.push(`\`\`\`ruby
Server: ${evt.message.guild.name}
Name: ${evt.message.channel.name}
ID: ${evt.message.channel.id}
Type: ${evt.message.channel.type}
Position: ${evt.message.channel.position}
New_Messages: ${evt.message.channel.messages.length} (since the bot was restarted)
Created: ${new Date(evt.message.channel.createdAt).toGMTString()}
Topic: ${evt.message.channel.topic}
\`\`\``);
} else if (evt.message.content.indexOf('<#') !== -1) {
R.forEach(suffix => {
const channel = R.find(R.propEq('id', suffix.substring(2, suffix.length - 1)))(evt.message.guild.channels);
if (channel.type === 0) {
channelinfo.push(`\`\`\`ruby
Server: ${channel.guild.name}
Name: ${channel.name}
ID: ${channel.id}
Type: ${channel.type}
Position: ${channel.position}
New_Messages: ${channel.messages.length} (since the bot was restarted)
Created: ${new Date(channel.createdAt).toGMTString()}
Topic: ${channel.topic}
\`\`\``);
} else {
channelinfo.push(`\`\`\`ruby
Server: ${channel.guild.name}
Name: ${channel.name}
ID: ${channel.id}
Type: ${channel.type}
Position: ${channel.position}
Created: ${new Date(channel.createdAt).toGMTString()}
Bitrate: ${channel.bitrate}
User_Limit: ${channel.user_limit}
\`\`\``);
}
}, suffix.split(' '));
} else {
const channel = R.find(R.propEq('name', suffix))(evt.message.guild.channels);
if (!channel) return;
if (channel.type === 0) {
channelinfo.push(`\`\`\`ruby
Server: ${channel.guild.name}
Name: ${channel.name}
ID: ${channel.id}
Type: ${channel.type}
Position: ${channel.position}
New_Messages: ${channel.messages.length} (since the bot was restarted)
Created: ${new Date(channel.createdAt).toGMTString()}
Topic: ${channel.topic}
\`\`\``);
} else {
channelinfo.push(`\`\`\`ruby
Server: ${channel.guild.name}
Name: ${channel.name}
ID: ${channel.id}
Type: ${channel.type}
Position: ${channel.position}
Created: ${new Date(channel.createdAt).toGMTString()}
Bitrate: ${channel.bitrate}
User_Limit: ${channel.user_limit}
\`\`\``);
}
}
return Promise.resolve(channelinfo);
}
function serverinfo(client, evt, suffix) {
const serverinfo = [];
if (evt.message.channel.isPrivate) return Promise.resolve('Use this in an actual server.\nhttp://fat.gfycat.com/GranularWeeCorydorascatfish.gif');
if (!suffix) {
const roles = R.join(', ', R.reject(name => name === '@everyone', R.pluck('name', evt.message.guild.roles)));
serverinfo.push(`\`\`\`ruby
Name: ${evt.message.guild.name}
ID: ${evt.message.guild.id}
Region: ${evt.message.guild.region}
Owner: ${evt.message.guild.owner.username}
Channels: ${evt.message.guild.channels.length} (${evt.message.guild.textChannels.length} text & ${evt.message.guild.voiceChannels.length} voice)
Default_Channel: ${evt.message.guild.generalChannel.name}
AFK_Channel: ${evt.message.guild.afk_channel ? evt.message.guild.afk_channel.name : 'None'}
AFK_Timeout: ${evt.message.guild.afk_timeout / 60} minutes
Members: ${evt.message.guild.members.length}
Created: ${new Date(evt.message.guild.createdAt).toGMTString()}
Emojis: ${evt.message.guild.emojis.length ? R.join(', ', R.pluck('name', evt.message.guild.emojis)) : 'None'}
Roles: ${roles.length ? roles : 'None'}
Icon: ${evt.message.guild.iconURL ? `\`\`\`${evt.message.guild.iconURL}` : `None
\`\`\``}`);
} else {
const guild = R.find(R.propEq('name', suffix))(client.Guilds);
if (!guild || nconf.get('SHARDING')) return;
const roles = R.join(', ', R.reject(name => name === '@everyone', R.pluck('name', guild.roles)));
serverinfo.push(`\`\`\`ruby
Name: ${guild.name}
ID: ${guild.id}
Region: ${guild.region}
Owner: ${guild.owner.username}
Channels: ${guild.channels.length} (${guild.textChannels.length} text & ${guild.voiceChannels.length} voice)
Default_Channel: ${guild.generalChannel.name}
AFK_Channel: ${guild.afk_channel.name ? guild.afk_channel.name : 'None'}
AFK_Timeout: ${guild.afk_timeout / 60} minutes
Members: ${guild.members.length}
Created: ${new Date(guild.createdAt).toGMTString()}
Emotes: ${guild.emojis.length ? R.join(', ', R.pluck('name', guild.emojis)) : 'None'}
Roles: ${roles}
Icon: ${guild.iconURL ? `\`\`\`${guild.iconURL}` : `None
\`\`\``}`);
}
return Promise.resolve(serverinfo);
}
function userinfo(client, evt, suffix) {
const userinfo = [];
if (evt.message.channel.isPrivate) {
userinfo.push(`\`\`\`ruby
Name: ${evt.message.author.username}
ID: ${evt.message.author.id}
Discriminator: ${evt.message.author.discriminator}
Status: ${evt.message.author.status} ${evt.message.author.gameName ? '(Playing ' + evt.message.author.gameName + ')' : ''}
Registered: ${new Date(evt.message.author.registeredAt).toGMTString()}
Avatar: ${evt.message.author.avatarURL ? `\`\`\`${evt.message.author.avatarURL}` : `None
\`\`\``}`);
} else if (!suffix && !evt.message.mentions.length) {
userinfo.push(`\`\`\`ruby
Name: ${evt.message.author.username}
ID: ${evt.message.author.id}
Discriminator: ${evt.message.author.discriminator}
Status: ${evt.message.author.status} ${evt.message.author.gameName ? '(Playing ' + evt.message.author.gameName + ')' : ''}
Registered: ${new Date(evt.message.author.registeredAt).toGMTString()}
Avatar: ${evt.message.author.avatarURL ? `\`\`\`${evt.message.author.avatarURL}` : `None
\`\`\``}`);
} else if (evt.message.mentions.length) {
R.forEach(user => {
userinfo.push(`\`\`\`ruby
Name: ${user.username}
ID: ${user.id}
Discriminator: ${user.discriminator}
Status: ${user.status} ${user.gameName ? '(Playing ' + user.gameName + ')' : ''}
Registered: ${new Date(user.registeredAt).toGMTString()}
Avatar: ${user.avatarURL ? `\`\`\`${user.avatarURL}` : `None
\`\`\``}`);
}, evt.message.mentions);
} else {
const user = R.find(R.propEq('username', suffix))(evt.message.guild.members);
if (!user) return;
userinfo.push(`\`\`\`ruby
Name: ${user.username}
ID: ${user.id}
Discriminator: ${user.discriminator}
Status: ${user.status} ${user.gameName ? '(Playing ' + user.gameName + ')' : ''}
Registered: ${new Date(user.registeredAt).toGMTString()}
Avatar: ${user.avatarURL ? `\`\`\`${user.avatarURL}` : `None
\`\`\``}`);
}
return Promise.resolve(userinfo);
}
export default {
avatar,
channelinfo,
serverinfo,
userinfo,
whois: userinfo
};
export const help = {
avatar: {parameters: 'username'},
channelinfo: {parameters: 'channelname'},
serverinfo: {parameters: 'servername'},
userinfo: {parameters: 'username'}
};
|
PhunStyle/Gravebot
|
src/commands/info/index.js
|
JavaScript
|
mit
| 7,877
|
exports.load = function (swagger, parms) {
var searchParms = parms.searchableOptions
var Bloglist = {
'spec': {
description: 'Blog operations',
path: '/blog',
method: 'GET',
summary: 'Get Blog',
notes: '',
type: 'Blog',
nickname: 'getBlog',
produces: ['application/json'],
parameters: searchParms
}
}
swagger.addGet(Bloglist)
}
|
JavierPDev/Meangular
|
tools/swagger/modules/blogs/services.js
|
JavaScript
|
mit
| 399
|
module.exports = function (grunt) {
grunt.initConfig({
copyto: {
jsrfToLocal: {
files:
[
{cwd: '../lib/phprf/', src: ["**/*"], dest: 'php_mvc/cakephp/app/vendor/razorflow_php/'},
{cwd: '../lib/phprf/static/rf/', src: ["js/razorflow.wrapper.min.js", "css/razorflow.min.css"], dest: 'php_mvc/cakephp/app/webroot/'},
{cwd: '../lib/phprf/', src: ["**/*"], dest: 'php_mvc/rfci/application/libraries/razorflow_php/'},
{cwd: '../lib/phprf/static/rf/', src: ["js/razorflow.wrapper.min.js", "css/razorflow.min.css", "img/**"], dest: 'php_mvc/rfci/application/'},
{cwd: '../lib/phprf/', src: ["**/*"], dest: 'php_embedded/razorflow_php/'},
{cwd: '../lib/phprf/', src: ["**/*"], dest: 'distributable/php_database_sample/razorflow_php/'},
{cwd: '../static/rf/', src: ["**/*"], dest: 'html_embedded/razorflow_js/'},
]
},
},
});
grunt.loadNpmTasks('grunt-copy-to');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.registerTask('default', ["copyto"])
}
|
sguha-work/examples
|
apps/Gruntfile.js
|
JavaScript
|
mit
| 1,037
|
define([
'jquery',
'underscore',
'backbone',
'templates',
'collections/bullet',
'collections/paragraph',
'views/bullets/new',
'views/bullets/select_bullets',
'views/bullets/edit',
'views/paragraphs/new',
'views/paragraphs/select_paragraphs',
'views/paragraphs/edit'
], function ($,
_,
Backbone,
JST,
BulletCollection,
ParagraphCollection,
NewBulletView,
SelectBulletsView,
EditBulletView,
NewParagraphView,
SelectParagraphsView,
EditParagraphView) {
'use strict';
var EditItemView = Backbone.View.extend({
template: JST['app/scripts/templates/edit_item.ejs'],
id: 'edit-item',
urls: {
editResume: '/resumes/:resumeId/edit'
},
events: {
'click #save_item': 'save',
'click #cancel_item': 'cancel'
},
initialize: function(options) {
this.resume = options.resume;
this.section = options.section;
this.bulletId = options.bulletId;
this.paragraphId = options.paragraphId;
this.user = options.user;
this.listenTo(this.model, 'sync', function(model, response, options) {
this.trigger('item:updated');
});
this.bullets = new BulletCollection();
this.paragraphs = new ParagraphCollection();
$.when(
this.bullets.fetch(),
this.paragraphs.fetch()
).then(function() {
this.trigger('item:edit:ready');
}.bind(this));
},
render: function() {
this.$el.html(this.template());
if (this.bulletId && this.bulletId !== 'new') {
this.renderEditBulletView(this.bulletId);
this.initSelectParagraphsView();
this.renderSelectParagraphsView();
} else if (this.paragraphId && this.paragraphId !== 'new') {
this.renderEditParagraphView(this.paragraphId);
this.initSelectBulletsView();
this.renderSelectBulletsView();
} else {
if (this.bulletId === 'new') {
this.initSelectParagraphsView();
this.renderSelectParagraphsView();
this.renderNewBullet();
} else if (this.paragraphId === 'new') {
this.initSelectBulletsView();
this.renderSelectBulletsView();
this.renderNewParagraph();
} else {
this.initSelectBulletsView();
this.initSelectParagraphsView();
this.renderSelectBulletsView();
this.renderSelectParagraphsView();
}
}
return this;
},
initSelectBulletsView: function() {
this.selectBulletsView = new SelectBulletsView({
collection: this.bullets,
user: this.user,
selectedBullets: this.model.bulletIds()
});
this.listenTo(this.selectBulletsView, 'show:new:bullet', this.renderNewBullet);
this.listenTo(this.selectBulletsView, 'bullet:edit:show', this.renderEditBulletView);
},
initSelectParagraphsView: function() {
this.selectParagraphsView = new SelectParagraphsView({
collection: this.paragraphs,
user: this.user,
selectedParagraphs: this.model.paragraphIds(),
});
this.listenTo(this.selectParagraphsView, 'paragraph:new', this.renderNewParagraph);
this.listenTo(this.selectParagraphsView, 'paragraph:edit:show', this.renderEditParagraphView);
},
renderSelectBulletsView: function() {
this.$('section#bullets').html(this.selectBulletsView.render().el);
},
renderSelectParagraphsView: function() {
this.$('section#paragraphs').html(this.selectParagraphsView.render().el);
},
renderEditBulletView: function(bulletId) {
var bullet = this.bullets.get(bulletId);
this.editBulletView = new EditBulletView({
model: bullet,
user: this.user
});
this.listenTo(this.editBulletView, 'bullet:edit:cancel', this.cancelEditBullet);
this.listenTo(this.editBulletView, 'bullet:saved', function() {
Backbone.history.navigate(this.editItemUrl());
this.initSelectBulletsView();
this.renderSelectBulletsView();
});
this.$('section#bullets').html(this.editBulletView.render().el);
Backbone.history.navigate(this.editBulletUrl(bullet));
},
cancelEditBullet: function() {
Backbone.history.navigate(this.editItemUrl());
this.editBulletView.remove();
delete this.bulletId;
this.initSelectBulletsView();
this.renderSelectBulletsView();
},
renderEditParagraphView: function(paragraphId) {
var paragraph = this.paragraphs.get(paragraphId);
this.editParagraphView = new EditParagraphView({
model: paragraph,
user: this.user
});
this.listenTo(this.editParagraphView, 'paragraph:edit:cancel', this.cancelEditParagraph);
this.listenTo(this.editParagraphView, 'paragraph:saved', function() {
Backbone.history.navigate(this.editItemUrl());
this.initSelectParagraphsView();
this.renderSelectParagraphsView();
});
this.$('section#paragraphs').html(this.editParagraphView.render().el);
Backbone.history.navigate(this.editParagraphUrl(paragraph));
},
cancelEditParagraph: function() {
Backbone.history.navigate(this.editItemUrl());
this.editParagraphView.remove();
delete this.paragraphId;
this.initSelectParagraphsView();
this.renderSelectParagraphsView();
},
save: function(e) {
e.preventDefault();
this.model.set(this.newAttributes());
var bullets = _.map(this.getSelectedBulletIds(), function(bulletId) {
return this.bullets.get(bulletId);
}, this);
this.model.set('bullets', bullets);
var paragraphs = _.map(this.getSelectedParagraphIds(), function(paragraphId) {
return this.paragraphs.get(paragraphId);
}, this);
this.model.set('paragraphs', paragraphs);
if (this.user) {
var header = { headers: { 'X-Toke-Key': this.user.get('token').get('key') }};
this.model.save({}, header);
} else {
console.log('Not Authorized');
}
},
newAttributes: function() {
return {
name: this.$('#new-item-name').val(),
title: this.$('#new-item-title').val(),
heading: this.$('#new-item-heading').val()
};
},
getSelectedBulletIds: function() {
return this.selectBulletsView.getSelectedBulletIds();
},
getSelectedParagraphIds: function() {
return this.selectParagraphsView.getSelectedParagraphIds();
},
cancel: function(e) {
e.preventDefault();
Backbone.history.navigate(this.editSectionUrl());
this.trigger('item:edit:cancel');
},
renderNewBullet: function() {
this.newBulletView = new NewBulletView({
collection: this.model.get('bullets'),
model: this.model,
user: this.user
});
this.listenTo(this.newBulletView, 'bullet:new:saved', this.newBulletSaved);
this.listenTo(this.newBulletView, 'bullet:new:cancel', this.cancelNewBullet);
this.$('section#bullets').html(this.newBulletView.render().el);
},
newBulletSaved: function(bullet) {
this.bullets.add(bullet);
this.selectBulletsView.setSelectedBullets(this.model.get('bullet_ids'));
this.renderSelectBulletsView();
},
cancelNewBullet: function() {
this.newBulletView.remove();
this.initSelectBulletsView();
this.renderSelectBulletsView();
},
renderNewParagraph: function() {
this.newParagraphView = new NewParagraphView({
collection: this.model.get('paragraphs'),
model: this.model,
user: this.user
});
this.listenTo(this.newParagraphView, 'paragraph:new:saved', this.newParagraphSaved);
this.listenTo(this.newParagraphView, 'paragraph:new:cancel', this.cancelNewParagraph);
this.$('section#paragraphs').html(this.newParagraphView.render().el);
},
newParagraphSaved: function(paragraph) {
this.paragraphs.add(paragraph);
this.selectParagraphsView.setSelectedParagraphs(this.model.get('paragraph_ids'));
this.renderSelectParagraphsView();
},
cancelNewParagraph: function() {
this.newParagraphView.remove();
this.initSelectParagraphsView();
this.renderSelectParagraphsView();
},
editItemUrl: function() {
return '/resumes/:resumeId/sections/:sectionId/items/:itemId/edit'
.replace(/:resumeId/, this.resume.id)
.replace(/:sectionId/, this.section.id)
.replace(/:itemId/, this.model.id);
},
editBulletUrl: function(bullet) {
return '/resumes/:resumeId/sections/:sectionId/items/:itemId/bullets/:bulletId/edit'
.replace(/:resumeId/, this.resume.id)
.replace(/:sectionId/, this.section.id)
.replace(/:itemId/, this.model.id)
.replace(/:bulletId/, bullet.id);
},
editParagraphUrl: function(paragraph) {
return '/resumes/:resumeId/sections/:sectionId/items/:itemId/paragraphs/:paragraphId/edit'
.replace(/:resumeId/, this.resume.id)
.replace(/:sectionId/, this.section.id)
.replace(/:itemId/, this.model.id)
.replace(/:paragraphId/, paragraph.id);
},
editSectionUrl: function() {
return this.urls['editResume'].replace(/:resumeId/, this.resume.id);
}
});
return EditItemView;
});
|
jmflannery/jackflannery.me
|
app/scripts/views/items/edit.js
|
JavaScript
|
mit
| 9,430
|
angular.module('myApp')
.factory('authenticationService', function ($q, $http) {
var service = {
_user: null,
setCurrentUser: function (user) {
if (user) {
service._user = user;
return service.setCurrentUser();
}
else {
var d = $q.defer();
return d.promise;
}
},
currentUser: function () {
var d = $q.defer();
d.resolve(service._user);
return d.promise;
}
};
return service;
});
|
BahodirBoydedayev/conferenceApp
|
target/classes/public/js/app/service/authenticationService.js
|
JavaScript
|
mit
| 664
|
import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
import Girl from '@/components/Girl'
import Ar from '@/components/Ar'
import Ar1 from '@/components/Ar1'
import Ar2 from '@/components/Ar2'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Hello',
component: Hello
},
{
path: '/girl',
name: 'girl',
component: Girl
},{
path: '/ar',
name: 'ar',
component: Ar,
children:[
{
path: '1',
name: 'ar1',
component: Ar1
},
{
path: '2',
name: 'ar2',
component: Ar2
}
]
}
// ,{
// path: '/ar/1',
// name: 'ar1',
// component: Ar1
// },{
// path: '/ar/2',
// name: 'ar2',
// component: Ar2
// }
]
})
|
zhaoqize/projects
|
vue2基础实现代码/src/router/index.js
|
JavaScript
|
mit
| 888
|
// Version: 3.6.6
(function(){
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(h,s){var f={},g=f.lib={},q=function(){},m=g.Base={extend:function(a){q.prototype=this;var c=new q;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
r=g.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||k).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new r.init(c,a)}}),l=f.enc={},k=l.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b,
2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}},
u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);c.sigBytes-=b}return new r.init(g,b)},clone:function(){var a=m.clone.call(this);
a._data=this._data.clone();return a},_minBufferSize:0});g.Hasher=u.extend({cfg:m.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return(new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return(new t.HMAC.init(a,
d)).finalize(c)}}});var t=f.algo={};return f}(Math);
(function(h){for(var s=CryptoJS,f=s.lib,g=f.WordArray,q=f.Hasher,f=s.algo,m=[],r=[],l=function(a){return 4294967296*(a-(a|0))|0},k=2,n=0;64>n;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]=
c[d+p]|0;else{var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16]}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;
d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f)})(Math);
(function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j<h;j++)k[j]^=1549556828,n[j]^=909522486;r.sigBytes=l.sigBytes=m;this.reset()},reset:function(){var f=this._hasher;f.reset();f.update(this._iKey)},update:function(f){this._hasher.update(f);return this},finalize:function(f){var g=
this._hasher;f=g.finalize(f);g.reset();return g.finalize(this._oKey.clone().concat(f))}})})();
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<
e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
var t=void 0,w=!0,x=null,z=!1;function A(){return function(){}}var aa=1,ba=z,ca=[],fa="-pnpres",B=1E3,ga=/{([\w\-]+)}/g;function ia(){return"x"+ ++aa+""+ +new Date}function K(){return+new Date}var L,ja=Math.floor(20*Math.random());L=function(a,d){return 0<a.indexOf("pubsub.")&&a.replace("pubsub","ps"+(d?ka().split("-")[0]:20>++ja?ja:ja=1))||a};function la(a,d){function b(){e+d>K()?(clearTimeout(c),c=setTimeout(b,d)):(e=K(),a())}var c,e=0;return b}
function ma(a,d){var b=[];M(a||[],function(a){d(a)&&b.push(a)});return b}function na(a,d){return a.replace(ga,function(a,c){return d[c]||a})}function ka(a){var d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var c=16*Math.random()|0;return("x"==a?c:c&3|8).toString(16)});a&&a(d);return d}
function M(a,d){if(a&&d)if(a&&(Array.isArray&&Array.isArray(a)||"number"===typeof a.length))for(var b=0,c=a.length;b<c;)d.call(a[b],a[b],b++);else for(b in a)a.hasOwnProperty&&a.hasOwnProperty(b)&&d.call(a[b],b,a[b])}function oa(a,d){var b=[];M(a||[],function(a,e){b.push(d(a,e))});return b}function pa(a,d){var b=[];M(a,function(a,e){d?0>a.search("-pnpres")&&e.f&&b.push(a):e.f&&b.push(a)});return b.sort()}function qa(){setTimeout(function(){ba||(ba=1,M(ca,function(a){a()}))},B)}var O,S=14,V=8,ra=z;
function sa(a,d){var b="",c,e;if(d){c=a[15];if(16<c)throw"Decryption error: Maybe bad key";if(16==c)return"";for(e=0;e<16-c;e++)b+=String.fromCharCode(a[e])}else for(e=0;16>e;e++)b+=String.fromCharCode(a[e]);return b}function ta(a,d){var b=[],c;if(!d)try{a=unescape(encodeURIComponent(a))}catch(e){throw"Error on UTF-8 encode";}for(c=0;c<a.length;c++)b[c]=a.charCodeAt(c);return b}
function ua(a,d){var b=12<=S?3:2,c=[],e=[],c=[],e=[],m=a.concat(d),n;c[0]=GibberishAES.k.l(m);e=c[0];for(n=1;n<b;n++)c[n]=GibberishAES.k.l(c[n-1].concat(m)),e=e.concat(c[n]);c=e.slice(0,4*V);e=e.slice(4*V,4*V+16);return{key:c,h:e}}
function va(a,d,b){var d=ya(d),c=Math.ceil(a.length/16),e=[],m,n=[];for(m=0;m<c;m++){var j=e,r=m,v=a.slice(16*m,16*m+16),u=[],p=t,p=t;16>v.length&&(p=16-v.length,u=[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p]);for(p=0;p<v.length;p++)u[p]=v[p];j[r]=u}0===a.length%16&&e.push([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]);for(m=0;m<e.length;m++)e[m]=0===m?za(e[m],b):za(e[m],n[m-1]),n[m]=Aa(e[m],d);return n}
function Ba(a,d,b,c){var d=ya(d),e=a.length/16,m=[],n,j=[],r="";for(n=0;n<e;n++)m.push(a.slice(16*n,16*(n+1)));for(n=m.length-1;0<=n;n--)j[n]=Ca(m[n],d),j[n]=0===n?za(j[n],b):za(j[n],m[n-1]);for(n=0;n<e-1;n++)r+=sa(j[n]);var r=r+sa(j[n],w),v;if(c)v=r;else try{v=decodeURIComponent(escape(r))}catch(u){throw"Bad Key";}return v}function Aa(a,d){ra=z;var b=Da(a,d,0),c;for(c=1;c<S+1;c++)b=Ia(b),b=Ja(b),c<S&&(b=Ka(b)),b=Da(b,d,c);return b}
function Ca(a,d){ra=w;var b=Da(a,d,S),c;for(c=S-1;-1<c;c--)b=Ja(b),b=Ia(b),b=Da(b,d,c),0<c&&(b=Ka(b));return b}function Ia(a){var d=ra?La:Ma,b=[],c;for(c=0;16>c;c++)b[c]=d[a[c]];return b}function Ja(a){var d=[],b=ra?[0,13,10,7,4,1,14,11,8,5,2,15,12,9,6,3]:[0,5,10,15,4,9,14,3,8,13,2,7,12,1,6,11],c;for(c=0;16>c;c++)d[c]=a[b[c]];return d}
function Ka(a){var d=[],b;if(ra)for(b=0;4>b;b++)d[4*b]=Na[a[4*b]]^Oa[a[1+4*b]]^Pa[a[2+4*b]]^Qa[a[3+4*b]],d[1+4*b]=Qa[a[4*b]]^Na[a[1+4*b]]^Oa[a[2+4*b]]^Pa[a[3+4*b]],d[2+4*b]=Pa[a[4*b]]^Qa[a[1+4*b]]^Na[a[2+4*b]]^Oa[a[3+4*b]],d[3+4*b]=Oa[a[4*b]]^Pa[a[1+4*b]]^Qa[a[2+4*b]]^Na[a[3+4*b]];else for(b=0;4>b;b++)d[4*b]=Ra[a[4*b]]^Sa[a[1+4*b]]^a[2+4*b]^a[3+4*b],d[1+4*b]=a[4*b]^Ra[a[1+4*b]]^Sa[a[2+4*b]]^a[3+4*b],d[2+4*b]=a[4*b]^a[1+4*b]^Ra[a[2+4*b]]^Sa[a[3+4*b]],d[3+4*b]=Sa[a[4*b]]^a[1+4*b]^a[2+4*b]^Ra[a[3+4*
b]];return d}function Da(a,d,b){var c=[],e;for(e=0;16>e;e++)c[e]=a[e]^d[b][e];return c}function za(a,d){var b=[],c;for(c=0;16>c;c++)b[c]=a[c]^d[c];return b}
function ya(a){var d=[],b=[],c,e,m=[];for(c=0;c<V;c++)e=[a[4*c],a[4*c+1],a[4*c+2],a[4*c+3]],d[c]=e;for(c=V;c<4*(S+1);c++){d[c]=[];for(a=0;4>a;a++)b[a]=d[c-1][a];if(0===c%V){a=b[0];e=t;for(e=0;4>e;e++)b[e]=b[e+1];b[3]=a;b=Ta(b);b[0]^=Ua[c/V-1]}else 6<V&&4==c%V&&(b=Ta(b));for(a=0;4>a;a++)d[c][a]=d[c-V][a]^b[a]}for(c=0;c<S+1;c++){m[c]=[];for(b=0;4>b;b++)m[c].push(d[4*c+b][0],d[4*c+b][1],d[4*c+b][2],d[4*c+b][3])}return m}function Ta(a){for(var d=0;4>d;d++)a[d]=Ma[a[d]];return a}
function Va(a,d){var b=[];for(i=0;i<a.length;i+=d)b[i/d]=parseInt(a.substr(i,d),16);return b}function Wa(a){for(var d=[],b=0;256>b;b++){for(var c=a,e=b,m=t,n=t,m=n=0;8>m;m++)n=1==(e&1)?n^c:n,c=127<c?283^c<<1:c<<1,e>>>=1;d[b]=n}return d}
var Ma=Va("637c777bf26b6fc53001672bfed7ab76ca82c97dfa5947f0add4a2af9ca472c0b7fd9326363ff7cc34a5e5f171d8311504c723c31896059a071280e2eb27b27509832c1a1b6e5aa0523bd6b329e32f8453d100ed20fcb15b6acbbe394a4c58cfd0efaafb434d338545f9027f503c9fa851a3408f929d38f5bcb6da2110fff3d2cd0c13ec5f974417c4a77e3d645d197360814fdc222a908846eeb814de5e0bdbe0323a0a4906245cc2d3ac629195e479e7c8376d8dd54ea96c56f4ea657aae08ba78252e1ca6b4c6e8dd741f4bbd8b8a703eb5664803f60e613557b986c11d9ee1f8981169d98e949b1e87e9ce5528df8ca1890dbfe6426841992d0fb054bb16",2),
La,Za=Ma,$a=[];for(i=0;i<Za.length;i++)$a[Za[i]]=i;La=$a;var Ua=Va("01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc591",2),Ra=Wa(2),Sa=Wa(3),Qa=Wa(9),Oa=Wa(11),Pa=Wa(13),Na=Wa(14),ab,bb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gb=bb.split("");"function"===typeof Array.indexOf&&(bb=gb);
ab={encode:function(a){var d=[],b="",c;for(c=0;c<16*a.length;c++)d.push(a[Math.floor(c/16)][c%16]);for(c=0;c<d.length;c+=3)b+=gb[d[c]>>2],b+=gb[(d[c]&3)<<4|d[c+1]>>4],b=d[c+1]!==t?b+gb[(d[c+1]&15)<<2|d[c+2]>>6]:b+"=",b=d[c+2]!==t?b+gb[d[c+2]&63]:b+"=";a=b.slice(0,64);for(c=1;c<Math.ceil(b.length/64);c++)a+=b.slice(64*c,64*c+64)+(Math.ceil(b.length/64)==c+1?"":"\n");return a},decode:function(a){var a=a.replace(/\n/g,""),d=[],b=[],c=[],e;for(e=0;e<a.length;e+=4)b[0]=bb.indexOf(a.charAt(e)),b[1]=bb.indexOf(a.charAt(e+
1)),b[2]=bb.indexOf(a.charAt(e+2)),b[3]=bb.indexOf(a.charAt(e+3)),c[0]=b[0]<<2|b[1]>>4,c[1]=(b[1]&15)<<4|b[2]>>2,c[2]=(b[2]&3)<<6|b[3],d.push(c[0],c[1],c[2]);return d=d.slice(0,d.length-d.length%16)}};
O={size:function(a){switch(a){case 128:S=10;V=4;break;case 192:S=12;V=6;break;case 256:S=14;V=8;break;default:throw"Invalid Key Size Specified:"+a;}},h2a:function(a){var d=[];a.replace(/(..)/g,function(a){d.push(parseInt(a,16))});return d},expandKey:ya,encryptBlock:Aa,decryptBlock:Ca,Decrypt:ra,s2a:ta,rawEncrypt:va,rawDecrypt:Ba,dec:function(a,d,b){var a=ab.s(a),c=a.slice(8,16),c=ua(ta(d,b),c),d=c.key,c=c.h,a=a.slice(16,a.length);return a=Ba(a,d,c,b)},openSSLKey:ua,a2h:function(a){var d="",b;for(b=
0;b<a.length;b++)d+=(16>a[b]?"0":"")+a[b].toString(16);return d},enc:function(a,d,b){var c;c=[];var e;for(e=0;8>e;e++)c=c.concat(Math.floor(256*Math.random()));e=ua(ta(d,b),c);d=e.key;e=e.h;c=[[83,97,108,116,101,100,95,95].concat(c)];a=ta(a,b);a=va(a,d,e);a=c.concat(a);return ab.t(a)},Hash:{MD5:function(a){function d(a,b){var c,d,h,e,f;h=a&2147483648;e=b&2147483648;c=a&1073741824;d=b&1073741824;f=(a&1073741823)+(b&1073741823);return c&d?f^2147483648^h^e:c|d?f&1073741824?f^3221225472^h^e:f^1073741824^
h^e:f^h^e}function b(a,b,c,h,e,f,j){a=d(a,d(d(b&c|~b&h,e),j));return d(a<<f|a>>>32-f,b)}function c(a,b,c,h,e,f,j){a=d(a,d(d(b&h|c&~h,e),j));return d(a<<f|a>>>32-f,b)}function e(a,b,c,h,e,f,j){a=d(a,d(d(b^c^h,e),j));return d(a<<f|a>>>32-f,b)}function m(a,b,c,h,e,f,j){a=d(a,d(d(c^(b|~h),e),j));return d(a<<f|a>>>32-f,b)}function n(a){var b,c,d=[];for(c=0;3>=c;c++)b=a>>>8*c&255,d=d.concat(b);return d}var j=[],r,v,u,p,f,g,k,h,l=Va("67452301efcdab8998badcfe10325476d76aa478e8c7b756242070dbc1bdceeef57c0faf4787c62aa8304613fd469501698098d88b44f7afffff5bb1895cd7be6b901122fd987193a679438e49b40821f61e2562c040b340265e5a51e9b6c7aad62f105d02441453d8a1e681e7d3fbc821e1cde6c33707d6f4d50d87455a14eda9e3e905fcefa3f8676f02d98d2a4c8afffa39428771f6816d9d6122fde5380ca4beea444bdecfa9f6bb4b60bebfbc70289b7ec6eaa127fad4ef308504881d05d9d4d039e6db99e51fa27cf8c4ac5665f4292244432aff97ab9423a7fc93a039655b59c38f0ccc92ffeff47d85845dd16fa87e4ffe2ce6e0a30143144e0811a1f7537e82bd3af2352ad7d2bbeb86d391",
8),j=a.length;r=j+8;v=16*((r-r%64)/64+1);u=[];for(f=p=0;f<j;)r=(f-f%4)/4,p=8*(f%4),u[r]|=a[f]<<p,f++;r=(f-f%4)/4;u[r]|=128<<8*(f%4);u[v-2]=j<<3;u[v-1]=j>>>29;j=u;f=l[0];g=l[1];k=l[2];h=l[3];for(a=0;a<j.length;a+=16)r=f,v=g,u=k,p=h,f=b(f,g,k,h,j[a+0],7,l[4]),h=b(h,f,g,k,j[a+1],12,l[5]),k=b(k,h,f,g,j[a+2],17,l[6]),g=b(g,k,h,f,j[a+3],22,l[7]),f=b(f,g,k,h,j[a+4],7,l[8]),h=b(h,f,g,k,j[a+5],12,l[9]),k=b(k,h,f,g,j[a+6],17,l[10]),g=b(g,k,h,f,j[a+7],22,l[11]),f=b(f,g,k,h,j[a+8],7,l[12]),h=b(h,f,g,k,j[a+9],
12,l[13]),k=b(k,h,f,g,j[a+10],17,l[14]),g=b(g,k,h,f,j[a+11],22,l[15]),f=b(f,g,k,h,j[a+12],7,l[16]),h=b(h,f,g,k,j[a+13],12,l[17]),k=b(k,h,f,g,j[a+14],17,l[18]),g=b(g,k,h,f,j[a+15],22,l[19]),f=c(f,g,k,h,j[a+1],5,l[20]),h=c(h,f,g,k,j[a+6],9,l[21]),k=c(k,h,f,g,j[a+11],14,l[22]),g=c(g,k,h,f,j[a+0],20,l[23]),f=c(f,g,k,h,j[a+5],5,l[24]),h=c(h,f,g,k,j[a+10],9,l[25]),k=c(k,h,f,g,j[a+15],14,l[26]),g=c(g,k,h,f,j[a+4],20,l[27]),f=c(f,g,k,h,j[a+9],5,l[28]),h=c(h,f,g,k,j[a+14],9,l[29]),k=c(k,h,f,g,j[a+3],14,l[30]),
g=c(g,k,h,f,j[a+8],20,l[31]),f=c(f,g,k,h,j[a+13],5,l[32]),h=c(h,f,g,k,j[a+2],9,l[33]),k=c(k,h,f,g,j[a+7],14,l[34]),g=c(g,k,h,f,j[a+12],20,l[35]),f=e(f,g,k,h,j[a+5],4,l[36]),h=e(h,f,g,k,j[a+8],11,l[37]),k=e(k,h,f,g,j[a+11],16,l[38]),g=e(g,k,h,f,j[a+14],23,l[39]),f=e(f,g,k,h,j[a+1],4,l[40]),h=e(h,f,g,k,j[a+4],11,l[41]),k=e(k,h,f,g,j[a+7],16,l[42]),g=e(g,k,h,f,j[a+10],23,l[43]),f=e(f,g,k,h,j[a+13],4,l[44]),h=e(h,f,g,k,j[a+0],11,l[45]),k=e(k,h,f,g,j[a+3],16,l[46]),g=e(g,k,h,f,j[a+6],23,l[47]),f=e(f,g,
k,h,j[a+9],4,l[48]),h=e(h,f,g,k,j[a+12],11,l[49]),k=e(k,h,f,g,j[a+15],16,l[50]),g=e(g,k,h,f,j[a+2],23,l[51]),f=m(f,g,k,h,j[a+0],6,l[52]),h=m(h,f,g,k,j[a+7],10,l[53]),k=m(k,h,f,g,j[a+14],15,l[54]),g=m(g,k,h,f,j[a+5],21,l[55]),f=m(f,g,k,h,j[a+12],6,l[56]),h=m(h,f,g,k,j[a+3],10,l[57]),k=m(k,h,f,g,j[a+10],15,l[58]),g=m(g,k,h,f,j[a+1],21,l[59]),f=m(f,g,k,h,j[a+8],6,l[60]),h=m(h,f,g,k,j[a+15],10,l[61]),k=m(k,h,f,g,j[a+6],15,l[62]),g=m(g,k,h,f,j[a+13],21,l[63]),f=m(f,g,k,h,j[a+4],6,l[64]),h=m(h,f,g,k,j[a+
11],10,l[65]),k=m(k,h,f,g,j[a+2],15,l[66]),g=m(g,k,h,f,j[a+9],21,l[67]),f=d(f,r),g=d(g,v),k=d(k,u),h=d(h,p);return n(f).concat(n(g),n(k),n(h))}},Base64:ab};
function hb(a){function d(a,b){e||(e=1,clearTimeout(n),c&&(c.onerror=c.onload=x,c.abort&&c.abort(),c=x),a&&r(b))}function b(){if(!m){m=1;clearTimeout(n);try{response=JSON.parse(c.responseText)}catch(a){return d(1)}v(response)}}var c,e=0,m=0,n;n=setTimeout(function(){d(1)},ib);var j=a.data||{},r=a.b||A(),v=a.c||A(),u="undefined"===typeof a.m;try{c="undefined"!==typeof XDomainRequest&&new XDomainRequest||new XMLHttpRequest;c.onerror=c.onabort=function(){d(1,c.responseText||{error:"Network Connection Error"})};
c.onload=c.onloadend=b;c.onreadystatechange=function(){if(4==c.readyState)switch(c.status){case 401:case 402:case 403:try{response=JSON.parse(c.responseText),d(1,response)}catch(a){return d(1,c.responseText)}}};j.pnsdk=jb;var p=a.url.join("/"),f=[];j&&(M(j,function(a,b){var c="object"==typeof b?JSON.stringify(b):b;"undefined"!=typeof b&&(b!=x&&0<encodeURIComponent(c).length)&&f.push(a+"="+encodeURIComponent(c))}),p+="?"+f.join("&"));url=p;c.open("GET",url,u);u&&(c.timeout=ib);c.send()}catch(g){return d(0),
hb(a)}return d}function kb(a,d,b){M(a.split(","),function(a){function e(a){a||(a=window.event);b(a)||(a.cancelBubble=w,a.returnValue=z,a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation())}d.addEventListener?d.addEventListener(a,e,z):d.attachEvent?d.attachEvent("on"+a,e):d["on"+a]=e})}function lb(a){console.error(a)}function mb(a,d,b){if(b)a.setAttribute(d,b);else return a&&a.getAttribute&&a.getAttribute(d)}function nb(a){return document.getElementById(a)}
function rb(a,d){var b=[];M(a.split(/\s+/),function(a){M((d||document).getElementsByTagName(a),function(a){b.push(a)})});return b}function sb(a,d){for(var b in d)if(d.hasOwnProperty(b))try{a.style[b]=d[b]+(0<"|width|height|top|left|".indexOf(b)&&"number"==typeof d[b]?"px":"")}catch(c){}}function tb(a){return document.createElement(a)}function ub(a,d){return CryptoJS.HmacSHA256(a,d).toString(CryptoJS.enc.Base64)}
function $(a){function d(){}function b(a,b){function c(b){b&&(Ea=K()-(b/1E4+(K()-d)/2),a&&a(Ea))}var d=K();b&&c(b)||F.time(c)}function c(a,b){wa&&wa(a,b);wa=x}function e(){F.time(function(a){b(A(),a);a||c(1,{error:"Heartbeat failed to connect to Pubnub Servers.Please check your network settings."});setTimeout(e,Ya)})}function m(){yb()||c(1,{error:"Offline. Please check your network settings. "});setTimeout(m,B)}function n(a,b){"object"==typeof a&&a.error&&a.message&&a.payload?b({message:a.message,
payload:a.payload}):b(a)}function j(a,b,c){if("object"==typeof a){if(a.error&&a.message&&a.payload){c({message:a.message,payload:a.payload});return}if(a.payload){b(a.payload);return}}b(a)}function r(a){var b=0;M(pa(y),function(c){if(c=y[c])b++,(a||A())(c)});return b}function v(a){if(zb){if(!P.length)return}else{a&&(P.i=0);if(P.i||!P.length)return;P.i=1}C(P.shift())}function u(){!ea&&p()}function p(){clearTimeout(W);!G||500<=G||1>G||!pa(y,w).length?ea=z:(ea=w,F.presence_heartbeat({callback:function(){W=
setTimeout(p,G*B)},error:function(a){s&&s("Presence Heartbeat unable to reach Pubnub servers."+JSON.stringify(a));W=setTimeout(p,G*B)}}))}function f(a,b){return Q.decrypt(a,b||R)||Q.decrypt(a,R)||a}function g(a,b,c){var d=z;if("number"===typeof a)d=5<a||0==a?z:w;else{if("boolean"===typeof a)return a?30:0;d=w}return d?(c&&c("Presence Heartbeat value invalid. Valid range ( x > 5 or x = 0). Current Value : "+(b||5)),b||5):a}function k(a){var b="",c=[];M(a,function(a){c.push(a)});var d=c.sort(),f;for(f in d){var e=
d[f],b=b+(e+"="+encodeURIComponent(a[e]));f!=d.length-1&&(b+="&")}return b}function h(a){a||(a={});M(X,function(b,c){b in a||(a[b]=c)});return a}function l(a){function b(a,c){var d=(a&65535)+(c&65535);return(a>>16)+(c>>16)+(d>>16)<<16|d&65535}function c(a,b){return a>>>b|a<<32-b}var d;d=a.replace(/\r\n/g,"\n");for(var a="",f=0;f<d.length;f++){var e=d.charCodeAt(f);128>e?a+=String.fromCharCode(e):(127<e&&2048>e?a+=String.fromCharCode(e>>6|192):(a+=String.fromCharCode(e>>12|224),a+=String.fromCharCode(e>>
6&63|128)),a+=String.fromCharCode(e&63|128))}f=a;d=[];for(e=0;e<8*f.length;e+=8)d[e>>5]|=(f.charCodeAt(e/8)&255)<<24-e%32;var h=8*a.length,f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,
1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e=Array(64),j,g,k,l,n,m,p,s,q,r,u;d[h>>5]|=128<<24-h%32;d[(h+64>>9<<4)+15]=h;for(s=0;s<
d.length;s+=16){h=a[0];j=a[1];g=a[2];k=a[3];l=a[4];n=a[5];m=a[6];p=a[7];for(q=0;64>q;q++)e[q]=16>q?d[q+s]:b(b(b(c(e[q-2],17)^c(e[q-2],19)^e[q-2]>>>10,e[q-7]),c(e[q-15],7)^c(e[q-15],18)^e[q-15]>>>3),e[q-16]),r=b(b(b(b(p,c(l,6)^c(l,11)^c(l,25)),l&n^~l&m),f[q]),e[q]),u=b(c(h,2)^c(h,13)^c(h,22),h&j^h&g^j&g),p=m,m=n,n=l,l=b(k,r),k=g,g=j,j=h,h=b(r,u);a[0]=b(h,a[0]);a[1]=b(j,a[1]);a[2]=b(g,a[2]);a[3]=b(k,a[3]);a[4]=b(l,a[4]);a[5]=b(n,a[5]);a[6]=b(m,a[6]);a[7]=b(p,a[7])}d="";for(f=0;f<4*a.length;f++)d+="0123456789abcdef".charAt(a[f>>
2]>>8*(3-f%4)+4&15)+"0123456789abcdef".charAt(a[f>>2]>>8*(3-f%4)&15);return d}a.db=vb;a.xdr=hb;a.error=a.error||lb;a.hmac_SHA256=ub;O.size(256);var Xa=O.s2a("0123456789012345");a.crypto_obj={encrypt:function(a,b){if(!b)return a;var c=O.s2a(l(b).slice(0,32)),d=O.s2a(JSON.stringify(a)),c=O.rawEncrypt(d,c,Xa);return O.Base64.encode(c)||a},decrypt:function(a,b){if(!b)return a;var c=O.s2a(l(b).slice(0,32));try{var d=O.Base64.decode(a),e=O.rawDecrypt(d,c,Xa,z);return JSON.parse(e)}catch(f){}}};a.params=
{pnsdk:jb};SELF=function(a){return $(a)};var da,ob=+a.windowing||10,pb=(+a.timeout||310)*B,Ya=(+a.keepalive||60)*B,qb=a.noleave||0,E=a.publish_key||"demo",q=a.subscribe_key||"demo",J=a.auth_key||"",T=a.secret_key||"",cb=a.hmac_SHA256,Fa=a.ssl?"s":"",ha="http"+Fa+"://"+(a.origin||"pubsub.pubnub.com"),H=L(ha),db=L(ha),P=[],Ea=0,eb=0,fb=0,wa=0,xa=a.restore||0,Y=0,Ga=z,y={},U={},W=x,N=g(a.heartbeat||a.pnexpires||0,a.error),G=a.heartbeat_interval||N-3,ea=z,zb=a.no_wait_for_pending,Ab=a["compatible_3.5"]||
z,C=a.xdr,X=a.params||{},s=a.error||A(),yb=a._is_online||function(){return 1},I=a.jsonp_cb||function(){return 0},Z=a.db||{get:A(),set:A()},R=a.cipher_key,D=a.uuid||Z&&Z.get(q+"uuid")||"",Q=a.crypto_obj||{encrypt:function(a){return a},decrypt:function(a){return a}},F={LEAVE:function(a,b,c,d){var e={uuid:D,auth:J},f=L(ha),c=c||A(),g=d||A(),d=I();if(0<a.indexOf(fa))return w;if(Ab&&(!Fa||"0"==d)||qb)return z;"0"!=d&&(e.callback=d);C({m:b||Fa,timeout:2E3,a:d,data:h(e),c:function(a){j(a,c,g)},b:function(a){n(a,
g)},url:[f,"v2","presence","sub_key",q,"channel",encodeURIComponent(a),"leave"]});return w},set_resumed:function(a){Ga=a},get_cipher_key:function(){return R},set_cipher_key:function(a){R=a},raw_encrypt:function(a,b){return Q.encrypt(a,b||R)||a},raw_decrypt:function(a,b){return f(a,b)},get_heartbeat:function(){return N},set_heartbeat:function(a){N=g(a,G,s);G=1<=N-3?N-3:1;d();p()},get_heartbeat_interval:function(){return G},set_heartbeat_interval:function(a){G=a;p()},get_version:function(){return"3.6.6"},
_add_param:function(a,b){X[a]=b},history:function(a,b){var b=a.callback||b,c=a.count||a.limit||100,d=a.reverse||"false",e=a.error||A(),j=a.auth_key||J,g=a.cipher_key,k=a.channel,l=a.start,m=a.end,p=a.include_token,r={},u=I();if(!k)return s("Missing Channel");if(!b)return s("Missing Callback");if(!q)return s("Missing Subscribe Key");r.stringtoken="true";r.count=c;r.reverse=d;r.auth=j;u&&(r.callback=u);l&&(r.start=l);m&&(r.end=m);p&&(r.include_token="true");C({a:u,data:h(r),c:function(a){if("object"==
typeof a&&a.error)e({message:a.message,payload:a.payload});else{for(var c=a[0],d=[],h=0;h<c.length;h++){var j=f(c[h],g);try{d.push(JSON.parse(j))}catch(Bb){d.push(j)}}b([d,a[1],a[2]])}},b:function(a){n(a,e)},url:[H,"v2","history","sub-key",q,"channel",encodeURIComponent(k)]})},replay:function(a,b){var b=b||a.callback||A(),c=a.auth_key||J,d=a.source,e=a.destination,f=a.stop,g=a.start,k=a.end,l=a.reverse,m=a.limit,n=I(),p={};if(!d)return s("Missing Source Channel");if(!e)return s("Missing Destination Channel");
if(!E)return s("Missing Publish Key");if(!q)return s("Missing Subscribe Key");"0"!=n&&(p.callback=n);f&&(p.stop="all");l&&(p.reverse="true");g&&(p.start=g);k&&(p.end=k);m&&(p.count=m);p.auth=c;C({a:n,c:function(a){j(a,b,err)},b:function(){b([0,"Disconnected"])},url:[H,"v1","replay",E,q,d,e],data:h(p)})},auth:function(a){J=a;d()},time:function(a){var b=I();C({a:b,data:h({uuid:D,auth:J}),timeout:5*B,url:[H,"time",b],c:function(b){a(b[0])},b:function(){a(0)}})},publish:function(a,b){var b=b||a.callback||
A(),c=a.message,d=a.channel,e=a.auth_key||J,f=a.cipher_key,g=a.error||A(),k=a.post||z,l="store_in_history"in a?a.store_in_history:w,m=I(),p="push";a.prepend&&(p="unshift");if(!c)return s("Missing Message");if(!d)return s("Missing Channel");if(!E)return s("Missing Publish Key");if(!q)return s("Missing Subscribe Key");c=JSON.stringify(Q.encrypt(c,f||R)||c);c=[H,"publish",E,q,0,encodeURIComponent(d),m,encodeURIComponent(c)];X={uuid:D,auth:e};l||(X.store="0");P[p]({a:m,timeout:5*B,url:c,data:h(X),b:function(a){n(a,
g);v(1)},c:function(a){j(a,b,g);v(1)},mode:k?"POST":"GET"});v()},unsubscribe:function(a,b){var c=a.channel,b=b||a.callback||A(),e=a.error||A();Y=0;c=oa((c.join?c.join(","):""+c).split(","),function(a){if(y[a])return a+","+a+fa}).join(",");M(c.split(","),function(a){var c=w;a&&(ba&&(c=F.LEAVE(a,0,b,e)),c||b({action:"leave"}),y[a]=0,a in U&&delete U[a])});d()},subscribe:function(a,b){function e(a){a?setTimeout(d,B):(H=L(ha,1),db=L(ha,1),setTimeout(function(){F.time(e)},B));r(function(b){if(a&&b.d)return b.d=
0,b.p(b.name);!a&&!b.d&&(b.d=1,b.o(b.name))})}function j(){var a=I(),b=pa(y).join(",");if(b){c();var g=h({uuid:D,auth:k});2<JSON.stringify(U).length&&(g.state=JSON.stringify(U));N&&(g.heartbeat=N);u();wa=C({timeout:da,a:a,b:function(a){n(a,v);F.time(e)},data:h(g),url:[db,"subscribe",q,encodeURIComponent(b),a,Y],c:function(a){if(!a||"object"==typeof a&&"error"in a&&a.error)return v(a.error),setTimeout(d,B);G(a[1]);Y=!Y&&xa&&Z.get(q)||a[1];r(function(a){a.g||(a.g=1,a.n(a.name))});if(Ga&&!xa)Y=0,Ga=
z,Z.set(q,0);else{R&&(Y=1E4,R=0);Z.set(q,a[1]);var b,c=(2<a.length?a[2]:oa(pa(y),function(b){return oa(Array(a[0].length).join(",").split(","),function(){return b})}).join(",")).split(",");b=function(){var a=c.shift()||fb;return[(y[a]||{}).a||eb,a.split(fa)[0]]};var e=K()-Ea-+a[1]/1E4;M(a[0],function(c){var d=b(),c=f(c,y[d[1]]?y[d[1]].cipher_key:x);d[0](c,a,d[1],e)})}setTimeout(j,W)}})}}var g=a.channel,b=(b=b||a.callback)||a.message,k=a.auth_key||J,l=a.connect||A(),m=a.reconnect||A(),p=a.disconnect||
A(),v=a.error||A(),G=a.idle||A(),E=a.presence||0,P=a.noheresync||0,R=a.backfill||0,X=a.timetoken||0,da=a.timeout||pb,W=a.windowing||ob,Q=a.state,T=a.heartbeat||a.pnexpires,ea=a.restore||xa;xa=ea;Y=X;if(!g)return s("Missing Channel");if(!b)return s("Missing Callback");if(!q)return s("Missing Subscribe Key");(T||0===T)&&F.set_heartbeat(T);M((g.join?g.join(","):""+g).split(","),function(c){var d=y[c]||{};y[fb=c]={name:c,g:d.g,d:d.d,f:1,a:eb=b,cipher_key:a.cipher_key,n:l,o:p,p:m};Q&&(U[c]=c in Q?Q[c]:
Q);E&&(F.subscribe({channel:c+fa,callback:E,restore:ea}),!d.f&&!P&&F.here_now({channel:c,callback:function(a){M("uuids"in a?a.uuids:[],function(b){E({action:"join",uuid:b,timestamp:K(),occupancy:a.occupancy||1},a,c)})}}))});d=function(){c();setTimeout(j,W)};if(!ba)return ca.push(d);d()},here_now:function(a,b){var b=a.callback||b,c=a.error||A(),d=a.auth_key||J,e=a.channel,f=I(),g=a.state,d={uuid:D,auth:d};if(!("uuids"in a?a.uuids:1))d.disable_uuids=1;g&&(d.state=1);if(!b)return s("Missing Callback");
if(!q)return s("Missing Subscribe Key");g=[H,"v2","presence","sub_key",q];e&&g.push("channel")&&g.push(encodeURIComponent(e));"0"!=f&&(d.callback=f);C({a:f,data:h(d),c:function(a){j(a,b,c)},b:function(a){n(a,c)},url:g})},where_now:function(a,b){var b=a.callback||b,c=a.error||A(),d=a.auth_key||J,e=I(),f=a.uuid||D,d={auth:d};if(!b)return s("Missing Callback");if(!q)return s("Missing Subscribe Key");"0"!=e&&(d.callback=e);C({a:e,data:h(d),c:function(a){j(a,b,c)},b:function(a){n(a,c)},url:[H,"v2","presence",
"sub_key",q,"uuid",encodeURIComponent(f)]})},state:function(a,b){var b=a.callback||b||A(),c=a.error||A(),d=a.auth_key||J,e=I(),f=a.state,g=a.uuid||D,k=a.channel,d=h({auth:d});if(!q)return s("Missing Subscribe Key");if(!g)return s("Missing UUID");if(!k)return s("Missing Channel");"0"!=e&&(d.callback=e);y[k]&&(y[k].f&&f)&&(U[k]=f);d.state=JSON.stringify(f);f=f?[H,"v2","presence","sub-key",q,"channel",encodeURIComponent(k),"uuid",g,"data"]:[H,"v2","presence","sub-key",q,"channel",encodeURIComponent(k),
"uuid",encodeURIComponent(g)];C({a:e,data:h(d),c:function(a){j(a,b,c)},b:function(a){n(a,c)},url:f})},grant:function(a,b){var b=a.callback||b,c=a.error||A(),d=a.channel,e=I(),f=a.ttl,g=a.read?"1":"0",l=a.write?"1":"0",m=a.auth_key;if(!b)return s("Missing Callback");if(!q)return s("Missing Subscribe Key");if(!E)return s("Missing Publish Key");if(!T)return s("Missing Secret Key");var p=q+"\n"+E+"\ngrant\n",g={w:l,r:g,timestamp:Math.floor((new Date).getTime()/1E3)};"undefined"!=d&&(d!=x&&0<d.length)&&
(g.channel=d);"0"!=e&&(g.callback=e);if(f||0===f)g.ttl=f;m&&(g.auth=m);g=h(g);m||delete g.auth;p+=k(g);d=cb(p,T);d=d.replace(/\+/g,"-");d=d.replace(/\//g,"_");g.signature=d;C({a:e,data:g,c:function(a){j(a,b,c)},b:function(a){n(a,c)},url:[H,"v1","auth","grant","sub-key",q]})},audit:function(a,b){var b=a.callback||b,c=a.error||A(),d=a.channel,e=a.auth_key,f=I();if(!b)return s("Missing Callback");if(!q)return s("Missing Subscribe Key");if(!E)return s("Missing Publish Key");if(!T)return s("Missing Secret Key");
var g=q+"\n"+E+"\naudit\n",l={timestamp:Math.floor((new Date).getTime()/1E3)};"0"!=f&&(l.callback=f);"undefined"!=d&&(d!=x&&0<d.length)&&(l.channel=d);e&&(l.auth=e);l=h(l);e||delete l.auth;g+=k(l);d=cb(g,T);d=d.replace(/\+/g,"-");d=d.replace(/\//g,"_");l.signature=d;C({a:f,data:l,c:function(a){j(a,b,c)},b:function(a){n(a,c)},url:[H,"v1","auth","audit","sub-key",q]})},revoke:function(a,b){a.read=z;a.write=z;F.grant(a,b)},set_uuid:function(a){D=a;d()},get_uuid:function(){return D},presence_heartbeat:function(a){var b=
a.callback||A(),c=a.error||A(),a=I(),d={uuid:D,auth:J};2<JSON.stringify(U).length&&(d.state=JSON.stringify(U));0<N&&320>N&&(d.heartbeat=N);"0"!=a&&(d.callback=a);var e=C,d=h(d),f=5*B,g=H,k=q,l=pa(y,w).join(",");e({a:a,data:d,timeout:f,url:[g,"v2","presence","sub-key",k,"channel",encodeURIComponent(l),"heartbeat"],c:function(a){j(a,b,c)},b:function(a){n(a,c)}})},xdr:C,ready:qa,db:Z,uuid:ka,map:oa,each:M,"each-channel":r,grep:ma,offline:function(){c(1,{message:"Offline. Please check your network settings."})},
supplant:na,now:K,unique:ia,updater:la};D||(D=F.uuid());Z.set(q+"uuid",D);setTimeout(m,B);setTimeout(e,Ya);W=setTimeout(u,(G-3)*B);b();da=F;for(var Ha in da)da.hasOwnProperty(Ha)&&(SELF[Ha]=da[Ha]);SELF.init=SELF;SELF.$=nb;SELF.attr=mb;SELF.search=rb;SELF.bind=kb;SELF.css=sb;SELF.create=tb;"undefined"!==typeof window&&kb("beforeunload",window,function(){SELF["each-channel"](function(a){SELF.LEAVE(a.name,1)});return w});if(a.notest)return SELF;"undefined"!==typeof window&&kb("offline",window,SELF._reset_offline);
"undefined"!==typeof document&&kb("offline",document,SELF._reset_offline);SELF.ready();return SELF}var jb="PubNub-JS-Phonegap/3.6.6",ib=31E4,vb,wb="undefined"!=typeof localStorage&&localStorage;vb={get:function(a){try{return wb?wb.getItem(a):-1==document.cookie.indexOf(a)?x:((document.cookie||"").match(RegExp(a+"=([^;]+)"))||[])[1]||x}catch(d){}},set:function(a,d){try{if(wb)return wb.setItem(a,d)&&0;document.cookie=a+"="+d+"; expires=Thu, 1 Aug 2030 20:00:00 UTC; path=/"}catch(b){}}};$.init=$;
$.secure=$;PUBNUB=$({});"undefined"!==typeof module&&(module.u=$)||"undefined"!==typeof exports&&(exports.q=$)||(PUBNUB=$);
var xb=PUBNUB.ws=function(a,d){if(!(this instanceof xb))return new xb(a,d);var b=this,a=b.url=a||"";b.protocol=d||"Sec-WebSocket-Protocol";var c=a.split("/"),c={ssl:"wss:"===c[0],origin:c[2],publish_key:c[3],subscribe_key:c[4],channel:c[5]};b.CONNECTING=0;b.OPEN=1;b.CLOSING=2;b.CLOSED=3;b.CLOSE_NORMAL=1E3;b.CLOSE_GOING_AWAY=1001;b.CLOSE_PROTOCOL_ERROR=1002;b.CLOSE_UNSUPPORTED=1003;b.CLOSE_TOO_LARGE=1004;b.CLOSE_NO_STATUS=1005;b.CLOSE_ABNORMAL=1006;b.onclose=b.onerror=b.onmessage=b.onopen=b.onsend=
A();b.binaryType="";b.extensions="";b.bufferedAmount=0;b.trasnmitting=z;b.buffer=[];b.readyState=b.CONNECTING;if(!a)return b.readyState=b.CLOSED,b.onclose({code:b.CLOSE_ABNORMAL,reason:"Missing URL",wasClean:w}),b;b.e=PUBNUB.init(c);b.e.j=c;b.j=c;b.e.subscribe({restore:z,channel:c.channel,disconnect:b.onerror,reconnect:b.onopen,error:function(){b.onclose({code:b.CLOSE_ABNORMAL,reason:"Missing URL",wasClean:z})},callback:function(a){b.onmessage({data:a})},connect:function(){b.readyState=b.OPEN;b.onopen()}})};
xb.prototype.send=function(a){var d=this;d.e.publish({channel:d.e.j.channel,message:a,callback:function(a){d.onsend({data:a})}})};
})();
|
gdi2290/javascript
|
phonegap/pubnub.min.js
|
JavaScript
|
mit
| 33,766
|
'use strict';
// MODULES //
var data = require( './data.js' );
// MATRIX //
/**
* FUNCTION: matrix( methods, ctx, next )
* Creates a matrix.
*
* @param {Object} methods - RPC methods
* @param {Object} ctx - analysis context
* @param {Function} next - callback
* @returns {Void}
*/
function matrix( methods, ctx, next ) {
methods.matrix( data, data.dims, 'float64', onMatrix );
function onMatrix( error, matrix ) {
if ( error ) {
return next( error );
}
ctx.mat = matrix;
next();
}
} // end FUNCTION matrix()
// EXPORTS //
module.exports = matrix;
|
kgryte/talks-nodejs-interactive-2015
|
examples/webrtc/analysis/matrix.js
|
JavaScript
|
mit
| 570
|
import DS from 'ember-data';
export default DS.Model.extend({
word: DS.attr('string'),
definition: DS.attr('string'),
complete: DS.attr('boolean'),
list: DS.belongsTo('list')
});
|
alexbrinkman/slovnik
|
app/models/word.js
|
JavaScript
|
mit
| 188
|
var $ = require('air')
, expect = require('chai').expect
, util = require('../util');
describe('Css:', function() {
beforeEach(function(done) {
$.plugin([
require('css')
]);
util.before();
done();
})
afterEach(util.after);
it('should return self on no elements', function(done) {
var el = $();
expect(el.css()).to.equal(el);
done();
});
it('should return null for non-existent style property', function(done) {
var el = $('.css');
expect(Boolean(el.css('non-existent-style'))).to.eql(false);
done();
});
it('should get all styles', function(done) {
var el = $('.css')
, styles = el.css();
// NOTE: array style object, chai update, breaks assertion
//expect(styles).to.be.an('object');
expect(styles.color).to.be.a('string');
done();
});
it('should get computed style', function(done) {
var el = $('.css')
, color = el.css('color')
, background = el.css('background-color');
expect(color).to.be.a('string');
expect(background).to.be.a('string');
done();
});
it('should set style property', function(done) {
var el = $('.css');
expect(el.css('position', 'relative')).to.eql(el);
expect(el.css('position')).to.eql('relative');
done();
});
it('should set style property', function(done) {
var el = $('.css')
, props = {position: 'absolute', left: '5px', top: '5px'};
expect(el.css(props)).to.eql(el);
expect(el.css('position')).to.eql('absolute');
expect(el.css('left')).to.eql('5px');
expect(el.css('top')).to.eql('5px');
done();
});
});
|
socialally/air
|
test/spec/css.js
|
JavaScript
|
mit
| 1,625
|
module.exports = require('./commitlint.config.js');
|
marionebl/conventional-changelog-lint
|
@commitlint/read/fixtures/recursive-extends/first-extended/index.js
|
JavaScript
|
mit
| 52
|
var THREEx = THREEx || {}
THREEx.DayNight = {}
THREEx.DayNight.currentPhase = function(sunRotation){
if( Math.sin(sunRotation) > Math.sin(0) ){
return 'day'
}else if( Math.sin(sunRotation) > Math.sin(-Math.PI/6) ){
return 'twilight'
}else{
return 'night'
}
}
//////////////////////////////////////////////////////////////////////////////////
// SunLight //
//////////////////////////////////////////////////////////////////////////////////
THREEx.DayNight.SunLight = function(){
var light = new THREE.DirectionalLight( 0xffffff, 1 );
this.object3d = light
this.update = function(sunRotation){
light.position.x = 0;
light.position.y = Math.sin(sunRotation) * 90000;
light.position.z = Math.cos(sunRotation) * 90000;
// console.log('Phase ', THREEx.DayNight.currentPhase(sunRotation))
var phase = THREEx.DayNight.currentPhase(sunRotation)
if( phase === 'day' ){
light.color.set("rgb(255,"+ (Math.floor(Math.sin(sunRotation)*200)+55) + "," + (Math.floor(Math.sin(sunRotation)*200)) +")");
}else if( phase === 'twilight' ){
light.intensity = 1;
light.color.set("rgb(" + (255-Math.floor(Math.sin(sunRotation)*510*-1)) + "," + (55-Math.floor(Math.sin(sunRotation)*110*-1)) + ",0)");
} else {
light.intensity = 0;
}
}
}
//////////////////////////////////////////////////////////////////////////////////
// SunSphere //
//////////////////////////////////////////////////////////////////////////////////
THREEx.DayNight.SunSphere = function(){
var geometry = new THREE.SphereGeometry( 20000, 30, 30 )
var material = new THREE.MeshBasicMaterial({
color : 0xff0000
})
var mesh = new THREE.Mesh(geometry, material)
this.object3d = mesh
this.update = function(sunRotation){
mesh.position.x = 0;
mesh.position.y = Math.sin(sunRotation) * 400000;
mesh.position.z = Math.cos(sunRotation) * 400000;
var phase = THREEx.DayNight.currentPhase(sunRotation)
if( phase === 'day' ){
mesh.material.color.set("rgb(255,"+ (Math.floor(Math.sin(sunRotation)*200)+55) + "," + (Math.floor(Math.sin(sunRotation)*200)+5) +")");
}else if( phase === 'twilight' ){
mesh.material.color.set("rgb(255,55,5)");
} else {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
// Skydom //
//////////////////////////////////////////////////////////////////////////////////
THREEx.DayNight.Skydom = function(){
var geometry = new THREE.SphereGeometry( 700000, 32, 15 );
var shader = THREEx.DayNight.Skydom.Shader
var uniforms = THREE.UniformsUtils.clone(shader.uniforms)
var material = new THREE.ShaderMaterial({
vertexShader : shader.vertexShader,
fragmentShader : shader.fragmentShader,
uniforms : uniforms,
side : THREE.BackSide
});
var mesh = new THREE.Mesh( geometry, material );
this.object3d = mesh
this.update = function(sunRotation){
var phase = THREEx.DayNight.currentPhase(sunRotation)
if( phase === 'day' ){
uniforms.topColor.value = new THREE.Color("rgb(0,120,255)");
uniforms.bottomColor.value = new THREE.Color("rgb(255,"+ (Math.floor(Math.sin(sunRotation)*200)+55) + "," + (Math.floor(Math.sin(sunRotation)*200)) +")");
} else if( phase === 'twilight' ){
uniforms.topColor.value = new THREE.Color("rgb(0," + (120-Math.floor(Math.sin(sunRotation)*240*-1)) + "," + (255-Math.floor(Math.sin(sunRotation)*510*-1)) +")");
uniforms.bottomColor.value = new THREE.Color("rgb(" + (255-Math.floor(Math.sin(sunRotation)*510*-1)) + "," + (55-Math.floor(Math.sin(sunRotation)*110*-1)) + ",0)");
} else {
uniforms.topColor.value.set('black')
uniforms.bottomColor.value.set('black');
}
}
}
THREEx.DayNight.Skydom.Shader = {
uniforms : {
topColor : { type: "c", value: new THREE.Color().setHSL( 0.6, 1, 0.75 ) },
bottomColor : { type: "c", value: new THREE.Color( 0xffffff ) },
offset : { type: "f", value: 400 },
exponent : { type: "f", value: 0.6 },
},
vertexShader : [
'varying vec3 vWorldPosition;',
'void main() {',
' vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',
' vWorldPosition = worldPosition.xyz;',
' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
'}',
].join('\n'),
fragmentShader : [
'uniform vec3 topColor;',
'uniform vec3 bottomColor;',
'uniform float offset;',
'uniform float exponent;',
'varying vec3 vWorldPosition;',
'void main() {',
' float h = normalize( vWorldPosition + offset ).y;',
' gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( h, exponent ), 0.0 ) ), 1.0 );',
'}',
].join('\n'),
}
|
jeromeetienne/threex.cloudgaming
|
examples/bower_components/threex.daynight/threex.daynight.js
|
JavaScript
|
mit
| 4,584
|
(function(T,U,V,O,W,B,L,E,F,G,X,Y,M,Z,H,v,I,P,N,K,Q,$,R,aa,ba,ca,da,ea,fa,S,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,g,m){B("JS");E(["JU.BS","$.V3"],"JS.VTemp",null,function(){c$=G(function(){this.bsTemp=this.vNorm3=this.vNorm2=this.vNorm1=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;F(this,arguments)},JS,"VTemp");K(c$,function(){this.vTemp=new JU.V3;this.vA=new JU.V3;this.vB=new JU.V3;this.vTemp1=new JU.V3;this.vTemp2=new JU.V3;this.vNorm1=new JU.V3;
this.vNorm2=new JU.V3;this.vNorm3=new JU.V3;this.bsTemp=new JU.BS})});B("J.api");R(J.api,"SmilesMatcherInterface");B("JS");E(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","JU.AU $.BS $.PT JS.InvalidSmilesException $.SmilesGenerator $.SmilesParser JU.BSUtil".split(" "),function(){c$=N(JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);m(c$,"getLastException",function(){return JS.InvalidSmilesException.getLastError()});m(c$,"getMolecularFormula",function(a,b){JS.InvalidSmilesException.clear();
var c=JS.SmilesParser.getMolecule(a,b);c.createTopoMap(null);c.nodes=c.jmolAtoms;return c.getMolecularFormula(!b,null,!1)},"~S,~B");m(c$,"getSmiles",function(a,b,c,d,e,f,k,j){JS.InvalidSmilesException.clear();return d?(new JS.SmilesGenerator).getBioSmiles(a,b,c,e,f,k):(new JS.SmilesGenerator).getSmiles(a,b,c,j)},"~A,~N,JU.BS,~B,~B,~B,~S,~B");g(c$,"areEqual",function(a,b){var c=this.find(a,b,!1,!1);return null==c?-1:c.length},"~S,~S");g(c$,"areEqual",function(a,b){var c=this.find(a,b,!1,!0,!0);return null!=
c&&1==c.length},"~S,JS.SmilesSearch");g(c$,"find",function(a,b,c,d){JS.InvalidSmilesException.clear();b=JS.SmilesParser.getMolecule(b,!1);return this.find(a,b,c,!c,d)},"~S,~S,~B,~B");m(c$,"getRelationship",function(a,b){if(null==a||null==b||0==a.length||0==b.length)return"";var c=this.getMolecularFormula(a,!1),d=this.getMolecularFormula(b,!1);if(!c.equals(d))return"none";var e,c=JS.SmilesMatcher.countStereo(a),d=JS.SmilesMatcher.countStereo(b);e=c==d&&0<this.areEqual(b,a);if(!e){e=a+b;if(0<=e.indexOf("/")||
0<=e.indexOf("\\")||0<=e.indexOf("@")){if(c==d&&0<c&&(a=this.reverseChirality(a),e=0<this.areEqual(a,b)))return"enantiomers";if(e=0<this.areEqual("/nostereo/"+b,a))return c==d?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");m(c$,"reverseChirality",function(a){a=JU.PT.rep(a,"@@","!@");a=JU.PT.rep(a,"@","@@");a=JU.PT.rep(a,"!@@","@");a=JU.PT.rep(a,"@@SP","@SP");a=JU.PT.rep(a,"@@OH","@OH");return a=JU.PT.rep(a,"@@TB","@TB")},"~S");m(c$,"getSubstructureSet",
function(a,b,c,d,e,f){return this.match(a,b,c,d,null,e,!1,f,1)},"~S,~A,~N,JU.BS,~B,~B");m(c$,"getSubstructureSets",function(a,b,c,d,e,f,k){JS.InvalidSmilesException.clear();var j=new JS.SmilesParser(!0),h=null,h=j.parse("");h.firstMatchOnly=!1;h.matchAllAtoms=!1;h.jmolAtoms=b;h.jmolAtomCount=Math.abs(c);h.setSelected(e);h.getRingData(!0,d,k);h.asVector=!1;h.subSearches=Array(1);h.getSelections();b=new JU.BS;for(e=0;e<a.length;e++)if(null==a[e]||0==a[e].length||a[e].startsWith("#"))f.addLast(null);
else if(h.clear(),k=j.getSearch(h,JS.SmilesParser.cleanPattern(a[e]),d),h.subSearches[0]=k,k=JU.BSUtil.copy(h.search(!1)),f.addLast(k),b.or(k),b.cardinality()==c)break},"~A,~A,~N,~N,JU.BS,JU.Lst,~A");m(c$,"getSubstructureSetArray",function(a,b,c,d,e,f,k){return this.match(a,b,c,d,e,f,!1,k,2)},"~S,~A,~N,JU.BS,JU.BS,~B,~B");m(c$,"getCorrelationMaps",function(a,b,c,d,e,f){return this.match(a,b,c,d,null,e,!1,f,3)},"~S,~A,~N,JU.BS,~B,~B");g(c$,"find",function(a,b,c,d,e){var f=new JU.BS;b.createTopoMap(f);
return this.match(a,b.jmolAtoms,-b.jmolAtoms.length,null,f,c,d,e,2)},"~S,JS.SmilesSearch,~B,~B,~B");g(c$,"match",function(a,b,c,d,e,f,k,j,h){JS.InvalidSmilesException.clear();try{var g=JS.SmilesParser.getMolecule(a,f);g.jmolAtoms=b;g.jmolAtomCount=Math.abs(c);0>c&&(g.isSmilesFind=!0);g.setSelected(d);g.getSelections();g.bsRequired=null;g.setRingData(e);g.firstMatchOnly=j;g.matchAllAtoms=k;switch(h){case 1:return g.asVector=!1,g.search(!1);case 2:g.asVector=!0;var l=g.search(!1);return l.toArray(Array(l.size()));
case 3:g.getMaps=!0;var n=g.search(!1);return n.toArray(JU.AU.newInt2(n.size()))}}catch(r){if(H(r,Exception))throw null==JS.InvalidSmilesException.getLastError()&&JS.InvalidSmilesException.clear(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw r;}return null},"~S,~A,~N,JU.BS,JU.BS,~B,~B,~B,~N");c$.countStereo=g(c$,"countStereo",function(a){a=JU.PT.rep(a,"@@","@");for(var b=a.lastIndexOf("@")+1,c=0;0<=--b;)"@"==a.charAt(b)&&c++;return c},"~S");I(c$,"MODE_BITSET",1,"MODE_ARRAY",
2,"MODE_MAP",3)});B("JS");E(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){c$=N(JS,"InvalidSmilesException",Exception);c$.getLastError=g(c$,"getLastError",function(){return JS.InvalidSmilesException.lastError});c$.clear=g(c$,"clear",function(){JS.InvalidSmilesException.lastError=null});M(c$,function(a){Q(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=a},"~S");I(c$,"lastError",null)});B("JS");E(["JU.JmolMolecule","JU.BS","$.Lst","JS.VTemp"],"JS.SmilesSearch",
"java.util.Arrays $.Hashtable JU.AU $.SB $.V3 JS.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser JU.BSUtil $.Logger".split(" "),function(){c$=G(function(){this.bioAtoms=this.smartsAtoms=this.jmolAtoms=this.pattern=this.patternAtoms=null;this.jmolAtomCount=0;this.bsRequired=this.bsSelected=null;this.isSmilesFind=this.isSmarts=this.matchAllAtoms=this.firstMatchOnly=!1;this.subSearches=null;this.needRingData=this.haveAtomStereochemistry=this.haveBondStereochemistry=this.haveSelected=
!1;this.needAromatic=!0;this.needRingMemberships=!1;this.ringDataMax=-2147483648;this.measures=null;this.flags=0;this.lastChainAtom=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=this.ringSets=null;this.getMaps=this.asVector=!1;this.top=null;this.isRingCheck=this.isSilent=!1;this.selectedAtomCount=0;this.htNested=this.bsFound=this.ringConnections=this.ringCounts=this.ringData=null;this.nNested=0;this.bsReturn=this.vReturn=this.nestedBond=null;this.aromaticDouble=this.noAromatic=this.ignoreStereochemistry=
!1;this.v=this.bsCheck=null;F(this,arguments)},JS,"SmilesSearch",JU.JmolMolecule);K(c$,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS;this.top=this;this.bsFound=new JU.BS;this.bsReturn=new JU.BS;this.v=new JS.VTemp});g(c$,"toString",function(){var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});g(c$,"setSelected",function(a){null==
a&&(a=JU.BS.newN(this.jmolAtomCount),a.setBits(0,this.jmolAtomCount));this.bsSelected=a},"JU.BS");g(c$,"setAtomArray",function(){this.patternAtoms.length>this.ac&&(this.patternAtoms=JU.AU.arrayCopyObject(this.patternAtoms,this.ac));this.nodes=this.patternAtoms});g(c$,"addAtom",function(){this.ac>=this.patternAtoms.length&&(this.patternAtoms=JU.AU.doubleLength(this.patternAtoms));var a=(new JS.SmilesAtom).setIndex(this.ac);this.patternAtoms[this.ac]=a;this.ac++;return a});g(c$,"addNested",function(a){null==
this.top.htNested&&(this.top.htNested=new java.util.Hashtable);this.setNested(++this.top.nNested,a);return this.top.nNested},"~S");g(c$,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});g(c$,"setNested",function(a,b){this.top.htNested.put("_"+a,b)},"~N,~O");g(c$,"getNested",function(a){return this.top.htNested.get("_"+a)},"~N");g(c$,"getMissingHydrogenCount",function(){for(var a=0,b,c=0;c<this.ac;c++)if(0<=(b=this.patternAtoms[c].missingHydrogenCount))a+=
b;return a});g(c$,"setRingData",function(a){this.needAromatic&&(this.needRingData=!0);this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&0==(this.flags&1))).valueOf())).valueOf();if(!this.needAromatic&&(this.bsAromatic.clearAll(),null!=a&&this.bsAromatic.or(a),!this.needRingMemberships&&!this.needRingData))return;this.getRingData(this.needRingData,this.flags,null)},"JU.BS");g(c$,"getRingData",function(a,b,c){var d=0!=(b&4),e=0!=(b&8);d&&null==c&&(c=JU.AU.createArrayOfArrayList(4));
e&&this.needAromatic&&(this.bsAromatic=JS.SmilesAromatic.checkAromaticDefined(this.jmolAtoms,this.bsSelected),d=!1);0>this.ringDataMax&&(this.ringDataMax=8);d&&6>this.ringDataMax&&(this.ringDataMax=6);a&&(this.ringCounts=v(this.jmolAtomCount,0),this.ringConnections=v(this.jmolAtomCount,0),this.ringData=Array(this.ringDataMax+1));this.ringSets=new JU.SB;for(var f="****";f.length<this.ringDataMax;)f+=f;var k=null;for(b=3;b<=this.ringDataMax;b++)if(!(b>this.jmolAtomCount)){var j="*1"+f.substring(0,b-
2)+"*1",j=JS.SmilesParser.getMolecule(j,!0),j=this.subsearch(j,!1,!0);if(null!=c&&5>=b){for(var h=new JU.Lst,g=j.size();0<=--g;)h.addLast(j.get(g));c[b-3]=h}if(this.needAromatic){if(!e&&(!d||5==b||6==b))for(h=j.size();0<=--h;)g=j.get(h),(e||JS.SmilesAromatic.isFlatSp2Ring(this.jmolAtoms,this.bsSelected,g,d?0.1:0.01))&&this.bsAromatic.or(g);if(d)switch(b){case 5:k=j;break;case 6:e?this.bsAromatic=JS.SmilesAromatic.checkAromaticDefined(this.jmolAtoms,this.bsAromatic):JS.SmilesAromatic.checkAromaticStrict(this.jmolAtoms,
this.bsAromatic,k,j),c[3]=new JU.Lst,this.setAromatic56(k,this.bsAromatic5,5,c[3]),this.setAromatic56(j,this.bsAromatic6,6,c[3])}}if(a){this.ringData[b]=new JU.BS;for(var l=0;l<j.size();l++){h=j.get(l);this.ringData[b].or(h);for(g=h.nextSetBit(0);0<=g;g=h.nextSetBit(g+1))this.ringCounts[g]++}}}if(a)for(b=this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1))if(a=this.jmolAtoms[b],c=a.getEdges(),null!=c)for(l=c.length;0<=--l;)0<this.ringCounts[a.getBondedAtomIndex(l)]&&this.ringConnections[b]++},
"~B,~N,~A");g(c$,"setAromatic56",function(a,b,c,d){for(var e=0;e<a.size();e++){var f=a.get(e);this.v.bsTemp.clearAll();this.v.bsTemp.or(f);this.v.bsTemp.and(this.bsAromatic);this.v.bsTemp.cardinality()==c&&(b.or(f),null!=d&&d.addLast(f))}},"JU.Lst,JU.BS,~N,JU.Lst");g(c$,"subsearch",function(a,b,c){a.ringSets=this.ringSets;a.jmolAtoms=this.jmolAtoms;a.jmolAtomCount=this.jmolAtomCount;a.bsSelected=this.bsSelected;a.htNested=this.htNested;a.isSmilesFind=this.isSmilesFind;a.bsCheck=this.bsCheck;a.isSmarts=
!0;a.bsAromatic=this.bsAromatic;a.bsAromatic5=this.bsAromatic5;a.bsAromatic6=this.bsAromatic6;a.ringData=this.ringData;a.ringCounts=this.ringCounts;a.ringConnections=this.ringConnections;b?(a.bsRequired=null,a.firstMatchOnly=!1,a.matchAllAtoms=!1):c?(a.bsRequired=null,a.isSilent=!0,a.isRingCheck=!0,a.asVector=!0,a.matchAllAtoms=!1):(a.haveSelected=this.haveSelected,a.bsRequired=this.bsRequired,a.firstMatchOnly=this.firstMatchOnly,a.matchAllAtoms=this.matchAllAtoms,a.getMaps=this.getMaps,a.asVector=
this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn);return a.search(b)},"JS.SmilesSearch,~B,~B");g(c$,"search",function(a){this.ignoreStereochemistry=0!=(this.flags&2);this.noAromatic=0!=(this.flags&1);this.aromaticDouble=0!=(this.flags&16);JU.Logger.debugging&&!this.isSilent&&JU.Logger.debug("SmilesSearch processing "+this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.Lst;null==this.bsSelected&&(this.bsSelected=JU.BS.newN(this.jmolAtomCount),this.bsSelected.setBits(0,
this.jmolAtomCount));this.selectedAtomCount=this.bsSelected.cardinality();if(null!=this.subSearches)for(a=0;a<this.subSearches.length&&!(null!=this.subSearches[a]&&(this.subsearch(this.subSearches[a],!1,!1),this.firstMatchOnly&&(null==this.vReturn?0<=this.bsReturn.nextSetBit(0):0<this.vReturn.size())));a++);else 0<this.ac&&this.checkMatch(null,-1,-1,a);return this.asVector||this.getMaps?this.vReturn:this.bsReturn},"~B");g(c$,"checkMatch",function(a,b,c,d){var e;if(null==a)null==this.nestedBond?this.clearBsFound(-1):
this.bsReturn.clearAll();else{if(this.bsFound.get(c)||!this.bsSelected.get(c))return!0;e=this.jmolAtoms[c];if(!this.isRingCheck){if(null!=a.atomsOr){for(var f=0;f<a.nAtomsOr;f++)if(!this.checkMatch(a.atomsOr[f],b,c,d))return!1;return!0}if(null==a.primitives){if(!this.checkPrimitiveAtom(a,c))return!0}else for(f=0;f<a.nPrimitives;f++)if(!this.checkPrimitiveAtom(a.primitives[f],c))return!0}e=e.getEdges();for(f=a.getBondCount();0<=--f;){var k=a.getBond(f);if(k.getAtomIndex2()==a.index){var j=k.getAtom1(),
h=j.getMatchingAtom();switch(k.order){case 96:case 112:if(!this.checkMatchBond(a,j,k,c,h,null))return!0;break;default:for(var g=0;g<e.length&&(!(e[g].getAtomIndex1()==h||e[g].getAtomIndex2()==h)||!e[g].isCovalent());g++);if(g==e.length||!this.checkMatchBond(a,j,k,c,h,e[g]))return!0}}}this.patternAtoms[a.index].setMatchingAtom(c);JU.Logger.debugging&&!this.isSilent&&JU.Logger.debug("pattern atom "+b+" "+a);this.bsFound.set(c)}if(!this.continueMatch(b,c,d))return!1;0<=c&&this.clearBsFound(c);return!0},
"JS.SmilesAtom,~N,~N,~B");g(c$,"continueMatch",function(a,b,c){var d,e;if(++a<this.ac){var f=this.patternAtoms[a],k=0<=b?f.getBondTo(null):0==a?this.nestedBond:null;if(null==k){k=JU.BSUtil.copy(this.bsFound);if(0<=f.notBondedIndex){d=this.patternAtoms[f.notBondedIndex];var j=this.jmolAtoms[d.getMatchingAtom()];if(d.isBioAtom)d=j.getOffsetResidueAtom("0",1),0<=d&&k.set(d),d=j.getOffsetResidueAtom("0",-1),0<=d&&k.set(d);else{e=j.getEdges();for(d=0;d<e.length;d++)k.set(e[d].getOtherAtomNode(j).getIndex())}}b=
0<=b&&f.isBioAtom&&(null==f.atomName||null!=f.residueChar);for(j=this.bsSelected.nextSetBit(0);0<=j;j=this.bsSelected.nextSetBit(j+1)){if(!k.get(j)&&!this.checkMatch(f,a,j,c))return!1;b&&(d=this.jmolAtoms[j].getOffsetResidueAtom(f.atomName,1),0<=d&&(j=d-1))}this.bsFound=k;return!0}d=this.jmolAtoms[k.getAtom1().getMatchingAtom()];switch(k.order){case 96:j=d.getOffsetResidueAtom(f.atomName,1);if(0<=j){k=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);if(!this.checkMatch(f,a,j,c))return!1;
this.bsFound=k}return!0;case 112:b=new JU.Lst;d.getCrossLinkLeadAtomIndexes(b);k=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);for(j=0;j<b.size();j++)if(!this.checkMatch(f,a,b.get(j).intValue(),c))return!1;this.bsFound=k;return!0}e=d.getEdges();if(null!=e)for(j=0;j<e.length;j++)if(!this.checkMatch(f,a,d.getBondedAtomIndex(j),c))return!1;this.clearBsFound(b);return!0}if(!this.ignoreStereochemistry&&!this.checkStereochemistry())return!0;k=new JU.BS;for(j=f=0;j<this.ac;j++)if(b=this.patternAtoms[j].getMatchingAtom(),
c||!this.top.haveSelected||this.patternAtoms[j].selected){f++;k.set(b);this.patternAtoms[j].isBioAtom&&null==this.patternAtoms[j].atomName&&this.jmolAtoms[b].getGroupBits(k);if(c)break;!this.isSmarts&&0<this.patternAtoms[j].missingHydrogenCount&&this.getHydrogens(this.jmolAtoms[b],k)}if(null!=this.bsRequired&&!this.bsRequired.intersects(k)||this.matchAllAtoms&&k.cardinality()!=this.selectedAtomCount)return!0;if(null!=this.bsCheck)if(c){this.bsCheck.clearAll();for(j=0;j<this.ac;j++)this.bsCheck.set(this.patternAtoms[j].getMatchingAtom());
if(this.bsCheck.cardinality()!=this.ac)return!0}else if(k.cardinality()!=this.ac)return!0;this.bsReturn.or(k);if(this.getMaps){a=v(f,0);for(k=j=0;j<this.ac;j++)if(c||!this.top.haveSelected||this.patternAtoms[j].selected)a[k++]=this.patternAtoms[j].getMatchingAtom();this.vReturn.addLast(a);return!this.firstMatchOnly}if(this.asVector){c=!0;for(j=this.vReturn.size();0<=--j&&c;)c=!this.vReturn.get(j).equals(k);if(!c)return!0;this.vReturn.addLast(k)}if(this.isRingCheck){this.ringSets.append(" ");for(d=
3*a+2;--d>a;)this.ringSets.append("-").appendI(this.patternAtoms[(d<=2*a?2*a-d+1:d-1)%a].getMatchingAtom());this.ringSets.append("- ");return!0}return this.firstMatchOnly?!1:k.cardinality()!=this.selectedAtomCount},"~N,~N,~B");g(c$,"clearBsFound",function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");g(c$,"getHydrogens",function(a,b){for(var c=a.getEdges(),d=-1,e=0;e<c.length;e++)if(1==this.jmolAtoms[a.getBondedAtomIndex(e)].getElementNumber()){d=a.getBondedAtomIndex(e);
if(null==b)break;b.set(d)}return 0<=d?this.jmolAtoms[d]:null},"JU.Node,JU.BS");g(c$,"checkPrimitiveAtom",function(a,b){for(var c=this.jmolAtoms[b],d=a.not;;){var e;if(0<a.iNested){d=this.getNested(a.iNested);L(d,JS.SmilesSearch)&&(a.isBioAtom&&(d.nestedBond=a.getBondTo(null)),d=this.subsearch(d,!0,!1),null==d&&(d=new JU.BS),a.isBioAtom||this.setNested(a.iNested,d));d=a.not!=d.get(b);break}if(a.isBioAtom){e=c;if(null!=a.atomName&&(a.isLeadAtom()?!e.isLeadAtom():!a.atomName.equals(e.getAtomName().toUpperCase())))break;
if(a.notCrossLinked&&e.getCrossLinkLeadAtomIndexes(null))break;if(null!=a.residueName&&!a.residueName.equals(e.getGroup3(!1).toUpperCase()))break;if(null!=a.residueChar){if(a.isDna()&&!e.isDna()||a.isRna()&&!e.isRna()||a.isProtein()&&!e.isProtein()||a.isNucleic()&&!e.isNucleic())break;var f=e.getGroup1("\x00").toUpperCase(),f=a.residueChar.equals(f);switch(a.residueChar.charAt(0)){case "N":f=a.isNucleic()?e.isNucleic():f;break;case "R":f=a.isNucleic()?e.isPurine():f;break;case "Y":f=a.isNucleic()?
e.isPyrimidine():f}if(!f)break}if(0<=a.elementNumber&&a.elementNumber!=c.getElementNumber())break}else{if(null!=a.atomName&&!a.atomName.equals(c.getAtomName().toUpperCase()))break;if(0<=a.jmolIndex&&c.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(c.getAtomType()))break;if(0<=a.elementNumber&&a.elementNumber!=c.getElementNumber())break;e=a.isAromatic();if(!this.noAromatic&&!a.aromaticAmbiguous&&e!=this.bsAromatic.get(b))break;if(-2147483648!=(e=a.getAtomicMass()))if(f=c.getIsotopeNumber(),
0<=e&&e!=f||0>e&&0!=f&&-e!=f)break;if(-2147483648!=(e=a.getCharge())&&e!=c.getFormalCharge())break;e=a.getCovalentHydrogenCount()+a.missingHydrogenCount;if(0<=e&&e!=c.getCovalentHydrogenCount())break;e=a.implicitHydrogenCount;if(-2147483648!=e&&(f=c.getImplicitHydrogenCount(),-1==e?0==f:e!=f))break;if(0<a.degree&&a.degree!=c.getCovalentBondCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=c.getCovalentBondCount()-c.getCovalentHydrogenCount())break;if(0<a.valence&&a.valence!=c.getValence())break;
if(0<a.connectivity&&a.connectivity!=c.getCovalentBondCount()+c.getImplicitHydrogenCount())break;if(null!=this.ringData&&-1<=a.ringSize)if(0>=a.ringSize){if(0==this.ringCounts[b]!=(0==a.ringSize))break}else{c=this.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];if(null==c||!c.get(b))break;if(!this.noAromatic)if(500==a.ringSize){if(!this.bsAromatic5.get(b))break}else if(600==a.ringSize&&!this.bsAromatic6.get(b))break}if(null!=this.ringData&&-1<=a.ringMembership&&(-1==a.ringMembership?0==this.ringCounts[b]:
this.ringCounts[b]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(e=this.ringConnections[b],-1==a.ringConnectivity&&0==e||-1!=a.ringConnectivity&&e!=a.ringConnectivity))break}d=!d;break}return d},"JS.SmilesAtom,~N");g(c$,"checkMatchBond",function(a,b,c,d,e,f){if(null!=c.bondsOr){for(var k=0;k<c.nBondsOr;k++)if(this.checkMatchBond(a,b,c.bondsOr[k],d,e,f))return!0;return!1}if(null==c.primitives){if(!this.checkPrimitiveBond(c,d,e,f))return!1}else for(a=0;a<c.nPrimitives;a++)if(!this.checkPrimitiveBond(c.primitives[a],
d,e,f))return!1;c.matchingBond=f;return!0},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesBond,~N,~N,JU.Edge");g(c$,"checkPrimitiveBond",function(a,b,c,d){var e=!1;switch(a.order){case 96:return a.isNot!=(this.bioAtoms[c].getOffsetResidueAtom("0",1)==this.bioAtoms[b].getOffsetResidueAtom("0",0));case 112:return a.isNot!=this.bioAtoms[b].isCrossLinked(this.bioAtoms[c])}var f=!this.noAromatic&&this.bsAromatic.get(b),k=!this.noAromatic&&this.bsAromatic.get(c);d=d.getCovalentOrder();if(f&&k)switch(a.order){case 17:case 65:e=
JS.SmilesSearch.isRingBond(this.ringSets,b,c);break;case 1:e=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.ringSets,b,c);break;case 2:e=!this.isSmarts||this.aromaticDouble&&(2==d||514==d);break;case 769:case 1025:case 81:case -1:e=!0}else switch(a.order){case 81:case -1:e=!0;break;case 1:case 257:case 513:e=1==d||1041==d||1025==d;break;case 769:e=d==(this.isSmilesFind?33:1);break;case 1025:e=d==(this.isSmilesFind?97:1);break;case 2:e=2==d;break;case 3:e=3==d;break;case 65:e=JS.SmilesSearch.isRingBond(this.ringSets,
b,c)}return e!=a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");c$.isRingBond=g(c$,"isRingBond",function(a,b,c){return null!=a&&0<=a.indexOf("-"+b+"-"+c+"-")},"JU.SB,~N,~N");g(c$,"checkStereochemistry",function(){for(var a=0;a<this.measures.size();a++)if(!this.measures.get(a).check())return!1;if(this.haveAtomStereochemistry){JU.Logger.debugging&&JU.Logger.debug("checking stereochemistry...");for(var b=null,c=null,d=null,e=null,f=null,k=null,j=c=null,a=0;a<this.ac;a++){var h=this.patternAtoms[a],g=this.jmolAtoms[h.getMatchingAtom()],
k=h.missingHydrogenCount;0>k&&(k=0);var l=h.getChiralClass();if(-2147483648!=l){var n=h.getChiralOrder();if(this.isSmilesFind&&g.getAtomSite()>>8!=l)return!1;JU.Logger.debugging&&JU.Logger.debug("...type "+l+" for pattern atom "+h+" "+g);switch(l){case 2:c=h.getBond(0).getOtherAtom(h);j=h.getBond(1).getOtherAtom(h);if(null==c||null==j)continue;for(d=b=h;2==c.getBondCount()&&2==j.getBondCount()&&4==c.getValence()&&4==j.getValence();)h=c.getBondNotTo(b,!0),b=c,c=h.getOtherAtom(c),h=j.getBondNotTo(d,
!0),d=j,j=h.getOtherAtom(j);h=c;e=Array(6);e[4]=(new JS.SmilesAtom).setIndex(604);d=h.getBondCount();for(b=0;b<d;b++)c=h.bonds[b].getOtherAtom(h),2==h.bonds[b].matchingBond.getCovalentOrder()?null==j&&(j=c):null==e[0]?e[0]=this.getJmolAtom(c.getMatchingAtom()):e[1]=this.getJmolAtom(c.getMatchingAtom());if(null==j)continue;d=j.getBondCount();if(2>d||3<d)continue;for(b=0;b<d;b++)c=j.bonds[b].getOtherAtom(j),2!=j.bonds[b].matchingBond.getCovalentOrder()&&(null==e[2]?e[2]=this.getJmolAtom(c.getMatchingAtom()):
e[3]=this.getJmolAtom(c.getMatchingAtom()));if(this.isSmilesFind&&(null==e[1]&&this.getX(h,e,1,!1,!0),null==e[3]&&this.getX(j,e,3,!1,!1),!this.setSmilesCoordinates(g,h,j,e)))return!1;null==e[1]&&this.getX(h,e,1,!0,!1);null==e[3]&&this.getX(j,e,3,!0,!1);if(!JS.SmilesSearch.checkStereochemistryAll(h.not,g,l,n,e[0],e[1],e[2],e[3],null,null,this.v))return!1;continue;case 4:case 8:case 5:case 6:b=this.getJmolAtom(h.getMatchingBondedAtom(0));switch(k){case 0:c=this.getJmolAtom(h.getMatchingBondedAtom(1));
break;case 1:c=this.getHydrogens(this.getJmolAtom(h.getMatchingAtom()),null);h.isFirst&&(d=c,c=b,b=d);break;default:continue}d=this.getJmolAtom(h.getMatchingBondedAtom(2-k));e=this.getJmolAtom(h.getMatchingBondedAtom(3-k));f=this.getJmolAtom(h.getMatchingBondedAtom(4-k));k=this.getJmolAtom(h.getMatchingBondedAtom(5-k));if(this.isSmilesFind&&!this.setSmilesCoordinates(g,h,j,[b,c,d,e,f,k])||!JS.SmilesSearch.checkStereochemistryAll(h.not,g,l,n,b,c,d,e,f,k,this.v))return!1}}}}if(this.haveBondStereochemistry)for(b=
0;b<this.ac;b++){c=this.patternAtoms[b];e=f=j=null;l=g=a=0;d=c.getBondCount();n=!1;for(k=0;k<d;k++){var h=c.getBond(k),r=h.getAtom2()===c,m=h.order;switch(m){case 769:case 1025:case 2:if(r)continue;j=h.getAtom2();l=m;(n=2!=m)&&(a=h.isNot?-1:1);break;case 257:case 513:f=r?h.getAtom1():h.getAtom2(),a=r!=(257==m)?1:-1}}if(n){h=c.getBondNotTo(j,!1);if(null==h)return!1;f=h.getOtherAtom(c);h=j.getBondNotTo(c,!1);if(null==h)return!1;e=h.getOtherAtom(j)}else{if(null==j||0==a)continue;d=j.getBondCount();for(k=
0;k<d&&0==g;k++)switch(h=j.getBond(k),r=h.getAtom2()===j,m=h.order,m){case 257:case 513:e=r?h.getAtom1():h.getAtom2(),g=r!=(257==m)?1:-1}if(0==g)continue}this.isSmilesFind&&this.setSmilesBondCoordinates(c,j,l);c=this.getJmolAtom(c.getMatchingAtom());j=this.getJmolAtom(j.getMatchingAtom());h=this.getJmolAtom(f.getMatchingAtom());d=this.getJmolAtom(e.getMatchingAtom());if(null==h||null==d)return!1;JS.SmilesMeasure.setTorsionData(h,c,j,d,this.v,n);if(n){if(g=769==l?1:-1,j=this.v.vTemp1.dot(this.v.vTemp2),
0.05>j||0.95<j||0<this.v.vNorm1.dot(this.v.vNorm2)*a*g)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*a*g)return!1}return!0});g(c$,"getX",function(a,b,c,d,e){var f=this.getJmolAtom(a.getMatchingAtom()),k=a.isFirst||3==c;if(d){if(this.isSmarts){var j=f.getEdges();for(d=0;d<j.length;d++)if(2!=j[d].getCovalentOrder()){var h=this.jmolAtoms[f.getBondedAtomIndex(d)];if(h!==b[c-1]){b[c]=h;break}}}if(null==b[c]){j=new JU.V3;for(d=h=0;4>d;d++)null!=b[d]&&(h++,j.sub(b[d]));0==j.length()?(j.setT(b[4]),
k=!1):(j.scaleAdd2(h+1,this.getJmolAtom(a.getMatchingAtom()),j),k=this.isSmilesFind||k);b[c]=(new JS.SmilesAtom).setIndex(-1);b[c].setT(j)}}null==b[c]&&(b[c]=this.getHydrogens(f,null),e&&(k=!0));null!=b[c]&&k&&(h=b[c],b[c]=b[c-1],b[c-1]=h)},"JS.SmilesAtom,~A,~N,~B,~B");c$.checkStereochemistryAll=g(c$,"checkStereochemistryAll",function(a,b,c,d,e,f,k,j,h,g,l){switch(c){default:case 2:case 4:return a==(JS.SmilesSearch.getHandedness(f,k,j,e,l)!=d);case 5:return a==(!JS.SmilesSearch.isDiaxial(b,b,h,e,
l,-0.95)||JS.SmilesSearch.getHandedness(f,k,j,e,l)!=d);case 6:if(a!=!JS.SmilesSearch.isDiaxial(b,b,g,e,l,-0.95))return!1;JS.SmilesSearch.getPlaneNormals(f,k,j,h,l);if(a!=(0>l.vNorm1.dot(l.vNorm2)||0>l.vNorm2.dot(l.vNorm3)))return!1;l.vNorm2.sub2(b,e);return a==((0>l.vNorm1.dot(l.vNorm2)?2:1)==d);case 8:return JS.SmilesSearch.getPlaneNormals(e,f,k,j,l),0>l.vNorm1.dot(l.vNorm2)?a==(3!=d):0>l.vNorm2.dot(l.vNorm3)?a==(2!=d):a==(1!=d)}},"~B,JU.Node,~N,~N,JU.Node,JU.Node,JU.Node,JU.Node,JU.Node,JU.Node,JS.VTemp");
g(c$,"getJmolAtom",function(a){return 0>a||a>=this.jmolAtoms.length?null:this.jmolAtoms[a]},"~N");g(c$,"setSmilesBondCoordinates",function(a,b,c){a=this.jmolAtoms[a.getMatchingAtom()];b=this.jmolAtoms[b.getMatchingAtom()];a.set(-1,0,0);b.set(1,0,0);if(2==c){var d=0,e=0;c=a.getEdges();for(var f=c.length;0<=--f;){var k=c[f],j=k.getOtherAtomNode(a);if(j!==b)switch(j.set(-1,0==d++?-1:1,0),j=k.getAtomIndex2()==a.getIndex()?d:-d,k.order){case 1025:e=j;break;case 1041:e=-j}}var h=0,d=0,g=Array(2);c=b.getEdges();
for(f=c.length;0<=--f;)if(k=c[f],j=k.getOtherAtomNode(b),j!==a)switch(g[d]=j,j.set(1,0==d++?1:-1,0),j=k.getAtomIndex2()==b.getIndex()?d:-d,k.order){case 1025:h=j;break;case 1041:h=-j}0<e*h==(Math.abs(e)%2==Math.abs(h)%2)&&(a=g[0].y,g[0].y=g[1].y,g[1].y=a)}else{c=a.getEdges();g=0;for(f=c.length;0<=--f;)if(k=c[f],k.getOtherAtomNode(a)===b){g=33==k.order?1:-1;break}for(f=c.length;0<=--f;)k=c[f],j=k.getOtherAtomNode(a),j!==b&&j.set(-1,1,0);c=b.getEdges();for(f=c.length;0<=--f;)k=c[f],j=k.getOtherAtomNode(b),
j!==a&&j.set(1,1,-g/2)}},"JS.SmilesAtom,JS.SmilesAtom,~N");g(c$,"setSmilesCoordinates",function(a,b,c,d){var e=a.getAtomSite();if(-2147483648==e)return!1;var f=e>>8,e=e&255;c=2==f||3==f?c=this.jmolAtoms[c.getMatchingAtom()]:null;a.set(0,0,0);a=this.jmolAtoms[b.getMatchingAtom()];a.set(0,0,0);a=this.getMappedAtoms(a,c,d);switch(f){case 2:case 4:2==e&&(e=a[0],a[0]=a[1],a[1]=e);d[a[0]].set(0,0,1);d[a[1]].set(1,0,-1);d[a[2]].set(0,1,-1);d[a[3]].set(-1,-1,-1);break;case 8:switch(e){case 1:d[a[0]].set(1,
0,0);d[a[1]].set(0,1,0);d[a[2]].set(-1,0,0);d[a[3]].set(0,-1,0);break;case 2:d[a[0]].set(1,0,0);d[a[1]].set(-1,0,0);d[a[2]].set(0,1,0);d[a[3]].set(0,-1,0);break;case 3:d[a[0]].set(1,0,0),d[a[1]].set(0,1,0),d[a[2]].set(0,-1,0),d[a[3]].set(-1,0,0)}break;case 5:case 6:f=a.length,2==e&&(e=a[0],a[0]=a[f-1],a[f-1]=e),d[a[0]].set(0,0,1),d[a[f-1]].set(0,0,-1),d[a[1]].set(1,0,0),d[a[2]].set(0,1,0),d[a[3]].set(-1,0,0),6==f&&d[a[4]].set(0,-1,0)}return!0},"JU.Node,JS.SmilesAtom,JS.SmilesAtom,~A");g(c$,"getMappedAtoms",
function(a,b,c){for(var d=v(null==c[4]?4:null==c[5]?5:6,0),e=0;e<d.length;e++)d[e]=null==c[e]?104+100*e:c[e].getIndex();for(var f,k=a.getEdges(),j=null==b?null:b.getEdges(),e=0;e<d.length;e++){for(f=0;f<k.length&&k[f].getOtherAtomNode(a)!==c[e];f++);if(f<k.length)d[e]=10*f+100+e;else if(null!=b){for(f=0;f<j.length&&j[f].getOtherAtomNode(b)!==c[e];f++);f<j.length&&(d[e]=10*f+300+e)}}java.util.Arrays.sort(d);for(e=0;e<d.length;e++)d[e]%=10;return d},"JU.Node,JU.Node,~A");c$.isDiaxial=g(c$,"isDiaxial",
function(a,b,c,d,e,f){e.vA.sub2(a,c);e.vB.sub2(b,d);e.vA.normalize();e.vB.normalize();return e.vA.dot(e.vB)<f},"JU.Node,JU.Node,JU.Node,JU.Node,JS.VTemp,~N");c$.getHandedness=g(c$,"getHandedness",function(a,b,c,d,e){a=JS.SmilesAromatic.getNormalThroughPoints(a,b,c,e.vTemp,e.vA,e.vB);return 0<JS.SmilesSearch.distanceToPlane(e.vTemp,a,d)?1:2},"JU.Node,JU.Node,JU.Node,JU.Node,JS.VTemp");c$.getPlaneNormals=g(c$,"getPlaneNormals",function(a,b,c,d,e){JS.SmilesAromatic.getNormalThroughPoints(a,b,c,e.vNorm1,
e.vTemp1,e.vTemp2);JS.SmilesAromatic.getNormalThroughPoints(b,c,d,e.vNorm2,e.vTemp1,e.vTemp2);JS.SmilesAromatic.getNormalThroughPoints(c,d,a,e.vNorm3,e.vTemp1,e.vTemp2)},"JU.Node,JU.Node,JU.Node,JU.Node,JS.VTemp");c$.distanceToPlane=g(c$,"distanceToPlane",function(a,b,c){return null==a?NaN:(a.x*c.x+a.y*c.y+a.z*c.z+b)/Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},"JU.V3,~N,JU.P3");g(c$,"createTopoMap",function(a){null==a&&(a=new JU.BS);var b=this.getMissingHydrogenCount();this.jmolAtoms=b=Array(this.ac+b);for(var c=
0,d=new JU.BS,e=0;e<this.ac;e++){var f=this.patternAtoms[e],k=f.getChiralClass(),j=f.missingHydrogenCount;0>j&&(j=0);var h=b[c]=(new JS.SmilesAtom).setAll(0,c,-2147483648==k?k:(k<<8)+f.getChiralOrder(),f.elementNumber,f.getCharge());h.atomName=f.atomName;h.residueName=f.residueName;h.residueChar=f.residueChar;h.isBioAtom=f.isBioAtom;h.$isLeadAtom=f.$isLeadAtom;h.setAtomicMass(f.getAtomicMass());f.isAromatic()&&a.set(c);!f.isFirst&&(1==j&&0<k)&&d.set(c);f.setMatchingAtom(c++);f=Array(f.getBondCount()+
j);for(h.setBonds(f);0<=--j;)f=b[c]=(new JS.SmilesAtom).setAll(0,c,0,1,0),c++,f.setBonds(Array(1)),k=new JS.SmilesBond(h,f,1,!1),JU.Logger.info(""+k)}for(e=0;e<this.ac;e++){f=this.patternAtoms[e];j=f.getMatchingAtom();a=b[j];j=f.getBondCount();for(c=0;c<j;c++)if(h=f.getBond(c),h.getAtom1()===f){k=1;switch(h.order){case 769:k=33;break;case 1025:k=97;break;case 257:k=1025;break;case 513:k=1041;break;case 112:case 96:k=h.order;break;case 1:k=1;break;case 17:k=514;break;case 2:k=2;break;case 3:k=3}h=
b[h.getAtom2().getMatchingAtom()];k=new JS.SmilesBond(a,h,k,!1);h.bondCount--;JU.Logger.info(""+k)}else h=b[h.getAtom1().getMatchingAtom()],k=h.getBondTo(a),a.addBond(k)}for(e=d.nextSetBit(0);0<=e;e=d.nextSetBit(e+1))f=b[e].getEdges(),k=f[0],f[0]=f[1],f[1]=k},"JU.BS");g(c$,"setTop",function(a){this.top=null==a?this:a.getTop()},"JS.SmilesSearch");g(c$,"getTop",function(){return this.top===this?this:this.top.getTop()});g(c$,"getSelections",function(){var a=this.top.htNested;if(!(null==a||0==this.jmolAtoms.length))for(var b=
new java.util.Hashtable,c,a=a.entrySet().iterator();a.hasNext()&&((c=a.next())||1);){var d=c.getValue().toString();if(d.startsWith("select")){var e=b.containsKey(d)?b.get(d):this.smartsAtoms[0].findAtomsLike(d.substring(6));null==e&&(e=new JU.BS);b.put(d,e);c.setValue(e)}}});I(c$,"INITIAL_ATOMS",16)});B("JS");E(["java.util.Hashtable","JU.BS","JS.VTemp"],"JS.SmilesGenerator","JU.Lst $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesParser $.SmilesSearch JU.BNode $.BSUtil $.Elements $.JmolMolecule $.Logger".split(" "),
function(){c$=G(function(){this.atoms=null;this.ac=0;this.bsAromatic=this.bsSelected=null;this.explicitH=!1;this.vTemp=this.ringSets=null;this.nPairs=0;this.bsIncludingH=this.htRings=this.htRingsSequence=this.prevSp2Atoms=this.prevAtom=this.bsToDo=this.bsBondsDn=this.bsBondsUp=null;F(this,arguments)},JS,"SmilesGenerator");K(c$,function(){this.vTemp=new JS.VTemp;this.bsBondsUp=new JU.BS;this.bsBondsDn=new JU.BS;this.htRingsSequence=new java.util.Hashtable;this.htRings=new java.util.Hashtable});g(c$,
"getSmiles",function(a,b,c,d){var e=c.nextSetBit(0);if(0>e)return"";this.atoms=a;this.ac=b;this.bsSelected=c=JU.BSUtil.copy(c);this.explicitH=d;return this.getSmilesComponent(a[e],c,!1)},"~A,~N,JU.BS,~B");g(c$,"getBioSmiles",function(a,b,c,d,e,f){this.atoms=a;this.ac=b;b=new JU.SB;c=JU.BSUtil.copy(c);null!=f&&b.append("//* Jmol bioSMILES ").append(f.$replace("*","_")).append(" *//");f="\n";var k=new JU.BS,j=null,h,g=new JU.Lst;try{for(var l=0,n=c.nextSetBit(0);0<=n;n=c.nextSetBit(n+1)){var r=a[n],
m=r.getGroup1("?"),p=r.getBioStructureTypeName(),t=m.equals("?");if(null!=f)if(0<b.length()&&b.append(f),f=null,l=0,0<p.length)0!=r.getChainID()&&(h="//* chain "+r.getChainIDStr()+" "+p+" "+r.getResno()+" *// ",l=h.length,b.append(h)),b.append("~").appendC(p.charAt(0)).append("~"),l++;else{h=this.getSmilesComponent(r,c,!0);if(h.equals(j))f="";else{var j=h,q=r.getGroup3(!0);null!=q&&b.append("//* ").append(q).append(" *//");b.append(h);f=".\n"}continue}75<=l&&(b.append("\n "),l=2);t?this.addBracketedBioName(b,
r,0<p.length?".0":null):b.append(m);l++;var s=r.getOffsetResidueAtom("0",0);if(e){r.getCrossLinkLeadAtomIndexes(g);for(var z=0;z<g.size();z++)b.append(":"),h=this.getRingCache(s,g.get(z).intValue(),this.htRingsSequence),b.append(h),l+=1+h.length;g.clear()}r.getGroupBits(k);c.andNot(k);var x=r.getOffsetResidueAtom("0",1);if(0>x||!c.get(x)){b.append(" //* ").appendI(r.getResno()).append(" *//");if(0>x&&0>(x=c.nextSetBit(n+1)))break;0<l&&(f=".\n")}n=x-1}}catch(A){if(H(A,Exception))throw new JS.InvalidSmilesException("//* error: "+
A.getMessage()+" *//");throw A;}if(!d&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(b,this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");h=b.toString();h.endsWith(".\n")&&(h=h.substring(0,h.length-2));return h},"~A,~N,JU.BS,~B,~B,~S");g(c$,"addBracketedBioName",function(a,b,c){a.append("[");if(null!=c&&L(b,JU.BNode)){var d=b.getChainIDStr();a.append(b.getGroup3(!1));c.equals(".0")||a.append(c).append("#").appendI(b.getElementNumber());a.append("//* ").appendI(b.getResno());
0<d.length&&a.append(":").append(d);a.append(" *//")}else a.append(JU.Elements.elementNameFromNumber(b.getElementNumber()));a.append("]")},"JU.SB,JU.Node,~S");g(c$,"getSmilesComponent",function(a,b,c){!this.explicitH&&(1==a.getElementNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);this.bsSelected=JU.JmolMolecule.getBranchBitSet(this.atoms,a.getIndex(),JU.BSUtil.copy(b),null,-1,!0,!1);b.andNot(this.bsSelected);this.bsIncludingH=JU.BSUtil.copy(this.bsSelected);if(!this.explicitH)for(b=
this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1)){var d=this.atoms[b];1==d.getElementNumber()&&0==d.getIsotopeNumber()&&this.bsSelected.clear(b)}2<this.bsSelected.cardinality()?(b=null,b=JS.SmilesParser.getMolecule("A[=&@]A",!0),b.jmolAtoms=this.atoms,L(this.atoms,Array)&&(b.bioAtoms=this.atoms),b.setSelected(this.bsSelected),b.jmolAtomCount=this.ac,b.ringDataMax=7,b.setRingData(null),this.bsAromatic=b.bsAromatic,this.ringSets=b.ringSets,this.setBondDirections()):this.bsAromatic=
new JU.BS;this.bsToDo=JU.BSUtil.copy(this.bsSelected);b=new JU.SB;for(d=this.bsToDo.nextSetBit(0);0<=d;d=this.bsToDo.nextSetBit(d+1))4<this.atoms[d].getCovalentBondCount()&&(this.getSmiles(b,this.atoms[d],c,!1,this.explicitH),a=null);if(null!=a)for(;null!=(a=this.getSmiles(b,a,c,!0,this.explicitH)););for(;0<this.bsToDo.cardinality()||!this.htRings.isEmpty();){a=this.htRings.values().iterator();if(a.hasNext()){if(a=this.atoms[a.next()[1].intValue()],!this.bsToDo.get(a.getIndex()))break}else a=this.atoms[this.bsToDo.nextSetBit(0)];
b.append(".");for(this.prevAtom=this.prevSp2Atoms=null;null!=(a=this.getSmiles(b,a,c,!0,this.explicitH)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(b,this.htRings),new JS.InvalidSmilesException("//* ?ring error? *//\n"+b);return b.toString()},"JU.Node,JU.BS,~B");g(c$,"getBondStereochemistry",function(a,b){if(null==a)return"\x00";var c=a.index,d=null==b||a.getAtomIndex1()==b.getIndex();return this.bsBondsUp.get(c)?d?"/":"\\":this.bsBondsDn.get(c)?d?"\\":"/":"\x00"},"JU.Edge,JU.Node");g(c$,
"setBondDirections",function(){for(var a=new JU.BS,b=S(2,3,null),c=this.bsSelected.nextSetBit(0);0<=c;c=this.bsSelected.nextSetBit(c+1))for(var d=this.atoms[c],e=d.getEdges(),f=0;f<e.length;f++){var k=e[f],j=k.index;if(!a.get(j)){var h=k.getOtherAtomNode(d);if(!(2!=k.getCovalentOrder()||JS.SmilesSearch.isRingBond(this.ringSets,c,h.getIndex()))){a.set(j);var g=k=null,j=0,l=[d,h];JU.Logger.debugging&&JU.Logger.debug(d+" == "+h);g=1;for(h=0;2>h&&0<g&&3>g;h++)for(var g=0,n=l[h],r=n.getEdges(),m=0;m<r.length;m++)1==
r[m].getCovalentOrder()&&(b[h][g++]=r[m],"\x00"!=this.getBondStereochemistry(r[m],n)&&(k=r[m],j=h));if(!(3==g||0==g))if(null==k&&(j=0,k=b[j][0],this.bsBondsUp.set(k.index)),n=this.getBondStereochemistry(k,l[j]),g=k.getOtherAtomNode(l[j]),null!=g)for(h=0;2>h;h++)for(r=0;2>r;r++)if(m=b[h][r],!(null==m||m===k)){var p=m.index,t=m.getOtherAtomNode(l[h]);if(null!=t){var q=this.getBondStereochemistry(m,l[h]),s=JS.SmilesSearch.isDiaxial(l[j],l[h],g,t,this.vTemp,0);"\x00"==q||q!=n==s?("\\"==n&&s||"/"==n&&
!s)==(m.getAtomIndex1()!=t.getIndex())?this.bsBondsUp.set(p):this.bsBondsDn.set(p):JU.Logger.error("BOND STEREOCHEMISTRY ERROR");JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(k,l[0])+" "+g.getIndex()+" "+t.getIndex()+" "+this.getBondStereochemistry(m,l[h]))}}}}}});g(c$,"getSmiles",function(a,b,c,d,e){var f=b.getIndex();if(!this.bsToDo.get(f))return null;this.bsToDo.clear(f);var k=!this.bsSelected.get(f),j=null==this.prevAtom?-1:this.prevAtom.getIndex(),h=this.bsAromatic.get(f),
g=null!=this.prevSp2Atoms,l=this.prevSp2Atoms,n=0,m=b.getElementNumber(),w=0,p=new JU.Lst,t=null,q=null,s=b.getEdges(),z=null,x=h?10:0,A=Array(7);JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=s)for(var u=s.length;0<=--u;){var y=s[u];if(y.isCovalent()){var C=s[u].getOtherAtomNode(b),y=C.getIndex();if(y==j)q=s[u];else{var D=!e&&1==C.getElementNumber()&&0==C.getIsotopeNumber();if(!this.bsIncludingH.get(y))if(!D&&c&&this.bsSelected.get(f))this.bsToDo.set(y);else continue;D?(z=C,w++,1<w&&
(x=10)):p.addLast(s[u])}}}s=null;null==l&&(l=Array(5));null!=q&&(s=JS.SmilesBond.getBondOrderString(q.getCovalentOrder()),null==this.prevSp2Atoms?l[n++]=this.prevAtom:n=2);var n=n+w,j=0,B=new JU.BS;if(d)for(u=0;u<p.size();u++){var y=p.get(u),D=y.getOtherAtomNode(b),C=D.getCovalentBondCount()-(e?0:D.getCovalentHydrogenCount()),v=y.getCovalentOrder();if(1==v&&1==C&&u<p.size()-(null==t?1:0))B.set(y.index);else if((1<v||C>j)&&!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(D.getIndex(),f)))j=
1<v?1E3+v:C,t=y}j=null==t?null:t.getOtherAtomNode(b);C=null==t?0:t.getCovalentOrder();7>x&&null!=q&&(2==q.getCovalentOrder()&&2==C&&null!=this.prevSp2Atoms&&null!=this.prevSp2Atoms[1]?(A[x++]=this.prevSp2Atoms[0],A[x++]=this.prevSp2Atoms[1]):A[x++]=this.prevAtom);7>x&&1==w&&(A[x++]=z);z=1==C&&null==this.prevSp2Atoms;v=this.getBondStereochemistry(q,this.prevAtom);q=new JU.SB;for(u=0;u<p.size();u++)y=p.get(u),B.get(y.index)&&(D=y.getOtherAtomNode(b),y=new JU.SB,y.append("("),this.prevAtom=b,this.prevSp2Atoms=
null,this.getSmiles(y,D,c,d,e),y.append(")"),0<=q.indexOf(y.toString())&&(x=10),q.appendSB(y),p.remove(u--),7>x&&(A[x++]=D),5>n&&(l[n++]=D));u=2==C?j.getIndex():-1;if(1<w||h||0>u||JS.SmilesSearch.isRingBond(this.ringSets,f,u))n=-1;0>n&&(l=null);if(null!=s||"\x00"!=v)"\x00"!=v&&(s=""+v),a.append(s);c=null;if(!d&&(5==p.size()||6==p.size()))c=this.sortInorganic(b,p);for(u=0;u<p.size();u++)y=p.get(u),y!==t&&(D=y.getOtherAtomNode(b),d=this.getRingCache(f,D.getIndex(),this.htRings),s=JS.SmilesBond.getBondOrderString(y.order),
z||(v=this.getBondStereochemistry(y,b),"\x00"!=v&&(s=""+v)),q.append(s),q.append(d),7>x&&(A[x++]=D),null!=l&&5>n&&(l[n++]=D));if(g&&2==x&&2==C&&3==j.getCovalentBondCount()){s=j.getEdges();for(n=0;n<s.length;n++)s[n].isCovalent()&&j.getBondedAtomIndex(n)!=f&&(A[x++]=this.atoms[j.getBondedAtomIndex(n)]);n=0}else null!=j&&7>x&&(A[x++]=j);g=b.getFormalCharge();p=b.getIsotopeNumber();d=b.getValence();u=b.getAtomName();e=L(b,JU.BNode)?b.getBioStructureTypeName():"";JU.Logger.debugging&&a.append("\n//* "+
b+" *//\t");k&&0!=e.length&&0!=u.length?this.addBracketedBioName(a,b,"."+u):a.append(JS.SmilesAtom.getAtomLabel(m,p,d,g,w,h,null!=c?c:this.checkStereoPairs(b,f,A,x)));a.appendSB(q);if(null==t)return null;2==C&&(1==n||2==n)?(null==l[0]&&(l[0]=b),null==l[1]&&(l[1]=b)):l=null;this.prevSp2Atoms=l;this.prevAtom=b;return j},"JU.SB,JU.Node,~B,~B,~B");g(c$,"sortInorganic",function(a,b){for(var c=a.getIndex(),d=b.size(),e=new JU.Lst,f=new JU.Lst,k,j,h,g,l=new JU.BS,n=null,m=Array(6),n=!0,w="",p=0;p<d;p++)if(h=
b.get(p),m[0]=k=h.getOtherAtomNode(a),0==p?w=this.addStereoCheck(c,m,0,""):n&&null!=this.addStereoCheck(c,m,0,w)&&(n=!1),!l.get(p)){l.set(p);for(var t=!1,q=p+1;q<d;q++)if(!l.get(q)&&(g=b.get(q),j=g.getOtherAtomNode(a),JS.SmilesSearch.isDiaxial(a,a,k,j,this.vTemp,-0.95))){e.addLast([h,g]);t=!0;l.set(q);break}t||f.addLast(h)}c=e.size();if(n||6==d&&3!=c||5==d&&0==c)return"";n=e.get(0);h=n[0];m[0]=h.getOtherAtomNode(a);b.clear();b.addLast(h);1<c&&f.addLast(e.get(1)[0]);3==c&&f.addLast(e.get(2)[0]);1<
c&&f.addLast(e.get(1)[1]);3==c&&f.addLast(e.get(2)[1]);for(p=0;p<f.size();p++)h=f.get(p),b.addLast(h),m[p+1]=h.getOtherAtomNode(a);b.addLast(n[1]);return JS.SmilesGenerator.getStereoFlag(a,m,d,this.vTemp)},"JU.Node,JU.Lst");g(c$,"checkStereoPairs",function(a,b,c,d){if(4>d)return"";if(4==d&&6==a.getElementNumber())for(var e="",f=0;4>f;f++)if(null==(e=this.addStereoCheck(b,c,f,e))){d=10;break}return 6<d?"":JS.SmilesGenerator.getStereoFlag(a,c,d,this.vTemp)},"JU.Node,~N,~A,~N");c$.getStereoFlag=g(c$,
"getStereoFlag",function(a,b,c,d){var e=b[0],f=b[1],k=b[2],j=b[3],h=b[4];b=b[5];var g=4;switch(c){default:case 5:case 6:return JS.SmilesSearch.checkStereochemistryAll(!1,a,g,1,e,f,k,j,h,b,d)?"@":"@@";case 2:case 4:if(null==k||null==j)break;c=JS.SmilesAromatic.getNormalThroughPoints(e,f,k,d.vTemp,d.vA,d.vB);if(0.2>Math.abs(JS.SmilesSearch.distanceToPlane(d.vTemp,c,j))){g=8;if(JS.SmilesSearch.checkStereochemistryAll(!1,a,g,1,e,f,k,j,h,b,d))return"@SP1";if(JS.SmilesSearch.checkStereochemistryAll(!1,
a,g,2,e,f,k,j,h,b,d))return"@SP2";if(JS.SmilesSearch.checkStereochemistryAll(!1,a,g,3,e,f,k,j,h,b,d))return"@SP3"}else return JS.SmilesSearch.checkStereochemistryAll(!1,a,g,1,e,f,k,j,h,b,d)?"@":"@@"}return""},"JU.Node,~A,~N,JS.VTemp");g(c$,"addStereoCheck",function(a,b,c,d){var e=b[c].getAtomicAndIsotopeNumber(),f=b[c].getCovalentBondCount(),k=6==e&&!this.explicitH?b[c].getCovalentHydrogenCount():0;if(6==e?4!=f||3!=k:1<f)return d;e=";"+e+"/"+k+"/"+f+",";if(0<=d.indexOf(e)){if(3==k){for(e=k=0;e<f&&
3>k;e++){var j=b[c].getBondedAtomIndex(e);j!=a&&(k+=this.atoms[j].getAtomicAndIsotopeNumber())}if(3<k)return d}return null}return d+e},"~N,~A,~N,~S");g(c$,"getRingCache",function(a,b,c){var d=JS.SmilesGenerator.getRingKey(a,b),e=c.get(d),e=null==e?null:e[0];null==e?(c.put(d,[e=JS.SmilesParser.getRingPointer(++this.nPairs),Integer.$valueOf(b)]),JU.Logger.debugging&&JU.Logger.debug("adding for "+a+" ring key "+this.nPairs+": "+d)):(c.remove(d),JU.Logger.debugging&&JU.Logger.debug("using ring key "+
d));return e},"~N,~N,java.util.Map");g(c$,"dumpRingKeys",function(a,b){JU.Logger.info(a.toString()+"\n\n");for(var c,d=b.keySet().iterator();d.hasNext()&&((c=d.next())||1);)JU.Logger.info("unmatched ring key: "+c)},"JU.SB,java.util.Map");c$.getRingKey=g(c$,"getRingKey",function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)},"~N,~N")});B("JS");E(null,"JS.SmilesAromatic",["JU.BS","$.V3"],function(){c$=N(JS,"SmilesAromatic");c$.isFlatSp2Ring=g(c$,"isFlatSp2Ring",function(a,b,c,d){for(var e=c.nextSetBit(0);0<=
e;e=c.nextSetBit(e+1)){var f=a[e],k=f.getEdges();if(!(3>k.length)&&3<k.length)return!1}if(3.4028235E38==d)return!0;0>=d&&(d=0.01);for(var j=new JU.V3,h=new JU.V3,g=new JU.V3,l=null,e=c.cardinality(),n=Array(2*e),m=0,w=1-5*d,e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1)){for(var f=a[e],k=f.getEdges(),p=-1,t=-1,q=-1,k=k.length;0<=--k;){var s=f.getBondedAtomIndex(k);b.get(s)&&(c.get(s)?0>t?t=s:q=s:p=s)}JS.SmilesAromatic.getNormalThroughPoints(a[t],a[e],a[q],j,h,g);null==l&&(l=new JU.V3);if(!JS.SmilesAromatic.addNormal(j,
l,w))return!1;n[m++]=JU.V3.newV(j);if(0<=p){JS.SmilesAromatic.getNormalThroughPoints(a[t],a[p],a[q],j,h,g);if(!JS.SmilesAromatic.addNormal(j,l,w))return!1;n[m++]=JU.V3.newV(j)}}return JS.SmilesAromatic.checkStandardDeviation(n,l,m,d)},"~A,JU.BS,JU.BS,~N");c$.addNormal=g(c$,"addNormal",function(a,b,c){var d=b.dot(a);if(0!=d&&Math.abs(d)<c)return!1;0>d&&a.scale(-1);b.add(a);b.normalize();return!0},"JU.V3,JU.V3,~N");c$.checkStandardDeviation=g(c$,"checkStandardDeviation",function(a,b,c,d){for(var e=
0,f=0,k=0;k<c;k++)var j=a[k].dot(b),e=e+j,f=f+j*j;e=Math.sqrt((f-e*e/c)/(c-1));return e<d},"~A,JU.V3,~N,~N");c$.getNormalThroughPoints=g(c$,"getNormalThroughPoints",function(a,b,c,d,e,f){e.sub2(b,a);f.sub2(c,a);d.cross(e,f);d.normalize();e.setT(a);return-e.dot(d)},"JU.Node,JU.Node,JU.Node,JU.V3,JU.V3,JU.V3");c$.checkAromaticDefined=g(c$,"checkAromaticDefined",function(a,b){for(var c=new JU.BS,d=b.nextSetBit(0);0<=d;d=b.nextSetBit(d+1))for(var e=a[d].getEdges(),f=0;f<e.length;f++)switch(e[f].order){case 515:case 514:case 513:c.set(e[f].getAtomIndex1()),
c.set(e[f].getAtomIndex2())}return c},"~A,JU.BS");c$.checkAromaticStrict=g(c$,"checkAromaticStrict",function(a,b,c,d){for(var e=new JU.BS,f=new JU.BS,k=c.size();0<=--k;){var j=c.get(k);JS.SmilesAromatic.isAromaticRing(b,f,j,5)&&JS.SmilesAromatic.checkAromaticStrict2(a,e,c,d,j,!0)}for(k=d.size();0<=--k;)j=d.get(k),JS.SmilesAromatic.isAromaticRing(b,f,j,6)&&JS.SmilesAromatic.checkAromaticStrict2(a,e,c,d,j,!1);b.clearAll();b.or(e)},"~A,JU.BS,JU.Lst,JU.Lst");c$.isAromaticRing=g(c$,"isAromaticRing",function(a,
b,c,d){b.clearAll();b.or(c);b.and(a);return b.cardinality()==d},"JU.BS,JU.BS,JU.BS,~N");c$.checkAromaticStrict2=g(c$,"checkAromaticStrict2",function(a,b,c,d,e,f){f=JS.SmilesAromatic.countInternalPairs(a,e,f)<<1;switch(f){case -3:break;default:for(var k=e.nextSetBit(0);0<=k;k=e.nextSetBit(k+1))for(var j=a[k].getEdges(),h=0;h<j.length;h++)if(2==j[h].order){var g=j[h].getOtherAtomNode(a[k]).getIndex();if(!e.get(g)){for(var l=!1,n=c.size();0<=--n&&!l;){var m=c.get(n);if(m.get(g)&&(b.get(g)||3==Math.abs(JS.SmilesAromatic.countInternalPairs(a,
m,!0))))l=!0}for(n=d.size();0<=--n&&!l;)if(m=d.get(n),m.get(g)&&(b.get(g)||3==Math.abs(JS.SmilesAromatic.countInternalPairs(a,m,!1))))l=!0;if(!l)return;f++}}}6==f&&b.or(e)},"~A,JU.BS,JU.Lst,JU.Lst,JU.BS,~B");c$.countInternalPairs=g(c$,"countInternalPairs",function(a,b,c){for(var d=0,e=0,f=0,k=b.nextSetBit(0);0<=k;k=b.nextSetBit(k+1)){for(var j=a[k],h=j.getEdges(),g=!1,l=0;l<h.length;l++){var n=h[l].getOtherAtomNode(j).getIndex();if(b.get(n))switch(h[l].order){case 514:case 513:case 515:e++;break;
case 2:d++,g=!0}}if(c&&0==e)switch(j.getElementNumber()){case 7:case 8:case 16:g||f++}}return 0==e?O(d/2)+f:e==(c?5:6)?-3:0},"~A,JU.BS,~B")});B("JS");E(["JU.P3","JU.BNode"],"JS.SmilesAtom",["JU.AU","JU.Elements","$.Logger"],function(){c$=G(function(){this.atomsOr=null;this.nAtomsOr=0;this.primitives=null;this.index=this.nPrimitives=0;this.residueChar=this.residueName=this.atomName=null;this.isBioAtom=!1;this.bioType="\x00";this.$isLeadAtom=!1;this.notBondedIndex=-1;this.notCrossLinked=!1;this.aromaticAmbiguous=
!0;this.atomType=null;this.covalentHydrogenCount=-1;this.hasSymbol=this.selected=this.not=!1;this.isFirst=!0;this.jmolIndex=-1;this.elementNumber=-2;this.implicitHydrogenCount=this.missingHydrogenCount=-2147483648;this.bonds=this.parent=null;this.iNested=this.bondCount=0;this.charge=this.atomicMass=-2147483648;this.matchingAtom=-1;this.chiralOrder=this.chiralClass=-2147483648;this.$isAromatic=!1;this.atomSite=this.component=0;this.nonhydrogenDegree=this.degree=-1;this.valence=0;this.connectivity=
-1;this.ringSize=this.ringMembership=-2147483648;this.ringConnectivity=-1;F(this,arguments)},JS,"SmilesAtom",JU.P3,JU.BNode);K(c$,function(){this.bonds=Array(4)});c$.getChiralityClass=g(c$,"getChiralityClass",function(a){return O(("0;11;AL;33;TH;TP;OH;77;SP;".indexOf(a)+1)/3)},"~S");c$.allowSmilesUnbracketed=g(c$,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I,".indexOf(a+",")},"~S");g(c$,"setBioAtom",function(a){this.isBioAtom="\x00"!=a;this.bioType=a;null!=this.parent&&
(this.parent.bioType=a,this.parent.isBioAtom=this.isBioAtom)},"~S");g(c$,"setAtomName",function(a){null!=a&&(0<a.length&&(this.atomName=a),a.equals("0")&&(this.$isLeadAtom=!0),null!=this.parent&&(this.parent.atomName=a))},"~S");g(c$,"setBonds",function(a){this.bonds=a},"~A");g(c$,"addAtomOr",function(){null==this.atomsOr&&(this.atomsOr=Array(2));this.nAtomsOr>=this.atomsOr.length&&(this.atomsOr=JU.AU.doubleLength(this.atomsOr));var a=(new JS.SmilesAtom).setIndex(this.index);a.parent=this;this.atomsOr[this.nAtomsOr]=
a;this.nAtomsOr++;return a});g(c$,"addPrimitive",function(){null==this.primitives&&(this.primitives=Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);System.arraycopy(this.primitives,0,a,0,this.primitives.length);this.primitives=a}a=(new JS.SmilesAtom).setIndex(this.index);a.parent=this;this.primitives[this.nPrimitives]=a;this.setSymbol("*");this.hasSymbol=!1;this.nPrimitives++;return a});m(c$,"toString",function(){var a=null!=this.residueChar||null!=this.residueName?
(null==this.residueChar?this.residueName:this.residueChar)+"."+this.atomName:-1==this.elementNumber?"A":-2==this.elementNumber?"*":JU.Elements.elementSymbolFromNumber(this.elementNumber);this.$isAromatic&&(a=a.toLowerCase());return"["+a+"."+this.index+(0<=this.matchingAtom?"("+this.matchingAtom+")":"")+"]"});g(c$,"setIndex",function(a){this.index=a;return this},"~N");g(c$,"setAll",function(a,b,c,d,e){this.component=a;this.index=b;this.atomSite=c;this.elementNumber=d;this.charge=e;return this},"~N,~N,~N,~N,~N");
g(c$,"setHydrogenCount",function(){if(-2147483648!=this.missingHydrogenCount)return!0;var a=JS.SmilesAtom.getDefaultCount(this.elementNumber,this.$isAromatic);if(-2==a)return!1;if(-1==a)return!0;7==this.elementNumber&&this.$isAromatic&&2==this.bondCount&&1==this.bonds[0].order&&1==this.bonds[1].order&&a++;for(var b=0;b<this.bondCount;b++)switch(this.bonds[b].order){case 81:7==this.elementNumber&&JU.Logger.info("Ambiguous bonding to aromatic N found -- MF may be in error");a-=1;break;case 1:case 257:case 513:a-=
1;break;case 2:a-=this.$isAromatic&&6==this.elementNumber?1:2;break;case 3:a-=3}0<a&&(this.missingHydrogenCount=a);return!0},"JS.SmilesSearch");c$.getDefaultCount=g(c$,"getDefaultCount",function(a,b){switch(a){case 0:case -1:return-1;case 6:return b?3:4;case 8:case 16:return 2;case 7:return b?2:3;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1}return-2},"~N,~B");m(c$,"getIndex",function(){return this.index});g(c$,"isAromatic",function(){return this.$isAromatic});g(c$,"setSymbol",function(a){this.$isAromatic=
a.equals(a.toLowerCase());this.hasSymbol=!0;if(a.equals("*"))return this.$isAromatic=!1,this.elementNumber=-2,!0;if(a.equals("Xx"))return this.elementNumber=0,!0;this.aromaticAmbiguous=!1;if(a.equals("a")||a.equals("A"))return 0>this.elementNumber&&(this.elementNumber=-1),!0;this.$isAromatic&&(a=a.substring(0,1).toUpperCase()+(1==a.length?"":a.substring(1)));this.elementNumber=JU.Elements.elementNumberFromSymbol(a,!0);return 0!=this.elementNumber},"~S");m(c$,"getElementNumber",function(){return this.elementNumber});
g(c$,"getAtomicMass",function(){return this.atomicMass});g(c$,"setAtomicMass",function(a){this.atomicMass=a},"~N");g(c$,"getCharge",function(){return this.charge});g(c$,"setCharge",function(a){this.charge=a},"~N");g(c$,"getMatchingAtom",function(){return this.matchingAtom});g(c$,"setMatchingAtom",function(a){this.matchingAtom=a},"~N");g(c$,"getChiralClass",function(){return this.chiralClass});g(c$,"setChiralClass",function(a){this.chiralClass=a},"~N");g(c$,"getChiralOrder",function(){return this.chiralOrder});
g(c$,"setChiralOrder",function(a){this.chiralOrder=a},"~N");g(c$,"setExplicitHydrogenCount",function(a){this.missingHydrogenCount=a},"~N");g(c$,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");g(c$,"setDegree",function(a){this.degree=a},"~N");g(c$,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");g(c$,"setValence",function(a){this.valence=a},"~N");g(c$,"setConnectivity",function(a){this.connectivity=a},"~N");g(c$,"setRingMembership",function(a){this.ringMembership=
a},"~N");g(c$,"setRingSize",function(a){this.ringSize=a},"~N");g(c$,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");m(c$,"getModelIndex",function(){return this.component});m(c$,"getAtomSite",function(){return this.atomSite});m(c$,"getImplicitHydrogenCount",function(){return 0});g(c$,"getExplicitHydrogenCount",function(){return this.missingHydrogenCount});m(c$,"getFormalCharge",function(){return this.charge});m(c$,"getIsotopeNumber",function(){return this.atomicMass});m(c$,"getAtomicAndIsotopeNumber",
function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,this.atomicMass)});m(c$,"getAtomName",function(){return null==this.atomName?"":this.atomName});m(c$,"getGroup3",function(){return null==this.residueName?"":this.residueName},"~B");m(c$,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");g(c$,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=a;this.bondCount++},"JS.SmilesBond");
g(c$,"setBondArray",function(){this.bonds.length>this.bondCount&&(this.bonds=JU.AU.arrayCopyObject(this.bonds,this.bondCount));null!=this.atomsOr&&this.atomsOr.length>this.nAtomsOr&&(this.atomsOr=JU.AU.arrayCopyObject(this.atomsOr,this.atomsOr.length));null!=this.primitives&&this.primitives.length>this.nPrimitives&&(this.primitives=JU.AU.arrayCopyObject(this.primitives,this.primitives.length));for(var a=0;a<this.bonds.length;a++)this.isBioAtom&&17==this.bonds[a].order&&(this.bonds[a].order=112),this.bonds[a].getAtom1().index>
this.bonds[a].getAtom2().index&&this.bonds[a].switchAtoms()});m(c$,"getEdges",function(){return null!=this.parent?this.parent.getEdges():this.bonds});g(c$,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");m(c$,"getCovalentBondCount",function(){return this.getBondCount()});g(c$,"getBondCount",function(){return null!=this.parent?this.parent.getCovalentBondCount():this.bondCount});g(c$,"getMatchingBondedAtom",function(a){if(null!=this.parent)return this.parent.getMatchingBondedAtom(a);
if(a>=this.bondCount)return-1;a=this.bonds[a];return(a.getAtom1()===this?a.getAtom2():a.getAtom1()).matchingAtom},"~N");m(c$,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},"~N");m(c$,"getCovalentHydrogenCount",function(){if(0<=this.covalentHydrogenCount)return this.covalentHydrogenCount;if(null!=this.parent)return this.parent.getCovalentHydrogenCount();for(var a=this.covalentHydrogenCount=0;a<this.bonds.length;a++)1==
this.bonds[a].getOtherAtom(this).elementNumber&&this.covalentHydrogenCount++;return this.covalentHydrogenCount});m(c$,"getValence",function(){if(null!=this.parent)return this.parent.getValence();var a=this.valence;if(0>=a&&null!=this.bonds)for(var b=this.bonds.length;0<=--b;)a+=this.bonds[b].getValence();return this.valence=a});g(c$,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);for(var b,c=0;c<this.bonds.length;c++)if(null!=(b=this.bonds[c]))if(null==a?b.getAtom2()===
this:b.getOtherAtom(this)===a)return b;return null},"JS.SmilesAtom");g(c$,"getBondNotTo",function(a,b){for(var c,d=0;d<this.bonds.length;d++)if(null!=(c=this.bonds[d])){var e=c.getOtherAtom(this);if(a!==e&&(b||1!=e.elementNumber))return c}return null},"JS.SmilesAtom,~B");m(c$,"isLeadAtom",function(){return this.$isLeadAtom});m(c$,"getOffsetResidueAtom",function(){if(this.isBioAtom)for(var a=0;a<this.bonds.length;a++)if(this.bonds[a].getAtomIndex1()==this.index&&96==this.bonds[a].order)return this.bonds[a].getOtherAtom(this).index;
return-1},"~S,~N");m(c$,"getGroupBits",function(a){a.set(this.index)},"JU.BS");m(c$,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"JU.BNode");m(c$,"getCrossLinkLeadAtomIndexes",function(a){for(var b=0;b<this.bonds.length;b++)112==this.bonds[b].order&&a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));return!0},"JU.Lst");m(c$,"getBioStructureTypeName",function(){return null});m(c$,"getResno",function(){return 0});m(c$,"getChainID",function(){return 0});m(c$,"getChainIDStr",
function(){return""});c$.getAtomLabel=g(c$,"getAtomLabel",function(a,b,c,d,e,f,k){var j=JU.Elements.elementSymbolFromNumber(a);f&&(j=j.toLowerCase(),6!=a&&(c=2147483647));return(0<k.length||0!=b||0!=d?-1:JS.SmilesAtom.getDefaultCount(a,!1))==c?j:"["+(0>=b?"":""+b)+j+(0>d?""+d:0<d?"+"+d:"")+k+(1<e?"H"+e:1==e?"H":"")+"]"},"~N,~N,~N,~N,~N,~B,~S");m(c$,"isDna",function(){return"d"==this.bioType});m(c$,"isRna",function(){return"r"==this.bioType});m(c$,"isNucleic",function(){return"n"==this.bioType||"r"==
this.bioType||"d"==this.bioType});m(c$,"isProtein",function(){return"p"==this.bioType});m(c$,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});m(c$,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="CTUI".indexOf(this.residueChar)});m(c$,"isDeleted",function(){return!1});g(c$,"setAtomType",function(a){this.atomType=a},"~S");m(c$,"getAtomType",function(){return null==this.atomType?this.atomName:this.atomType});m(c$,
"findAtomsLike",function(){return null},"~S");I(c$,"STEREOCHEMISTRY_DEFAULT",0,"STEREOCHEMISTRY_ALLENE",2,"STEREOCHEMISTRY_TETRAHEDRAL",4,"STEREOCHEMISTRY_TRIGONAL_BIPYRAMIDAL",5,"STEREOCHEMISTRY_OCTAHEDRAL",6,"STEREOCHEMISTRY_SQUARE_PLANAR",8,"UNBRACKETED_SET","B, C, N, O, P, S, F, Cl, Br, I,")});B("JS");E(["JU.Edge"],"JS.SmilesBond",["JS.InvalidSmilesException"],function(){c$=G(function(){this.atom2=this.atom1=null;this.isNot=!1;this.primitives=this.matchingBond=null;this.nPrimitives=0;this.bondsOr=
null;this.nBondsOr=0;F(this,arguments)},JS,"SmilesBond",JU.Edge);c$.getBondOrderString=g(c$,"getBondOrderString",function(a){switch(a){case 1:return"";case 2:return"=";case 3:return"#";default:return""}},"~N");g(c$,"set",function(a){this.order=a.order;this.isNot=a.isNot;this.primitives=a.primitives;this.nPrimitives=a.nPrimitives;this.bondsOr=a.bondsOr;this.nBondsOr=a.nBondsOr},"JS.SmilesBond");g(c$,"addBondOr",function(){null==this.bondsOr&&(this.bondsOr=Array(2));if(this.nBondsOr>=this.bondsOr.length){var a=
Array(2*this.bondsOr.length);System.arraycopy(this.bondsOr,0,a,0,this.bondsOr.length);this.bondsOr=a}a=new JS.SmilesBond(null,null,-1,!1);this.bondsOr[this.nBondsOr]=a;this.nBondsOr++;return a});g(c$,"addPrimitive",function(){null==this.primitives&&(this.primitives=Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);System.arraycopy(this.primitives,0,a,0,this.primitives.length);this.primitives=a}a=new JS.SmilesBond(null,null,-1,!1);this.primitives[this.nPrimitives]=
a;this.nPrimitives++;return a});m(c$,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});M(c$,function(a,b,c,d){Q(this,JS.SmilesBond,[]);this.set2(c,d);this.set2a(a,b)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");g(c$,"set2",function(a,b){this.order=a;this.isNot=b},"~N,~B");g(c$,"set2a",function(a,b){null!=a&&(this.atom1=a,a.addBond(this));null!=b&&(this.atom2=b,b.isFirst=!1,b.addBond(this))},"JS.SmilesAtom,JS.SmilesAtom");c$.isBondType=g(c$,"isBondType",function(a,
b,c){if(0>"-=#:/\\.+!,&;@~^'".indexOf(a))return!1;if(!b&&0>"-=#:/\\.~^'".indexOf(a))throw new JS.InvalidSmilesException("SMARTS bond type "+a+" not allowed in SMILES");return c&&"~"==a?!1:!0},"~S,~B,~B");c$.getBondTypeFromCode=g(c$,"getBondTypeFromCode",function(a){switch(a){case ".":return 0;case "-":return 1;case "=":return 2;case "#":return 3;case ":":return 17;case "/":return 257;case "\\":return 513;case "^":return 769;case "'":return 1025;case "@":return 65;case "~":return 81;case "+":return 96}return-1},
"~S");g(c$,"getAtom1",function(){return this.atom1});g(c$,"getAtom2",function(){return this.atom2});g(c$,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&a.addBond(this)},"JS.SmilesAtom");g(c$,"getBondType",function(){return this.order});g(c$,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");m(c$,"getAtomIndex1",function(){return this.atom1.index});m(c$,"getAtomIndex2",function(){return this.atom2.index});m(c$,"getCovalentOrder",function(){return this.order});
m(c$,"getOtherAtomNode",function(a){return a===this.atom1?this.atom2:a===this.atom2?this.atom1:null},"JU.Node");m(c$,"isCovalent",function(){return 112!=this.order});g(c$,"getValence",function(){return this.order&7});m(c$,"isHydrogen",function(){return 112==this.order});g(c$,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;this.atom2=a;switch(this.order){case 769:this.order=1025;break;case 1025:this.order=769;break;case 257:this.order=513;break;case 513:this.order=257}});I(c$,"TYPE_UNKNOWN",
-1,"TYPE_NONE",0,"TYPE_SINGLE",1,"TYPE_DOUBLE",2,"TYPE_TRIPLE",3,"TYPE_AROMATIC",17,"TYPE_DIRECTIONAL_1",257,"TYPE_DIRECTIONAL_2",513,"TYPE_ATROPISOMER_1",769,"TYPE_ATROPISOMER_2",1025,"TYPE_RING",65,"TYPE_ANY",81,"TYPE_BIO_SEQUENCE",96,"TYPE_BIO_PAIR",112,"TYPE_MULTIPLE",999)});B("JS");c$=G(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.indices=null;this.max=this.min=0;this.points=null;F(this,arguments)},JS,"SmilesMeasure");K(c$,function(){this.indices=v(4,0);
this.points=Array(4)});M(c$,function(a,b,c,d,e,f){this.search=a;this.type=Math.min(4,Math.max(c,2));this.index=b;this.min=Math.min(d,e);this.max=Math.max(d,e);this.isNot=f},"JS.SmilesSearch,~N,~N,~N,~N,~B");m(c$,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+this.min+","+this.max+") for",b=0;b<this.type;b++)a+=" "+(b>=this.nPoints?"?":""+this.indices[b]);return a});g(c$,"addPoint",function(a){if(this.nPoints==this.type)return!1;if(0==this.nPoints)for(var b=1;b<this.type;b++)this.indices[b]=
a+b;this.indices[this.nPoints++]=a;return!0},"~N");g(c$,"check",function(){for(var a=0;a<this.type;a++){var b=this.search.patternAtoms[this.indices[a]].getMatchingAtom();this.points[a]=this.search.jmolAtoms[b]}a=0;switch(this.type){case 2:a=this.points[0].distance(this.points[1]);break;case 3:this.search.v.vA.sub2(this.points[0],this.points[1]);this.search.v.vB.sub2(this.points[2],this.points[1]);a=this.search.v.vA.angle(this.search.v.vB)/0.017453292;break;case 4:JS.SmilesMeasure.setTorsionData(this.points[0],
this.points[1],this.points[2],this.points[3],this.search.v,!0),a=this.search.v.vTemp1.angle(this.search.v.vTemp2)/0.017453292*(0>this.search.v.vNorm1.dot(this.search.v.vNorm2)?1:-1)}return(a<this.min||a>this.max)==this.isNot});c$.setTorsionData=g(c$,"setTorsionData",function(a,b,c,d,e,f){e.vTemp1.sub2(a,b);e.vTemp2.sub2(d,c);f&&(e.vNorm1.sub2(b,c),e.vNorm1.normalize(),e.vTemp1.cross(e.vTemp1,e.vNorm1),e.vTemp1.normalize(),e.vTemp2.cross(e.vTemp2,e.vNorm1),e.vTemp2.normalize(),e.vNorm2.cross(e.vTemp1,
e.vTemp2))},"JU.P3,JU.P3,JU.P3,JU.P3,JS.VTemp,~B");I(c$,"TYPES","__dat","radiansPerDegree",0.017453292519943295);B("JS");E(["java.util.Hashtable"],"JS.SmilesParser","java.lang.Character JU.Lst $.PT $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch JU.Elements $.Logger".split(" "),function(){c$=G(function(){this.isBioSequence=this.isSmarts=!1;this.bioType="\x00";this.ringBonds=null;this.flags=this.branchLevel=this.braceCount=0;this.htMeasures=null;F(this,arguments)},
JS,"SmilesParser");K(c$,function(){this.ringBonds=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});c$.getMolecule=g(c$,"getMolecule",function(a,b){return(new JS.SmilesParser(b)).parse(a)},"~S,~B");M(c$,function(a){this.isSmarts=a},"~B");g(c$,"reset",function(){this.branchLevel=this.braceCount=0});g(c$,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("SMILES expressions must not be null");var b=new JS.SmilesSearch;0<=a.indexOf("$(select")&&(a=this.parseNested(b,a,
"select"));for(a=JS.SmilesParser.cleanPattern(a);a.startsWith("/");){var c=JS.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(c.length);this.flags=0;0<=c.indexOf("NOAROMATIC")&&(this.flags|=1);0<=c.indexOf("AROMATICSTRICT")&&(this.flags|=4);0<=c.indexOf("AROMATICDEFINED")&&(this.flags|=8);0<=c.indexOf("AROMATICDOUBLE")&&(this.flags|=16);0<=c.indexOf("NOSTEREO")&&(this.flags|=2)}0<=a.indexOf("$")&&(a=this.parseVariables(a));this.isSmarts&&0<=a.indexOf("[$")&&(a=this.parseVariableLength(a));
if(0<=a.indexOf("||")){a=JU.PT.split(a,"||");c="";b.subSearches=Array(a.length);for(var d=0;d<a.length;d++){var e="|"+a[d]+"|";0>c.indexOf(e)&&(b.subSearches[d]=this.getSearch(b,a[d],this.flags),c+=e)}JU.Logger.info(c);return b}return this.getSearch(b,a,this.flags)},"~S");g(c$,"parseVariableLength",function(a){for(var b=new JU.SB,c=a.length-1,d=0,e=!1,f=0;f<c;f++)switch(a.charAt(f)){case "(":d++;break;case ")":d--;break;case "|":0<d&&(e=!0,"|"==a.charAt(f+1)&&(a=a.substring(0,f)+a.substring(f+1),
c--))}if(0<=a.indexOf("||")){c=JU.PT.split(a,"||");for(f=0;f<c.length;f++)b.append("||").append(this.parseVariableLength(c[f]))}else{c=-1;d=v(1,0);for(f=null;0<=(c=a.indexOf("[$",c+1));){var k=c,j=-2147483648,h=-2147483648,c=JS.SmilesParser.getDigits(a,c+2,d),j=d[0];-2147483648!=j&&"-"==JS.SmilesParser.getChar(a,c)&&(c=JS.SmilesParser.getDigits(a,c+1,d),h=d[0]);if("("==JS.SmilesParser.getChar(a,c)&&(f=JS.SmilesParser.getSubPattern(a,k,"["),f.endsWith(")"))){var g=k+f.length+2,l=JS.SmilesParser.getSubPattern(a,
c,"("),n=c;JS.SmilesParser.getSubPattern(a,c,"[");c+=1+l.length;if(0<=l.indexOf(":")&&0>l.indexOf("|")){for(var m=0,w=l.length,p=-1,f=0;f<w;f++)switch(l.charAt(f)){case "[":case "(":m++;break;case ")":case "]":m--;break;case ".":0<=p&&0==m&&(w=f);break;case ":":0>p&&0==m&&(p=f)}0<p&&(l=l.substring(0,p)+"("+l.substring(p,w)+")"+l.substring(w))}if(-2147483648==j){if(f=l.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,k)+"[$1"+a.substring(n,n+f+1)+")]"+a.substring(g)+"||"+a.substring(0,
k)+"[$1("+a.substring(n+f+2)+a.substring(g))}else{-2147483648==h&&(h=j);0<=l.indexOf("|")&&(l="[$("+l+")]");for(f=j;f<=h;f++){j=new JU.SB;j.append("||").append(a.substring(0,k));for(n=0;n<f;n++)j.append(l);j.append(a.substring(g));b.appendSB(j)}}}}}return e?this.parseVariableLength(b.substring(2)):2>b.length()?a:b.substring(2)},"~S");g(c$,"getSearch",function(a,b,c){this.htMeasures=new java.util.Hashtable;var d=new JS.SmilesSearch;d.setTop(a);d.isSmarts=this.isSmarts;d.pattern=b;d.flags=c;0<=b.indexOf("$(")&&
(b=this.parseNested(d,b,""));this.parseSmiles(d,b,null,!1);if(0!=this.braceCount)throw new JS.InvalidSmilesException("unmatched '{'");if(!this.ringBonds.isEmpty())throw new JS.InvalidSmilesException("Open ring");d.setAtomArray();for(a=d.ac;0<=--a;)if(b=d.patternAtoms[a],b.setBondArray(),!this.isSmarts&&"\x00"==b.bioType&&!b.setHydrogenCount(d))throw new JS.InvalidSmilesException("unbracketed atoms must be one of: B, C, N, O, P, S, F, Cl, Br, I,");if(this.isSmarts)for(a=d.ac;0<=--a;){b=d.patternAtoms[a];
this.checkNested(d,b,c);for(var e=0;e<b.nAtomsOr;e++)this.checkNested(d,b.atomsOr[e],c);for(e=0;e<b.nPrimitives;e++)this.checkNested(d,b.primitives[e],c)}!this.isSmarts&&!this.isBioSequence&&(d.elementCounts[1]=d.getMissingHydrogenCount());this.fixChirality(d);return d},"JS.SmilesSearch,~S,~N");g(c$,"checkNested",function(a,b,c){if(0<b.iNested){var d=a.getNested(b.iNested);L(d,String)&&!d.startsWith("select")&&("~"!=d.charAt(0)&&"\x00"!=b.bioType&&(d="~"+b.bioType+"~"+d),c=this.getSearch(a,d,c),0<
c.ac&&c.patternAtoms[0].selected&&(b.selected=!0),a.setNested(b.iNested,c))}},"JS.SmilesSearch,JS.SmilesAtom,~N");g(c$,"fixChirality",function(a){for(var b=a.ac;0<=--b;){var c=a.patternAtoms[b],d=c.getChiralClass();if(-2147483648!=d){var e=c.missingHydrogenCount;0>e&&(e=0);e+=c.getBondCount();switch(d){case 0:switch(e){case 2:d=3==c.getValence()?3:2;break;case 3:case 4:case 5:case 6:d=e}break;case 8:4!=e&&(d=0);break;case 2:case 6:case 4:case 5:e!=d&&(d=0)}if(0==d)throw new JS.InvalidSmilesException("Incorrect number of bonds for stereochemistry descriptor");
c.setChiralClass(d)}}},"JS.SmilesSearch");g(c$,"parseSmiles",function(a,b,c,d){for(var e=v(1,0),f=0,k,j=null;null!=b&&0!=b.length;){var h=0;if(null==c||null!=j&&0==j.order)this.isBioSequence&&(a.top.needAromatic=!1),h=this.checkBioType(b,0);k=JS.SmilesParser.getChar(b,h);var g=this.checkBrace(a,k,"{");g&&(k=JS.SmilesParser.getChar(b,++h));if("("==k){d="."==JS.SmilesParser.getChar(b,h+1);if(null==c)throw new JS.InvalidSmilesException("No previous atom for "+(d?"measure":"branch"));h=JS.SmilesParser.getSubPattern(b,
h,"(");h.startsWith(".")?this.parseMeasure(a,h.substring(1),c):0==h.length&&this.isBioSequence?c.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,h,c,!0),this.branchLevel--);h=h.length+2}else{for(f=h;JS.SmilesBond.isBondType(k,this.isSmarts,this.isBioSequence);)k=JS.SmilesParser.getChar(b,++h);j=this.parseBond(a,null,b.substring(f,h),null,c,!1,d);g&&-1!=j.order&&(h=f);k=JS.SmilesParser.getChar(b,h);this.checkBrace(a,k,"{")&&(k=JS.SmilesParser.getChar(b,++h));"~"==k&&0==j.order&&(h=this.checkBioType(b,
h),k=JS.SmilesParser.getChar(b,h));if("\x00"==k&&0==j.order)break;f=JU.PT.isDigit(k)||"%"==k;g=!f&&("_"==k||"["==k||"*"==k||JU.PT.isLetter(k));if(f){switch(k){case "%":if("("==JS.SmilesParser.getChar(b,h+1)){if(f=JS.SmilesParser.getSubPattern(b,h+1,"("),JS.SmilesParser.getDigits(f,0,e),h+=f.length+3,0>e[0])throw new JS.InvalidSmilesException("Invalid ring designation: "+f);}else if(h+3<=b.length&&(h=JS.SmilesParser.getDigits(b.substring(0,h+3),h+1,e)),10>e[0])throw new JS.InvalidSmilesException("Two digits must follow the % sign");
d=e[0];break;default:d=k.charCodeAt(0)-48,h++}this.parseRing(a,d,c,j)}else if(g)switch(k){case "[":case "_":f=JS.SmilesParser.getSubPattern(b,h,k);h+=f.length+("["==k?2:0);this.isBioSequence&&("["==k&&0>f.indexOf(".")&&0>f.indexOf("_"))&&(f+=".0");c=this.parseAtom(a,null,f,c,j,"["==k,!1,d);-1!=j.order&&0!=j.order&&j.set2a(null,c);break;default:f=!this.isBioSequence&&JU.PT.isUpperCase(k)?JS.SmilesParser.getChar(b,h+1):"\x00";if("X"!=k||"x"!=f)if(!JU.PT.isLowerCase(f)||0==JU.Elements.elementNumberFromSymbol(b.substring(h,
h+2),!0))f="\x00";"\x00"!=f&&0<="NA CA BA PA SC AC".indexOf(b.substring(h,h+2))&&(f="\x00");k=JU.PT.isUpperCase(k)&&JU.PT.isLowerCase(f)?2:1;c=this.parseAtom(a,null,b.substring(h,h+k),c,j,!1,!1,d);h+=k}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(b,h));}k=JS.SmilesParser.getChar(b,h);"}"==k&&this.checkBrace(a,k,"}")&&h++;b=b.substring(h);d=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");g(c$,"checkBioType",function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;
this.bioType="*";var c=JS.SmilesParser.getChar(a,2);if("~"==c&&("*"==(c=a.charAt(1))||JU.PT.isLowerCase(c)))this.bioType=c,b=3}return b},"~S,~N");g(c$,"parseMeasure",function(a,b,c){for(var d=b.indexOf(":"),e=!1,f=0>d?b:b.substring(0,d);0!=d;){1==f.length&&(f+="0");var k=this.htMeasures.get(f);if(null==k==0>d)break;try{if(0<d){var j="__dat".indexOf(f.charAt(0));if(2>j)break;var h=v(1,0),g=JS.SmilesParser.getDigits(f,1,h),l=b.indexOf(",",d);0>l&&(l=b.indexOf("-",d+1));if(0>l)break;var n=b.substring(d+
1,l);n.startsWith("!")&&(e=!0,n=n.substring(1));var m=d+1==l?0:JU.PT.fVal(n),n=b.substring(l+1),w=0==n.length?3.4028235E38:JU.PT.fVal(n),k=new JS.SmilesMeasure(a,g,j,m,w,e);a.measures.addLast(k);0<g?this.htMeasures.put(f,k):0==g&&JU.Logger.debugging&&JU.Logger.debug("measure created: "+k)}else{if(!k.addPoint(c.index))break;k.nPoints==k.type&&(this.htMeasures.remove(f),JU.Logger.debugging&&JU.Logger.debug("measure created: "+k));return}if(!k.addPoint(c.index))break}catch(p){if(H(p,NumberFormatException))break;
else throw p;}return}throw new JS.InvalidSmilesException("invalid measure: "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom");g(c$,"checkBrace",function(a,b,c){switch(b){case "{":if(b!=c)break;this.braceCount++;return a.top.haveSelected=!0;case "}":if(b!=c)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new JS.InvalidSmilesException("Unmatched '}'");},"JS.SmilesSearch,~S,~S");g(c$,"parseNested",function(a,b,c){var d;for(c="$("+c;0<=(d=b.lastIndexOf(c));){var e=JS.SmilesParser.getSubPattern(b,
d+1,"("),f=d+e.length+3;b=b.substring(0,d)+"_"+a.addNested(e)+"_"+b.substring(f)}return b},"JS.SmilesSearch,~S,~S");g(c$,"parseVariables",function(a){for(var b=new JU.Lst,c=new JU.Lst,d,e=0,f=-1;0<=(d=a.indexOf("$",e))&&"("!=JS.SmilesParser.getChar(a,e+1);){e=JS.SmilesParser.skipTo(a,d,"=");if(e<=d+1||'"'!=JS.SmilesParser.getChar(a,e+1))break;d=a.substring(d,e);if(0<d.lastIndexOf("$")||0<d.indexOf("]"))throw new JS.InvalidSmilesException("Invalid variable name: "+d);f=JS.SmilesParser.getSubPattern(a,
e+1,'"');b.addLast("["+d+"]");c.addLast(f);e+=f.length+2;e=JS.SmilesParser.skipTo(a,e,";");f=++e}return 0>f?a:JU.PT.replaceStrings(a.substring(f),b,c)},"~S");g(c$,"parseAtom",function(a,b,c,d,e,f,k,j){if(null==c||0==c.length)throw new JS.InvalidSmilesException("Empty atom definition");var h=null==b?a.addAtom():k?b.addPrimitive():b.addAtomOr();0<this.braceCount&&(h.selected=!0);if(!this.checkLogic(a,c,h,null,d,k,j)){var g=v(1,0);this.isBioSequence&&1==c.length&&(c+=".0");var l=c.charAt(0),n=0,m=!1;
if(this.isSmarts&&"!"==l){l=JS.SmilesParser.getChar(c,++n);if("\x00"==l)throw new JS.InvalidSmilesException("invalid '!'");h.not=m=!0}var w=-2147483648,p=c.indexOf(".");if(0<=p){l=c.substring(n,p);0==l.length&&(l="*");1<l.length?h.residueName=l.toUpperCase():l.equals("*")||(h.residueChar=l);l=c.substring(p+1).toUpperCase();if(0<=(p=l.indexOf("#")))JS.SmilesParser.getDigits(l,p+1,g),h.elementNumber=g[0],l=l.substring(0,p);0==l.length&&(l="*");l.equals("*")||h.setAtomName(l);l="\x00"}for(h.setBioAtom(this.bioType);"\x00"!=
l;){h.setAtomName(this.isBioSequence?"0":"");if(JU.PT.isDigit(l)){n=JS.SmilesParser.getDigits(c,n,g);l=g[0];if(-2147483648==l)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(c,n)&&(n++,l=-l);h.setAtomicMass(l)}else switch(l){case '"':l=JU.PT.getQuotedStringAt(c,n);n+=l.length+2;h.setAtomType(l);break;case "_":n=JS.SmilesParser.getDigits(c,n+1,g)+1;if(-2147483648==g[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(n));h.iNested=
g[0];if(this.isBioSequence&&f&&n!=c.length)throw new JS.InvalidSmilesException("invalid characters: "+c.substring(n));break;case "=":n=JS.SmilesParser.getDigits(c,n+1,g);h.jmolIndex=g[0];break;case "#":n=JS.SmilesParser.getDigits(c,n+1,g);h.elementNumber=g[0];break;case "-":case "+":n=this.checkCharge(c,n,h);break;case "@":a.haveAtomStereochemistry=!0;n=this.checkChirality(c,n,a.patternAtoms[h.index]);break;default:var p=JS.SmilesParser.getChar(c,n+1),t=c.substring(n+1,n+(JU.PT.isLowerCase(p)&&(!f||
!JU.PT.isDigit(JS.SmilesParser.getChar(c,n+2)))?2:1)),q=Character.toUpperCase(l)+t,s=!0;f&&JU.PT.isLetter(l)&&(!m&&(k?b:h).hasSymbol?s=!1:"H"==l?s=!JU.PT.isDigit(p)||"?"==JS.SmilesParser.getChar(c,n+2):0<="DdhRrvXx".indexOf(l)&&JU.PT.isDigit(p)?s=!1:!q.equals("A")&&!q.equals("Xx")&&(s=0<JU.Elements.elementNumberFromSymbol(q,!0),!s&&""!==t&&(t="",q=q.substring(0,1),s=0<JU.Elements.elementNumberFromSymbol(q,!0))));if(s){if(!f&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(q)||
!h.setSymbol(q=l+t))throw new JS.InvalidSmilesException("Invalid atom symbol: "+q);k&&(b.hasSymbol=!0);n+=q.length}else switch(n=JS.SmilesParser.getDigits(c,n+1,g),p=g[0],l){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(n));case "D":h.setDegree(-2147483648==p?1:p);break;case "d":h.setNonhydrogenDegree(-2147483648==p?1:p);break;case "H":w=-2147483648==p?1:p;break;case "h":h.setImplicitHydrogenCount(-2147483648==p?-1:p);break;case "R":-2147483648==p&&(p=-1);h.setRingMembership(p);
a.top.needRingData=!0;break;case "r":if(-2147483648==p)p=-1,h.setRingMembership(p);else{h.setRingSize(p);switch(p){case 500:p=5;break;case 600:p=6}p>a.ringDataMax&&(a.ringDataMax=p)}a.top.needRingData=!0;break;case "v":h.setValence(-2147483648==p?1:p);break;case "X":h.setConnectivity(-2147483648==p?1:p);break;case "x":h.setRingConnectivity(-2147483648==p?-1:p),a.top.needRingData=!0}}l=JS.SmilesParser.getChar(c,n);if(m&&"\x00"!=l)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");
}-2147483648==w&&f&&(w=-2147483647);h.setExplicitHydrogenCount(w);a.patternAtoms[h.index].setExplicitHydrogenCount(w)}null!=d&&0==e.order&&(h.notBondedIndex=d.index);null!=d&&0!=e.order&&(-1==e.order&&(e.order=this.isBioSequence&&j?112:this.isSmarts||d.isAromatic()&&h.isAromatic()?81:1),f||e.set2a(null,h),0==this.branchLevel&&(17==e.order||112==e.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=h);return h},"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");
g(c$,"parseRing",function(a,b,c,d){a=Integer.$valueOf(b);b=this.ringBonds.get(a);if(null==b)this.ringBonds.put(a,d);else{this.ringBonds.remove(a);switch(d.order){case -1:d.order=-1!=b.order?b.order:this.isSmarts||c.isAromatic()&&b.getAtom1().isAromatic()?81:1;break;case 257:d.order=513;break;case 513:d.order=257}if(-1!=b.order&&b.order!=d.order)throw new JS.InvalidSmilesException("Incoherent bond type for ring");b.set(d);c.bondCount--;b.setAtom2(c)}},"JS.SmilesSearch,~N,JS.SmilesAtom,JS.SmilesBond");
g(c$,"checkCharge",function(a,b,c){var d=a.length,e=a.charAt(b),f=1;++b;if(b<d){var g=a.charAt(b);if(JU.PT.isDigit(g)){if(d=v(1,0),b=JS.SmilesParser.getDigits(a,b,d),f=d[0],-2147483648==f)throw new JS.InvalidSmilesException("Non numeric charge");}else for(;b<d&&a.charAt(b)==e;)b++,f++}c.setCharge("+"==e?f:-f);return b},"~S,~N,JS.SmilesAtom");g(c$,"checkChirality",function(a,b,c){var d=0,e=-2147483648,f=a.length,g,d=0,e=1;if(++b<f){switch(g=a.charAt(b)){case "@":e=2;b++;break;case "H":break;case "A":case "D":case "E":case "O":case "S":case "T":d=
b+1<f?JS.SmilesAtom.getChiralityClass(a.substring(b,b+2)):-1;b+=2;break;default:e=JU.PT.isDigit(g)?1:-1}g=b;if(1==e){for(;g<f&&JU.PT.isDigit(a.charAt(g));)g++;if(g>b){try{e=Integer.parseInt(a.substring(b,g))}catch(j){if(H(j,NumberFormatException))e=-1;else throw j;}b=g}}if(1>e||0>d)throw new JS.InvalidSmilesException("Invalid stereochemistry descriptor");}c.setChiralClass(d);c.setChiralOrder(e);"?"==JS.SmilesParser.getChar(a,b)&&(JU.Logger.info("Ignoring '?' in stereochemistry"),b++);return b},"~S,~N,JS.SmilesAtom");
g(c$,"parseBond",function(a,b,c,d,e,f,g){var j=JS.SmilesParser.getChar(c,0);if("."==j){if(null!=d||null!=b)throw new JS.InvalidSmilesException("invalid '.'");this.isBioSequence="~"==JS.SmilesParser.getChar(c,1);return new JS.SmilesBond(null,null,0,!1)}if("+"==j&&null!=b)throw new JS.InvalidSmilesException("invalid '+'");d=null==b?null==d?new JS.SmilesBond(e,null,this.isBioSequence&&null!=e?g?112:96:-1,!1):d:f?b.addPrimitive():b.addBondOr();if("\x00"!=j&&!this.checkLogic(a,c,null,d,e,f,!1)){if(f="!"==
j)if(j=JS.SmilesParser.getChar(c,1),"\x00"==j||"!"==j)throw new JS.InvalidSmilesException("invalid '!'");c=JS.SmilesBond.getBondTypeFromCode(j);65==c&&(a.top.needRingMemberships=!0);if(null==e&&0!=c)throw new JS.InvalidSmilesException("Bond without a previous atom");switch(c){case 769:case 1025:f&&(f=!1,c=769==c?1025:769);a.haveBondStereochemistry=!0;break;case 257:case 513:a.haveBondStereochemistry=!0;break;case 2:case 1:e.isAromatic()&&(a.top.needRingData=!0)}d.set2(c,f);this.isBioSequence&&null!=
b&&b.set2(c,f)}return d},"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B");g(c$,"checkLogic",function(a,b,c,d,e,f,g){for(var j=b.indexOf(","),h=b.length;;){var m=0<j;if(m&&!this.isSmarts||0==j)break;var l="",j=b.indexOf(";");if(0<=j){if(!this.isSmarts||0==j)break;l="&"+b.substring(j+1);b=b.substring(0,j);m||(b+=l,l="")}var n=0;if(m)for(b+=",";0<(j=b.indexOf(",",n))&&j<=h;){n=b.substring(n,j)+l;if(0==n.length)throw new JS.InvalidSmilesException("missing "+(null==d?"atom":"bond")+
" token");null==d?this.parseAtom(a,c,n,null,null,!0,!1,g):this.parseBond(a,d,n,null,e,!1,!1);n=j+1}else if(0<=(j=b.indexOf("&"))||null!=d&&1<h&&!f){if(!this.isSmarts||0==j)break;if(null!=d&&0>j&&1<h){f=new JU.SB;for(m=0;m<h;){var r=b.charAt(m++);f.appendC(r);"!"!=r&&m<h&&f.appendC("&")}b=f.toString();h=b.length}for(b+="&";0<(j=b.indexOf("&",n))&&j<=h;)n=b.substring(n,j)+l,null==d?this.parseAtom(a,c,n,null,null,!0,!0,g):this.parseBond(a,d,n,null,e,!0,!1),n=j+1}else return!1;return!0}r=b.charAt(j);
throw new JS.InvalidSmilesException((this.isSmarts?"invalid placement for '"+r+"'":"["+r+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom,JS.SmilesBond,JS.SmilesAtom,~B,~B");c$.getSubPattern=g(c$,"getSubPattern",function(a,b,c){var d,e=1;switch(c){case "[":d="]";break;case '"':case "%":d=c;break;case "(":d=")";break;default:d=c,e=0}for(var f=a.length,g=1,j=b+1;j<f;j++){var h=a.charAt(j);if(h==d){if(g--,0==g)return a.substring(b+e,j+1-e)}else h==c&&g++}throw new JS.InvalidSmilesException("Unmatched "+
c);},"~S,~N,~S");c$.getChar=g(c$,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");c$.getDigits=g(c$,"getDigits",function(a,b,c){for(var d=b,e=a.length;d<e&&JU.PT.isDigit(a.charAt(d));)d++;try{c[0]=Integer.parseInt(a.substring(b,d))}catch(f){if(H(f,NumberFormatException))c[0]=-2147483648;else throw f;}return d},"~S,~N,~A");c$.skipTo=g(c$,"skipTo",function(a,b,c){for(var d;(d=JS.SmilesParser.getChar(a,++b))!=c&&"\x00"!=d;);return"\x00"==d?-1:b},"~S,~N,~S");c$.getRingPointer=g(c$,
"getRingPointer",function(a){return 10>a?""+a:100>a?"%"+a:"%("+a+")"},"~N");c$.cleanPattern=g(c$,"cleanPattern",function(a){a=JU.PT.replaceAllCharacters(a," \t\n\r","");a=JU.PT.rep(a,"^^","'");for(var b=0,c=0;0<=(b=a.indexOf("//*"))&&(c=a.indexOf("*//"))>=b;)a=a.substring(0,b)+a.substring(c+3);return a=JU.PT.rep(a,"//","")},"~S")});B("JS");E(["JS.JmolSmilesExtension"],"JS.SmilesExt","java.lang.Float JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JM.BondSet JU.BSUtil $.Logger".split(" "),function(){c$=
G(function(){this.sm=this.e=null;F(this,arguments)},JS,"SmilesExt",null,JS.JmolSmilesExtension);M(c$,function(){});m(c$,"init",function(a){this.e=a;this.sm=this.e.vwr.getSmilesMatcher();return this},"~O");m(c$,"getSmilesCorrelation",function(a,b,c,d,e,f,g,j,h,m,l,n,r){var w=null==m?0.1:3.4028235E38;try{null==d&&(d=new JU.Lst,e=new JU.Lst);var p=new JU.M4,t=new JU.P3,q=this.e.vwr.ms.at,s=this.e.vwr.getAtomCount(),z=this.sm.getCorrelationMaps(c,q,s,a,j,!0);null==z&&this.e.evalError(this.sm.getLastException(),
null);if(0==z.length)return NaN;var x=z[0];for(a=0;a<x.length;a++)d.addLast(q[x[a]]);z=this.sm.getCorrelationMaps(c,q,s,b,j,n);null==z&&this.e.evalError(this.sm.getLastException(),null);if(0==z.length)return NaN;JU.Logger.info(z.length+" mappings found");if(r||!h){b=3.4028235E38;c=null;for(a=0;a<z.length;a++){e.clear();for(var A=0;A<z[a].length;A++)e.addLast(q[z[a][A]]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var u=JU.Measure.getTransformMatrix4(d,e,p,t);JU.Logger.info("getSmilesCorrelation stddev="+
u);if(null!=g&&u<w){for(var y=new JU.BS,A=0;A<z[a].length;A++)y.set(z[a][A]);g.addLast(y)}u<b&&(c=z[a],null!=f&&f.setM4(p),null!=l&&l.setT(t),b=u)}null!=m&&(m[0]=x,m[1]=c);e.clear();for(a=0;a<c.length;a++)e.addLast(q[c[a]]);return b}for(a=0;a<z.length;a++)for(A=0;A<z[a].length;A++)e.addLast(q[z[a][A]])}catch(v){if(H(v,Exception))this.e.evalError(v.getMessage(),null);else throw v;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~B,~A,JU.P3,~B,~B");m(c$,"getSmilesMatches",function(a,b,c,d,e,
f){if(0==a.length||a.equals("H"))try{return this.e.vwr.getSmilesOpt(c,0,0,a.equals("H"),!f,!1,!0,!0)}catch(g){if(H(g,Exception))this.e.evalError(g.getMessage(),null);else throw g;}var j=!0,h;if(null==d){j=null==b;try{h=j?this.sm.getSubstructureSetArray(a,this.e.vwr.ms.at,this.e.vwr.getAtomCount(),c,null,e,!1):this.sm.find(a,b,e,!1)}catch(m){if(H(m,Exception))return this.e.evalError(m.getMessage(),null),null;throw m;}}else{h=new JU.Lst;a=this.getSmilesCorrelation(d,c,a,null,null,null,h,e,!1,null,null,
!1,!1);if(Float.isNaN(a))return f?new JU.BS:[];this.e.showString("RMSD "+a+" Angstroms");h=h.toArray(Array(h.size()))}if(f){f=new JU.BS;for(a=0;a<h.length;a++)f.or(h[a]);if(j)return f;if(!e)return Integer.$valueOf(f.cardinality());e=v(f.cardinality(),0);j=0;for(h=f.nextSetBit(0);0<=h;h=f.nextSetBit(h+1))e[j++]=h+1;return e}if(!j)for(a=0;a<h.length;a++)h[a]=JU.BSUtil.copy2(h[a],new JM.BondSet);e=new JU.Lst;for(a=0;a<h.length;a++)e.addLast(h[a]);return e},"~S,~S,JU.BS,JU.BS,~B,~B");m(c$,"getFlexFitList",
function(a,b,c,d){var e=JU.AU.newInt2(2);this.getSmilesCorrelation(a,b,c,null,null,null,null,d,!1,e,null,!1,!1);if(null==e[0])return null;a=this.e.vwr.getDihedralMap(e[0]);b=null==a?null:this.e.vwr.getDihedralMap(e[1]);if(null==b||b.length!=a.length)return null;e=P(a.length,3,0);c=this.e.vwr.ms.at;JS.SmilesExt.getTorsions(c,b,e,0);JS.SmilesExt.getTorsions(c,a,e,1);b=P(6*a.length,0);for(d=c=0;c<a.length;c++){var f=a[c];b[d++]=f[0];b[d++]=f[1];b[d++]=f[2];b[d++]=f[3];b[d++]=e[c][0];b[d++]=e[c][1]}return b},
"JU.BS,JU.BS,~S,~B");c$.getTorsions=g(c$,"getTorsions",function(a,b,c,d){for(var e=b.length;0<=--e;){var f=b[e],f=JU.Measure.computeTorsion(a[f[0]],a[f[1]],a[f[2]],a[f[3]],!0);1==d&&(180<f-c[e][0]?f-=360:-180>=f-c[e][0]&&(f+=360));c[e][d]=f}},"~A,~A,~A,~N")})})(Clazz,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,
Clazz.exceptionOf,Clazz.newIntArray,Clazz.defineStatics,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.p0p,Clazz.pu$h,Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,Clazz.clone,Clazz.doubleToShort,
Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
|
mausdin/MOFsite
|
jsmol/j2s/core/coresmiles.z.js
|
JavaScript
|
mit
| 86,130
|
import React from 'react';
import {Decorator as Cerebral} from 'cerebral-view-react';
import styles from './styles.css';
@Cerebral({
boilerplates: 'bin.boilerplates'
})
class Boilerplates extends React.Component {
render() {
return (
<div className={styles.wrapper}>
{Object.keys(this.props.boilerplates).map((key, index) => {
return (
<div
className={styles.boilerplate}
key={index}
onClick={() => this.props.signals.bin.boilerplateClicked({name: key})}>
{this.props.boilerplates[key]}
</div>
);
})}
</div>
);
}
}
export default Boilerplates;
|
christianalfoni/webpack-bin
|
app/mobileLandscape/Boilerplates/index.js
|
JavaScript
|
mit
| 689
|
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.17/esri/copyright.txt for details.
//>>built
define("esri/tasks/locationproviders/StandardGeographyQueryLocationProvider","../../declare dojo/_base/lang dojo/_base/array dojo/string ../../lang ../../geometry/jsonUtils ./LocationProviderRemoteBase".split(" "),function(k,l,m,e,n,p,q){return k("esri.tasks.locationproviders.StandardGeographyQueryLocationProvider",q,{standardGeographyQueryTask:null,queryParameters:null,geographyQueryTemplate:null,geometryType:"esriGeometryPolygon",constructor:function(){this.queryParameters||(this.queryParameters=
{});this.queryParameters.returnCentroids&&(this.geometryType="esriGeometryPoint")},_batchWillOverflow:function(a,b){return 100<a.length+1},_locateBatch:function(a){var b=l.mixin({},this.queryParameters,{geographyQueries:m.map(a,function(a,b){var d=a.expression;d.OBJECTID=b;return d})});n.isDefined(b.generalizationLevel)||(b.generalizationLevel=6);b.returnGeometry=!1===this.queryParameters.returnGeometry?!1:!0;return this.standardGeographyQueryTask.execute(b).then(function(b){for(var e=[],d=0;d<b.featureSet.features.length;d++){var f=
b.featureSet.features[d];if(f)for(var c=0;c<a.length;c++){var g=a[c];if(g.expression.OBJECTID==f.attributes.ResultID){for(c=0;c<g.features.length;c++){var h=g.features[c];f.geometry&&(h.geometry=p.fromJson(f.geometry),e.push(h))}break}}}return e})},_createKey:function(a,b){return e.substitute(this.geographyQueryTemplate,a.attributes)},_createQueryExpression:function(a){return{QUERY:e.substitute(this.geographyQueryTemplate,a.attributes)}}})});
|
darklilium/Factigis_2
|
arcgis_js_api/library/3.17/3.17compact/esri/tasks/locationproviders/StandardGeographyQueryLocationProvider.js
|
JavaScript
|
mit
| 1,646
|
/**
@module ember
@submodule ember-runtime
*/
import CoreObject from "ember-runtime/system/core_object";
import Observable from "ember-runtime/mixins/observable";
/**
`Ember.Object` is the main base class for all Ember objects. It is a subclass
of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
see the documentation for each of these.
@class Object
@namespace Ember
@extends Ember.CoreObject
@uses Ember.Observable
@public
*/
var EmberObject = CoreObject.extend(Observable);
EmberObject.toString = function() {
return "Ember.Object";
};
export default EmberObject;
|
thejameskyle/ember.js
|
packages/ember-runtime/lib/system/object.js
|
JavaScript
|
mit
| 616
|
/* eslint no-shadow:0 */
/* eslint no-console:0 */
/* eslint max-len:0 */
/* eslint max-nested-callbacks:0 */
import testUtils from '../test.utils.js'
import angular from 'angular-fix'
import _ from 'lodash'
const {getNewField, input, basicForm, shouldWarnWithLog} = testUtils
describe('formly-form', () => {
let $compile, formlyConfig, scope, el, $timeout
beforeEach(window.module('formly'))
beforeEach(inject((_$compile_, _formlyConfig_, _$timeout_, $rootScope) => {
formlyConfig = _formlyConfig_
$compile = _$compile_
$timeout = _$timeout_
scope = $rootScope.$new()
scope.model = {}
scope.fields = []
}))
it(`should be possible to use it as an attribute directive`, () => {
const el = compileAndDigest(`
<div formly-form model="model" fields="fields" form="theForm"></div>
`)
expect(el.length).to.equal(1)
expect(el.prop('nodeName').toLowerCase()).to.equal('ng-form')
})
it('should use ng-form as the default root tag', () => {
const el = compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm"></formly-form>
`)
expect(el.length).to.equal(1)
expect(el.prop('nodeName').toLowerCase()).to.equal('ng-form')
})
it('should use a different root tag when specified', () => {
const el = compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm" root-el="form"></formly-form>
`)
expect(el.length).to.equal(1)
expect(el.prop('nodeName').toLowerCase()).to.equal('form')
})
it(`should use a different root tag for formly-fields when specified`, () => {
scope.fields = [getNewField()]
const el = compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm" field-root-el="area"></formly-form>
`)
expect(el[0].querySelector('area.formly-field')).to.exist
})
it(`should assign the scope's "form" property to the given FormController if it has a value`, () => {
const el = compileAndDigest(`
<form name="theForm">
<formly-form model="model" fields="fields" form="theForm" id="my-formly-form"></formly-form>
</form>
`)
const isolateScope = angular.element(el[0].querySelector('#my-formly-form')).isolateScope()
expect(scope.theForm).to.eq(isolateScope.form)
expect(scope.theForm.$name).to.eq('theForm')
})
it(`should assign the scope's "form" property to its own FormController if it doesn't have a value`, () => {
const el = compileAndDigest(`
<div>
<formly-form model="model" fields="fields" form="theForm" id="my-formly-form"></formly-form>
</div>
`)
const isolateScope = angular.element(el[0].querySelector('#my-formly-form')).isolateScope()
expect(scope.theForm).to.eq(isolateScope.theFormlyForm)
})
it(`should warn if there's no FormController to be assigned`, inject(($log) => {
compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm" id="my-formly-form" root-el="div"></formly-form>
`)
const log = $log.warn.logs[0]
expect($log.warn.logs).to.have.length(1)
expect(log[0]).to.equal('Formly Warning:')
expect(log[1]).to.equal('Your formly-form does not have a `form` property. Many functions of the form (like validation) may not work')
}))
it(`should put the formControl on the field's scope when using a different form root element`, () => {
scope.fields = [getNewField()]
const el = compileAndDigest(`
<form name="theForm">
<formly-form model="model" fields="fields" form="theForm" root-el="div"></formly-form>
</form>
`)
const fieldScope = angular.element(el[0].querySelector('.formly-field')).isolateScope()
expect(fieldScope.fc).to.exist
})
it(`should not allow sibling forms to override each other on a parent form`, () => {
compileAndDigest(`
<form name="parent">
<formly-form form="form1" model="model" fields="fields"></formly-form>
<formly-form form="form2" model="model" fields="fields"></formly-form>
</form>
`)
expect(scope.parent).to.have.property('formly_1')
expect(scope.parent).to.have.property('formly_2')
})
it(`should place the form control on the scope property defined by the form attribute`, () => {
compileAndDigest(`
<formly-form form="vm.myForm" model="model" fields="fields"></formly-form>
`)
expect(scope.vm).to.have.property('myForm')
expect(scope.vm.myForm).to.have.property('$name')
})
it(`should initialize the model and the fields if not provided`, () => {
compileAndDigest(`
<formly-form model="model" fields="fields"></formly-form>
`)
expect(scope.model).to.exist
expect(scope.fields).to.exist
})
it(`should initialize the model and fields if they are null`, () => {
scope.model = null
scope.fields = null
compileAndDigest(`
<formly-form model="model" fields="fields"></formly-form>
`)
expect(scope.model).to.exist
expect(scope.fields).to.exist
})
it(`should allow the user to specify their own name for the form`, () => {
compileAndDigest(`
<form name="parent">
<div ng-repeat="forms in [1, 2] track by $index">
<formly-form model="model" fields="fields" bind-name="$parent.$index + '_in_my_ng_repeat'"></formly-form>
</div>
</form>
`)
expect(scope.parent).to.have.property('formly_0_in_my_ng_repeat')
expect(scope.parent).to.have.property('formly_1_in_my_ng_repeat')
const firstForm = el[0].querySelector('ng-form')
const firstFormScope = angular.element(firstForm).isolateScope()
expect(firstFormScope.formId).to.eq('formly_0_in_my_ng_repeat')
})
it(`should allow you to completely swap out the fields`, () => {
scope.fields = [getNewField(), getNewField()]
compileAndDigest(basicForm)
scope.fields = [getNewField(), getNewField()]
expect(() => scope.$digest()).to.not.throw()
})
describe(`ngTransclude element`, () => {
it(`should have the specified className`, () => {
const el = compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm" transclude-class="foo yeah"></formly-form>
`)
expect(el[0].querySelector('.foo.yeah')).to.exist
})
it(`should not have a className when one is unspecified`, () => {
// this test is to avoid giving it a class of "undefined"
const el = compileAndDigest(`
<formly-form model="model" fields="fields" form="theForm"></formly-form>
`)
const transcludedDiv = el[0].querySelector('div[ng-transclude]')
expect(transcludedDiv.classList).to.have.length(0)
})
})
describe(`fieldGroup`, () => {
beforeEach(() => {
scope.user = {}
formlyConfig.setType({
name: 'input',
template: input,
})
let key = 0
scope.fields = [
{
className: 'bar',
fieldGroup: [
{type: 'input', key: key++},
{type: 'input', key: key++},
],
},
{type: 'input', key: key++},
{type: 'input', key: key++},
{
className: 'foo',
model: scope.user,
fieldGroup: [
{type: 'input', key: key++},
{type: 'input', key: key++, className: 'specific-field'},
{type: 'input', key: key++},
],
},
]
})
it(`should allow you to specify a fieldGroup which will use the formly-form directive internally`, () => {
compileAndDigest()
expect(el[0].querySelectorAll('[formly-field].formly-field-input')).to.have.length(7)
expect(el[0].querySelectorAll('ng-form')).to.have.length(2)
expect(el[0].querySelectorAll('ng-form.foo')).to.have.length(1)
expect(el[0].querySelectorAll('ng-form.foo [formly-field].formly-field-input')).to.have.length(3)
expect(el[0].querySelectorAll('.formly-field-group')).to.have.length(2)
})
it(`should copy the parent's attributes in the template`, () => {
scope.fields = [
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
],
},
]
compileAndDigest('<formly-form model="model" fields="fields" some-extra-attr="someValue"></formly-form>')
const fieldGroupNode = el[0].querySelector('.field-group')
expect(fieldGroupNode).to.exist
expect(fieldGroupNode.getAttribute('some-extra-attr')).to.eq('someValue')
})
describe(`options`, () => {
const formWithOptions = '<formly-form model="model" fields="fields" options="options"></formly-form>'
beforeEach(() => {
scope.fields = [
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
],
},
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
],
},
]
scope.options = {}
})
it(`should allow you to call the child's updateInitialValue and resetModel from the parent`, () => {
const field = scope.fields[0].fieldGroup[0]
compileAndDigest(formWithOptions)
expect(field.initialValue).to.not.exist
scope.model[field.key] = 'foo'
scope.options.updateInitialValue()
expect(field.initialValue).to.eq('foo')
scope.model[field.key] = 'bar'
scope.options.resetModel()
expect(scope.model[field.key]).to.eq('foo')
})
it(`should have the same formState`, () => {
compileAndDigest(formWithOptions)
const fieldGroup1 = scope.fields[0]
const fieldGroup2 = scope.fields[1]
expect(fieldGroup1.options.formState).to.eq(fieldGroup2.options.formState)
expect(scope.options.formState).to.eq(fieldGroup1.options.formState)
})
})
it(`should be possible to use a wrapper & templateOptions in a fieldGroup`, () => {
formlyConfig.setWrapper({
name: 'panel',
template: `<div class="panel">
<div class="heading">
Panel Title: {{options.templateOptions.title}}
</div>
<div class="sub-heading">
Subtitle: {{to.subtitle}}
</div>
<div class="body">
<formly-transclude></formly-transclude>
</div>
</div>
`,
})
scope.fields = [
{
className: 'field-group',
wrapper: 'panel',
templateOptions: {
title: 'My Panel',
subtitle: 'is awesome',
},
fieldGroup: [
getNewField(),
getNewField(),
],
},
]
scope.options = {}
compileAndDigest()
const panelNode = el[0].querySelector('.panel')
expect(panelNode).to.exist
const bodyNode = panelNode.querySelector('.body')
expect(bodyNode).to.exist
const headingNode = panelNode.querySelector('.heading')
expect(headingNode).to.exist
const headingEl = angular.element(headingNode)
expect(headingEl.text().trim()).to.eq('Panel Title: My Panel')
const subHeadingNode = panelNode.querySelector('.sub-heading')
expect(subHeadingNode).to.exist
const subHeadingEl = angular.element(subHeadingNode)
expect(subHeadingEl.text().trim()).to.eq('Subtitle: is awesome')
})
it(`should be possible to hide a fieldGroup with the hide property`, () => {
compileAndDigest()
expect(el[0].querySelectorAll('ng-form.bar')).to.have.length(1)
const fieldGroup1 = scope.fields[0]
fieldGroup1.hide = true
scope.$digest()
expect(el[0].querySelectorAll('ng-form.bar')).to.have.length(0)
})
it(`should pass the model to it's children fields`, () => {
compileAndDigest()
const specificGroup = scope.fields[3]
const specificField = specificGroup.fieldGroup[1]
const specificFieldNode = el[0].querySelector('.specific-field')
expect(specificFieldNode).to.exist
specificField.formControl.$setViewValue('foo')
expect(specificGroup.model[specificField.key]).to.eq('foo')
expect(specificGroup.model).to.eq(scope.user)
expect(scope.user[specificField.key]).to.eq('foo')
expect(angular.element(specificFieldNode).isolateScope().model).to.eq(scope.user)
})
it(`should have a form property`, () => {
compileAndDigest()
expect(scope.fields[0].form).to.have.property('$$parentForm')
})
it(`should be able to be dynamically hidden with a hideExpression`, () => {
scope.fields = [
{
hideExpression: 'model.foo === "bar"',
fieldGroup: [
getNewField(),
getNewField(),
],
},
getNewField({
key: 'foo', hideExpression: 'options.data.canHide && model.baz === "foobar"', data: {canHide: true},
}),
]
compileAndDigest()
expect(scope.fields[0].hide).to.be.false
expect(scope.fields[1].hide).to.be.false
scope.model.foo = 'bar'
scope.model.baz = 'foobar'
scope.$digest()
expect(scope.fields[0].hide).to.be.true
expect(scope.fields[1].hide).to.be.true
})
it(`should allow a field group inside a field group`, () => {
scope.fields = scope.fields = [
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
],
},
],
},
]
expect(() => compileAndDigest()).to.not.throw()
})
it(`should validate fields in a fieldGroup`, () => {
scope.fields = [
{
className: 'field-group',
fieldGroup: [
getNewField(),
getNewField(),
{
className: 'field-group',
fieldGroup: [
getNewField({extra: 'property'}),
getNewField(),
getNewField(),
],
},
],
},
]
expect(() => compileAndDigest()).to.throw()
})
})
describe('an instance of model', () => {
const spy1 = sinon.spy()
const spy2 = sinon.spy()
beforeEach(() => {
scope.model = {}
scope.fieldModel1 = {}
scope.fields = [
{template: input, key: 'foo', model: scope.fieldModel1},
{template: input, key: 'bar', model: scope.fieldModel1},
{template: input, key: 'zoo', model: scope.fieldModel1},
]
})
it('should be assigned with only one watcher', () => {
compileAndDigest()
$timeout.flush()
scope.fields[0].expressionProperties = {'data.dummy': spy1}
scope.fields[1].expressionProperties = {'data.dummy': spy2}
scope.fieldModel1.foo = 'value'
scope.$digest()
$timeout.flush()
expect(spy1).to.have.been.calledOnce
expect(spy2).to.have.been.calledOnce
})
})
describe('nested model as string', () => {
let spy
beforeEach(() => {
spy = sinon.spy()
scope.model = {
nested: {},
}
scope.fields = [
{template: input, key: 'foo'},
]
})
it('starting with "model." should be assigned with only one watcher', () => {
testModelAccessor('model.nested')
})
it('starting with "model[" should be assigned with only one watcher', () => {
testModelAccessor('model["nested"]')
})
it('starting with "formState." should be assigned with only one watcher', () => {
testFormStateAccessor('formState.nested')
})
it('starting with "formState[" should be assigned with only one watcher', () => {
testFormStateAccessor('formState["nested"]')
})
function testModelAccessor(accessor) {
scope.fields[0].model = accessor
compileAndDigest()
$timeout.flush()
scope.fields[0].expressionProperties = {'data.dummy': spy}
scope.model.nested.foo = 'value'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.calledOnce
}
function testFormStateAccessor(accessor) {
const formWithOptions = '<formly-form model="model" fields="fields" options="options"></formly-form>'
scope.options = {
formState: {
nested: {},
},
}
scope.fields[0].model = accessor
compileAndDigest(formWithOptions)
$timeout.flush()
scope.fields[0].expressionProperties = {'data.dummy': spy}
scope.options.formState.nested.foo = 'value'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.calledOnce
}
})
describe('hideExpression', () => {
beforeEach(() => {
scope.model = {}
scope.fieldModel = {}
scope.fields = [
{template: input, key: 'foo', model: scope.fieldModel},
{template: input, key: 'bar', model: scope.fieldModel, hideExpression: () => !!scope.fieldModel.foo},
]
})
it('should be called and resolve to true when field model changes', () => {
compileAndDigest()
expect(scope.fields[1].hide).be.false
scope.fields[0].formControl.$setViewValue('value')
expect(scope.fields[1].hide).be.true
})
it('should be called and resolve to false when field model changes', () => {
scope.fieldModel.foo = 'value'
compileAndDigest()
expect(scope.fields[1].hide).be.true
scope.fields[0].formControl.$setViewValue('')
expect(scope.fields[1].hide).be.false
})
})
describe(`options`, () => {
beforeEach(() => {
scope.model = {
foo: 'myFoo',
bar: 123,
foobar: 'ab@cd.com',
}
scope.fields = [
{template: input, key: 'foo'},
{template: input, key: 'bar', templateOptions: {type: 'numaber'}},
{template: input, key: 'foobar', templateOptions: {type: 'email'}},
]
scope.options = {
formState: {
foo: 'bar',
},
}
})
it(`should throw an error with extra options`, () => {
expect(() => {
scope.options = {extra: true}
compileAndDigest()
}).to.throw()
})
it(`should run expressionProperties when the formState changes`, () => {
const spy = sinon.spy()
const field = {
template: input,
key: 'foo',
expressionProperties: {
'templateOptions.label': spy,
},
}
scope.fields = [field]
compileAndDigest()
scope.options.formState.foo = 'eggs'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.called
})
describe(`resetModel`, () => {
it(`should reset the model that's given`, () => {
compileAndDigest()
expect(typeof scope.options.resetModel).to.eq('function')
const previousFoo = scope.model.foo
scope.model.foo = 'newFoo'
scope.options.resetModel()
expect(scope.model.foo).to.eq(previousFoo)
})
it(`should reset the $viewValue of fields`, () => {
compileAndDigest()
const previousFoobar = scope.model.foobar
scope.fields[2].formControl.$setViewValue('not-an-email')
scope.options.resetModel()
expect(scope.fields[2].formControl.$viewValue).to.equal(previousFoobar)
})
it(`should reset the $viewValue and $modelValue to undefined if the value was not originally defined`, () => {
scope.fields.push({
template: input, key: 'baz', templateOptions: {required: true},
})
compileAndDigest()
const fc = scope.fields[scope.fields.length - 1].formControl
scope.model.baz = 'hello world'
scope.$digest()
expect(fc.$viewValue).to.eq('hello world')
expect(fc.$modelValue).to.eq('hello world')
scope.options.resetModel()
expect(scope.model.baz).to.be.undefined
expect(fc.$viewValue).to.be.undefined
expect(fc.$modelValue).to.be.undefined
})
it(`should rerender the ng-model element`, () => {
const el = compileAndDigest()
const ngModelNode = el[0].querySelector('[ng-model]')
scope.model.foo = 'hey there!'
scope.$digest()
scope.options.resetModel()
expect(ngModelNode.value).to.eq('myFoo')
})
it(`should reset models of fields`, () => {
scope.fieldModel = {baz: false}
scope.fields.push({
template: input, key: 'baz', model: scope.fieldModel,
})
compileAndDigest()
scope.fieldModel.baz = true
scope.options.resetModel()
expect(scope.fieldModel.baz).to.be.false
})
it(`should not break if a fieldGroup has yet to be initialized`, () => {
scope.fields = [
{fieldGroup: [getNewField()], hide: true},
]
compileAndDigest()
expect(() => scope.options.resetModel()).to.not.throw()
})
it(`should not break if a field has yet to be initialized`, () => {
scope.fields = [getNewField({hide: true})]
compileAndDigest()
expect(() => scope.options.resetModel()).to.not.throw()
})
})
describe(`hide-directive attribute`, () => {
beforeEach(() => {
scope.fields = [{template: input, key: 'foo'}]
})
it(`should default to ng-if`, () => {
compileAndDigest(basicForm)
const fieldNode = el[0].querySelector('.formly-field')
expect(fieldNode.getAttribute('ng-if')).to.exist
})
it(`should allow custom directive for hiding`, () => {
compileAndDigest(`
<formly-form model="model" fields="fields" hide-directive="ng-show"></formly-form>
`)
const fieldNode = el[0].querySelector('.formly-field')
expect(fieldNode.getAttribute('ng-if')).to.not.exist
expect(fieldNode.getAttribute('ng-show')).to.exist
})
})
describe(`track-by attribute`, () => {
const template = `<formly-form model="model" fields="fields" track-by="field.key"></formly-form>`
beforeEach(() => {
scope.fields = [getNewField(), getNewField(), getNewField()]
})
it(`should default to track by $$hashKey when the attribute is not present`, () => {
compileAndDigest(basicForm)
expect(scope.fields[0].$$hashKey).to.exist
})
it(`should track by the specified value`, () => {
compileAndDigest(template)
expectTrackBy('field.key')
})
it(`should allow you to track by $index`, () => {
compileAndDigest(`<formly-form model="model" fields="fields" track-by="$index"></formly-form>`)
expectTrackBy('$index')
})
it(`should throw an error when the field's specified values are not unique`, () => {
scope.fields.push({template: input, key: 'foo'})
scope.fields.push({template: input, key: 'foo'})
expect(compileAndDigest.bind(null, template)).to.throw('ngRepeat:dupes')
})
it(`should allow you to push a field after initial compile`, () => {
expectFieldChange(scope.fields.push.bind(scope.fields, getNewField()))
})
it(`should allow you to pop a field after initial compile`, () => {
expectFieldChange(scope.fields.pop.bind(scope.fields))
})
it(`should allow you to splice out a field after initial compile`, () => {
expectFieldChange(scope.fields.splice.bind(scope.fields, 1, 1))
})
it(`should allow you splice in a field after initial compile`, () => {
expectFieldChange(scope.fields.splice.bind(scope.fields, 1, 0, getNewField()))
})
function expectTrackBy(trackBy) {
expect(el[0].innerHTML).to.contain(`field in fields track by ${trackBy}`)
}
function expectFieldChange(change) {
compileAndDigest(template)
change()
expect(() => scope.$digest()).to.not.throw()
}
})
describe(`updateInitialValue`, () => {
it(`should update the initial value of the fields`, () => {
compileAndDigest()
const field = scope.fields[0]
expect(field.initialValue).to.equal('myFoo')
scope.model.foo = 'otherValue'
scope.options.updateInitialValue()
expect(field.initialValue).to.equal('otherValue')
})
it(`should reset to the updated initial value`, () => {
compileAndDigest()
const field = scope.fields[0]
scope.model.foo = 'otherValue'
scope.options.updateInitialValue()
scope.model.foo = 'otherValueAgain'
scope.options.resetModel()
expect(field.initialValue).to.equal('otherValue')
expect(scope.model.foo).to.equal('otherValue')
})
})
describe(`removeChromeAutoComplete`, () => {
it(`should not have a hidden input when nothing is specified`, () => {
const el = compileAndDigest()
const autoCompleteFixEl = el[0].querySelector('[autocomplete="address-level4"]')
expect(autoCompleteFixEl).to.be.null
})
it(`should add a hidden input when specified as true`, () => {
scope.options.removeChromeAutoComplete = true
const el = compileAndDigest()
const autoCompleteFixEl = el[0].querySelector('[autocomplete="address-level4"]')
expect(autoCompleteFixEl).to.exist
})
it(`should override the 'true' global configuration`, inject((formlyConfig) => {
formlyConfig.extras.removeChromeAutoComplete = true
scope.options.removeChromeAutoComplete = false
const el = compileAndDigest()
const autoCompleteFixEl = el[0].querySelector('[autocomplete="address-level4"]')
expect(autoCompleteFixEl).to.be.null
}))
it(`should be added regardless of the option if the global config is set`, inject((formlyConfig) => {
formlyConfig.extras.removeChromeAutoComplete = true
const el = compileAndDigest()
const autoCompleteFixEl = el[0].querySelector('[autocomplete="address-level4"]')
expect(autoCompleteFixEl).to.exist
}))
})
describe(`fieldTransform`, () => {
beforeEach(() => {
formlyConfig.extras.fieldTransform = fieldTransform
})
it(`should give a deprecation warning when formlyConfig.extras.fieldTransform is a function rather than an array`, inject(($log) => {
shouldWarnWithLog(
$log,
[
'Formly Warning:',
'fieldTransform as a function has been deprecated.',
/Attempted for formlyConfig.extras/,
],
compileAndDigest
)
}))
it(`should give a deprecation warning when options.fieldTransform function rather than an array`, inject(($log) => {
formlyConfig.extras.fieldTransform = undefined
scope.fields = [getNewField()]
scope.options.fieldTransform = fields => fields
shouldWarnWithLog(
$log,
[
'Formly Warning:',
'fieldTransform as a function has been deprecated.',
'Attempted for form',
],
compileAndDigest
)
}))
it(`should throw an error if something is passed in and nothing is returned`, () => {
scope.fields = [getNewField()]
scope.options.fieldTransform = function() {
// I return nothing...
}
expect(() => compileAndDigest()).to.throw(/^Formly Error: fieldTransform must return an array of fields/)
})
it(`should allow you to transform field configuration`, () => {
scope.options.fieldTransform = fieldTransform
const spy = sinon.spy(scope.options, 'fieldTransform')
doExpectations(spy)
})
it(`should use formlyConfig.extras.fieldTransform when not specified on options`, () => {
const spy = sinon.spy(formlyConfig.extras, 'fieldTransform')
doExpectations(spy)
})
it(`should allow you to use an array of transform functions`, () => {
scope.fields = [getNewField({
customThing: 'foo',
otherCustomThing: {
whatever: '|-o-|',
}})]
scope.options.fieldTransform = [fieldTransform]
expect(() => compileAndDigest()).to.not.throw()
const field = scope.fields[0]
expect(field).to.have.deep.property('data.customThing')
expect(field).to.have.deep.property('data.otherCustomThing')
})
function doExpectations(spy) {
const originalFields = [{
key: 'keyProp',
template: '<hr />',
customThing: 'foo',
otherCustomThing: {
whatever: '|-o-|',
},
}]
scope.fields = originalFields
compileAndDigest()
expect(spy).to.have.been.calledWith(originalFields, scope.model, scope.options, scope.form)
const field = scope.fields[0]
expect(field).to.not.have.property('customThing')
expect(field).to.not.have.property('otherCustomThing')
expect(field).to.have.deep.property('data.customThing')
expect(field).to.have.deep.property('data.otherCustomThing')
}
function fieldTransform(fields) {
const extraKeys = ['customThing', 'otherCustomThing']
return _.map(fields, field => {
const newField = {data: {}}
_.each(field, (val, name) => {
if (_.contains(extraKeys, name)) {
newField.data[name] = val
} else {
newField[name] = val
}
})
return newField
})
}
})
describe(`data`, () => {
it(`should allow you to put whatever you want in data`, () => {
scope.options.data = {foo: 'bar'}
expect(compileAndDigest).to.not.throw()
})
})
})
function compileAndDigest(template) {
el = $compile(template || basicForm)(scope)
scope.$digest()
return el
}
describe(`field watchers`, () => {
it('should throw for a watcher with no listener', () => {
scope.fields = [getNewField({
watcher: {},
})]
expect(compileAndDigest).to.throw()
})
it(`should setup any watchers specified on a field`, () => {
scope.model = {}
const listener = sinon.spy()
const expression = sinon.spy()
scope.fields = [getNewField({
watcher: {
listener: '',
},
}), getNewField({
watcher: [{
listener: '',
expression: '',
}, {
listener,
expression,
}],
})]
expect(compileAndDigest).to.not.throw()
expect(listener).to.have.been.called
expect(expression).to.have.been.called
})
it(`should setup any watchers specified on a fieldgroup`, () => {
scope.model = {}
const listener = sinon.spy()
const expression = sinon.spy()
scope.fields = [{
watcher: [{
listener: '',
expression: '',
}, {
listener,
expression,
}],
fieldGroup: [
getNewField({}),
getNewField({}),
],
}]
expect(compileAndDigest).to.not.throw()
expect(listener).to.have.been.called
expect(expression).to.have.been.called
})
})
describe(`manualModelWatcher option`, () => {
beforeEach(() => {
scope.model = {
foo: 'myFoo',
bar: 123,
baz: {buzz: 'myBuzz'},
}
scope.fields = [
{template: input, key: 'foo'},
{template: input, key: 'bar', templateOptions: {type: 'number'}},
]
})
describe('declared as a boolean', () => {
beforeEach(() => {
scope.options = {
manualModelWatcher: true,
}
})
it(`should block a global model watcher`, () => {
const spy = sinon.spy()
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.foo = 'bar'
scope.$digest()
$timeout.verifyNoPendingTasks()
expect(spy).to.not.have.been.called
})
it(`should watch manually selected model property`, () => {
const spy = sinon.spy()
scope.fields[0].watcher = [{
expression: 'model.foo',
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.foo = 'bar'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.called
})
it(`should not watch model properties that do not have manual watcher defined`, () => {
const spy = sinon.spy()
scope.fields[0].watcher = [{
expression: 'model.foo',
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.bar = 123
scope.$digest()
$timeout.verifyNoPendingTasks()
expect(spy).to.not.have.been.called
})
it(`should run manual watchers defined as a function`, () => {
const spy = sinon.spy()
const stub = sinon.stub()
scope.fields[0].watcher = [{
expression: stub,
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
stub.reset()
spy.reset()
// set random stub value so it triggers watcher function
stub.returns(Math.random())
scope.$digest()
$timeout.flush()
expect(stub).to.have.been.called
expect(spy).to.have.been.called
})
it('should not trigger watches on other fields', () => {
const spy1 = sinon.spy()
const spy2 = sinon.spy()
scope.fields[0].watcher = [{
expression: 'model.foo',
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy1,
}
scope.fields[1].expressionProperties = {
'templateOptions.label': spy2,
}
compileAndDigest()
$timeout.flush()
spy1.reset()
spy2.reset()
scope.model.foo = 'asd'
scope.$digest()
$timeout.flush()
expect(spy1).to.have.been.called
expect(spy2).to.not.have.been.called
})
it('works with models that are declared as string (relative model)', () => {
const spy = sinon.spy()
const model = 'model.nested'
scope.model = {
nested: {
foo: 'foo',
},
}
scope.fields[0].model = model
scope.fields[0].watcher = [{
expression: 'model.nested.foo',
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.nested.foo = 'bar'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.called
})
})
describe('declared as a function', () => {
beforeEach(() => {
scope.options = {
manualModelWatcher: () => scope.model.baz,
}
})
it('works as a form-wide watcher', () => {
const spy = sinon.spy()
scope.options = {
manualModelWatcher: () => scope.model.baz,
}
scope.fields[1].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.foo = 'random string'
scope.$digest()
$timeout.verifyNoPendingTasks()
expect(spy).to.not.have.been.called
spy.reset()
scope.model.baz.buzz = 'random buzz string'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.called
})
it('still fires manual field watchers', () => {
const spy = sinon.spy()
scope.fields[0].watcher = [{
expression: 'model.foo',
runFieldExpressions: true,
}]
scope.fields[0].expressionProperties = {
'templateOptions.label': spy,
}
compileAndDigest()
$timeout.flush()
spy.reset()
scope.model.foo = 'bar'
scope.$digest()
$timeout.flush()
expect(spy).to.have.been.called
})
})
describe('enabled with watchAllExpressions option', () => {
beforeEach(() => {
scope.options = {
manualModelWatcher: true,
watchAllExpressions: true,
}
})
it('watches and evaluates string template expressions', () => {
const field = scope.fields[0]
field.expressionProperties = {
'templateOptions.label': 'model.foo',
}
compileAndDigest()
$timeout.flush()
scope.model.foo = 'bar'
scope.$digest()
expect(field.templateOptions.label).to.equal(scope.model.foo)
})
it('watches and evaluates string template expressions with custom string model', () => {
const field = scope.fields[0]
field.model = 'model.baz'
field.expressionProperties = {
'templateOptions.label': 'model.buzz',
}
compileAndDigest()
$timeout.flush()
scope.model.baz.buzz = 'bar'
scope.$digest()
expect(field.templateOptions.label).to.equal(scope.model.baz.buzz)
})
it('watches and evaluates string template expressions with custom object model', () => {
const field = scope.fields[0]
field.model = {customFoo: 'customBar'}
field.expressionProperties = {
'templateOptions.label': 'model.customFoo',
}
compileAndDigest()
$timeout.flush()
field.model.customFoo = 'bar'
scope.$digest()
expect(field.templateOptions.label).to.equal(field.model.customFoo)
})
it('watches and evaluates hideExpression', () => {
const field = scope.fields[0]
field.hideExpression = 'model.foo === "bar"'
compileAndDigest()
$timeout.flush()
scope.model.foo = 'bar'
scope.$digest()
expect(field.hide).to.equal(true)
})
it('watches and evaluates hideExpression with custom string model', () => {
const field = scope.fields[0]
field.model = 'model.baz'
field.hideExpression = 'model.baz.buzz === "bar"'
compileAndDigest()
$timeout.flush()
scope.model.baz.buzz = 'bar'
scope.$digest()
expect(field.hide).to.equal(true)
})
})
})
})
|
kamilkisiela/angular-formly
|
src/directives/formly-form.test.js
|
JavaScript
|
mit
| 39,221
|
'use strict';
var pokedex = require('../pokedex'),
_ = require('lodash');
/** Pokedex command
* @module command/pokedex
*/
module.exports = {
/** Command name */
name: '/pokedex',
/** Command regex pattern */
pattern: /\/pokedex/,
/** Command's description to be listed in /help */
description: '/pokedex - List all known Pokémon',
/** Is the command listed in Telegram's command list? */
list: true,
/**
* Callback to execute when a user executes the command.
* @param {Object} msg - The Telegram message object.
* @param {Array} match - The regex match result.
* @param {Object} user - The user's stored Mongoose model.
* @param {Boolean} created - Was the user created as a result of the command call?
*/
callback: function(msg, match, user, created) {
var names = [];
_.forEach(pokedex.pokedex, function(name, number) {
names.push(number + ') ' + name);
});
return 'All known Pokémon:\n\n' + names.join('\n');
}
};
|
algoni/PogoBot-Telegram
|
src/commands/pokedex.js
|
JavaScript
|
mit
| 1,055
|
var data = [
{
"firstName": "Ellie",
"lastName": "Aleen",
"age": 37,
"salary": 5117.200000000001,
"email": "Dee_Cummerata@gmail.com",
"addresses": [
{
"street": "8965 Maye Passage",
"city": "South Bayleemouth",
"country": "Falkland Islands (Malvinas)"
}
],
"bio": "Maiores modi cumque iure et repudiandae laudantium aperiam id temporibus. Nihil dicta adipisci asperiores. Eveniet provident rerum saepe nihil nesciunt et modi quas. Voluptatem doloremque doloremque dicta. Autem ad voluptatem.\n \rQuod earum reprehenderit quia. Itaque non voluptates. Molestias laudantium maiores in qui sint eligendi.\n \rIllum iste et aut voluptas. Quas cumque ut ducimus. Possimus est quibusdam voluptatum similique iste enim quas quibusdam optio. Cumque officiis adipisci ullam dolorum et et libero doloribus vel. Maxime quae quidem itaque neque quasi vel consequatur dignissimos.",
"expire": "2016-11-01T13:39:44.263Z",
"id": 0
},
{
"firstName": "Destiny",
"lastName": "Hazel",
"age": 33,
"salary": 2716,
"email": "Nicholaus.Witting59@yahoo.com",
"addresses": [
{
"street": "58930 Ashlynn Row",
"city": "Lloydfurt",
"country": "Yemen"
}
],
"bio": "Quibusdam iusto sit. Adipisci ducimus corrupti enim consequatur doloribus qui. At dolores et sed ipsa unde molestias voluptatem veritatis ut. Quisquam voluptates in harum consectetur voluptates soluta ex.\n \rUllam et repellendus eos accusantium voluptas et nihil. Doloremque quos dolorum repellat voluptatem quo et tenetur eos. Et accusamus dolor.\n \rEligendi doloremque doloremque nam esse modi assumenda hic. Pariatur magnam aut excepturi omnis ut nisi. Aut amet occaecati ut debitis laudantium vero. Incidunt quos tenetur alias.",
"expire": "2016-11-02T03:23:35.199Z",
"id": 1
},
{
"firstName": "Demond",
"lastName": "Eriberto",
"age": 25,
"salary": 8906,
"email": "Narciso44@yahoo.com",
"addresses": [
{
"street": "1108 Hodkiewicz Fields",
"city": "South Fritzfort",
"country": "Lebanon"
}
],
"bio": "Laborum culpa dicta deserunt laborum totam accusantium. Neque occaecati nihil. Dolor blanditiis dolorem quae aliquam eos sint ut. Enim voluptates quisquam magni minus tenetur sed. Enim sunt provident nisi deleniti voluptatem quisquam ad nisi. Error consequatur sint pariatur exercitationem commodi.\n \rEos rerum autem perferendis ducimus qui eius. Omnis ipsum porro et voluptas eius. Molestiae quis ut assumenda similique officia dolor nihil placeat qui. Asperiores nihil doloremque fugiat neque. Veniam minima sunt rerum excepturi est repellat.\n \rAccusamus qui exercitationem tempore non ipsa quidem praesentium. Quae consectetur cupiditate ipsa aperiam provident quo. Maiores dolorum occaecati ut provident. Illo commodi aut nihil. Voluptatem laboriosam nostrum. Sed suscipit molestias et vero nulla sed fuga ut nemo.",
"expire": "2016-11-01T17:28:31.761Z",
"id": 2
},
{
"firstName": "Margarette",
"lastName": "Vesta",
"age": 16,
"salary": 3735.8,
"email": "Brian.Eichmann@gmail.com",
"addresses": [
{
"street": "340 Antonina Harbor",
"city": "East Cristiantown",
"country": "Portugal"
},
{
"street": "232 Gladyce Fall",
"city": "Port Cassidyborough",
"country": "Andorra"
}
],
"bio": "Et et sunt itaque sit ipsa similique quibusdam cupiditate. Soluta est ut maiores quo officia nulla. Qui dolor minus fugiat placeat enim provident aut libero dignissimos. Dolores quos quia consequuntur neque modi.\n \rTempore doloremque quis non voluptatem quod. Accusamus molestiae veniam et nostrum voluptatem et quibusdam. Dolor commodi praesentium. Voluptates cumque modi perspiciatis consequatur rerum.\n \rDebitis iure dignissimos. Eum accusantium nesciunt nesciunt est sed. Magnam incidunt impedit eos neque eum porro.",
"expire": "2016-11-02T06:09:43.153Z",
"id": 3
},
{
"firstName": "Destany",
"lastName": "Grover",
"age": 53,
"salary": 1596.1000000000001,
"email": "Luciano66@yahoo.com",
"addresses": [
{
"street": "7511 Stracke Way",
"city": "West Kris",
"country": "Bahamas"
},
{
"street": "1835 Maggie Ridge",
"city": "Lake Margehaven",
"country": "Jordan"
}
],
"bio": "Neque et vel et. Enim occaecati consectetur consectetur qui assumenda quia ut. Debitis soluta libero nemo voluptatem quia facilis officiis.\n \rPraesentium et est. Et et non rem. Necessitatibus minus nihil explicabo. Harum voluptatem aut nostrum. Rerum dolor qui ut culpa sequi et dolore consequuntur.\n \rDistinctio non sit magni asperiores odio earum velit. In ipsum temporibus tempora officia omnis. Voluptas excepturi est sequi animi dolorem omnis.",
"expire": "2016-11-02T03:45:09.752Z",
"id": 4
},
{
"firstName": "Katelyn",
"lastName": "Mortimer",
"age": 53,
"salary": 8328.2,
"email": "Eliza_Reinger3@yahoo.com",
"addresses": [
{
"street": "3874 Alexys Valleys",
"city": "North Stephen",
"country": "Greenland"
}
],
"bio": "Eaque maiores nobis. A neque et odit aut. Rerum quia ut iste ipsa ducimus quibusdam dicta.\n \rEt exercitationem omnis placeat. Saepe occaecati quae officiis deserunt. Maiores eos est minus vitae quo. Suscipit iste accusamus iure quo sint qui nisi.\n \rPlaceat cum qui asperiores. Porro enim quas accusamus illo quo error omnis aliquid. Facere aut enim consequatur esse. Et rerum nobis reprehenderit quis aut occaecati quia non. Laudantium quia temporibus asperiores.",
"expire": "2016-11-02T02:14:17.094Z",
"id": 5
},
{
"firstName": "Elwyn",
"lastName": "Antonio",
"age": 62,
"salary": 7604,
"email": "Chad16@hotmail.com",
"addresses": [
{
"street": "405 Skiles Estates",
"city": "Lake Thora",
"country": "Dominica"
}
],
"bio": "Placeat debitis corrupti. Nostrum aut accusantium est corporis magnam voluptate reiciendis. Est neque libero quidem temporibus. Placeat voluptate laudantium.\n \rIpsum distinctio consequatur molestias iure. Qui nam consequatur veniam sed ut voluptatem et eius. Sapiente error est deleniti unde nulla perferendis error nihil esse. Rerum tempora voluptas eos minus. Iste quisquam ab quasi qui architecto eaque earum impedit.\n \rQuia repellat animi. Quo qui alias sed dolores earum dolorum et. Totam atque voluptatem accusantium aliquid reiciendis dolor perspiciatis expedita incidunt. Quidem ratione aut laudantium expedita. Consectetur soluta sunt labore libero explicabo. Veritatis doloribus ut aliquam eius cupiditate non sint.",
"expire": "2016-11-02T03:05:25.368Z",
"id": 6
},
{
"firstName": "Kenyatta",
"lastName": "Ronaldo",
"age": 59,
"salary": 2360.4,
"email": "Asia_Schuppe@hotmail.com",
"addresses": [
{
"street": "033 Bud Station",
"city": "Mafaldatown",
"country": "Azerbaijan"
},
{
"street": "99237 Arnaldo Islands",
"city": "New Henryton",
"country": "Cape Verde"
}
],
"bio": "Nisi nisi culpa error aliquid incidunt eos assumenda. Natus ut est qui animi facilis expedita. Libero voluptas illum et assumenda expedita dolore ratione atque.\n \rSunt velit est molestiae praesentium hic quia. Voluptatem aspernatur doloremque. Dolore beatae ut quaerat libero cum.\n \rRecusandae nesciunt dolor qui quo placeat. Blanditiis et cumque ex praesentium. Veniam dolorum nisi et ut ut ea. Et similique aperiam recusandae dolorum nihil ut deserunt molestiae.",
"expire": "2016-11-02T07:17:19.938Z",
"id": 7
},
{
"firstName": "Maybelle",
"lastName": "Agustin",
"age": 56,
"salary": 3461.6000000000004,
"email": "Arden65@gmail.com",
"addresses": [
{
"street": "86934 Rebecca Pine",
"city": "Port Tess",
"country": "Eritrea"
},
{
"street": "4111 Evert Haven",
"city": "New Kimmouth",
"country": "Saint Lucia"
},
{
"street": "43472 Effertz Circles",
"city": "Corneliuston",
"country": "Iceland"
}
],
"bio": "Quia et harum fugit incidunt nisi vero exercitationem. Est tempora reiciendis omnis. Nesciunt nam dolores numquam et quasi fugit. In nisi quae eligendi. Excepturi doloribus ut ut ut corporis debitis dolorum illum. Error eos officiis ipsa sed sint.\n \rTenetur fugiat pariatur voluptatem illum tenetur quaerat quia quo. Consequatur et quos vel veniam eaque. Fugit sint autem corporis omnis sint minus quis. Ut consectetur et.\n \rNeque rerum aut ratione. Voluptas dolores velit et odit. Nostrum ipsum mollitia et aut voluptatibus dicta illo. Praesentium voluptatum dolor dicta atque fuga. Officiis sed pariatur quidem. Eligendi autem quia eum quidem doloribus ipsa ut.",
"expire": "2016-11-02T03:09:41.801Z",
"id": 8
},
{
"firstName": "Emmett",
"lastName": "Aurore",
"age": 28,
"salary": 6141,
"email": "Aniya_Corwin27@hotmail.com",
"addresses": [
{
"street": "16975 Frederique Mountains",
"city": "Lake Vernie",
"country": "Iran"
}
],
"bio": "Placeat et quaerat ipsa iste. Reiciendis quia velit quis est vitae. Explicabo accusamus beatae exercitationem sed sint et maiores modi.\n \rCum ducimus impedit fugit aut autem ipsa quia omnis officiis. Et aut ipsa tempore sed ut dolor nam. Voluptas occaecati quia. Qui repudiandae nihil quia. Consectetur iste facere sed.\n \rAnimi atque facere sapiente magni sed nemo aspernatur facere aspernatur. Recusandae autem rerum reprehenderit non qui eligendi. Eius dicta dignissimos distinctio. Et rem quaerat aut porro error. Et sunt voluptatem ut velit unde.",
"expire": "2016-11-02T03:21:55.431Z",
"id": 9
},
{
"firstName": "Lia",
"lastName": "German",
"age": 64,
"salary": 4647.400000000001,
"email": "Elinore.Schneider@hotmail.com",
"addresses": [
{
"street": "83200 Griffin Route",
"city": "Estellaland",
"country": "Cape Verde"
},
{
"street": "3744 Cartwright Points",
"city": "East Javier",
"country": "Namibia"
}
],
"bio": "Suscipit non nam ut reiciendis id nemo. Quae doloremque vel quisquam totam perspiciatis et. Et autem est sit atque omnis ex cumque. Molestias ut expedita quo qui ut placeat.\n \rNobis commodi autem numquam voluptatum porro omnis excepturi eligendi magni. Voluptatem cumque dolores aliquid omnis et qui ad veniam et. Quod sint qui.\n \rMagnam nesciunt est at dolores molestiae doloribus repudiandae et soluta. Incidunt amet fuga. Qui in molestiae id et soluta sint. Iure voluptatem doloremque perferendis eos odit. Tempora aspernatur vitae optio.",
"expire": "2016-11-01T15:47:49.530Z",
"id": 10
},
{
"firstName": "Walker",
"lastName": "Rusty",
"age": 48,
"salary": 9098.300000000001,
"email": "Aiden_Schowalter@yahoo.com",
"addresses": [
{
"street": "171 Lorena Groves",
"city": "Port Avaberg",
"country": "Saint Lucia"
}
],
"bio": "Ut dolores sit aut molestiae in quis officia voluptatem. Id deserunt et dolorem amet officia et enim nesciunt. Porro commodi ut eveniet rerum eligendi quisquam a. Est dolor ea quos vero.\n \rPariatur impedit ipsam inventore praesentium ab autem. Et ut praesentium molestiae ipsa aut. Impedit unde asperiores autem mollitia eum omnis fugiat. Fugiat consectetur cumque beatae a iusto itaque iure. Dolor sed quia voluptate qui harum id. Perspiciatis deleniti et quasi.\n \rDeleniti quisquam et est aliquam nulla explicabo tempora. Atque unde accusamus provident sit. Sint excepturi qui ad ut placeat sit rerum non quod. Est quibusdam omnis omnis repellendus labore saepe. Omnis nemo est ut hic pariatur omnis nisi.",
"expire": "2016-11-02T08:13:32.304Z",
"id": 11
},
{
"firstName": "Guillermo",
"lastName": "Monty",
"age": 25,
"salary": 9346.5,
"email": "Isaac_Rippin49@hotmail.com",
"addresses": [
{
"street": "29956 Coralie Springs",
"city": "South Vallie",
"country": "Andorra"
},
{
"street": "3694 Lebsack Wells",
"city": "South Diana",
"country": "Christmas Island"
},
{
"street": "96510 Langosh Estates",
"city": "South Prudencetown",
"country": "Japan"
}
],
"bio": "Dolores ut asperiores aut at doloremque laboriosam aut omnis. Fuga reiciendis nihil mollitia ut quisquam. Est corrupti similique ut voluptas sunt itaque maiores sit. Facere expedita quod dolorum voluptatibus. Animi porro quos eos.\n \rItaque minima consequatur ducimus. Ratione vitae sunt sunt facilis autem quaerat qui minima vel. Quo earum assumenda ea praesentium. Qui ut pariatur saepe ducimus. Reiciendis occaecati quam est tempore distinctio harum laborum.\n \rMolestiae perferendis neque velit qui. Autem qui velit totam voluptatem temporibus. Tempora id eum nesciunt. Dolor libero et occaecati. Vel corporis qui ut et deleniti voluptas aliquid aut accusamus. Quia molestiae illo sed et tenetur et rerum ut magni.",
"expire": "2016-11-02T03:13:13.390Z",
"id": 12
},
{
"firstName": "Jayne",
"lastName": "Dejon",
"age": 72,
"salary": 9429.800000000001,
"email": "Seth_MacGyver@hotmail.com",
"addresses": [
{
"street": "08908 Hagenes Curve",
"city": "Koeppport",
"country": "Bouvet Island (Bouvetoya)"
},
{
"street": "32330 Ryleigh Park",
"city": "Myrtismouth",
"country": "Georgia"
},
{
"street": "40024 Maurice Prairie",
"city": "New Daronchester",
"country": "Zimbabwe"
}
],
"bio": "Voluptatem eveniet animi enim eligendi libero. Quidem consectetur sed aliquam fuga at voluptas distinctio. Qui incidunt soluta. Saepe ut qui provident aut eveniet harum et id. Fugiat provident facere. Maiores quasi consequatur.\n \rOccaecati maiores corporis. Quo molestiae porro sint odit sunt. Optio neque et nostrum fugiat consectetur. Sit perspiciatis ea. Dolorem vero optio.\n \rFugiat id rerum voluptatem numquam sint eius. Sit hic dolor accusamus. Dolorem doloremque et blanditiis nulla nihil. Deserunt et harum rerum qui aliquid tempora.",
"expire": "2016-11-01T12:12:21.017Z",
"id": 13
},
{
"firstName": "Calista",
"lastName": "Anya",
"age": 57,
"salary": 5475.6,
"email": "Melyssa17@hotmail.com",
"addresses": [
{
"street": "6150 Conn Court",
"city": "Camyllefurt",
"country": "Luxembourg"
},
{
"street": "604 Eichmann Streets",
"city": "Considineborough",
"country": "Papua New Guinea"
},
{
"street": "059 Raynor Club",
"city": "Leonoraberg",
"country": "Belgium"
}
],
"bio": "Sequi a voluptatibus esse sint quas enim quidem molestiae ut. Et sapiente quia distinctio unde. Et at quisquam corporis qui quia non incidunt voluptatibus quas. Dolor explicabo molestiae placeat distinctio autem sapiente. Atque hic explicabo commodi. Fuga nostrum et fugiat sed.\n \rSunt corporis labore occaecati itaque sed veniam. Ut voluptatem et impedit ducimus odio quidem esse. Aliquam nesciunt accusantium vitae quam consequatur voluptate aut qui quia. Rem sapiente esse qui.\n \rMinus ratione qui qui quis molestiae voluptas. A accusamus laborum minus reiciendis aut cupiditate veritatis. Dolores magni doloremque et. Et odio tempore et harum sit molestias ducimus et hic. Iste ipsam molestiae.",
"expire": "2016-11-02T09:56:15.490Z",
"id": 14
},
{
"firstName": "Nathen",
"lastName": "Lourdes",
"age": 41,
"salary": 5463.400000000001,
"email": "Jamey.Tromp@yahoo.com",
"addresses": [
{
"street": "1812 Gerlach Shoals",
"city": "Bertramshire",
"country": "Micronesia"
},
{
"street": "640 Zboncak Turnpike",
"city": "South Tyriqueshire",
"country": "Iceland"
}
],
"bio": "At architecto culpa repellat natus neque vitae et vel aut. Quis veritatis et itaque dolorem qui est voluptatibus. Saepe quisquam dolor. Nam voluptatem vel sint alias libero dolor ad quia. Et odit et quasi ipsum saepe alias quam. Numquam necessitatibus voluptatem eius eius ut quam incidunt.\n \rEsse sunt iure quas earum dolore commodi necessitatibus. Ut distinctio consequatur necessitatibus suscipit. Et quam cum ab nobis. Similique sit iusto beatae. Deserunt blanditiis dicta aut nesciunt aut.\n \rConsequatur dolorum aut fuga reiciendis. Veniam aut quo velit occaecati. Rerum deleniti eveniet expedita in est fuga rem. Qui accusantium et dolor sed labore aut itaque. Vel natus dolorem est voluptatem et praesentium magnam.",
"expire": "2016-11-02T05:24:43.478Z",
"id": 19
},
{
"firstName": "Raoul",
"lastName": "Marianne",
"age": 36,
"salary": 3910.5,
"email": "Audreanne_Corwin46@gmail.com",
"addresses": [
{
"street": "8643 Gottlieb Road",
"city": "Bertramtown",
"country": "Peru"
},
{
"street": "69491 Gusikowski Junction",
"city": "Casimerburgh",
"country": "New Zealand"
}
],
"bio": "Repellendus laudantium non fugit voluptas. Vel soluta est pariatur necessitatibus veritatis. Unde nam optio hic commodi quia quam et. Molestiae occaecati ipsam hic est enim non. Voluptas ea error non aliquid non.\n \rQuia quia vero qui eligendi voluptatem non consequuntur. Perferendis illo pariatur et possimus. Ratione nulla similique soluta aut. Quia ea natus et. Ipsam necessitatibus consequatur autem adipisci officiis.\n \rVoluptas aspernatur ut qui. Cupiditate quo autem. Consequuntur exercitationem commodi. Eum eligendi commodi. Mollitia deleniti laboriosam officiis provident in et.",
"expire": "2016-11-02T08:42:30.051Z",
"id": 20
}
];
|
ducin/angularjs-training
|
app/data.js
|
JavaScript
|
mit
| 18,932
|
/* eslint-disable */
require('script-loader!file-saver');
import XLSX from 'xlsx'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
header,
data,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
data.unshift(header);
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}
|
ren8179/QrF.Core
|
vue-cms/src/vendor/Export2Excel.js
|
JavaScript
|
mit
| 5,066
|
'use strict';
/**
* Config
* @type {{domain: string, store: {enabled: boolean}, supervisor: {enabled: boolean}, prism: {enabled: boolean}, lg: {enabled: boolean}, gump: {enabled: boolean}}}
*/
module.exports = {
domain: 'ping.ms',
peer: {
enabled: true
}
}
|
eSited/ping.ms
|
admin/src/config.js
|
JavaScript
|
mit
| 272
|
var Article = require('mongoose').model('Article');
module.exports = {
getArticleById: function(req, res, next) {
Article.findOne({_id: req.params.id})
.exec(function(err, course) {
if (err) {
console.log('Articles could not be loaded: ' + err);
} else {
res.send(course);
}
});
},
getAllArticles: function(req, res, next) {
Article.find({}, function(err, collection) {
if (err) {
console.log('Articles could not be loaded: ' + err);
}
res.send(collection);
});
},
getArticlesByTags: function(req, res, next) {
var meta = JSON.parse(req.params.companyMeta);
Article.find({tags: { "$in": meta } })
.exec(function(err, articles) {
if (err) {
console.log('Articles could not be loaded: ' + err);
} else {
res.send(articles);
}
});
},
createArticle: function(req, res, next) {
var articleData = req.body;
Article.create(articleData, function(err, category) {
if (err) {
console.log('Failed to create new article! ' + err);
return;
}
res.end();
});
},
updateArticle: function(req, res, next) {
var articleData = req.body;
Article.update({_id: req.body._id}, articleData, function() {
res.end();
})
},
removeArticle: function(req, res, next) {
Article.remove({_id: req.body._id}, function() {
res.end();
})
}
};
|
pan196/Project.Catalog
|
server/controllers/ArticleCtrl.js
|
JavaScript
|
mit
| 1,750
|
/***********************************************************************
*author:huang.chao
*date:2013.9.7
*overview:TBD
************************************************************************/
var tendencyset = {
initialize: function () {
$(".express-link").on('click', function () {
$.mobile.changePage("express.html", { transition: "pop" });
});
$(".tendency-link").on('click', function () {
$.mobile.changePage("tendency.html", { transition: "pop" });
});
$(".summary-link").on('click', function () {
$.mobile.changePage("summary.html", { transition: "pop" });
});
$(".check-btn").on('click', function () {
$.mobile.changePage("tendency.html", { transition: "pop" });
});
$("#startdate-label").text(window.localStorage.getItem("maf-tendency-startdate"));
$("#startdate-btn").on('click', function () {
$('#startdate-datebox').datebox({ 'defaultValue': window.localStorage.getItem("maf-tendency-startdate") });
$('#startdate-datebox').datebox('open');
});
$('#startdate-datebox').on('change', function (e, p) {
$('#startdate-label').text(common.formatdate1($(this).val()));
window.localStorage.setItem("maf-tendency-startdate", common.formatdate1($(this).val()));
});
$("#enddate-label").text(window.localStorage.getItem("maf-tendency-enddate"));
$("#enddate-btn").on('click', function () {
$('#enddate-datebox').datebox({ 'defaultValue': window.localStorage.getItem("maf-tendency-enddate") });
$('#enddate-datebox').datebox('open');
});
$('#enddate-datebox').on('change', function (e, p) {
$('#enddate-label').text(common.formatdate1($(this).val()));
window.localStorage.setItem("maf-tendency-enddate", common.formatdate1($(this).val()));
});
$("#interval-label").text(window.localStorage.getItem("maf-tendency-groupby"))
$(".interval-btn").on('click', function () {
$("#popupMenu").popup( "open" );
});
$(".interval-link-daily").on('click', function (event, ui) {
$("#interval-label").text("Daily");
window.localStorage.setItem("maf-tendency-groupby", "Daily");
$("#popupMenu").popup("close");
});
$(".interval-link-weekly").on('click', function (event, ui) {
$("#interval-label").text("Weekly");
window.localStorage.setItem("maf-tendency-groupby", "Weekly");
$("#popupMenu").popup("close");
});
$(".interval-link-monthly").on('click', function (event, ui) {
$("#interval-label").text("Monthly");
window.localStorage.setItem("maf-tendency-groupby", "Monthly");
$("#popupMenu").popup("close");
});
},
};
|
huangchaosuper/ReportViewer
|
reportviewer/www/js/pages/tendency-set.js
|
JavaScript
|
mit
| 2,895
|
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const tls = require('tls');
const conn = tls.connect(0, common.mustNotCall());
conn.on('error', common.mustCall(function() {
assert.doesNotThrow(function() {
conn.destroy();
});
}));
|
hoho/dosido
|
nodejs/test/parallel/test-tls-client-abort2.js
|
JavaScript
|
mit
| 1,468
|
var utils = require(__common + 'tools/utils');
var constants = require('../constants/index');
function defaultSettings(req) {
return {
culture: req.params.culture,
labels: constants.labels.load(req.params.culture)
};
}
function extendedSettings(req, extender) {
return utils.merge(extender, defaultSettings(req));
}
module.exports = {
'default': defaultSettings,
extended: extendedSettings
};
|
SergeyRyzhov/Moilly
|
app/common/tools/settings.js
|
JavaScript
|
mit
| 404
|
'use strict';
/* eslint-env node */
module.exports = function(environment) {
let ENV = {
modulePrefix: 'dummy',
environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}
if (environment === 'production') {
// here be dragons
}
return ENV;
};
|
simplabs/ember-cli-pixijs
|
tests/dummy/config/environment.js
|
JavaScript
|
mit
| 1,214
|
/* eslint-env jest */
const { mockClient, fetchMock } = require('../mocks/client.mock')
const Module = require('../../src/endpoints/currencies')
describe('endpoints > currencies', () => {
let endpoint
beforeEach(() => {
endpoint = new Module(mockClient)
fetchMock.reset()
})
it('test /v2/currencies', async () => {
expect(endpoint.isPaginated).toEqual(true)
expect(endpoint.isBulk).toEqual(true)
expect(endpoint.supportsBulkAll).toEqual(true)
expect(endpoint.isLocalized).toEqual(true)
expect(endpoint.isAuthenticated).toEqual(false)
expect(endpoint.cacheTime).not.toEqual(undefined)
expect(endpoint.url).toEqual('/v2/currencies')
fetchMock.addResponse([1, 2, 3])
let content = await endpoint.ids()
expect(content).toEqual([1, 2, 3])
})
})
|
gw2efficiency/gw2api-client
|
tests/endpoints/currencies.spec.js
|
JavaScript
|
mit
| 801
|
'use strict';
var expect = require('expect');
var glogg = require('../');
describe('glogg', function() {
var logger;
beforeEach(function(done) {
logger = glogg('glogg-test');
done();
});
afterEach(function(done) {
logger.remove();
done();
});
it('emits a debug event when debug method is called', function(done) {
logger.on('debug', function(msg) {
expect(msg).toEqual('test');
done();
});
logger.debug('test');
});
it('emits a info event when info method is called', function(done) {
logger.on('info', function(msg) {
expect(msg).toEqual('test');
done();
});
logger.info('test');
});
it('emits a warn event when warn method is called', function(done) {
logger.on('warn', function(msg) {
expect(msg).toEqual('test');
done();
});
logger.warn('test');
});
it('emits a error event when error method is called', function(done) {
logger.on('error', function(msg) {
expect(msg).toEqual('test');
done();
});
logger.error('test');
});
it('formats a string message with util.format syntax', function(done) {
logger.on('debug', function(msg) {
expect(msg).toEqual('test something');
done();
});
logger.debug('test %s', 'something');
});
it('does not format a non-string message', function(done) {
var expected = { test: 'something' };
logger.on('debug', function(msg) {
expect(msg).toEqual(expected);
done();
});
logger.debug(expected);
});
it('allows you to "destructure" the individual log-level functions', function(done) {
var debug = logger.debug;
logger.on('debug', function(msg) {
expect(msg).toEqual('test');
done();
});
debug('test');
});
});
|
undertakerjs/glogg
|
test/index.js
|
JavaScript
|
mit
| 1,794
|
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLInputElement() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLInputElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLInputElement, HTMLElement.interface);
Object.defineProperty(HTMLInputElement, "prototype", {
value: HTMLInputElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
HTMLInputElement.prototype.select = function select() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl].select();
};
HTMLInputElement.prototype.setRangeText = function setRangeText(replacement) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'setRangeText' on 'HTMLInputElement': " +
"1 argument required, but only " +
arguments.length +
" present."
);
}
const args = [];
for (let i = 0; i < arguments.length && i < 4; ++i) {
args[i] = arguments[i];
}
args[0] = conversions["DOMString"](args[0], {
context: "Failed to execute 'setRangeText' on 'HTMLInputElement': parameter 1"
});
return this[impl].setRangeText(...args);
};
HTMLInputElement.prototype.setSelectionRange = function setSelectionRange(start, end) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (arguments.length < 2) {
throw new TypeError(
"Failed to execute 'setSelectionRange' on 'HTMLInputElement': " +
"2 arguments required, but only " +
arguments.length +
" present."
);
}
const args = [];
for (let i = 0; i < arguments.length && i < 3; ++i) {
args[i] = arguments[i];
}
args[0] = conversions["unsigned long"](args[0], {
context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 1"
});
args[1] = conversions["unsigned long"](args[1], {
context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 2"
});
if (args[2] !== undefined) {
args[2] = conversions["DOMString"](args[2], {
context: "Failed to execute 'setSelectionRange' on 'HTMLInputElement': parameter 3"
});
}
return this[impl].setSelectionRange(...args);
};
Object.defineProperty(HTMLInputElement.prototype, "accept", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("accept");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'accept' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("accept", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "alt", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("alt");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'alt' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("alt", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "autocomplete", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("autocomplete");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'autocomplete' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("autocomplete", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "autofocus", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("autofocus");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'autofocus' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("autofocus", "");
} else {
this.removeAttribute("autofocus");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "defaultChecked", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("checked");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'defaultChecked' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("checked", "");
} else {
this.removeAttribute("checked");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "checked", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["checked"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'checked' property on 'HTMLInputElement': The provided value"
});
this[impl]["checked"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "dirName", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("dirName");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'dirName' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("dirName", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "disabled", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("disabled");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'disabled' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("disabled", "");
} else {
this.removeAttribute("disabled");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "form", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["form"]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "files", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return utils.tryWrapperForImpl(this[impl]["files"]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "formNoValidate", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("formNoValidate");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'formNoValidate' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("formNoValidate", "");
} else {
this.removeAttribute("formNoValidate");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "formTarget", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("formTarget");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'formTarget' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("formTarget", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "indeterminate", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["indeterminate"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'indeterminate' property on 'HTMLInputElement': The provided value"
});
this[impl]["indeterminate"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "inputMode", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("inputMode");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'inputMode' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("inputMode", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "max", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("max");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'max' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("max", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "maxLength", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["maxLength"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["long"](V, {
context: "Failed to set the 'maxLength' property on 'HTMLInputElement': The provided value"
});
this[impl]["maxLength"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "min", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("min");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'min' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("min", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "minLength", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["minLength"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["long"](V, {
context: "Failed to set the 'minLength' property on 'HTMLInputElement': The provided value"
});
this[impl]["minLength"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "multiple", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("multiple");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'multiple' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("multiple", "");
} else {
this.removeAttribute("multiple");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "name", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("name");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'name' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("name", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "pattern", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("pattern");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'pattern' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("pattern", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "placeholder", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("placeholder");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'placeholder' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("placeholder", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "readOnly", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("readOnly");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'readOnly' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("readOnly", "");
} else {
this.removeAttribute("readOnly");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "required", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this.hasAttribute("required");
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["boolean"](V, {
context: "Failed to set the 'required' property on 'HTMLInputElement': The provided value"
});
if (V) {
this.setAttribute("required", "");
} else {
this.removeAttribute("required");
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "size", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["size"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["unsigned long"](V, {
context: "Failed to set the 'size' property on 'HTMLInputElement': The provided value"
});
this[impl]["size"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "src", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("src");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'src' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("src", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "step", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("step");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'step' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("step", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "type", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["type"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'type' property on 'HTMLInputElement': The provided value"
});
this[impl]["type"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "defaultValue", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("value");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'defaultValue' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("value", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "value", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["value"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'value' property on 'HTMLInputElement': The provided value",
treatNullAsEmptyString: true
});
this[impl]["value"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionStart", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["selectionStart"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["unsigned long"](V, {
context: "Failed to set the 'selectionStart' property on 'HTMLInputElement': The provided value"
});
}
this[impl]["selectionStart"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionEnd", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["selectionEnd"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["unsigned long"](V, {
context: "Failed to set the 'selectionEnd' property on 'HTMLInputElement': The provided value"
});
}
this[impl]["selectionEnd"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "selectionDirection", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
return this[impl]["selectionDirection"];
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
if (V === null || V === undefined) {
V = null;
} else {
V = conversions["DOMString"](V, {
context: "Failed to set the 'selectionDirection' property on 'HTMLInputElement': The provided value"
});
}
this[impl]["selectionDirection"] = V;
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "align", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("align");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'align' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("align", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, "useMap", {
get() {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
const value = this.getAttribute("useMap");
return value === null ? "" : value;
},
set(V) {
if (!this || !module.exports.is(this)) {
throw new TypeError("Illegal invocation");
}
V = conversions["DOMString"](V, {
context: "Failed to set the 'useMap' property on 'HTMLInputElement': The provided value"
});
this.setAttribute("useMap", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLInputElement.prototype, Symbol.toStringTag, {
value: "HTMLInputElement",
writable: false,
enumerable: false,
configurable: true
});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
// implementing this mixin interface.
_mixedIntoPredicates: [],
is(obj) {
if (obj) {
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
return true;
}
for (const isMixedInto of module.exports._mixedIntoPredicates) {
if (isMixedInto(obj)) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (const isMixedInto of module.exports._mixedIntoPredicates) {
if (isMixedInto(wrapper)) {
return true;
}
}
}
return false;
},
convert(obj, { context = "The provided value" } = {}) {
if (module.exports.is(obj)) {
return utils.implForWrapper(obj);
}
throw new TypeError(`${context} is not of type 'HTMLInputElement'.`);
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLInputElement.prototype);
obj = this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLInputElement.prototype);
obj = this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});
obj[impl][utils.wrapperSymbol] = obj;
if (Impl.init) {
Impl.init(obj[impl], privateData);
}
return obj;
},
interface: HTMLInputElement,
expose: {
Window: { HTMLInputElement }
}
}; // iface
module.exports = iface;
const Impl = require("../nodes/HTMLInputElement-impl.js");
|
ani2404/ee6761cloud
|
node_modules/jsdom/lib/jsdom/living/generated/HTMLInputElement.js
|
JavaScript
|
mit
| 25,670
|
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./baFullCalendar.component'));
//# sourceMappingURL=index.js.map
|
akhandpratapsingh-tudip/Atithi
|
src/app/theme/components/baFullCalendar/index.js
|
JavaScript
|
mit
| 193
|
'use strict';
/**
* Module dependencies.
*/
var assets = require('./public/config/assets').development;
// Karma configuration
module.exports = function(config) {
config.set({
basePath : './public',
// Frameworks to use
frameworks: ['jasmine'],
// List of files / patterns to load in the browser
files: assets.vendor.js.concat(assets.js, assets.tests),
// Test results reporter to use
// Possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
//reporters: ['progress'],
reporters: ['progress'],
// Web server port
port: 9876,
// Enable / disable colors in the output (reporters and logs)
colors: true,
// Level of logging
// Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// Enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// If true, it capture browsers, run tests and exit
singleRun: true
/*
plugins : [
'karma-junit-reporter',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
*/
});
};
|
Tsur/kalzate
|
root/karma.conf.js
|
JavaScript
|
mit
| 1,623
|
import { Meteor } from 'meteor/meteor';
import { ServiceConfiguration } from 'meteor/service-configuration';
import _ from 'underscore';
import { CustomOAuth } from '../../../custom-oauth';
import { Logger } from '../../../logger';
import { settings } from '../../../settings';
const logger = new Logger('rocketchat:lib', {
methods: {
oauth_updated: {
type: 'info',
},
},
});
function _OAuthServicesUpdate() {
const services = settings.get(/^(Accounts_OAuth_|Accounts_OAuth_Custom-)[a-z0-9_]+$/i);
services.forEach((service) => {
logger.oauth_updated(service.key);
let serviceName = service.key.replace('Accounts_OAuth_', '');
if (serviceName === 'Meteor') {
serviceName = 'meteor-developer';
}
if (/Accounts_OAuth_Custom-/.test(service.key)) {
serviceName = service.key.replace('Accounts_OAuth_Custom-', '');
}
if (service.value === true) {
const data = {
clientId: settings.get(`${ service.key }_id`),
secret: settings.get(`${ service.key }_secret`),
};
if (/Accounts_OAuth_Custom-/.test(service.key)) {
data.custom = true;
data.clientId = settings.get(`${ service.key }-id`);
data.secret = settings.get(`${ service.key }-secret`);
data.serverURL = settings.get(`${ service.key }-url`);
data.tokenPath = settings.get(`${ service.key }-token_path`);
data.identityPath = settings.get(`${ service.key }-identity_path`);
data.authorizePath = settings.get(`${ service.key }-authorize_path`);
data.scope = settings.get(`${ service.key }-scope`);
data.accessTokenParam = settings.get(`${ service.key }-access_token_param`);
data.buttonLabelText = settings.get(`${ service.key }-button_label_text`);
data.buttonLabelColor = settings.get(`${ service.key }-button_label_color`);
data.loginStyle = settings.get(`${ service.key }-login_style`);
data.buttonColor = settings.get(`${ service.key }-button_color`);
data.tokenSentVia = settings.get(`${ service.key }-token_sent_via`);
data.identityTokenSentVia = settings.get(`${ service.key }-identity_token_sent_via`);
data.usernameField = settings.get(`${ service.key }-username_field`);
data.emailField = settings.get(`${ service.key }-email_field`);
data.nameField = settings.get(`${ service.key }-name_field`);
data.avatarField = settings.get(`${ service.key }-avatar_field`);
data.rolesClaim = settings.get(`${ service.key }-roles_claim`);
data.mergeUsers = settings.get(`${ service.key }-merge_users`);
data.mergeRoles = settings.get(`${ service.key }-merge_roles`);
data.showButton = settings.get(`${ service.key }-show_button`);
new CustomOAuth(serviceName.toLowerCase(), {
serverURL: data.serverURL,
tokenPath: data.tokenPath,
identityPath: data.identityPath,
authorizePath: data.authorizePath,
scope: data.scope,
loginStyle: data.loginStyle,
tokenSentVia: data.tokenSentVia,
identityTokenSentVia: data.identityTokenSentVia,
usernameField: data.usernameField,
emailField: data.emailField,
nameField: data.nameField,
avatarField: data.avatarField,
rolesClaim: data.rolesClaim,
mergeUsers: data.mergeUsers,
mergeRoles: data.mergeRoles,
accessTokenParam: data.accessTokenParam,
showButton: data.showButton,
});
}
if (serviceName === 'Facebook') {
data.appId = data.clientId;
delete data.clientId;
}
if (serviceName === 'Twitter') {
data.consumerKey = data.clientId;
delete data.clientId;
}
if (serviceName === 'Linkedin') {
data.clientConfig = {
requestPermissions: ['r_liteprofile', 'r_emailaddress'],
};
}
if (serviceName === 'Nextcloud') {
data.buttonLabelText = settings.get('Accounts_OAuth_Nextcloud_button_label_text');
data.buttonLabelColor = settings.get('Accounts_OAuth_Nextcloud_button_label_color');
data.buttonColor = settings.get('Accounts_OAuth_Nextcloud_button_color');
}
// If there's no data other than the service name, then put the service name in the data object so the operation won't fail
const keys = Object.keys(data).filter((key) => data[key] !== undefined);
if (!keys.length) {
data.service = serviceName.toLowerCase();
}
ServiceConfiguration.configurations.upsert({
service: serviceName.toLowerCase(),
}, {
$set: data,
});
} else {
ServiceConfiguration.configurations.remove({
service: serviceName.toLowerCase(),
});
}
});
}
const OAuthServicesUpdate = _.debounce(Meteor.bindEnvironment(_OAuthServicesUpdate), 2000);
function OAuthServicesRemove(_id) {
const serviceName = _id.replace('Accounts_OAuth_Custom-', '');
return ServiceConfiguration.configurations.remove({
service: serviceName.toLowerCase(),
});
}
settings.get(/^Accounts_OAuth_.+/, function() {
return OAuthServicesUpdate(); // eslint-disable-line new-cap
});
settings.get(/^Accounts_OAuth_Custom-[a-z0-9_]+/, function(key, value) {
if (!value) {
return OAuthServicesRemove(key);// eslint-disable-line new-cap
}
});
function customOAuthServicesInit() {
// Add settings for custom OAuth providers to the settings so they get
// automatically added when they are defined in ENV variables
Object.keys(process.env).forEach((key) => {
if (/Accounts_OAuth_Custom-[a-zA-Z0-9_-]+$/.test(key)) {
settings.add(key, process.env[key]);
}
});
}
customOAuthServicesInit();
|
Sing-Li/Rocket.Chat
|
app/lib/server/startup/oAuthServicesUpdate.js
|
JavaScript
|
mit
| 5,375
|
'use strict';
var Service = {
STOPPED: 0,
STARTED: 1,
sequence: 0,
};
Service.Registry = require('./registry')(Service);
Service.Impl = require('./impl')(Service);
module.exports = Service;
|
reekoheek/yesbee
|
lib/service/index.js
|
JavaScript
|
mit
| 199
|
(function() {
var app;
app = angular.module("Chutter");
app.controller("toolbarCtrl", [
"$auth", "$scope", "$mdDialog", "poller", "$mdToast", "API", "Communities", "Networks", "$state", "$location", "Page", function($auth, $scope, $mdDialog, poller, $mdToast, API, Communities, Networks, $state, $location, Page) {
$scope.communities = Communities;
$scope.networks = Networks;
$scope.page = Page;
$scope.$on("$stateChangeStart", function() {
return $scope.loading = true;
});
$scope.$on("$stateChangeSuccess", function() {
return $scope.loading = false;
});
$scope.applicationSectionNamespace = "frontpage";
$scope.$on("auth:show-signin", function() {
return $scope.logIn;
});
$scope.dropdownText = function() {
if ($scope.page.scope === "all") {
return "all";
} else if (["community", "comments", "submit", "network"].indexOf($scope.page.scope) > -1) {
return $scope.page.network.name;
}
};
$scope.logIn = function() {
return $mdDialog.show({
controller: 'authCtrl',
templateUrl: '../app/partials/main/authenticate.html',
parent: angular.element(document.body),
clickOutsideToClose: true
});
};
$scope.logout = function() {
return $auth.signOut().then(function() {
return $location.url("/");
});
};
if ($scope.user && $scope.user.id) {
$scope.poller = poller;
$scope.poller.get(API.makeURL('/users/ephemeral_notifications'), {
delay: 30000
}).promise.then(null, null, function(data) {
return $scope.showNotifications(data.data);
});
}
$scope.$on("auth:logout-success", function() {
return $scope.poller.stopAll();
});
$scope.$on("auth:login-success", function() {
$scope.poller = poller;
return $scope.poller.get(API.makeURL('/users/ephemeral_notifications'), {
delay: 30000
}).promise.then(null, null, function(data) {
return $scope.showNotifications(data.data);
});
});
$scope.showNotifications = function(notifications) {
var cascade, ephemeral_notifications;
ephemeral_notifications = _.reject(notifications, function(n) {
return n.ephemeral_count === 0;
});
if (ephemeral_notifications.length > 0) {
if (ephemeral_notifications.length > 1) {
cascade = true;
}
return _.each(ephemeral_notifications, function(notification) {
if (cascade) {
return setTimeout(function() {
return $scope.showNotification(notification);
}, 5000);
} else {
return $scope.showNotification(notification);
}
});
}
};
$scope.showNotification = function(notification) {
var body, title;
if (notification.entityable === "comment") {
body = notification.body.substring(0, 50);
if (body.length > 49) {
body += "...";
}
return $mdToast.show($mdToast.simple().content("Re: " + body).position("bottom right").action(notification.ephemeral_count + " new").hideDelay(5000));
} else if (notification.entityable === "post") {
title = notification.title.substring(0, 50);
if (title.length > 49) {
title += "...";
}
return $mdToast.show($mdToast.simple().content("Re: " + title).position("bottom right").action(notification.ephemeral_count + " new").hideDelay(5000));
}
};
$scope.editNetworks = function(ev) {
if (!($scope.user && $scope.user.id)) {
return $scope.logIn();
} else {
return $mdDialog.show({
controller: 'networkEditCtrl',
templateUrl: '../app/partials/main/networkEdit.html',
clickOutsideToClose: true,
parent: angular.element(document.body),
targetEvent: ev,
resolve: {
List: [
'NetworkResource', function(NetworkResource) {
return NetworkResource.list();
}
]
}
});
}
};
return $scope.editNetworkCommunities = function(network) {
return $mdDialog.show({
controller: "communityEditCtrl",
templateUrl: '../app/partials/main/communityEdit.html',
resolve: {
List: [
"NetworkResource", function(NetworkResource) {
return NetworkResource.communities({
id: network.id
});
}
]
},
parent: angular.element(document.body),
clickOutsideToClose: true
});
};
}
]);
app.controller("networkToolbarCtrl", [
"$auth", "$scope", "$mdDialog", "poller", "$mdToast", "API", "Communities", "Networks", "Network", "$state", "$location", "Page", function($auth, $scope, $mdDialog, poller, $mdToast, API, Communities, Networks, Network, $state, $location, Page) {
$scope.communities = Communities;
$scope.networks = Networks;
$scope.secondaryTitle = Network.name;
$scope.applicationSectionNamespace = "network_frontpage";
$scope.page = Page;
$scope.$on("auth:show-signin", function() {
return $scope.logIn;
});
$scope.dropdownText = function() {
if ($scope.page.scope === "all") {
return "all";
} else if (["community", "comments", "submit", "network"].indexOf($scope.page.scope) > -1) {
return $scope.page.network.name;
}
};
$scope.logIn = function() {
return $mdDialog.show({
controller: 'authCtrl',
templateUrl: '../app/partials/main/authenticate.html',
parent: angular.element(document.body),
clickOutsideToClose: true
});
};
$scope.logout = function() {
return $auth.signOut().then(function() {
return $location.url("/");
});
};
if ($scope.user && $scope.user.id) {
$scope.poller = poller;
$scope.poller.get(API.makeURL('/users/ephemeral_notifications'), {
delay: 30000
}).promise.then(null, null, function(data) {
return $scope.showNotifications(data.data);
});
}
$scope.$on("auth:logout-success", function() {
return $scope.poller.stopAll();
});
$scope.$on("auth:login-success", function() {
$scope.poller = poller;
return $scope.poller.get(API.makeURL('/users/ephemeral_notifications'), {
delay: 30000
}).promise.then(null, null, function(data) {
return $scope.showNotifications(data.data);
});
});
$scope.showNotifications = function(notifications) {
var cascade, ephemeral_notifications;
ephemeral_notifications = _.reject(notifications, function(n) {
return n.ephemeral_count === 0;
});
if (ephemeral_notifications.length > 0) {
if (ephemeral_notifications.length > 1) {
cascade = true;
}
return _.each(ephemeral_notifications, function(notification) {
if (cascade) {
return setTimeout(function() {
return $scope.showNotification(notification);
}, 5000);
} else {
return $scope.showNotification(notification);
}
});
}
};
$scope.showNotification = function(notification) {
var body, title;
if (notification.entityable === "comment") {
body = notification.body.substring(0, 50);
if (body.length > 49) {
body += "...";
}
return $mdToast.show($mdToast.simple().content("Re: " + body).position("bottom right").action(notification.ephemeral_count + " new").hideDelay(5000));
} else if (notification.entityable === "post") {
title = notification.title.substring(0, 50);
if (title.length > 49) {
title += "...";
}
return $mdToast.show($mdToast.simple().content("Re: " + title).position("bottom right").action(notification.ephemeral_count + " new").hideDelay(5000));
}
};
$scope.editNetworks = function(ev) {
if (!($scope.user && $scope.user.id)) {
return $scope.logIn();
} else {
return $mdDialog.show({
controller: 'networkEditCtrl',
templateUrl: '../app/partials/main/networkEdit.html',
clickOutsideToClose: true,
parent: angular.element(document.body),
targetEvent: ev,
resolve: {
List: [
'NetworkResource', function(NetworkResource) {
return NetworkResource.list();
}
]
}
});
}
};
return $scope.editNetworkCommunities = function(network) {
return $mdDialog.show({
controller: "communityEditCtrl",
templateUrl: '../app/partials/main/communityEdit.html',
resolve: {
List: [
"NetworkResource", function(NetworkResource) {
return NetworkResource.communities({
id: network.id
});
}
]
},
parent: angular.element(document.body),
clickOutsideToClose: true
});
};
}
]);
}).call(this);
|
chutterbox/chutter
|
app/js/shared/controllers/toolbar-controller.js
|
JavaScript
|
mit
| 9,673
|
exports.verses = verses;
exports.verse = verse;
exports.sing = verses.bind(null, 1, 8);
/**
* Return portion of song corresponding to requested verse number range (inclusive).
*
* @param {Number} first
* starting verse number
*
* @param {Number} last
* ending verse number
*
* @return {String}
* corresponding portion of song
*/
function verses(first, last) {
var idx = first - 1;
var end = last;
var str = [];
while (++idx <= end) {
str.push(verse(idx));
}
return str.join('\n') + '\n';
};
/**
* Return song verse by number.
*
* @param {Number} verse
* verse number
*
* @return {String}
* song verse
*/
function verse(number) {
switch (number) {
case 1: return '' +
'I know an old lady who swallowed a fly.\n' + 'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 2: return '' +
'I know an old lady who swallowed a spider.\n' + 'It wriggled and jiggled and tickled inside her.\n' +
'She swallowed the spider to catch the fly.\n' + 'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 3: return '' +
'I know an old lady who swallowed a bird.\n' + 'How absurd to swallow a bird!\n' +
'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n' +
'She swallowed the spider to catch the fly.\n' + 'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 4: return '' +
'I know an old lady who swallowed a cat.\n' + 'Imagine that, to swallow a cat!\n' + 'She swallowed the cat to catch the bird.\n' +
'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n' + 'She swallowed the spider to catch the fly.\n' +
'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 5: return '' +
'I know an old lady who swallowed a dog.\n' + 'What a hog, to swallow a dog!\n' + 'She swallowed the dog to catch the cat.\n' +
'She swallowed the cat to catch the bird.\n' + 'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n' +
'She swallowed the spider to catch the fly.\n' + 'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 6: return '' +
'I know an old lady who swallowed a goat.\n' + 'Just opened her throat and swallowed a goat!\n' + 'She swallowed the goat to catch the dog.\n' +
'She swallowed the dog to catch the cat.\n' + 'She swallowed the cat to catch the bird.\n' +
'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n' +
'She swallowed the spider to catch the fly.\n' + 'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 7: return '' +
'I know an old lady who swallowed a cow.\n' + 'I don\'t know how she swallowed a cow!\n' + 'She swallowed the cow to catch the goat.\n' +
'She swallowed the goat to catch the dog.\n' + 'She swallowed the dog to catch the cat.\n' + 'She swallowed the cat to catch the bird.\n' +
'She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n' + 'She swallowed the spider to catch the fly.\n' +
'I don\'t know why she swallowed the fly. Perhaps she\'ll die.\n';
case 8: return '' +
'I know an old lady who swallowed a horse.\n' + 'She\'s dead, of course!\n';
};
};
|
wobh/xjavascript
|
food-chain/example.js
|
JavaScript
|
mit
| 3,419
|
var hljs = require('highlight.js');
require('highlight.js/styles/monokai.css');
document.addEventListener('DOMContentLoaded', function() {
hljs.initHighlightingOnLoad();
});
|
martinbroos/maatcss
|
docs.js
|
JavaScript
|
mit
| 179
|
version https://git-lfs.github.com/spec/v1
oid sha256:2674921c5beacbb4ae9f821ec3b14b596ed9f994e7da80ccdfb2f069503d065b
size 1676
|
yogeshsaroya/new-cdnjs
|
ajax/libs/mathjax/2.5.1/localization/gl/gl.js
|
JavaScript
|
mit
| 129
|
var searchData=
[
['rect_5f',['rect_',['../class_actor.html#ab10a4e51048d92a115d83dbd642f658f',1,'Actor']]],
['remove',['remove',['../class_state_manager.html#a0162883a90168f96374d30d96151ce45',1,'StateManager']]],
['rescue',['rescue',['../structscore__t.html#af94d9c1bcea990fc34ca75a1e32e0630',1,'score_t']]],
['resettimer',['resetTimer',['../class_spawner.html#a0939c6eecee88186ea3a7ac9d068a439',1,'Spawner']]],
['right',['Right',['../class_input.html#ab0bd6899066d443829fecc0543964fd4',1,'Input']]],
['rightaxisx',['RightAxisX',['../class_input.html#afa281e40da9ecb58cafbbc6b06009ae4',1,'Input']]],
['rightaxisy',['RightAxisY',['../class_input.html#ac311857ea1849254d4e31c00eb4814ef',1,'Input']]]
];
|
Lacty/ToTheTop
|
doc/search/all_10.js
|
JavaScript
|
mit
| 717
|
/*!
* eve.contcartogram.js
* https://github.com/eveui/eve
*
* Copyright 2015, Ismail Ozdemir
* Released under the MIT license
* https://github.com/eveui/eve/blob/master/LICENSE
*
* Date: 2015-04-09 09:15 AM (EST)
*
* DEFINITION
* Base class for continuous cartogram.
*/
(function (e) {
//define continuous cartogram class
function contCartogram(options) {
//declare needed variables
let that = this,
map = e.initVis(options),
serie = map.series[0],
labelField = serie.labelField,
valueField = serie.valueField,
colorField = serie.colorField,
parentField = serie.parentField,
folderPath = e.mapDirectory + 'cartomaps/',
cartoData = null,
cartoGeo = null,
mapType = 0,
mapName = '',
projection = null,
carto = null,
labels = null,
zoom = null,
paths = null,
path = null,
minVal = 0,
maxVal = 0,
fillColor = '',
oldFillColor = '',
oldData = null,
currentFiltered = null,
currentData = null,
labelType = '',
parentType = '',
labelwoutMeasure = [],
fillOpacity = 0,
gradientRatio = 0,
coloringBase = '';
//set map plot width and height
map.plot.width = map.plot.width - map.plot.left - map.plot.right;
map.plot.height = map.plot.height - map.plot.top - map.plot.bottom;
//create chart g
let mapG = map.svg.append('g')
.attr('transform', 'translate(' + map.plot.left + ',' + map.plot.top + ')');
//create foreign object for map paths
let pathG = mapG
.append('svg')
.attr('width', map.plot.width - map.plot.left)
.attr('height', map.plot.height)
.attr('transform', 'translate(0,0)');
//sets initial map variables
function setMapVariables() {
let labelLengths = [],
parentLengths = [],
dataLength = 0,
tempLength = 0;
//trim map name
mapName = map.series[0].map.replace('%20', '').trim();
//determine folder path and map type based on map name
//0: Region, 1: Country, 2: Counties, 3: Zip
if (mapName.length === 3) {
folderPath = e.mapDirectory + 'cartomaps/countries/';
mapType = 1;
}
else if (mapName.substring(0, 3) === "SC_") {
folderPath = e.mapDirectory + 'cartomaps/SubCountries/';
if (mapName.substring(0, 6) === "SC_Zip")
mapType = 3;
else
mapType = 2;
}
//initialize projection based on map name
if (mapName === "USA" || mapName === "SC_USACounties")
projection = d3.geoAlbersUsa();
else
projection = d3.geoEquirectangular();
dataLength = map.data.length > 10 ? 10 : map.data.length;
let i = 0;
while (labelLengths.length < dataLength) {
if (isNaN(map.data[i][labelField]) || mapType === 3)
labelLengths.push(map.data[i][labelField].length);
i++;
}
if (parentField) {
i = 0;
while (parentLengths.length < dataLength) {
if (isNaN(map.data[i][parentField]))
parentLengths.push(map.data[i][parentField].length);
i++;
}
}
//determine label field type
tempLength = d3.max(labelLengths);
if (tempLength < 3)
labelType = 'code2'
else if (tempLength < 4)
labelType = 'code3'
else
labelType = 'name'
//determine parent field type if exists
if (parentField !== '' && parentField !== null) {
tempLength = d3.max(parentLengths);
if (tempLength < 3)
parentType = 'code'
else
parentType = 'name'
}
}
//animates columns
function animatePaths() {
if (colorField === '') {
minVal = map.domains.minY;
maxVal = map.domains.maxY;
coloringBase = valueField;
} else {
minVal = map.domains.minColor;
maxVal = map.domains.maxColor;
coloringBase = colorField;
}
//create scaling for cartogram distortion
let scale = d3.scaleLinear().domain([map.domains.minY, map.domains.maxY]).range([(map.domains.minY === map.domains.maxY ? 500 : 1), 500]);
// tell the cartogram to use the scaled values
carto.value(function (d) {
if (d.currentData) {
oldFillColor = d3.select(this).attr('fill');
oldData = d.currentData;
} else {
oldFillColor = '';
oldData = null;
}
//reset data
d.currentData = null;
//get data for current shape based on label type
if (labelType === 'code2') {
switch (mapType) {
case 0:
{
currentFiltered = e.filterSingle(map.data, { key: labelField, values: d.properties.iso_a2 });
}
break;
case 1:
{
if (d.properties.postal)
currentFiltered = e.filterSingle(map.data, { key: labelField, values: d.properties.postal });
}
break;
default:
{
currentFiltered = null;
}
}
}
else if (labelType === 'code3') {
switch (mapType) {
case 0:
{
currentFiltered = e.filterSingle(map.data, { key: labelField, values: d.properties.iso_a3 });
}
break;
default:
{
currentFiltered = null;
}
}
}
else {
let names = [], altNames;
if (d.properties.name_alt) {
names.push(d.properties.name);
altNames = d.properties.name_alt.split('|');
altNames.forEach(function (n) {
names.push(n);
});
} else {
names = d.properties.name;
}
switch (mapType) {
case 2:
{
if (mapName === 'SC_USACounties')
currentFiltered = e.filterSingle(map.data, [{ key: labelField, values: names }, { key: parentField, values: (parentType === 'code' ? d.properties.parent : d.properties.parentName) }]);
else
currentFiltered = e.filterSingle(map.data, { key: labelField, values: names, replaceChar: true });
}
break;
case 3:
{
currentFiltered = e.filterSingle(map.data, { key: labelField, values: names }, true);
}
break;
default:
{
currentFiltered = e.filterSingle(map.data, { key: labelField, values: names, replaceChar: true });
}
}
}
//check if data exists for current shape
if (currentFiltered) {
//check whether the value exists
if (currentFiltered[valueField] != 0 && currentFiltered[valueField] != null) { //do not convert to !== , it gives a different result
if (map.legend.type !== 'default')
currentFiltered[valueField] = parseFloat(currentFiltered[valueField]);
//set fill color
switch (map.legend.type) {
case 'default':
{
fillColor = e.matchGroup(currentFiltered[coloringBase], map.legend.legendColors, 'color') || 'rgb(221,221,221)';
}
break;
case 'ranged':
{
let rangeObj = e.matchRange(currentFiltered[coloringBase], map.legend.rangeList, 'color');
if (rangeObj) {
fillColor = rangeObj.color;
d.legendClass = 'ranged-' + rangeObj.index;
} else {
fillColor = 'rgb(221,221,221)';
}
}
break;
default:
{
//calculate ratio
if (minVal !== maxVal)
gradientRatio = currentFiltered[coloringBase] / (maxVal - minVal) * 100 - (minVal / (maxVal - minVal) * 100);
else
gradientRatio = 1;
fillColor = e.gradient(map.legend.gradientColors, gradientRatio);
}
}
//set opacity and data
fillOpacity = 1;
d.currentData = currentFiltered;
}
}
//set empty shape settings
if (!d.currentData) {
if (map.animation.effect) {
//check whether the effect is fade
if (map.animation.effect === 'fade') {
fillColor = 'rgb(221,221,221)';
fillOpacity = 0.9;
} else if (map.animation.effect === 'dim') {
if (oldData) {
fillColor = oldFillColor;
fillOpacity = 0.3;
d.currentData = oldData;
} else {
fillColor = 'rgb(221,221,221)';
fillOpacity = 0.9;
}
} else if (map.animation.effect === 'add') {
if (oldData) {
fillColor = oldFillColor;
fillOpacity = 1;
d.currentData = oldData;
} else {
fillColor = 'rgb(221,221,221)';
fillOpacity = 0.9;
}
} else {
fillColor = 'rgb(221,221,221)';
fillOpacity = 0.9;
}
}
}
//set fill color
d.fillColor = fillColor;
d.fillOpacity = fillOpacity;
if (!d.currentData)
return 1;
else
return scale(d.currentData[valueField]);
});
//generate the new features, pre-projected
let topoData = carto(cartoData, cartoGeo).features,
usaShape,
minX;
if (mapName === 'world' || mapName === 'worldwoantarctica') {
usaShape = e.filterSingle(topoData, { key: 'id', values: 'USA' });
minX = Number.MAX_SAFE_INTEGER;
for (let i = 0; i < usaShape.geometry.coordinates.length; i++) {
for (let j = 0; j < usaShape.geometry.coordinates[i][0].length; j++) {
if (usaShape.geometry.coordinates[i][0][j][0] < minX)
minX = usaShape.geometry.coordinates[i][0][j][0];
}
}
for (let k = 0; k < topoData.length; k++) {
if (topoData[k].id == 'RUS') {
for (let i = 0; i < topoData[k].geometry.coordinates.length; i++) {
for (let j = 0; j < topoData[k].geometry.coordinates[i][0].length; j++) {
if (topoData[k].geometry.coordinates[i][0][j][0] < minX) {
topoData[k].geometry.coordinates[i][0][j][0] = map.plot.width;
}
}
}
}
}
}
paths
.data(topoData)
.transition().duration(map.animation.duration)
.ease(map.animation.easing.toEasing())
.delay(function (d, i) { return i * map.animation.delay / Math.max(1, Math.sqrt(i / 8)); })
.attr('fill-opacity', function (d) { return d.fillOpacity; })
.attr('fill', function (d) { return d.fillColor; })
.attr("d", carto.path);
//check whether the labls are enabled and update labels
//if (map.series[0].labelsEnabled && map.series[0].labelFormat !== '' && labels !== null) {
if (map.series[0].labelFormat !== '' && labels !== null) {
labels
.data(topoData)
.text(function (d) {
//get label format
labelFormat = map.series[0].labelFormat;
labelValue = d.properties.name;
codeValue = mapName.length === 3 ? d.properties.postal : d.properties.iso_a2;
//check whether the current data has iso_a3
if (d.properties.iso_a3 !== null) {
//check if iso_a3 = STP
if (d.properties.iso_a3 === 'STP')
labelValue = 'Sao Tome and Principe';
else if (d.properties.iso_a3 === 'CIV')
labelValue = 'Cote dIvoire';
else if (d.properties.iso_a3 === 'BLM')
labelValue = 'St-Barthelemy';
else if (d.properties.iso_a3 === 'CUW')
labelValue = 'Curacao';
}
// check if data for the shape exists
if (d.currentData) {
//assign format
labelFormat = labelFormat.replaceAll('{code}', codeValue).replaceAll('{label}', labelValue);
labelFormat = map.getContent(d.currentData, map.series[0], labelFormat);
}
else {
labelwoutMeasure = ''
labelwoutMeasure += labelFormat.search('{code}') !== -1 ? codeValue : '';
labelwoutMeasure += labelFormat.search('{label}') !== -1 ? (labelwoutMeasure ? ' ' + labelValue : labelValue) : '';
labelFormat = labelwoutMeasure;
}
//return format
return labelFormat;
})
.style('fill', function (d) { return map.series[0].labelFontColor === 'auto' ? map.getAutoColor(d.fillColor) : map.series[0].labelFontColor; })
.style('font-size', map.series[0].labelFontSize + 'px')
.attr('transform', function (d) { return 'translate(' + carto.path.centroid(d) + ')'; });
}
//raise render complete
if (map.renderComplete) {
setTimeout(function () {
map.renderComplete();
}, 1000);
}
}
//creates grouped column chart
function createMap() {
//declare needed variables
let tooltipContent = '',
labelFormat = '',
labelValue = '',
codeValue = '';
//fill topology
d3.json(folderPath + mapName + '.json', function (error, data) {
cartoData = data;
cartoGeo = data.objects[mapName + '.geo'].geometries;
//create object for scaling and translating
let objGeo = topojson.feature(data, {
type: "GeometryCollection",
geometries: data.objects[mapName + '.geo'].geometries
});
//set scale and translate of the projection
projection.fitExtent([[0, 0], [map.plot.width, map.plot.height]], objGeo);
//create path
path = d3.geoPath().projection(projection);
//create distorted cartogram
carto = d3.cartogram()
.projection(projection)
.properties(function (d) {
return d.properties;
})
.value(function (d) {
return 1;
});
//create topology data
let topoData = carto.features(cartoData, cartoGeo);
//build paths
paths = pathG.append('g').selectAll('path')
.data(topoData)
.enter().append('path')
.attr('d', path)
.attr('stroke', 'rgb(255,255,255)')
.attr('stroke-width', 0.5)
.attr('fill', '#fafafa')
.attr('width', map.plot.width)
.attr('height', map.plot.width / 2)
.on('mousemove', function (d, i) {
//check whether tooltip enabled
if (map.tooltip.format !== '') {
//set default tooltip content
tooltipContent = "no data available";
//check whether current data exists
if (d.currentData) {
//get values from shape
codeValue = mapName.length === 3 ? d.properties.postal : d.properties.iso_a2;
labelValue = d.properties.name;
//check whether the current data has iso_a3
if (d.properties.iso_a3 !== null) {
//check if iso_a3 = STP
if (d.properties.iso_a3 === 'STP')
labelValue = 'Sao Tome and Principe';
else if (d.properties.iso_a3 === 'CIV')
labelValue = 'Cote dIvoire';
else if (d.properties.iso_a3 === 'BLM')
labelValue = 'St-Barthelemy';
else if (d.properties.iso_a3 === 'CUW')
labelValue = 'Curacao';
}
//set tooltip content
tooltipContent = map.tooltip.format.replaceAll('{code}', codeValue).replaceAll('{label}', labelValue);
tooltipContent = map.getContent(d.currentData, map.series[0], tooltipContent);
}
//show tooltip
map.showTooltip(tooltipContent);
}
})
.on('mouseout', function (d) {
//hide tooltip
map.hideTooltip();
});
//check if labels are enabled
//if (map.series[0].labelsEnabled && map.series[0].labelFormat !== '') {
if (map.series[0].labelFormat !== '') {
//create labels
labels = pathG.append('g').selectAll('text')
.data(topoData)
.enter().append('text')
.style("text-anchor", "middle")
.style('font-family', map.series[0].labelFontFamily)
.style('font-style', map.series[0].labelFontStyle === 'bold' ? 'normal' : map.series[0].labelFontStyle)
.style('font-weight', map.series[0].labelFontStyle === 'bold' ? 'bold' : 'normal')
.attr("dy", ".35em")
.on('mousemove', function (d, i) {
//check whether tooltip enabled
if (map.tooltip.format !== '') {
//set default tooltip content
tooltipContent = "no data available";
//check whether current data exists
if (d.currentData) {
//get values from shape
codeValue = mapName.length === 3 ? d.properties.postal : d.properties.iso_a2;
labelValue = d.properties.name;
//check whether the current data has iso_a3
if (d.properties.iso_a3 !== null) {
//check if iso_a3 = STP
if (d.properties.iso_a3 === 'STP')
labelValue = 'Sao Tome and Principe';
else if (d.properties.iso_a3 === 'CIV')
labelValue = 'Cote dIvoire';
else if (d.properties.iso_a3 === 'BLM')
labelValue = 'St-Barthelemy';
else if (d.properties.iso_a3 === 'CUW')
labelValue = 'Curacao';
}
//set tooltip content
tooltipContent = map.tooltip.format.replaceAll('{code}', codeValue).replaceAll('{label}', labelValue);
tooltipContent = map.getContent(d.currentData, map.series[0], tooltipContent);
}
//show tooltip
map.showTooltip(tooltipContent);
}
})
.on('mouseout', function (d) {
//hide tooltip
map.hideTooltip();
});
}
//raise on loaded
if (map.onLoaded) map.onLoaded();
//animate paths
animatePaths();
});
//attach clear content method to map
map.clear = function () {
//clear current data from all paths
paths.each(function (d) {
d.currentData = null;
});
};
//set update method to chart
map.update = function (data, keepAxis) {
//set chart data
map.data = data;
//update xy domain
map.calculateDomain();
map.updateLegend();
//animate paths
animatePaths();
};
//handles legend click
map.legendClick = function (d, i) {
if (map.legend.type === 'ranged') {
if (d.clicked) {
paths.attr('fill-opacity', function (d) {
if (d.legendClass === 'ranged-' + i)
return 0.1;
else
return d.fillOpacity;
});
} else {
paths.attr('fill-opacity', function (d) {
if (d.legendClass === 'ranged-' + i)
return 1;
else
return d.fillOpacity;
});
}
}
};
//handles legend hover
map.onLegendHover = function (d, i, status) {
if (map.legend.type === 'ranged') {
if (status) {
paths.attr('fill-opacity', function (d) {
if (d.legendClass !== 'ranged-' + i)
return 0.1;
else
return d.fillOpacity;
});
} else {
paths.attr('fill-opacity', function (d) { return d.fillOpacity; });
}
}
};
}
setMapVariables();
createMap();
//return continuous cartogram
return map;
}
//attach continuous cartogram method into the eve
e.contCartogram = function (options) {
options.type = 'contCartogram';
options.masterType = 'map';
//stack the options to the visualizations stack
e.visualizations.push(options);
return new contCartogram(options);
};
})(eve);
|
ozdemiri/eve
|
src/maps/eve.contcartogram.js
|
JavaScript
|
mit
| 26,860
|
//>>built
define(["dojo/_base/array","dojo/aspect","dojo/_base/declare"],function(c,g,e){return e("dijit.Destroyable",null,{destroy:function(c){this._destroyed=!0},own:function(){var e=["destroyRecursive","destroy","remove"];c.forEach(arguments,function(b){function f(){k.remove();c.forEach(h,function(a){a.remove()})}var d,k=g.before(this,"destroy",function(a){b[d](a)}),h=[];b.then?(d="cancel",b.then(f,f)):c.forEach(e,function(a){"function"===typeof b[a]&&(d||(d=a),h.push(g.after(b,a,f,!0)))})},this);return arguments}})});
|
ycabon/presentations
|
2020-devsummit/arcgis-js-api-road-ahead/js-api/dijit/Destroyable.js
|
JavaScript
|
mit
| 527
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { customAttribute } from 'aurelia-templating';
import { getLogger } from 'aurelia-logging';
/**
* Attribute to be placed on any HTML element in a view to emit the View instance
* to the debug console, giving you insight into the live View instance, including
* all child views, live bindings, behaviors and more.
*/
let ViewSpy = class ViewSpy {
/**
* Creates a new instance of ViewSpy.
*/
constructor() {
this.logger = getLogger('view-spy');
}
_log(lifecycleName, context) {
if (!this.value && lifecycleName === 'created') {
this.logger.info(lifecycleName, this.view);
}
else if (this.value && this.value.indexOf(lifecycleName) !== -1) {
this.logger.info(lifecycleName, this.view, context);
}
}
/**
* Invoked when the target view is created.
* @param view The target view.
*/
created(view) {
this.view = view;
this._log('created');
}
/**
* Invoked when the target view is bound.
* @param bindingContext The target view's binding context.
*/
bind(bindingContext) {
this._log('bind', bindingContext);
}
/**
* Invoked when the target element is attached to the DOM.
*/
attached() {
this._log('attached');
}
/**
* Invoked when the target element is detached from the DOM.
*/
detached() {
this._log('detached');
}
/**
* Invoked when the target element is unbound.
*/
unbind() {
this._log('unbind');
}
};
ViewSpy = __decorate([
customAttribute('view-spy')
], ViewSpy);
export { ViewSpy };
|
aurelia/testing
|
dist/es2017/view-spy.js
|
JavaScript
|
mit
| 2,233
|
alt.controller('signupCtrl', function($scope, $location, $window, altAuth, toaster) {
$scope.signup = function() {
var newUserData = {
username: $scope.username,
password: $scope.password,
firstName: $scope.fname,
lastName: $scope.lname,
gender: $scope.gender
};
altAuth.createUser(newUserData).then(function() {
toaster.pop('success', 'Successfully signed up!');
$location.path('/');
}, function(reason) {
toaster.pop('error', reason);
});
}
});
|
alt-001/alt-database-setup
|
public/app/account/signup.js
|
JavaScript
|
mit
| 483
|
import URL from './URL';
import pathToRegexp from 'path-to-regexp';
import ns from './namespace';
import Request from './Request';
import Response from './Response';
const privates = ns();
export default class Router {
constructor(options) {
let self = privates(this);
self.handlers = [];
self.errorHandlers = [];
self.paramHandlers = {};
self.defaults = {};
let caseSensitive = false;
let mergeParams = false;
let strict = false;
let addHistory = true;
let changePath = true;
let transition = true;
Object.defineProperties(self.defaults, {
caseSensitive: {
get: () => { return caseSensitive; },
set: (value) => { caseSensitive = Boolean(value); },
enumerable: true,
},
mergeParams: {
get: () => { return mergeParams; },
set: (value) => { mergeParams = Boolean(value); },
enumerable: true,
},
strict: {
get: () => { return strict; },
set: (value) => { strict = Boolean(value); },
enumerable: true,
},
addHistory: {
get: () => { return addHistory; },
set: (value) => { addHistory = Boolean(value); },
enumerable: true,
},
changePath: {
get: () => { return changePath; },
set: (value) => { changePath = Boolean(value); },
enumerable: true,
},
transition: {
get: () => { return transition; },
set: (value) => { transition = Boolean(value); },
enumerable: true,
},
});
for(let method in privateMethods) {
self[method] = privateMethods[method].bind(this);
}
this.defaults = options;
}
get defaults() { return privates(this).defaults; }
set defaults(obj) {
let self = privates(this);
if(typeof obj !== 'object' || obj === null) return;
for(let prop in self.defaults) {
if(! (prop in obj)) continue;
self.defaults[prop] = obj[prop];
}
}
dispatch(urlString, method, options) {
let self = privates(this);
if(typeof urlString !== 'string') return;
if(typeof method !== 'string') method = 'all';
if(typeof options !== 'object' || options === null) options = {};
if(typeof options.addHistory !== 'boolean') options.addHistory = self.defaults.addHistory;
if(typeof options.changePath !== 'boolean') options.changePath = self.defaults.changePath;
if(typeof options.transition !== 'boolean') options.transition = self.defaults.transition;
let request = new Request();
let response = new Response();
let url = URL.parse(urlString);
if(url.origin !== location.origin) {
//別オリジンならurl遷移;
if(options.transition) location.href = url.href;
return;
}
request.dispatcher = this;
request.originalUrl = urlString;
request.method = method;
request.data = options.data;
Object.assign(request, url);
let state = { path: urlString };
if(options.addHistory && options.changePath) {
//default;
window.history.pushState(state, null, url.href);
}else if(options.addHistory && options.changePath === false) {
window.history.pushState(state, null, location.href);
}else if(options.addHistory === false && options.changePath) {
window.history.replaceState(state, null, url.href);
}
// false && false は何もしない;
self.goGetCalledHandler = self.gfGetCalledHandler(url.pathname, method, '', {});
self.runNextHandler(request, response);
}
//use(callback [, callback...]) -> middleware
//use(pathname, callback [, callback...]);
//use(pathname, router);
//use(pathnames, router);
use() {
if(arguments.length === 0) return this;
let path = '/';
let type = 'middleware';
let firstParam = arguments[0];
//最初の引数がpathかどうか;
if(firstParam !== undefined && firstParam !== null && typeof firstParam !== 'function' && ! (firstParam instanceof Router)) {
path = firstParam;
Array.prototype.shift.bind(arguments)();
}
let self = privates(this);
let listeners = [];
Array.prototype.forEach.bind(arguments)((arg) => {
if(typeof arg !== 'function' && ! (arg instanceof Router)) {
return;
}
if(typeof arg === 'function' && arg.length === 4) {
//error handler登録;
self.register({ path, type, listener: arg }, 'error');
return;
}
listeners.push(arg);
});
if(listeners.length !== 0) {
self.register({ path, type, listeners });
}
return this;
}
all(path) { privates(this).METHOD(path, 'all', arguments); return this; }
get(path) { privates(this).METHOD(path, 'get', arguments); return this; }
post(path) { privates(this).METHOD(path, 'post', arguments); return this; }
head(path) { privates(this).METHOD(path, 'head', arguments); return this; }
put(path) { privates(this).METHOD(path, 'put', arguments); return this; }
delete(path) { privates(this).METHOD(path, 'delete', arguments); return this; }
options(path) { privates(this).METHOD(path, 'options', arguments); return this; }
route(path) {
let ret = {};
['all', 'get', 'post', 'head', 'put', 'delete', 'options'].forEach((method) => {
//ArrowFunctionはarguments使えないのでfunction(){}.bind(this)で代替;
ret[method] = function() {
this[method].bind(this, path).apply(this, arguments);
return ret;
}.bind(this);
});
return ret;
}
param(name, callback) {
if(typeof callback !== 'function') {
return;
}
let self = privates(this);
let names = null;
if(Array.isArray(name)) {
names = name;
}else {
names = [name];
}
names.forEach((name) => {
if(typeof name !== 'string') {
return;
}
if(name in self.paramHandlers) {
self.paramHandlers[name].listeners.push(callback);
return;
}
self.paramHandlers[name] = { listeners: [callback], type: 'parameter' };
});
}
}
const privateMethods = {
METHOD(path, method, args) {
if(path === undefined || path === null) {
return;
}
if(args.length === 1) {
this.dispatch(path, method);
return;
}
if(args.length === 2 && typeof args[1] === 'object' && args[1] !== null && ! (args[1] instanceof Router)) {
//args[1] is options;
this.dispatch(path, method, args[1]);
return;
}
let self = privates(this);
let type = 'method';
let listeners = [];
Array.prototype.shift.bind(args)();
Array.prototype.forEach.bind(args)((arg) => {
if(typeof arg !== 'function' && ! (arg instanceof Router)) {
return;
}
if(typeof arg === 'function' && arg.length === 4) {
//error handler登録;
self.register({ path, type, method, listener: arg }, 'error');
return;
}
listeners.push(arg);
});
if(listeners.length !== 0) {
self.register({ path, type, method, listeners });
}
},
//matchedはpattern.execの返り値を想定;
//元のURLからマッチした部分を引いて先頭にスラッシュをつけたものを返す
//(これが新たなpathになり子ルーターに渡される);
//元のURLからマッチした部分を引いた結果がURLのpathに相応しくないならnullを返す;
getRemainder(matched) {
if(matched.index !== 0) {
return null;
}
let remainder = matched.input.replace(matched[0], '');
if(matched[0].slice(-1) !== '/' && remainder[0] !== '/' && remainder !== '') {
return null;
}
return URL.addFirstSlash(remainder);
},
//matchedはpattern.execの返り値を想定。matchedは破壊されない;
//keysはpathToRegExp()の返り値の第二引数を想定。URLparameterのproperty名が入っている配列;
//parentParamsは継承するparams。子ルーターのURLparameterと親のルーターのURLparameterを併合する時のため。
getParams(matched, keys, parentParams) {
let self = privates(this);
let params = self.defaults.mergeParams ? Object.assign({}, parentParams) : {};
matched = matched.concat([]);
matched.shift();
if(matched.length === 0) {
return params;
}
keys.forEach((value) => {
if(typeof value !== 'object') {
return;
}
params[value.name] = matched.shift();
});
return params;
},
//paramsObserverとparamsのpropertyに違いがあれば、その違うproperty名を取得する;
//取得されたpropertyはそのproperty名で登録されているparamHandlerを取得するために用いられる;
getChangedParamKeys(paramsObserver, params) {
let keys = [];
for(let prop in params) {
if(paramsObserver[prop] !== params[prop]) {
paramsObserver[prop] = params[prop];
keys.push(prop);
}
}
return keys;
},
/**
* keysに含まれているparamHandler全て取得
* @param [array] keys getChangedParamKeysの返り値
* @return [array] keysにマッチしたparamHandlerが全て入っている配列
* paramHandlerの構造 => { handler, paramValue, req }
*/
getParamHandlers(keys, req) {
let self = privates(this);
let paramHandlers = [];
keys.forEach((key) => {
if(key in self.paramHandlers === false) {
return;
}
paramHandlers.push({
handler: {
type: self.paramHandlers[key].type,
listeners: self.paramHandlers[key].listeners,
},
paramValue: req.params[key],
req,
});
});
return paramHandlers;
},
getMatchedMiddlewareHandlers(handler, req, remainder) {
if(typeof handler.listener === 'function') {
return [{ handler: handler, req: req }];
}
if(handler.listener instanceof Router) {
return handler.listener.getMatchedHandlers(remainder, req.method, req.baseUrl, req.params);
}
},
/**
* Routerからpathとmethodにマッチするhandlerを全て取得する
* @param [string] path パス
* @param [string] method httpメソッド名
* @return [array] マッチしたhandler(matchedHandler)が全て入っている配列
* matchedHandlerの構造 => { handler, matched, baseUrl, remainder }
*/
getMatchedHandlers(path, method, _baseUrl) {
let self = privates(this);
let matchedHandlers = [];
self.handlers.forEach((handler) => {
let baseUrl = _baseUrl;
let matched = handler.pattern.exec(path);
if(matched === null) {
return;
}
if(handler.type === 'middleware') {
let remainder = self.getRemainder(matched);
if(remainder === null) {
return;
}
baseUrl += URL.removeTrailingSlash(matched[0]);
matchedHandlers.push({ handler, matched, baseUrl, remainder });
}else if(method === 'all' || handler.method === 'all' || handler.method === method) {
matchedHandlers.push({ handler, matched, baseUrl, remainder: '/' });
}
});
return matchedHandlers;
},
getCalledHandlers(path, method, baseUrl, params) {
let self = privates(this);
let matchedHandlers = self.getMatchedHandlers(path, method, baseUrl);
let calledHandlers = [];
let paramsObserver = {};
matchedHandlers.forEach((matchedHandler) => {
let handler = matchedHandler.handler;
let matched = matchedHandler.matched;
let remainder = matchedHandler.remainder;
let req = {
app: this,
baseUrl: matchedHandler.baseUrl,
params: self.getParams(matched, handler.pattern.keys, params),
};
//新たなparameterがあれば、そのparameterのparamHandlersを取得する;
let changedParamKeys = self.getChangedParamKeys(paramsObserver, req.params);
let paramHandlers = self.getParamHandlers(changedParamKeys, req);
calledHandlers.push(...paramHandlers);
calledHandlers.push({ handler, req, remainder });
});
return calledHandlers;
},
// ../sub/gfGetCalledHandler.jsにgeneratorFunctionで書かれたコードが有るため、コードを読む際はそちらへ;
gfGetCalledHandler(path, method, baseUrl, params) {
let calledHandlers = privates(this).getCalledHandlers(path, method, baseUrl, params);
let i = 0;
let l = 0;
let childRouter = null;
let obj = {
value: undefined,
done: true,
}
return {
next: function(skip) {
if(calledHandlers.length <= i) {
return {
done: true,
value: undefined,
};
}
let calledHandler = calledHandlers[i];
if(calledHandler.handler.listeners.length <= l) {
i++;
l = 0;
return this.next();
}
if(childRouter) {
let nextHandler = childRouter.getNextHandler(skip);
if(nextHandler) {
return {
done: false,
value: nextHandler
};
}
l++;
childRouter = null;
return this.next();
}
if(l !== 0 && skip) {
i++;
l = 0;
return this.next();
}
let listener = calledHandler.handler.listeners[l];
if(listener instanceof Router) {
childRouter = privates(listener);
childRouter.goGetCalledHandler = childRouter.gfGetCalledHandler(
calledHandler.remainder,
method,
calledHandler.req.baseUrl,
calledHandler.req.params
);
let nextHandler = childRouter.getNextHandler();
if(nextHandler) {
return {
done: false,
value: nextHandler
};
}
l++;
childRouter = null;
return this.next();
}
l++;
//次のhandlerがあるなら最終的にこのobjectを返す;
return {
done: false,
value:{
type: calledHandler.handler.type,
listener: listener,
req: calledHandler.req,
paramValue: calledHandler.paramValue,
},
};
},
};
},
getMatchedErrorHandlers(request) {
let self = privates(this);
let matchedHandlers = [];
let method = request.method;
let path = request.pathname;
self.errorHandlers.forEach((handler) => {
let matched = handler.pattern.exec(path);
if(matched === null) {
return;
}
if(handler.type === 'middleware') {
let remainder = self.getRemainder(matched);
if(remainder === null) {
return;
}
matchedHandlers.push({ handler });
}else if(handler.method === 'all' || method === 'all' || handler.method === method) {
matchedHandlers.push({ handler });
}
});
return matchedHandlers;
},
// ../sub/gfGetMatchedErrorHandler.jsにgeneratorFunctionで書かれたコードが有るため、コードを読む際はそちらへ;
gfGetMatchedErrorHandler(request) {
let matchedHandlers = privates(this).getMatchedErrorHandlers(request);
let i = 0;
return {
next: function() {
if(matchedHandlers.length <= i) {
return { done: true, value: undefined, }
}
return { done: false, value: matchedHandlers[i++], };
},
};
},
getNextHandler() {
let genObj = privates(this).goGetCalledHandler.next(arguments[0]);
if(genObj.done) {
return null;
}
return genObj.value;
},
runNextHandler(request, response, error) {
let self = privates(this);
let nextHandler = null;
if(error === 'route') {
nextHandler = self.getNextHandler(true);
}else if(error !== undefined) {
self.goGetMatchedErrorHandlers = self.gfGetMatchedErrorHandler(request);
self.runNextErrorHandler(request, response, error);
return;
}else {
nextHandler = self.getNextHandler();
}
if(nextHandler === null) {
return;
}
Object.assign(request, nextHandler.req);
let next = self.runNextHandler.bind(self, request, response);
if(nextHandler.type === 'parameter') {
nextHandler.listener(request, response, next, nextHandler.paramValue);
return;
}
nextHandler.listener(request, response, next);
},
getNextErrorHandler() {
let genObj = privates(this).goGetMatchedErrorHandlers.next();
if(genObj.done) {
return null;
}
return genObj.value;
},
runNextErrorHandler(request, response, error) {
let self = privates(this);
let nextHandler = self.getNextErrorHandler();
if(nextHandler === null) {
return;
}
let next = self.runNextErrorHandler.bind(self, request, response, error);
nextHandler.handler.listener(error, request, response, next);
},
register(properties, destination) {
let self = privates(this);
let handler = properties;
if(handler.type === 'middleware') {
handler.pattern = pathToRegexp(handler.path, null, {
sensitive: self.defaults.caseSensitive,
strict: self.defaults.strict,
end: false,
});
}else {
handler.pattern = pathToRegexp(handler.path, null, {
sensitive: self.defaults.caseSensitive,
strict: self.defaults.strict,
end: true,
});
}
if(destination === 'error') {
self.errorHandlers.push(handler);
return;
}
self.handlers.push(handler);
},
}
|
webkatu/leads-router
|
src/Router.js
|
JavaScript
|
mit
| 16,660
|
import React from 'react'
import Icon from '../Icon'
import { glyphType } from '../propTypes'
import fabricComponent from '../fabricComponent'
import style from './ListItem.scss'
const ListItemAction = ({ children, glyph, ...props }) => (
<div {...props}
styleName="ms-ListItem-action">
{ glyph && <Icon glyph={glyph} /> }
{ children }
</div>
)
ListItemAction.propTypes = {
children: React.PropTypes.node,
glyph: glyphType
}
export default fabricComponent(ListItemAction, style)
|
react-fabric/react-fabric
|
src/ListItem/ListItemAction.js
|
JavaScript
|
mit
| 503
|
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','fr',{placeholder:{title:"Propriétés de l'Espace réservé",toolbar:"Créer l'Espace réservé",text:"Texte de l'Espace réservé",edit:"Modifier l'Espace réservé",textMissing:"L'Espace réservé doit contenir du texte."}});
|
alexmsmartins/WikiModels
|
wm_web_client/src/main/webapp/classpath/js/ckeditor/plugins/placeholder/lang/fr.js
|
JavaScript
|
mit
| 423
|
/* eslint-disable new-cap */
const <%= name %>Fixtures = require("../../../spec/fixtures/<%= name %>s.json");
import Request from "appeal";
export default function <%= Name %>ControllerListSteps () {
this.When(/^a valid list <%= name %> request is received$/, function (callback) {
this.database.mock({
"select * from `client_access_tokens` where `token` = 'valid-client-access-token' and `deleted_at` is null limit 1": [
this.clientAccessTokenRecord
],
"select * from `client_access_tokens` where `token` = 'invalid-client-access-token' and `deleted_at` is null limit 1": [
],
"select * from `client_access_tokens` where `token` = 'expired-client-access-token' and `deleted_at` is null limit 1": [
this.clientAccessTokenRecord
]
});
this.querySpy = this.database.spy("select * from `<%= _name %>s`", [
<%= name %>Fixtures[0],
<%= name %>Fixtures[2],
<%= name %>Fixtures[3],
<%= name %>Fixtures[4],
<%= name %>Fixtures[5]
]);
Request
.get
.url(this.url + "/<%= name %>s")
.header("Content-Type", "application/vnd.api+json")
.header("Client-Access-Token", this.clientAccessToken)
.results((error, response) => {
this.response = response;
callback();
});
});
this.Then(/^respond with all the list of <%= name %>s$/, function (callback) {
this.response.body.should.have.property("data");
this.response.body.data.length.should.equal(5);
this.response.body.data[0].should.have.property("type");
this.response.body.data[0].should.have.property("attributes");
this.response.body.data[0].type.should.equal("<%= Name %>");
this.response.body.data[0].attributes.name.should.equal(<%= name %>Fixtures[0].name);
callback();
});
}
|
FreeAllMedia/generator-forbin-scudl
|
generators/app/templates/features/steps/_model.list.steps.js
|
JavaScript
|
mit
| 1,719
|
//----------- Imports -----------//
import styled from 'styled-components'
//----------- Bounds Wrapping -----------//
const Elem = styled.div`
align-items : stretch;
background : white;
color : black;
display : flex;
flex-direction : column;
font-size : $emBase;
font-style : normal;
min-height : 100vh;
position : relative;
z-index : 1;
`
//----------- Exports ----------- */
export default { Elem }
|
mattmanske/react-baseplate
|
app/containers/AppWrapper/styles.js
|
JavaScript
|
mit
| 482
|
version https://git-lfs.github.com/spec/v1
oid sha256:e71e6b9343ef224d72ade01b481580c24756afe41cd7da48f2007732a8afb8ec
size 32973
|
yogeshsaroya/new-cdnjs
|
ajax/libs/backbone.marionette/0.9.1/backbone.marionette.js
|
JavaScript
|
mit
| 130
|
const { app, BrowserWindow } = require('electron')
let win = null
app.on('ready', () => {
win = new BrowserWindow({ width: 800, height: 600 })
win.loadURL(`file://${__dirname}/index.html`)
})
|
spacebro/spacebro-client
|
example/webpack-electron/main.js
|
JavaScript
|
mit
| 197
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.5): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Popover = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'popover';
var VERSION = '4.0.0-alpha.5';
var DATA_KEY = 'bs.popover';
var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = $.extend({}, Tooltip.Default, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
});
var DefaultType = $.extend({}, Tooltip.DefaultType, {
content: '(string|element|function)'
});
var ClassName = {
FADE: 'fade',
ACTIVE: 'active'
};
var Selector = {
TITLE: '.popover-title',
CONTENT: '.popover-content'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
INSERTED: 'inserted' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY,
FOCUSIN: 'focusin' + EVENT_KEY,
FOCUSOUT: 'focusout' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
}
// overrides
Popover.prototype.isWithContent = function isWithContent() {
return this.getTitle() || this._getContent();
};
Popover.prototype.getTipElement = function getTipElement() {
return this.tip = this.tip || $(this.config.template)[0];
};
Popover.prototype.setContent = function setContent() {
var $tip = $(this.getTipElement());
// we use append for html objects to maintain js events
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
$tip.removeClass(ClassName.FADE).removeClass(ClassName.ACTIVE);
this.cleanupTether();
};
// private
Popover.prototype._getContent = function _getContent() {
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
};
// static
Popover._jQueryInterface = function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
};
_createClass(Popover, null, [{
key: 'VERSION',
// getters
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}, {
key: 'NAME',
get: function get() {
return NAME;
}
}, {
key: 'DATA_KEY',
get: function get() {
return DATA_KEY;
}
}, {
key: 'Event',
get: function get() {
return Event;
}
}, {
key: 'EVENT_KEY',
get: function get() {
return EVENT_KEY;
}
}, {
key: 'DefaultType',
get: function get() {
return DefaultType;
}
}]);
return Popover;
}(Tooltip);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover._jQueryInterface;
};
return Popover;
}(jQuery);
//# sourceMappingURL=popover.js.map
|
gthomas-appfolio/bootstrap-apm
|
js/dist/popover.js
|
JavaScript
|
mit
| 6,514
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _sr_RS = require('rc-calendar/lib/locale/sr_RS');
var _sr_RS2 = _interopRequireDefault(_sr_RS);
var _sr_RS3 = require('../../time-picker/locale/sr_RS');
var _sr_RS4 = _interopRequireDefault(_sr_RS3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
// Merge into a locale object
var locale = {
lang: (0, _extends3['default'])({ placeholder: 'Izaberite datum', rangePlaceholder: ['Početni datum', 'Krajnji datum'] }, _sr_RS2['default']),
timePickerLocale: (0, _extends3['default'])({}, _sr_RS4['default'])
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
exports['default'] = locale;
module.exports = exports['default'];
|
ligangwolai/blog
|
node_modules/_antd@2.13.4@antd/lib/date-picker/locale/sr_RS.js
|
JavaScript
|
mit
| 953
|
// Masonry
$('.component.data.class').masonry({
columnWidth: 'li',
itemSelector: 'li'
});
|
dimitrisdervas/jekyll-develloper
|
_includes/basic_components/javascriptPluginsCases/masonry.js
|
JavaScript
|
mit
| 93
|
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
const propTypes = {
activeTab: PropTypes.number,
className: PropTypes.string,
cssPrefix: PropTypes.string.isRequired,
onChange: PropTypes.func,
};
const defaultProps = {
activeTab: 0
};
class TabBar extends React.Component {
constructor(props) {
super(props);
this.handleClickTab = this.handleClickTab.bind(this);
}
handleClickTab(tabId) {
if (this.props.onChange) {
this.props.onChange(tabId);
}
}
render() {
const { activeTab, className, cssPrefix,
children, ...otherProps } = this.props;
const classes = classNames({
[`${cssPrefix}__tab-bar`]: true
}, className);
return (
<div className={classes} {...otherProps}>
{React.Children.map(children, (child, tabId) =>
React.cloneElement(child, {
cssPrefix,
tabId,
active: tabId === activeTab,
onTabClick: this.handleClickTab,
})
)}
</div>
);
}
}
TabBar.propTypes = propTypes;
TabBar.defaultProps = defaultProps;
export default TabBar;
|
react-mdl/react-mdl
|
src/Tabs/TabBar.js
|
JavaScript
|
mit
| 1,337
|
import { y } from './module';
y;
export default 1;
|
webpack/webpack
|
test/cases/scope-hoisting/orphan/node_modules/pkg/b.js
|
JavaScript
|
mit
| 51
|
'use strict';
// Create an instance
var wavesurfer = Object.create(WaveSurfer);
// Init & load audio file
document.addEventListener('DOMContentLoaded', function () {
var options = {
container : document.querySelector('#waveform'),
waveColor : 'violet',
progressColor : 'purple',
loaderColor : 'purple',
cursorColor : 'navy'
};
if (location.search.match('scroll')) {
options.minPxPerSec = 100;
options.scrollParent = true;
}
if (location.search.match('normalize')) {
options.normalize = true;
}
// Init
wavesurfer.init(options);
// Load audio from URL
wavesurfer.load('example/media/demo.wav');
// Regions
if (wavesurfer.enableDragSelection) {
wavesurfer.enableDragSelection({
color: 'rgba(0, 255, 0, 0.1)'
});
}
});
// Play at once when ready
// Won't work on iOS until you touch the page
wavesurfer.on('ready', function () {
//wavesurfer.play();
});
// Report errors
wavesurfer.on('error', function (err) {
console.error(err);
});
// Do something when the clip is over
wavesurfer.on('finish', function () {
console.log('Finished playing');
});
/* Progress bar */
document.addEventListener('DOMContentLoaded', function () {
var progressDiv = document.querySelector('#progress-bar');
var progressBar = progressDiv.querySelector('.progress-bar');
var showProgress = function (percent) {
progressDiv.style.display = 'block';
progressBar.style.width = percent + '%';
};
var hideProgress = function () {
progressDiv.style.display = 'none';
};
wavesurfer.on('loading', showProgress);
wavesurfer.on('ready', hideProgress);
wavesurfer.on('destroy', hideProgress);
wavesurfer.on('error', hideProgress);
});
// Drag'n'drop
document.addEventListener('DOMContentLoaded', function () {
var toggleActive = function (e, toggle) {
e.stopPropagation();
e.preventDefault();
toggle ? e.target.classList.add('wavesurfer-dragover') :
e.target.classList.remove('wavesurfer-dragover');
};
var handlers = {
// Drop event
drop: function (e) {
toggleActive(e, false);
// Load the file into wavesurfer
if (e.dataTransfer.files.length) {
wavesurfer.loadBlob(e.dataTransfer.files[0]);
} else {
wavesurfer.fireEvent('error', 'Not a file');
}
},
// Drag-over event
dragover: function (e) {
toggleActive(e, true);
},
// Drag-leave event
dragleave: function (e) {
toggleActive(e, false);
}
};
var dropTarget = document.querySelector('#drop');
Object.keys(handlers).forEach(function (event) {
dropTarget.addEventListener(event, handlers[event]);
});
});
|
cs-education/classTranscribe
|
public/javascripts/libraries/wavesurfer/example/main.js
|
JavaScript
|
mit
| 2,933
|
import Vue from 'vue';
import checkingComponent from '~/vue_merge_request_widget/components/states/mr_widget_checking.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('MRWidgetChecking', () => {
let Component;
let vm;
beforeEach(() => {
Component = Vue.extend(checkingComponent);
vm = mountComponent(Component);
});
afterEach(() => {
vm.$destroy();
});
it('renders disabled button', () => {
expect(vm.$el.querySelector('button').getAttribute('disabled')).toEqual('disabled');
});
it('renders loading icon', () => {
expect(vm.$el.querySelector('.mr-widget-icon i').classList).toContain('fa-spinner');
});
it('renders information about merging', () => {
expect(vm.$el.querySelector('.media-body').textContent.trim()).toEqual(
'Checking ability to merge automatically',
);
});
});
|
axilleas/gitlabhq
|
spec/javascripts/vue_mr_widget/components/states/mr_widget_checking_spec.js
|
JavaScript
|
mit
| 878
|
'use strict';
var controller = require('../controllers/schedules');
module.exports = function(Horarios, app, auth, database) {
var path = '/groups/:groupId/schedules/';
app.get(path, controller.all);
app.post(path, controller.create);
app.put(path + ':scheduleId', controller.update);
app.delete(path + ':scheduleId', controller.destroy);
app.get(path + ':scheduleId', controller.show);
app.param('scheduleId', controller.schedule);
app.param('groupId', controller.group);
};
|
wolf-mtwo/attendance
|
packages/custom/groups/server/routes/schedules.js
|
JavaScript
|
mit
| 494
|
/**
* Created by cyk on 15-4-10.
*/
// 该模块用于编写程序的单元测试用例
var event = require('events');
var EEmitter = event.EventEmitter;
// console.log(EEmitter); // EEmitter is a Class
var emitter = new EEmitter(); // EventEmitter object
// 针对单个对象设置监听器个数, 设置 0 表示不限制个数
emitter.setMaxListeners(13);
//console.log(emitter.addListener);
emitter.addListener('drink', function(){
console.log('hava a drink');
});
var callback = function () {
console.log('site down, have a drink');
};
function addListener() {
emitter.on('drink', callback);
}
addListener();
addListener();
addListener();
emitter.once('drink', function() {
console.log('drink only once');
})
var listenerCount = EEmitter.listenerCount(emitter, 'drink');
console.log('listenerCount:', listenerCount);
// 移除监听, 如果同一个监听被添加了多次,移除的时候每次只能移除一个监听,
// 需要多次移除
// If any single listener has been added multiple times to the listener array
// for the specified event, then removeListener must be called multiple times to remove each instance.
emitter.removeListener('drink', callback);
emitter.removeListener('drink', callback);
//emitter.removeListener('drink', callback);
// 一次性移除所有监听器
//emitter.removeAllListeners('drink');
// 根据事件,找出对应的监听器数组
//emitter.listeners('drink');
// 触发事件
emitter.emit('drink');
listenerCount = EEmitter.listenerCount(emitter, 'drink');
console.log('listenerCount:', listenerCount);
|
yardfarmer/bone
|
node/topic/demo/event/event_2.js
|
JavaScript
|
mit
| 1,595
|
var gulp = require('gulp');
var less = require('gulp-less');
var path = require('path');
var autoprefixer = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
var resolve = require("resolve-dep");
var deepExtend = require("deep-extend");
//var sourcemaps = require('gulp-sourcemaps');
var LessPluginAutoPrefix = require('less-plugin-autoprefix');
var LessPluginCleanCSS = require('less-plugin-clean-css');
var cleancss = new LessPluginCleanCSS({ advanced: true });
var autoprefix= new LessPluginAutoPrefix({ browsers: ["last 2 versions"] });
var dirs = gulp.pkg.demo.directories;
/**
* less options for development
*/
var options_dev = {
compress: false
};
/**
* less options for production
*/
var options_prod = {
compress: true
};
gulp.task('demo-less', function(){ return compileFile(dirs.lib+'/less/style.less', dirs.build+'/css', options_dev); });
gulp.task('demo-less_bootstrap', function(){ return compileFile(dirs.lib+'/less/bootstrap.less', dirs.build+'/css', options_dev); });
gulp.task('demo-less-prod', function(){ return compileFile(dirs.lib+'/less/style.less', dirs.build+'/css', options_prod); });
gulp.task('demo-less_bootstrap-prod', function(){ return compileFile(dirs.lib+'/less/bootstrap.less', dirs.build+'/css', options_prod); });
/**
* Compile a less file
*/
function compileFile(input, output, options){
return gulp.src(input)
//.pipe(sourcemaps.init())
.pipe(less(deepExtend({
filename: input,
paths: [
'.',
path.dirname(path.dirname(resolve.npm('bootstrap-less')[0]))
],
plugins: [cleancss,autoprefix]
}, options)))
.pipe(autoprefixer({browsers: ['last 3 versions']}))
.pipe(minify({restructuring: true, keepBreaks: !options.compress}))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(output))
;
}
|
com365/aurelia-ace
|
build/tasks/demo/less.js
|
JavaScript
|
mit
| 1,850
|
/**
* Copyright 2006-2014 GrapeCity inc
* Author: isaac.fang@grapecity.com
*/
define([
'mongoose'
], function (mongoose) {
'use strict';
var Schema = mongoose.Schema;
var SettingSchema = new Schema({
key: {
type: String,
index: true,
required: true
},
value: String,
scope: String,
note: {
type: String,
default: ''
}
});
var Setting = mongoose.model('Setting', SettingSchema);
return Setting;
});
|
ganggangdit/oglen
|
server/models/Setting.js
|
JavaScript
|
mit
| 538
|
var _obj = obj;
a = _obj.a;
b = _obj.b;
c = babelHelpers.objectWithoutPropertiesLoose(_obj, ["a", "b"]);
_obj;
|
babel/babel
|
packages/babel-plugin-transform-destructuring/test/fixtures/assumption-objectRestNoSymbols/rest-assignment-expression/output.js
|
JavaScript
|
mit
| 111
|
/**
* ContentCollection
*
* Store logs
* @class
* @return {object}
*/
define(['backbone'], function(Backbone) {
var ContentCollection = Backbone.Collection.extend({});
return ContentCollection;
});
|
powpowshen/Monocle
|
js/models/ContentCollection.js
|
JavaScript
|
mit
| 212
|
//>>built
define(["dojo/_base/kernel","dojo/_base/array","dojo/_base/declare","dojo/_base/lang","dojo/_base/Deferred"],function(f,g,h,e,k){f.deprecated("dojox/mobile/_DataMixin","Use dojox/mobile/_StoreMixin instead","2.0");return h("dojox.mobile._DataMixin",null,{store:null,query:null,queryOptions:null,setStore:function(a,b,d){if(a===this.store)return null;this.store=a;this._setQuery(b,d);a&&a.getFeatures()["dojo.data.api.Notification"]&&(g.forEach(this._conn||[],this.disconnect,this),this._conn=[this.connect(a,
"onSet","onSet"),this.connect(a,"onNew","onNew"),this.connect(a,"onDelete","onDelete"),this.connect(a,"close","onStoreClose")]);return this.refresh()},setQuery:function(a,b){this._setQuery(a,b);return this.refresh()},_setQuery:function(a,b){this.query=a;this.queryOptions=b||this.queryOptions},refresh:function(){if(!this.store)return null;var a=new k,b=e.hitch(this,function(b,c){this.onComplete(b,c);a.resolve()}),d=e.hitch(this,function(b,c){this.onError(b,c);a.resolve()}),c=this.query;this.store.fetch({query:c,
queryOptions:this.queryOptions,onComplete:b,onError:d,start:c&&c.start,count:c&&c.count});return a}})});
|
ycabon/presentations
|
2020-devsummit/arcgis-js-api-road-ahead/js-api/dojox/mobile/_DataMixin.js
|
JavaScript
|
mit
| 1,140
|
$(document).ready(function()
{
$.setAjaxForm('#qrcodeForm', function(data)
{
if(data.result == 'success') $.reloadAjaxModal(1500);
});
})
|
pengqinglan/EnterpriseServerPlatform
|
中小企业/system/module/wechat/js/qrcode.js
|
JavaScript
|
mit
| 162
|
'use strict';
const PARAM_MARKER = Symbol('PARAM');
const EXPR_MARKER = Symbol('EXPR');
const TAG = Symbol('X2NODE_DBOS');
/**
* Get parameter placeholder object that can be used in DBO specifications.
*
* @memberof module:x2node-dbos
* @function param
* @param {string} paramName Parameter name.
* @returns {Object} Placeholder object.
*/
exports.param = function(paramName) {
return {
[PARAM_MARKER]: true,
name: paramName,
toString() { return '?{' + this.name + '}'; }
};
};
/**
* Tell if the provided argument is a parameter placeholder.
*
* @memberof module:x2node-dbos
* @function isParam
* @param {*} v Argument to test. Safe to pass <code>null</code>,
* <code>undefined</code>, etc.
* @returns {boolean} <code>true</code> if the provided argument is a parameter
* placeholder.
*/
exports.isParam = function(v) {
return ((v !== null) && ((typeof v) === 'object') && v[PARAM_MARKER]);
};
/**
* Get value expression placeholder object that can be used in DBO
* specifications.
*
* @memberof module:x2node-dbos
* @function expr
* @param {string} valueExpr Value expression text.
* @returns {Object} Placeholder object.
*/
exports.expr = function(valueExpr) {
return {
[EXPR_MARKER]: true,
expr: valueExpr,
toString() { return '{{' + this.valueExpr + '}}'; }
};
};
/**
* Tell if the provided argument is a value expression placeholder.
*
* @memberof module:x2node-dbos
* @function isExpr
* @param {*} v Argument to test. Safe to pass <code>null</code>,
* <code>undefined</code>, etc.
* @returns {boolean} <code>true</code> if the provided argument is a value
* expression placeholder.
*/
exports.isExpr = function(v) {
return ((v !== null) && ((typeof v) === 'object') && v[EXPR_MARKER]);
};
/**
* Tag object.
*
* @protected
* @param {*} o Object to tag.
*/
exports.tag = function(o) {
o[TAG] = true;
};
/**
* Tell if the specified object is tagged.
*
* @protected
* @param {*} o Object to test.
* @returns {boolean} <code>true</code> if tagged.
*/
exports.isTagged = function(o) {
return o[TAG];
};
|
boylesoftware/x2node-dbos
|
lib/placeholders.js
|
JavaScript
|
mit
| 2,081
|
/*
Copyright (c) 2012-2013 Andreas Siebert, ask@touchableheroes.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/**
* Replace the first word in passed scope after this macro.
*/
function Word(params) {
this.name = "word";
this.params = params;
this.scope = {
after : "*/",
end : "#end",
/* some delimiter signs: sind vom dokument abhängig. */
whitespace : " ,-*/;()\n\r\t{}:"
};
this.offsetFix = 0;
};
/**
* Validate params of this function.
*
* @returns {___anonymous1474_1496}
*/
Word.prototype.validate = function() {
LOGGER.log("validate command");
return {
success : true
};
};
/**
*
*/
Word.prototype.skipWhiteSpaces = function( scope, start ) {
var rval = 0;
for( var i = start; i < scope.length; i++ ) {
var char = scope.charAt( i );
var isWhitespace = this.scope.whitespace.indexOf( char );
LOGGER.log( "isWhitespace: " + char + " pos: " + isWhitespace );
if( isWhitespace >= 0 ) {
continue;
} else {
rval = i;
break;
}
};
LOGGER.log( "find start of word: " + rval );
return rval;
};
/**
*
*/
Word.prototype.findWordEnd = function( scope, start ) {
var rval = 0;
for( var i = start; i < scope.length; i++ ) {
var char = scope.charAt( i );
var isWhitespace = this.scope.whitespace.indexOf( char );
var foundWhitespace = (isWhitespace < 0);
if( foundWhitespace ) {
continue;
} else {
rval = i;
break;
}
};
LOGGER.log( "find end of word: " + rval );
return rval;
};
/**
* skip until passed string inluding this length.
*
* @param scope string
* @param pattern string (not a regexp!)
*
* @returns {Number} 0 if nothing found, else position after passed string
*/
Word.prototype.skipUntil = function( scope, pattern ) {
var idx = scope.indexOf( pattern );
var rval = 0;
if( idx > -1)
rval = idx + pattern.length;
LOGGER.log( "skip chars in scope until: " + pattern + "[" + rval +"]");
return rval;
};
/**
* replace token one time with passed word/phrase
*
* @param scope
* @returns
*/
Word.prototype.exec = function(scope) {
var commentEndPos = this.skipUntil( scope, "*/" );
var start = this.skipWhiteSpaces( scope, commentEndPos );
var end = this.findWordEnd( scope, start+1 );
LOGGER.log( "found word with position start = " + start
+ "(" + scope.charAt(start) + "), end = " + end
+ "(" + scope.charAt(end)
+ "), skiped = " + commentEndPos );
if( start >= end ) {
LOGGER.log( "couldn't find word. use the full scope." );
return scope;
}
var before = scope.substring( 0, start );
// var after = scope.substring( end, scope.length );
var fill = this.params[ "with" ];
var msg = before + fill;
// + after;
LOGGER.log( "word.exec() : " );
LOGGER.log( "before = " + msg);
LOGGER.log( "with = " + fill);
// LOGGER.log( "after = " + after );
LOGGER.log( "replaced word:" + scope.substring( start, end ) );
this.offsetFix = end;
console.log( "offset = " + this.offsetFix );
console.log( "commentEndPos = " + commentEndPos );
console.log( "start = " + start );
console.log( "end = " + end );
return msg;
};
module.exports = Word;
|
drdrej/appbuildr-java-application
|
node_modules/appbuildr/lib/macro/word.js
|
JavaScript
|
mit
| 4,142
|
import site from '../app';
site.config($mdThemingProvider => {
$mdThemingProvider
.theme('default')
.primaryPalette('green', {
default: '600'
})
.accentPalette('orange', {
default: '800'
});
});
|
seiyria/openchallenge
|
src/js/configs/color.js
|
JavaScript
|
mit
| 229
|
Clazz.declarePackage ("JU");
Clazz.load (["JU.Int2IntHash"], "JU.C", ["java.lang.Byte", "$.Float", "JU.AU", "$.CU", "$.PT", "$.SB", "J.c.PAL", "JU.Escape", "$.Logger"], function () {
c$ = Clazz.declareType (JU, "C");
Clazz.makeConstructor (c$,
function () {
});
c$.getColix = Clazz.defineMethod (c$, "getColix",
function (argb) {
if (argb == 0) return 0;
var translucentFlag = 0;
if ((argb & 0xFF000000) != (-16777216)) {
translucentFlag = JU.C.getTranslucentFlag ((argb >> 24) & 0xFF);
argb |= 0xFF000000;
}var c = JU.C.colixHash.get (argb);
if ((c & 3) == 3) translucentFlag = 0;
return ((c > 0 ? c : JU.C.allocateColix (argb)) | translucentFlag);
}, "~N");
c$.allocateColix = Clazz.defineMethod (c$, "allocateColix",
function (argb) {
for (var i = JU.C.colixMax; --i >= 4; ) if ((argb & 0xFFFFFF) == (JU.C.argbs[i] & 0xFFFFFF)) return i;
if (JU.C.colixMax == JU.C.argbs.length) {
var oldSize = JU.C.colixMax;
var newSize = oldSize * 2;
if (newSize > 2048) newSize = 2048;
JU.C.argbs = JU.AU.arrayCopyI (JU.C.argbs, newSize);
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale = JU.AU.arrayCopyI (JU.C.argbsGreyscale, newSize);
}JU.C.argbs[JU.C.colixMax] = argb;
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale[JU.C.colixMax] = JU.CU.toFFGGGfromRGB (argb);
JU.C.colixHash.put (argb, JU.C.colixMax);
return (JU.C.colixMax < 2047 ? JU.C.colixMax++ : JU.C.colixMax);
}, "~N");
c$.setLastGrey = Clazz.defineMethod (c$, "setLastGrey",
function (argb) {
JU.C.calcArgbsGreyscale ();
JU.C.argbsGreyscale[2047] = JU.CU.toFFGGGfromRGB (argb);
}, "~N");
c$.calcArgbsGreyscale = Clazz.defineMethod (c$, "calcArgbsGreyscale",
function () {
if (JU.C.argbsGreyscale != null) return;
var a = Clazz.newIntArray (JU.C.argbs.length, 0);
for (var i = JU.C.argbs.length; --i >= 4; ) a[i] = JU.CU.toFFGGGfromRGB (JU.C.argbs[i]);
JU.C.argbsGreyscale = a;
});
c$.getArgbGreyscale = Clazz.defineMethod (c$, "getArgbGreyscale",
function (colix) {
if (JU.C.argbsGreyscale == null) JU.C.calcArgbsGreyscale ();
return JU.C.argbsGreyscale[colix & -30721];
}, "~N");
c$.getColixO = Clazz.defineMethod (c$, "getColixO",
function (obj) {
if (obj == null) return 0;
if (Clazz.instanceOf (obj, J.c.PAL)) return ((obj) === J.c.PAL.NONE ? 0 : 2);
if (Clazz.instanceOf (obj, Integer)) return JU.C.getColix ((obj).intValue ());
if (Clazz.instanceOf (obj, String)) return JU.C.getColixS (obj);
if (Clazz.instanceOf (obj, Byte)) return ((obj).byteValue () == 0 ? 0 : 2);
if (JU.Logger.debugging) {
JU.Logger.debug ("?? getColix(" + obj + ")");
}return 22;
}, "~O");
c$.getTranslucentFlag = Clazz.defineMethod (c$, "getTranslucentFlag",
function (translucentLevel) {
if (translucentLevel == 0) return 0;
if (translucentLevel < 0) translucentLevel = 128;
if (Float.isNaN (translucentLevel) || translucentLevel >= 255 || translucentLevel == 1.0) return 16384;
var iLevel = Clazz.doubleToInt (Math.floor (translucentLevel < 1 ? translucentLevel * 256 : translucentLevel >= 15 ? translucentLevel : translucentLevel <= 9 ? (Clazz.doubleToInt (Math.floor (translucentLevel - 1))) << 5 : 256));
return (((iLevel >> 5) & 0xF) << 11);
}, "~N");
c$.isColixLastAvailable = Clazz.defineMethod (c$, "isColixLastAvailable",
function (colix) {
return (colix > 0 && (colix & 2047) == 2047);
}, "~N");
c$.getArgb = Clazz.defineMethod (c$, "getArgb",
function (colix) {
return JU.C.argbs[colix & -30721];
}, "~N");
c$.isColixColorInherited = Clazz.defineMethod (c$, "isColixColorInherited",
function (colix) {
switch (colix) {
case 0:
case 1:
return true;
default:
return (colix & -30721) == 1;
}
}, "~N");
c$.getColixInherited = Clazz.defineMethod (c$, "getColixInherited",
function (myColix, parentColix) {
switch (myColix) {
case 0:
return parentColix;
case 1:
return (parentColix & -30721);
default:
return ((myColix & -30721) == 1 ? (parentColix & -30721 | myColix & 30720) : myColix);
}
}, "~N,~N");
c$.isColixTranslucent = Clazz.defineMethod (c$, "isColixTranslucent",
function (colix) {
return ((colix & 30720) != 0);
}, "~N");
c$.getChangeableColixIndex = Clazz.defineMethod (c$, "getChangeableColixIndex",
function (colix) {
return (colix >= 0 ? -1 : (colix & 2047));
}, "~N");
c$.getColixTranslucent3 = Clazz.defineMethod (c$, "getColixTranslucent3",
function (colix, isTranslucent, translucentLevel) {
colix &= -30721;
if (colix == 0) colix = 1;
return (isTranslucent ? (colix | JU.C.getTranslucentFlag (translucentLevel)) : colix);
}, "~N,~B,~N");
c$.copyColixTranslucency = Clazz.defineMethod (c$, "copyColixTranslucency",
function (colixFrom, colixTo) {
return JU.C.getColixTranslucent3 (colixTo, JU.C.isColixTranslucent (colixFrom), JU.C.getColixTranslucencyLevel (colixFrom));
}, "~N,~N");
c$.getColixTranslucencyFractional = Clazz.defineMethod (c$, "getColixTranslucencyFractional",
function (colix) {
var translevel = JU.C.getColixTranslucencyLevel (colix);
return (translevel == -1 ? 0.5 : translevel == 0 ? 0 : translevel == 255 ? 1 : translevel / 256);
}, "~N");
c$.getColixTranslucencyLevel = Clazz.defineMethod (c$, "getColixTranslucencyLevel",
function (colix) {
var logAlpha = (colix >> 11) & 0xF;
switch (logAlpha) {
case 0:
return 0;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
return logAlpha << 5;
case 15:
return -1;
default:
return 255;
}
}, "~N");
c$.getColixS = Clazz.defineMethod (c$, "getColixS",
function (colorName) {
var argb = JU.CU.getArgbFromString (colorName);
if (argb != 0) return JU.C.getColix (argb);
if ("none".equalsIgnoreCase (colorName)) return 0;
if ("opaque".equalsIgnoreCase (colorName)) return 1;
return 2;
}, "~S");
c$.getColixArray = Clazz.defineMethod (c$, "getColixArray",
function (colorNames) {
if (colorNames == null || colorNames.length == 0) return null;
var colors = JU.PT.getTokens (colorNames);
var colixes = Clazz.newShortArray (colors.length, 0);
for (var j = 0; j < colors.length; j++) {
colixes[j] = JU.C.getColix (JU.CU.getArgbFromString (colors[j]));
if (colixes[j] == 0) return null;
}
return colixes;
}, "~S");
c$.getHexCode = Clazz.defineMethod (c$, "getHexCode",
function (colix) {
return JU.Escape.escapeColor (JU.C.getArgb (colix));
}, "~N");
c$.getHexCodes = Clazz.defineMethod (c$, "getHexCodes",
function (colixes) {
if (colixes == null) return null;
var s = new JU.SB ();
for (var i = 0; i < colixes.length; i++) s.append (i == 0 ? "" : " ").append (JU.C.getHexCode (colixes[i]));
return s.toString ();
}, "~A");
c$.getColixTranslucent = Clazz.defineMethod (c$, "getColixTranslucent",
function (argb) {
var a = (argb >> 24) & 0xFF;
return (a == 0xFF ? JU.C.getColix (argb) : JU.C.getColixTranslucent3 (JU.C.getColix (argb), true, a / 255));
}, "~N");
c$.getBgContrast = Clazz.defineMethod (c$, "getBgContrast",
function (argb) {
return ((JU.CU.toFFGGGfromRGB (argb) & 0xFF) < 128 ? 8 : 4);
}, "~N");
Clazz.defineStatics (c$,
"INHERIT_ALL", 0,
"INHERIT_COLOR", 1,
"USE_PALETTE", 2,
"RAW_RGB", 3,
"SPECIAL_COLIX_MAX", 4,
"colixMax", 4,
"argbs", Clazz.newIntArray (128, 0),
"argbsGreyscale", null);
c$.colixHash = c$.prototype.colixHash = new JU.Int2IntHash (256);
Clazz.defineStatics (c$,
"RAW_RGB_INT", 3,
"UNMASK_CHANGEABLE_TRANSLUCENT", 0x07FF,
"CHANGEABLE_MASK", 0x8000,
"LAST_AVAILABLE_COLIX", 2047,
"TRANSLUCENT_SHIFT", 11,
"ALPHA_SHIFT", 13,
"TRANSLUCENT_MASK", 30720,
"TRANSPARENT", 16384,
"OPAQUE_MASK", -30721,
"BLACK", 4,
"ORANGE", 5,
"PINK", 6,
"BLUE", 7,
"WHITE", 8,
"CYAN", 9,
"RED", 10,
"GREEN", 11,
"GRAY", 12,
"SILVER", 13,
"LIME", 14,
"MAROON", 15,
"NAVY", 16,
"OLIVE", 17,
"PURPLE", 18,
"TEAL", 19,
"MAGENTA", 20,
"YELLOW", 21,
"HOTPINK", 22,
"GOLD", 23);
{
var predefinedArgbs = [0xFF000000, 0xFFFFA500, 0xFFFFC0CB, 0xFF0000FF, 0xFFFFFFFF, 0xFF00FFFF, 0xFFFF0000, 0xFF008000, 0xFF808080, 0xFFC0C0C0, 0xFF00FF00, 0xFF800000, 0xFF000080, 0xFF808000, 0xFF800080, 0xFF008080, 0xFFFF00FF, 0xFFFFFF00, 0xFFFF69B4, 0xFFFFD700];
for (var i = 0; i < predefinedArgbs.length; ++i) JU.C.getColix (predefinedArgbs[i]);
}});
|
m4rx9/rna-pdb-tools
|
rna_tools/tools/webserver-engine/app/static/app/jsmol/j2s/JU/C.js
|
JavaScript
|
mit
| 8,133
|
/**
* Button
*
* Render a button
*/
import React from 'react';
import styles from './styles.css';
const Button = (props) => (
<button {...props} className={`${styles.base} ${props.className}`} />
);
export default Button;
|
pure-ui/styleguide
|
plugins/react/frontend/components/common/Button/index.js
|
JavaScript
|
mit
| 231
|
/**
* Module dependencies.
*/
var mongoose = require('mongoose');
var BearerStrategy = require('passport-http-bearer').Strategy;
var config = require('config');
var User = mongoose.model('User');
/**
* Expose
*/
module.exports = new BearerStrategy(
function(token, done) {
var options = {
criteria: { token: token },
select: 'name username email hashed_password salt'
};
User.load(options, function (err, user) {
if (err) return done(err)
if (!user) {
return done(null, false, { message: 'Unknown user' });
}
return done(null, user);
});
}
);
|
nvl1109/ota-update
|
config/passport/bearer.js
|
JavaScript
|
mit
| 615
|
(function() {
'use strict';
function fileReader ($q) {
var onLoad = function(reader, deferred, scope) {
return function () {
scope.$apply(function () {
deferred.resolve(reader.result);
});
};
};
var onError = function (reader, deferred, scope) {
return function () {
scope.$apply(function () {
deferred.reject(reader.result);
});
};
};
var onProgress = function(reader, scope) {
return function (event) {
scope.$broadcast('fileProgress',
{
total: event.total,
loaded: event.loaded
});
};
};
var getReader = function(deferred, scope) {
var reader = new FileReader();
reader.onload = onLoad(reader, deferred, scope);
reader.onerror = onError(reader, deferred, scope);
reader.onprogress = onProgress(reader, scope);
return reader;
};
var readAsDataURL = function (file, scope) {
var deferred = $q.defer();
var reader = getReader(deferred, scope);
reader.readAsDataURL(file);
return deferred.promise;
};
var dataURItoBlob = function(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
};
return {
readAsDataUrl: readAsDataURL,
dataURIToBlob: dataURItoBlob
};
}
angular.module('common.services.filereader', [])
.factory('FileReader', fileReader);
})();
|
GitOfThomas/mewpipe-frontend
|
client/src/common/services/fileReaderService.js
|
JavaScript
|
mit
| 1,687
|
'use strict';
var db = require('mano').db
, _ = require('mano').i18n.bind('View: Component: Register dialog')
, userProto = db.User.prototype
, registrationInputNames = ['firstName', 'lastName', 'email', 'password', 'password-repeat'];
module.exports = function (context) {
var user = context.user || userProto;
return dialog(
{ id: 'register', class: 'dialog-register dialog-modal' },
header(
a({ class: 'dialog-modal-close', type: 'button', href: "." }, i({ class: 'fa fa-close' })),
h3(_("Create your account"))
),
section(
{ class: 'dialog-body' },
form(
{ action: '/register/', method: 'post' },
ul({ class: 'form-elements' }, registrationInputNames.map(function (name) {
var rel = user._get(name), labelElement;
if (name === 'password-repeat') {
labelElement = label(
span({ class: 'placeholder-fallback' }, _("Repeat password")),
input({
dbjs: db.Password,
name: name,
required: true,
placeholder: _("Repeat password")
})
);
} else {
labelElement = label(
span({ class: 'placeholder-fallback' }, rel.descriptor.label),
input({ dbjs: rel, placeholder: rel.descriptor.label })
);
}
return li({ class: 'input' },
labelElement,
span({ class: 'error-message' }));
})),
p(input({ type: 'submit', value: _("Create an account") }))
)
),
footer(
p(_("Already has account?"), ' ', a({ href: '#login' }, _("Log in")))
)
);
};
|
egovernment/eregistrations
|
view/components/register-dialog.js
|
JavaScript
|
mit
| 1,528
|
var class_object =
[
[ "Object", "class_object.html#a40860402e64d8008fb42329df7097cdb", null ],
[ "CastsShadows", "group___geometric_objects.html#ga74fa63e74026915a261117724303adfc", null ],
[ "CastsShadows", "group___geometric_objects.html#gab4254fb85f166245bb7234f5c5295777", null ],
[ "GetMaterial", "group___geometric_objects.html#ga7ad7172879f1b2fd092561827aa2bbb1", null ],
[ "Hit", "class_object.html#ad9977e40c0a3048eba9a81b25efcf3ef", null ],
[ "SetMaterial", "class_object.html#a791d7431f79b030866aa31c7c29ea0db", null ],
[ "ShadowHit", "class_object.html#a020a6edbef7b2591b1dd6815ebbc5aa0", null ],
[ "m_MaterialPtr", "class_object.html#aa79a61ad1ff44b1585cc4972034cecbe", null ],
[ "m_Shadows", "class_object.html#a7cde4bccf1989da90c2d2b463876e179", null ]
];
|
jensmcatanho/raytracer
|
docs/html/class_object.js
|
JavaScript
|
mit
| 807
|
var MongoClient = require('mongodb').MongoClient;
var db = null;
var url = '';
MongoClient.connect(url, function (err, db) {
if (err) { throw err; }
console.log('Banco de dados conectado: ' + db.databaseName);
});
module.exports = db;
|
jcbombardelli/Angular4Mean
|
server/config/mongodb.js
|
JavaScript
|
mit
| 245
|
let {} = 0;
|
harc/ohm
|
examples/ecmascript/test/data/esprima/ES6/binding-pattern/object-pattern/empty-var.js
|
JavaScript
|
mit
| 12
|
#! /usr/bin/env node
// Init shell module
require('shelljs/global');
// Init app modules
require('./modules/questions')();
|
justcoded/npm-jcn
|
index.js
|
JavaScript
|
mit
| 124
|
import React, { Component, PropTypes } from 'react'
import FormGroup from 'App/components/FormGroup'
import { getAllUserTypes } from 'App/utils'
class EditView extends Component {
static propTypes = {
isAdding: PropTypes.bool.isRequired,
user: PropTypes.object.isRequired,
onSubmit: PropTypes.func.isRequired,
}
constructor(props) {
super(props)
this.state = { ...this.props.user }
this.userTypes = getAllUserTypes()
this.handleSubmit = this.handleSubmit.bind(this)
}
componentWillReceiveProps(nextProps) {
if (!Object.is(this.props.user, nextProps.user)) {
this.setState({ ...nextProps.user })
}
}
validateUsername = (username) => {
if (!username.length) {
return 'Username is required.'
}
return true
}
validatePassword = (password) => {
if (!password.length) {
return 'Password is required.'
}
return true
}
validateType = (type) => {
const index = this.userTypes.findIndex(option => option.value === type)
if (index === -1) {
return 'Type is invalid.'
}
return true
}
handleChange = field => (value) => {
const nextState = {}
nextState[field] = value
this.setState(nextState)
}
handleSubmit(event) {
event.preventDefault()
this.props.onSubmit(this.state)
}
render() {
const { isAdding } = this.props
const { username, password, type } = this.state
const isUsernameValid = this.validateUsername(username)
const isPasswordValid = this.validatePassword(password)
const isTypeValid = this.validateType(type)
const isSubmitDisabled =
isUsernameValid !== true ||
isPasswordValid !== true ||
isTypeValid !== true
return (
<div className="row">
<div className="col-sm-6 col-sm-offset-3">
<div className="panel panel-default">
<div className="panel-body">
<form className="form-horizontal" onSubmit={this.handleSubmit}>
{
isAdding && (
<FormGroup
id="username"
label="Username"
value={username}
validate={this.validateUsername}
onChange={this.handleChange('username')}
/>
)
}
<FormGroup
type="password"
id="password"
label="Password"
value={password}
validate={this.validatePassword}
onChange={this.handleChange('password')}
/>
<FormGroup
type="select"
id="type"
label="Type"
value={type}
options={this.userTypes}
validate={this.validateType}
onChange={this.handleChange('type')}
/>
<div className="form-group no-margin-bottom">
<div className="col-sm-9 col-sm-offset-3">
<button type="submit" className="btn btn-default" disabled={isSubmitDisabled}>Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
)
}
}
export default EditView
|
nabil-jazoul/react-starter
|
app/routes/User/components/EditView.js
|
JavaScript
|
mit
| 3,364
|
'use strict';
var babelHelpers = require('./util/babelHelpers.js');
var React = require('react'),
CustomPropTypes = require('./util/propTypes'),
compat = require('./util/compat'),
cx = require('classnames'),
_ = require('./util/_');
module.exports = React.createClass({
displayName: 'List',
mixins: [require('./mixins/WidgetMixin'), require('./mixins/DataHelpersMixin'), require('./mixins/ListMovementMixin')],
propTypes: {
data: React.PropTypes.array,
onSelect: React.PropTypes.func,
onMove: React.PropTypes.func,
itemComponent: CustomPropTypes.elementType,
selectedIndex: React.PropTypes.number,
focusedIndex: React.PropTypes.number,
valueField: React.PropTypes.string,
textField: CustomPropTypes.accessor,
optID: React.PropTypes.string,
messages: React.PropTypes.shape({
emptyList: CustomPropTypes.message
})
},
getDefaultProps: function getDefaultProps() {
return {
optID: '',
onSelect: function onSelect() {},
data: [],
messages: {
emptyList: 'There are no items in this list'
}
};
},
getInitialState: function getInitialState() {
return {};
},
componentDidMount: function componentDidMount() {
this.move();
},
componentDidUpdate: function componentDidUpdate() {
this.move();
},
render: function render() {
var _this = this;
var _$omit = _.omit(this.props, ['data']);
var className = _$omit.className;
var props = babelHelpers.objectWithoutProperties(_$omit, ['className']);
var ItemComponent = this.props.itemComponent;
var items;
items = !this.props.data.length ? React.createElement(
'li',
{ className: 'rw-list-empty' },
_.result(this.props.messages.emptyList, this.props)
) : this.props.data.map(function (item, idx) {
var focused = item === _this.props.focused,
selected = item === _this.props.selected;
return React.createElement(
'li',
{
tabIndex: '-1',
key: 'item_' + idx,
role: 'option',
id: focused ? _this.props.optID : undefined,
'aria-selected': selected,
className: cx({
'rw-list-option': true,
'rw-state-focus': focused,
'rw-state-selected': selected
}),
onClick: _this.props.onSelect.bind(null, item) },
ItemComponent ? React.createElement(ItemComponent, { item: item, value: _this._dataValue(item), text: _this._dataText(item) }) : _this._dataText(item)
);
});
return React.createElement(
'ul',
babelHelpers._extends({}, props, {
className: (className || '') + ' rw-list',
ref: 'scrollable',
role: 'listbox' }),
items
);
},
_data: function _data() {
return this.props.data;
},
move: function move() {
var list = compat.findDOMNode(this),
idx = this._data().indexOf(this.props.focused),
selected = list.children[idx];
if (!selected) return;
this.notify('onMove', [selected, list, this.props.focused]);
}
});
|
rdjpalmer/react-widgets
|
lib/List.js
|
JavaScript
|
mit
| 3,117
|
var EventEmitter = require('events');
var util = require('util');
var Blocks = require('./engine/blocks');
var Sprite = require('./sprites/sprite');
var Runtime = require('./engine/runtime');
var sb2import = require('./import/sb2import');
/**
* Handles connections between blocks, stage, and extensions.
*
* @author Andrew Sliwinski <ascii@media.mit.edu>
*/
var VirtualMachine = function () {
var instance = this;
// Bind event emitter and runtime to VM instance
EventEmitter.call(instance);
/**
* VM runtime, to store blocks, I/O devices, sprites/targets, etc.
* @type {!Runtime}
*/
instance.runtime = new Runtime();
/**
* The "currently editing"/selected target ID for the VM.
* Block events from any Blockly workspace are routed to this target.
* @type {!string}
*/
instance.editingTarget = null;
// Runtime emits are passed along as VM emits.
instance.runtime.on(Runtime.SCRIPT_GLOW_ON, function (glowData) {
instance.emit(Runtime.SCRIPT_GLOW_ON, glowData);
});
instance.runtime.on(Runtime.SCRIPT_GLOW_OFF, function (glowData) {
instance.emit(Runtime.SCRIPT_GLOW_OFF, glowData);
});
instance.runtime.on(Runtime.BLOCK_GLOW_ON, function (glowData) {
instance.emit(Runtime.BLOCK_GLOW_ON, glowData);
});
instance.runtime.on(Runtime.BLOCK_GLOW_OFF, function (glowData) {
instance.emit(Runtime.BLOCK_GLOW_OFF, glowData);
});
instance.runtime.on(Runtime.PROJECT_RUN_START, function () {
instance.emit(Runtime.PROJECT_RUN_START);
});
instance.runtime.on(Runtime.PROJECT_RUN_STOP, function () {
instance.emit(Runtime.PROJECT_RUN_STOP);
});
instance.runtime.on(Runtime.VISUAL_REPORT, function (visualReport) {
instance.emit(Runtime.VISUAL_REPORT, visualReport);
});
instance.runtime.on(Runtime.SPRITE_INFO_REPORT, function (spriteInfo) {
instance.emit(Runtime.SPRITE_INFO_REPORT, spriteInfo);
});
this.blockListener = this.blockListener.bind(this);
this.flyoutBlockListener = this.flyoutBlockListener.bind(this);
};
/**
* Inherit from EventEmitter
*/
util.inherits(VirtualMachine, EventEmitter);
/**
* Start running the VM - do this before anything else.
*/
VirtualMachine.prototype.start = function () {
this.runtime.start();
};
/**
* "Green flag" handler - start all threads starting with a green flag.
*/
VirtualMachine.prototype.greenFlag = function () {
this.runtime.greenFlag();
};
/**
* Set whether the VM is in "turbo mode."
* When true, loops don't yield to redraw.
* @param {Boolean} turboModeOn Whether turbo mode should be set.
*/
VirtualMachine.prototype.setTurboMode = function (turboModeOn) {
this.runtime.turboMode = !!turboModeOn;
};
/**
* Set whether the VM is in 2.0 "compatibility mode."
* When true, ticks go at 2.0 speed (30 TPS).
* @param {Boolean} compatibilityModeOn Whether compatibility mode is set.
*/
VirtualMachine.prototype.setCompatibilityMode = function (compatibilityModeOn) {
this.runtime.setCompatibilityMode(!!compatibilityModeOn);
};
/**
* Stop all threads and running activities.
*/
VirtualMachine.prototype.stopAll = function () {
this.runtime.stopAll();
};
/**
* Clear out current running project data.
*/
VirtualMachine.prototype.clear = function () {
this.runtime.dispose();
this.editingTarget = null;
this.emitTargetsUpdate();
};
/**
* Get data for playground. Data comes back in an emitted event.
*/
VirtualMachine.prototype.getPlaygroundData = function () {
var instance = this;
// Only send back thread data for the current editingTarget.
var threadData = this.runtime.threads.filter(function (thread) {
return thread.target === instance.editingTarget;
});
// Remove the target key, since it's a circular reference.
var filteredThreadData = JSON.stringify(threadData, function (key, value) {
if (key === 'target') return;
return value;
}, 2);
this.emit('playgroundData', {
blocks: this.editingTarget.blocks,
threads: filteredThreadData
});
};
/**
* Post I/O data to the virtual devices.
* @param {?string} device Name of virtual I/O device.
* @param {Object} data Any data object to post to the I/O device.
*/
VirtualMachine.prototype.postIOData = function (device, data) {
if (this.runtime.ioDevices[device]) {
this.runtime.ioDevices[device].postData(data);
}
};
/**
* Load a project from a Scratch 2.0 JSON representation.
* @param {?string} json JSON string representing the project.
*/
VirtualMachine.prototype.loadProject = function (json) {
this.clear();
// @todo: Handle other formats, e.g., Scratch 1.4, Scratch 3.0.
sb2import(json, this.runtime);
// Select the first target for editing, e.g., the first sprite.
this.editingTarget = this.runtime.targets[1];
// Update the VM user's knowledge of targets and blocks on the workspace.
this.emitTargetsUpdate();
this.emitWorkspaceUpdate();
this.runtime.setEditingTarget(this.editingTarget);
};
/**
* Add a single sprite from the "Sprite2" (i.e., SB2 sprite) format.
* @param {?string} json JSON string representing the sprite.
*/
VirtualMachine.prototype.addSprite2 = function (json) {
// Select new sprite.
this.editingTarget = sb2import(json, this.runtime, true);
// Update the VM user's knowledge of targets and blocks on the workspace.
this.emitTargetsUpdate();
this.emitWorkspaceUpdate();
this.runtime.setEditingTarget(this.editingTarget);
};
/**
* Add a costume to the current editing target.
* @param {!Object} costumeObject Object representing the costume.
*/
VirtualMachine.prototype.addCostume = function (costumeObject) {
this.editingTarget.sprite.costumes.push(costumeObject);
// Switch to the costume.
this.editingTarget.setCostume(
this.editingTarget.sprite.costumes.length - 1
);
};
/**
* Add a backdrop to the stage.
* @param {!Object} backdropObject Object representing the backdrop.
*/
VirtualMachine.prototype.addBackdrop = function (backdropObject) {
var stage = this.runtime.getTargetForStage();
stage.sprite.costumes.push(backdropObject);
// Switch to the backdrop.
stage.setCostume(stage.sprite.costumes.length - 1);
};
/**
* Rename a sprite.
* @param {string} targetId ID of a target whose sprite to rename.
* @param {string} newName New name of the sprite.
*/
VirtualMachine.prototype.renameSprite = function (targetId, newName) {
var target = this.runtime.getTargetById(targetId);
if (target) {
if (!target.isSprite()) {
throw new Error('Cannot rename non-sprite targets.');
}
var sprite = target.sprite;
if (!sprite) {
throw new Error('No sprite associated with this target.');
}
sprite.name = newName;
this.emitTargetsUpdate();
} else {
throw new Error('No target with the provided id.');
}
};
/**
* Delete a sprite and all its clones.
* @param {string} targetId ID of a target whose sprite to delete.
*/
VirtualMachine.prototype.deleteSprite = function (targetId) {
var target = this.runtime.getTargetById(targetId);
if (target) {
if (!target.isSprite()) {
throw new Error('Cannot delete non-sprite targets.');
}
var sprite = target.sprite;
if (!sprite) {
throw new Error('No sprite associated with this target.');
}
var currentEditingTarget = this.editingTarget;
for (var i = 0; i < sprite.clones.length; i++) {
var clone = sprite.clones[i];
this.runtime.stopForTarget(sprite.clones[i]);
this.runtime.disposeTarget(sprite.clones[i]);
// Ensure editing target is switched if we are deleting it.
if (clone === currentEditingTarget) {
this.setEditingTarget(this.runtime.targets[0].id);
}
}
// Sprite object should be deleted by GC.
this.emitTargetsUpdate();
} else {
throw new Error('No target with the provided id.');
}
};
/**
* Set the renderer for the VM/runtime
* @param {!RenderWebGL} renderer The renderer to attach
*/
VirtualMachine.prototype.attachRenderer = function (renderer) {
this.runtime.attachRenderer(renderer);
};
/**
* Handle a Blockly event for the current editing target.
* @param {!Blockly.Event} e Any Blockly event.
*/
VirtualMachine.prototype.blockListener = function (e) {
if (this.editingTarget) {
this.editingTarget.blocks.blocklyListen(e, this.runtime);
}
};
/**
* Handle a Blockly event for the flyout.
* @param {!Blockly.Event} e Any Blockly event.
*/
VirtualMachine.prototype.flyoutBlockListener = function (e) {
this.runtime.flyoutBlocks.blocklyListen(e, this.runtime);
};
/**
* Set an editing target. An editor UI can use this function to switch
* between editing different targets, sprites, etc.
* After switching the editing target, the VM may emit updates
* to the list of targets and any attached workspace blocks
* (see `emitTargetsUpdate` and `emitWorkspaceUpdate`).
* @param {string} targetId Id of target to set as editing.
*/
VirtualMachine.prototype.setEditingTarget = function (targetId) {
// Has the target id changed? If not, exit.
if (targetId === this.editingTarget.id) {
return;
}
var target = this.runtime.getTargetById(targetId);
if (target) {
this.editingTarget = target;
// Emit appropriate UI updates.
this.emitTargetsUpdate();
this.emitWorkspaceUpdate();
this.runtime.setEditingTarget(target);
}
};
/**
* Emit metadata about available targets.
* An editor UI could use this to display a list of targets and show
* the currently editing one.
*/
VirtualMachine.prototype.emitTargetsUpdate = function () {
this.emit('targetsUpdate', {
// [[target id, human readable target name], ...].
targetList: this.runtime.targets.filter(function (target) {
// Don't report clones.
return !target.hasOwnProperty('isOriginal') || target.isOriginal;
}).map(function (target) {
return target.toJSON();
}),
// Currently editing target id.
editingTarget: this.editingTarget ? this.editingTarget.id : null
});
};
/**
* Emit an Blockly/scratch-blocks compatible XML representation
* of the current editing target's blocks.
*/
VirtualMachine.prototype.emitWorkspaceUpdate = function () {
this.emit('workspaceUpdate', {
xml: this.editingTarget.blocks.toXML()
});
};
/**
* Post/edit sprite info for the current editing target.
* @param {object} data An object with sprite info data to set.
*/
VirtualMachine.prototype.postSpriteInfo = function (data) {
this.editingTarget.postSpriteInfo(data);
};
module.exports = VirtualMachine;
|
kesl-scratch/PopconBot
|
scratch-vm/src/index.js
|
JavaScript
|
mit
| 10,936
|
var gulp = require ('gulp');
var watch = require ('gulp-watch');
var sass = require ('gulp-sass');
var concat = require ('gulp-concat');
var source = require ('vinyl-source-stream');
var browserify = require ('browserify');
var watchify = require ('watchify');
var reactify = require ('reactify');
var spawn = require ('child_process').spawn;
var del = require ('del');
var run = require ('run-sequence');
var SourceDirectories = require ('./utils/SourceDirectories');
var _path = {
ENTRY_POINT: './src/App.jsx',
OUTPUT_JS: 'App.js',
OUTPUT_CSS: 'App.css',
SERVER: [ './server.js', './server/**/*' ],
HTML: './src/*.html',
SASS: './src/**/*.scss',
REACT: [ './src/**/*.jsx', './src/**/*.js' ],
REACT_DIRECTORIES: SourceDirectories ('./src', 'relative'),
SRC: './src',
DIST: 'dist',
};
var _NODE = null;
var _WATCHER = null;
var _PRODUCTION = false;
var _browserify = function () {
return browserify (_path.ENTRY_POINT, {
cache: {},
debug: true,
transform: [ reactify ],
extensions: [ '.js', '.jsx' ],
paths: _path.REACT_DIRECTORIES,
packageCache: {}
});
};
var _getSourceDirectories = function () {
return SourceDirectories (_path.SRC, 'relative');
};
var _error = function (error) {
console.log (error.toString ());
};
gulp.task ('html', function () {
return gulp.src (_path.HTML)
.on ('error', _error)
.pipe (gulp.dest (_path.DIST))
.on('error', _error);
});
gulp.task ('sass', function () {
return gulp.src (_path.SASS)
.on ('error', _error)
.pipe (sass ())
.pipe (concat (_path.OUTPUT_CSS))
.pipe (gulp.dest (_path.DIST));
});
gulp.task ('watchify', function () {
if (_WATCHER) _WATCHER.close ();
_WATCHER = watchify (_browserify ());
_WATCHER
.bundle ()
.on ('error', _error)
.pipe (source (_path.OUTPUT_JS))
.on ('error', _error)
.pipe (gulp.dest (_path.DIST))
.on ('error', _error);
});
gulp.task ('browserify', function () {
if (_PRODUCTION) {
return _browserify ()
.bundle ()
.on ('error', _error)
.pipe (source (_path.OUTPUT_JS))
.on ('error', _error)
.pipe (gulp.dest (_path.DIST))
.on ('error', _error);
} else {
_WATCHER
.bundle ()
.on ('error', _error)
.pipe (source (_path.OUTPUT_JS))
.on ('error', _error)
.pipe (gulp.dest (_path.DIST))
.on ('error', _error);
}
});
gulp.task ('server', function () {
if (_NODE) _NODE.kill ();
_NODE = spawn ('node', ['server.js'], { stdio: 'inherit' });
_NODE.on ('close', function (code) {
if (code === 8) {
console.log ('Error detected; waiting for changes...');
}
})
});
gulp.task ('build', function () {
_PRODUCTION = true;
return run (['html'], ['sass'], ['browserify']);
});
gulp.task ('deploy', function () {
_PRODUCTION = true;
return run (['html'], ['sass'], ['browserify'], function () {
gulp.start ('server');
});
});
gulp.task ('start', function () {
return run (['html'], ['sass'], ['watchify'], function () {
run (['server'], function () {
watch (_path.SERVER, function () {
gulp.start ('server');
});
watch (_path.HTML, function () {
gulp.start ('html');
});
watch (_path.SASS, function () {
gulp.start ('sass');
});
watch (_path.REACT, function () {
if (_getSourceDirectories ().length !== _path.REACT_DIRECTORIES.length) {
_path.REACT_DIRECTORIES = _getSourceDirectories ();
gulp.start ('watchify');
} else {
gulp.start ('browserify');
}
});
})
})
});
gulp.task ('default', ['start']);
process.on ('exit', function () {
if (_NODE) _NODE.kill ();
})
|
VisionistInc/node-react
|
gulpfile.js
|
JavaScript
|
mit
| 3,711
|
"use strict";
var helpers = require("../../helpers/helpers");
exports["Europe/Lisbon"] = {
"guess:by:offset" : helpers.makeTestGuess("Europe/Lisbon", { offset: true, expect: "Europe/London" }),
"guess:by:abbr" : helpers.makeTestGuess("Europe/Lisbon", { abbr: true }),
"1911" : helpers.makeTestYear("Europe/Lisbon", [
["1911-12-31T23:59:59+00:00", "23:23:14", "LMT", 2205 / 60]
]),
"1912" : helpers.makeTestYear("Europe/Lisbon", [
["1912-01-01T00:00:00+00:00", "00:00:00", "WET", 0]
]),
"1916" : helpers.makeTestYear("Europe/Lisbon", [
["1916-06-17T22:59:59+00:00", "22:59:59", "WET", 0],
["1916-06-17T23:00:00+00:00", "00:00:00", "WEST", -60],
["1916-10-31T23:59:59+00:00", "00:59:59", "WEST", -60],
["1916-11-01T00:00:00+00:00", "00:00:00", "WET", 0]
]),
"1917" : helpers.makeTestYear("Europe/Lisbon", [
["1917-02-28T22:59:59+00:00", "22:59:59", "WET", 0],
["1917-02-28T23:00:00+00:00", "00:00:00", "WEST", -60],
["1917-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1917-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1918" : helpers.makeTestYear("Europe/Lisbon", [
["1918-03-01T22:59:59+00:00", "22:59:59", "WET", 0],
["1918-03-01T23:00:00+00:00", "00:00:00", "WEST", -60],
["1918-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1918-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1919" : helpers.makeTestYear("Europe/Lisbon", [
["1919-02-28T22:59:59+00:00", "22:59:59", "WET", 0],
["1919-02-28T23:00:00+00:00", "00:00:00", "WEST", -60],
["1919-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1919-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1920" : helpers.makeTestYear("Europe/Lisbon", [
["1920-02-29T22:59:59+00:00", "22:59:59", "WET", 0],
["1920-02-29T23:00:00+00:00", "00:00:00", "WEST", -60],
["1920-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1920-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1921" : helpers.makeTestYear("Europe/Lisbon", [
["1921-02-28T22:59:59+00:00", "22:59:59", "WET", 0],
["1921-02-28T23:00:00+00:00", "00:00:00", "WEST", -60],
["1921-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1921-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1924" : helpers.makeTestYear("Europe/Lisbon", [
["1924-04-16T22:59:59+00:00", "22:59:59", "WET", 0],
["1924-04-16T23:00:00+00:00", "00:00:00", "WEST", -60],
["1924-10-14T22:59:59+00:00", "23:59:59", "WEST", -60],
["1924-10-14T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1926" : helpers.makeTestYear("Europe/Lisbon", [
["1926-04-17T22:59:59+00:00", "22:59:59", "WET", 0],
["1926-04-17T23:00:00+00:00", "00:00:00", "WEST", -60],
["1926-10-02T22:59:59+00:00", "23:59:59", "WEST", -60],
["1926-10-02T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1927" : helpers.makeTestYear("Europe/Lisbon", [
["1927-04-09T22:59:59+00:00", "22:59:59", "WET", 0],
["1927-04-09T23:00:00+00:00", "00:00:00", "WEST", -60],
["1927-10-01T22:59:59+00:00", "23:59:59", "WEST", -60],
["1927-10-01T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1928" : helpers.makeTestYear("Europe/Lisbon", [
["1928-04-14T22:59:59+00:00", "22:59:59", "WET", 0],
["1928-04-14T23:00:00+00:00", "00:00:00", "WEST", -60],
["1928-10-06T22:59:59+00:00", "23:59:59", "WEST", -60],
["1928-10-06T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1929" : helpers.makeTestYear("Europe/Lisbon", [
["1929-04-20T22:59:59+00:00", "22:59:59", "WET", 0],
["1929-04-20T23:00:00+00:00", "00:00:00", "WEST", -60],
["1929-10-05T22:59:59+00:00", "23:59:59", "WEST", -60],
["1929-10-05T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1931" : helpers.makeTestYear("Europe/Lisbon", [
["1931-04-18T22:59:59+00:00", "22:59:59", "WET", 0],
["1931-04-18T23:00:00+00:00", "00:00:00", "WEST", -60],
["1931-10-03T22:59:59+00:00", "23:59:59", "WEST", -60],
["1931-10-03T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1932" : helpers.makeTestYear("Europe/Lisbon", [
["1932-04-02T22:59:59+00:00", "22:59:59", "WET", 0],
["1932-04-02T23:00:00+00:00", "00:00:00", "WEST", -60],
["1932-10-01T22:59:59+00:00", "23:59:59", "WEST", -60],
["1932-10-01T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1934" : helpers.makeTestYear("Europe/Lisbon", [
["1934-04-07T22:59:59+00:00", "22:59:59", "WET", 0],
["1934-04-07T23:00:00+00:00", "00:00:00", "WEST", -60],
["1934-10-06T22:59:59+00:00", "23:59:59", "WEST", -60],
["1934-10-06T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1935" : helpers.makeTestYear("Europe/Lisbon", [
["1935-03-30T22:59:59+00:00", "22:59:59", "WET", 0],
["1935-03-30T23:00:00+00:00", "00:00:00", "WEST", -60],
["1935-10-05T22:59:59+00:00", "23:59:59", "WEST", -60],
["1935-10-05T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1936" : helpers.makeTestYear("Europe/Lisbon", [
["1936-04-18T22:59:59+00:00", "22:59:59", "WET", 0],
["1936-04-18T23:00:00+00:00", "00:00:00", "WEST", -60],
["1936-10-03T22:59:59+00:00", "23:59:59", "WEST", -60],
["1936-10-03T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1937" : helpers.makeTestYear("Europe/Lisbon", [
["1937-04-03T22:59:59+00:00", "22:59:59", "WET", 0],
["1937-04-03T23:00:00+00:00", "00:00:00", "WEST", -60],
["1937-10-02T22:59:59+00:00", "23:59:59", "WEST", -60],
["1937-10-02T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1938" : helpers.makeTestYear("Europe/Lisbon", [
["1938-03-26T22:59:59+00:00", "22:59:59", "WET", 0],
["1938-03-26T23:00:00+00:00", "00:00:00", "WEST", -60],
["1938-10-01T22:59:59+00:00", "23:59:59", "WEST", -60],
["1938-10-01T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1939" : helpers.makeTestYear("Europe/Lisbon", [
["1939-04-15T22:59:59+00:00", "22:59:59", "WET", 0],
["1939-04-15T23:00:00+00:00", "00:00:00", "WEST", -60],
["1939-11-18T22:59:59+00:00", "23:59:59", "WEST", -60],
["1939-11-18T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1940" : helpers.makeTestYear("Europe/Lisbon", [
["1940-02-24T22:59:59+00:00", "22:59:59", "WET", 0],
["1940-02-24T23:00:00+00:00", "00:00:00", "WEST", -60],
["1940-10-05T22:59:59+00:00", "23:59:59", "WEST", -60],
["1940-10-05T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1941" : helpers.makeTestYear("Europe/Lisbon", [
["1941-04-05T22:59:59+00:00", "22:59:59", "WET", 0],
["1941-04-05T23:00:00+00:00", "00:00:00", "WEST", -60],
["1941-10-05T22:59:59+00:00", "23:59:59", "WEST", -60],
["1941-10-05T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1942" : helpers.makeTestYear("Europe/Lisbon", [
["1942-03-14T22:59:59+00:00", "22:59:59", "WET", 0],
["1942-03-14T23:00:00+00:00", "00:00:00", "WEST", -60],
["1942-04-25T21:59:59+00:00", "22:59:59", "WEST", -60],
["1942-04-25T22:00:00+00:00", "00:00:00", "WEMT", -120],
["1942-08-15T21:59:59+00:00", "23:59:59", "WEMT", -120],
["1942-08-15T22:00:00+00:00", "23:00:00", "WEST", -60],
["1942-10-24T22:59:59+00:00", "23:59:59", "WEST", -60],
["1942-10-24T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1943" : helpers.makeTestYear("Europe/Lisbon", [
["1943-03-13T22:59:59+00:00", "22:59:59", "WET", 0],
["1943-03-13T23:00:00+00:00", "00:00:00", "WEST", -60],
["1943-04-17T21:59:59+00:00", "22:59:59", "WEST", -60],
["1943-04-17T22:00:00+00:00", "00:00:00", "WEMT", -120],
["1943-08-28T21:59:59+00:00", "23:59:59", "WEMT", -120],
["1943-08-28T22:00:00+00:00", "23:00:00", "WEST", -60],
["1943-10-30T22:59:59+00:00", "23:59:59", "WEST", -60],
["1943-10-30T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1944" : helpers.makeTestYear("Europe/Lisbon", [
["1944-03-11T22:59:59+00:00", "22:59:59", "WET", 0],
["1944-03-11T23:00:00+00:00", "00:00:00", "WEST", -60],
["1944-04-22T21:59:59+00:00", "22:59:59", "WEST", -60],
["1944-04-22T22:00:00+00:00", "00:00:00", "WEMT", -120],
["1944-08-26T21:59:59+00:00", "23:59:59", "WEMT", -120],
["1944-08-26T22:00:00+00:00", "23:00:00", "WEST", -60],
["1944-10-28T22:59:59+00:00", "23:59:59", "WEST", -60],
["1944-10-28T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1945" : helpers.makeTestYear("Europe/Lisbon", [
["1945-03-10T22:59:59+00:00", "22:59:59", "WET", 0],
["1945-03-10T23:00:00+00:00", "00:00:00", "WEST", -60],
["1945-04-21T21:59:59+00:00", "22:59:59", "WEST", -60],
["1945-04-21T22:00:00+00:00", "00:00:00", "WEMT", -120],
["1945-08-25T21:59:59+00:00", "23:59:59", "WEMT", -120],
["1945-08-25T22:00:00+00:00", "23:00:00", "WEST", -60],
["1945-10-27T22:59:59+00:00", "23:59:59", "WEST", -60],
["1945-10-27T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1946" : helpers.makeTestYear("Europe/Lisbon", [
["1946-04-06T22:59:59+00:00", "22:59:59", "WET", 0],
["1946-04-06T23:00:00+00:00", "00:00:00", "WEST", -60],
["1946-10-05T22:59:59+00:00", "23:59:59", "WEST", -60],
["1946-10-05T23:00:00+00:00", "23:00:00", "WET", 0]
]),
"1947" : helpers.makeTestYear("Europe/Lisbon", [
["1947-04-06T01:59:59+00:00", "01:59:59", "WET", 0],
["1947-04-06T02:00:00+00:00", "03:00:00", "WEST", -60],
["1947-10-05T01:59:59+00:00", "02:59:59", "WEST", -60],
["1947-10-05T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1948" : helpers.makeTestYear("Europe/Lisbon", [
["1948-04-04T01:59:59+00:00", "01:59:59", "WET", 0],
["1948-04-04T02:00:00+00:00", "03:00:00", "WEST", -60],
["1948-10-03T01:59:59+00:00", "02:59:59", "WEST", -60],
["1948-10-03T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1949" : helpers.makeTestYear("Europe/Lisbon", [
["1949-04-03T01:59:59+00:00", "01:59:59", "WET", 0],
["1949-04-03T02:00:00+00:00", "03:00:00", "WEST", -60],
["1949-10-02T01:59:59+00:00", "02:59:59", "WEST", -60],
["1949-10-02T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1951" : helpers.makeTestYear("Europe/Lisbon", [
["1951-04-01T01:59:59+00:00", "01:59:59", "WET", 0],
["1951-04-01T02:00:00+00:00", "03:00:00", "WEST", -60],
["1951-10-07T01:59:59+00:00", "02:59:59", "WEST", -60],
["1951-10-07T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1952" : helpers.makeTestYear("Europe/Lisbon", [
["1952-04-06T01:59:59+00:00", "01:59:59", "WET", 0],
["1952-04-06T02:00:00+00:00", "03:00:00", "WEST", -60],
["1952-10-05T01:59:59+00:00", "02:59:59", "WEST", -60],
["1952-10-05T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1953" : helpers.makeTestYear("Europe/Lisbon", [
["1953-04-05T01:59:59+00:00", "01:59:59", "WET", 0],
["1953-04-05T02:00:00+00:00", "03:00:00", "WEST", -60],
["1953-10-04T01:59:59+00:00", "02:59:59", "WEST", -60],
["1953-10-04T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1954" : helpers.makeTestYear("Europe/Lisbon", [
["1954-04-04T01:59:59+00:00", "01:59:59", "WET", 0],
["1954-04-04T02:00:00+00:00", "03:00:00", "WEST", -60],
["1954-10-03T01:59:59+00:00", "02:59:59", "WEST", -60],
["1954-10-03T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1955" : helpers.makeTestYear("Europe/Lisbon", [
["1955-04-03T01:59:59+00:00", "01:59:59", "WET", 0],
["1955-04-03T02:00:00+00:00", "03:00:00", "WEST", -60],
["1955-10-02T01:59:59+00:00", "02:59:59", "WEST", -60],
["1955-10-02T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1956" : helpers.makeTestYear("Europe/Lisbon", [
["1956-04-01T01:59:59+00:00", "01:59:59", "WET", 0],
["1956-04-01T02:00:00+00:00", "03:00:00", "WEST", -60],
["1956-10-07T01:59:59+00:00", "02:59:59", "WEST", -60],
["1956-10-07T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1957" : helpers.makeTestYear("Europe/Lisbon", [
["1957-04-07T01:59:59+00:00", "01:59:59", "WET", 0],
["1957-04-07T02:00:00+00:00", "03:00:00", "WEST", -60],
["1957-10-06T01:59:59+00:00", "02:59:59", "WEST", -60],
["1957-10-06T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1958" : helpers.makeTestYear("Europe/Lisbon", [
["1958-04-06T01:59:59+00:00", "01:59:59", "WET", 0],
["1958-04-06T02:00:00+00:00", "03:00:00", "WEST", -60],
["1958-10-05T01:59:59+00:00", "02:59:59", "WEST", -60],
["1958-10-05T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1959" : helpers.makeTestYear("Europe/Lisbon", [
["1959-04-05T01:59:59+00:00", "01:59:59", "WET", 0],
["1959-04-05T02:00:00+00:00", "03:00:00", "WEST", -60],
["1959-10-04T01:59:59+00:00", "02:59:59", "WEST", -60],
["1959-10-04T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1960" : helpers.makeTestYear("Europe/Lisbon", [
["1960-04-03T01:59:59+00:00", "01:59:59", "WET", 0],
["1960-04-03T02:00:00+00:00", "03:00:00", "WEST", -60],
["1960-10-02T01:59:59+00:00", "02:59:59", "WEST", -60],
["1960-10-02T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1961" : helpers.makeTestYear("Europe/Lisbon", [
["1961-04-02T01:59:59+00:00", "01:59:59", "WET", 0],
["1961-04-02T02:00:00+00:00", "03:00:00", "WEST", -60],
["1961-10-01T01:59:59+00:00", "02:59:59", "WEST", -60],
["1961-10-01T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1962" : helpers.makeTestYear("Europe/Lisbon", [
["1962-04-01T01:59:59+00:00", "01:59:59", "WET", 0],
["1962-04-01T02:00:00+00:00", "03:00:00", "WEST", -60],
["1962-10-07T01:59:59+00:00", "02:59:59", "WEST", -60],
["1962-10-07T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1963" : helpers.makeTestYear("Europe/Lisbon", [
["1963-04-07T01:59:59+00:00", "01:59:59", "WET", 0],
["1963-04-07T02:00:00+00:00", "03:00:00", "WEST", -60],
["1963-10-06T01:59:59+00:00", "02:59:59", "WEST", -60],
["1963-10-06T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1964" : helpers.makeTestYear("Europe/Lisbon", [
["1964-04-05T01:59:59+00:00", "01:59:59", "WET", 0],
["1964-04-05T02:00:00+00:00", "03:00:00", "WEST", -60],
["1964-10-04T01:59:59+00:00", "02:59:59", "WEST", -60],
["1964-10-04T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1965" : helpers.makeTestYear("Europe/Lisbon", [
["1965-04-04T01:59:59+00:00", "01:59:59", "WET", 0],
["1965-04-04T02:00:00+00:00", "03:00:00", "WEST", -60],
["1965-10-03T01:59:59+00:00", "02:59:59", "WEST", -60],
["1965-10-03T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1966" : helpers.makeTestYear("Europe/Lisbon", [
["1966-04-03T01:59:59+00:00", "01:59:59", "WET", 0],
["1966-04-03T02:00:00+00:00", "03:00:00", "CET", -60]
]),
"1976" : helpers.makeTestYear("Europe/Lisbon", [
["1976-09-25T23:59:59+00:00", "00:59:59", "CET", -60],
["1976-09-26T00:00:00+00:00", "00:00:00", "WET", 0]
]),
"1977" : helpers.makeTestYear("Europe/Lisbon", [
["1977-03-26T23:59:59+00:00", "23:59:59", "WET", 0],
["1977-03-27T00:00:00+00:00", "01:00:00", "WEST", -60],
["1977-09-24T23:59:59+00:00", "00:59:59", "WEST", -60],
["1977-09-25T00:00:00+00:00", "00:00:00", "WET", 0]
]),
"1978" : helpers.makeTestYear("Europe/Lisbon", [
["1978-04-01T23:59:59+00:00", "23:59:59", "WET", 0],
["1978-04-02T00:00:00+00:00", "01:00:00", "WEST", -60],
["1978-09-30T23:59:59+00:00", "00:59:59", "WEST", -60],
["1978-10-01T00:00:00+00:00", "00:00:00", "WET", 0]
]),
"1979" : helpers.makeTestYear("Europe/Lisbon", [
["1979-03-31T23:59:59+00:00", "23:59:59", "WET", 0],
["1979-04-01T00:00:00+00:00", "01:00:00", "WEST", -60],
["1979-09-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["1979-09-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1980" : helpers.makeTestYear("Europe/Lisbon", [
["1980-03-29T23:59:59+00:00", "23:59:59", "WET", 0],
["1980-03-30T00:00:00+00:00", "01:00:00", "WEST", -60],
["1980-09-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["1980-09-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1981" : helpers.makeTestYear("Europe/Lisbon", [
["1981-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["1981-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["1981-09-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["1981-09-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1982" : helpers.makeTestYear("Europe/Lisbon", [
["1982-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["1982-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["1982-09-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["1982-09-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1983" : helpers.makeTestYear("Europe/Lisbon", [
["1983-03-27T01:59:59+00:00", "01:59:59", "WET", 0],
["1983-03-27T02:00:00+00:00", "03:00:00", "WEST", -60],
["1983-09-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["1983-09-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1984" : helpers.makeTestYear("Europe/Lisbon", [
["1984-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["1984-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["1984-09-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["1984-09-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1985" : helpers.makeTestYear("Europe/Lisbon", [
["1985-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["1985-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["1985-09-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["1985-09-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1986" : helpers.makeTestYear("Europe/Lisbon", [
["1986-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["1986-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["1986-09-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["1986-09-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1987" : helpers.makeTestYear("Europe/Lisbon", [
["1987-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["1987-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["1987-09-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["1987-09-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1988" : helpers.makeTestYear("Europe/Lisbon", [
["1988-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["1988-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["1988-09-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["1988-09-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1989" : helpers.makeTestYear("Europe/Lisbon", [
["1989-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["1989-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["1989-09-24T00:59:59+00:00", "01:59:59", "WEST", -60],
["1989-09-24T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1990" : helpers.makeTestYear("Europe/Lisbon", [
["1990-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["1990-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["1990-09-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["1990-09-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1991" : helpers.makeTestYear("Europe/Lisbon", [
["1991-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["1991-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["1991-09-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["1991-09-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1992" : helpers.makeTestYear("Europe/Lisbon", [
["1992-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["1992-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["1992-09-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["1992-09-27T01:00:00+00:00", "02:00:00", "CET", -60]
]),
"1993" : helpers.makeTestYear("Europe/Lisbon", [
["1993-03-28T00:59:59+00:00", "01:59:59", "CET", -60],
["1993-03-28T01:00:00+00:00", "03:00:00", "CEST", -120],
["1993-09-26T00:59:59+00:00", "02:59:59", "CEST", -120],
["1993-09-26T01:00:00+00:00", "02:00:00", "CET", -60]
]),
"1994" : helpers.makeTestYear("Europe/Lisbon", [
["1994-03-27T00:59:59+00:00", "01:59:59", "CET", -60],
["1994-03-27T01:00:00+00:00", "03:00:00", "CEST", -120],
["1994-09-25T00:59:59+00:00", "02:59:59", "CEST", -120],
["1994-09-25T01:00:00+00:00", "02:00:00", "CET", -60]
]),
"1995" : helpers.makeTestYear("Europe/Lisbon", [
["1995-03-26T00:59:59+00:00", "01:59:59", "CET", -60],
["1995-03-26T01:00:00+00:00", "03:00:00", "CEST", -120],
["1995-09-24T00:59:59+00:00", "02:59:59", "CEST", -120],
["1995-09-24T01:00:00+00:00", "02:00:00", "CET", -60]
]),
"1996" : helpers.makeTestYear("Europe/Lisbon", [
["1996-03-31T00:59:59+00:00", "01:59:59", "CET", -60],
["1996-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["1996-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["1996-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1997" : helpers.makeTestYear("Europe/Lisbon", [
["1997-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["1997-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["1997-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["1997-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1998" : helpers.makeTestYear("Europe/Lisbon", [
["1998-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["1998-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["1998-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["1998-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"1999" : helpers.makeTestYear("Europe/Lisbon", [
["1999-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["1999-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["1999-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["1999-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2000" : helpers.makeTestYear("Europe/Lisbon", [
["2000-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2000-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2000-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2000-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2001" : helpers.makeTestYear("Europe/Lisbon", [
["2001-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2001-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2001-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2001-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2002" : helpers.makeTestYear("Europe/Lisbon", [
["2002-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["2002-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["2002-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["2002-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2003" : helpers.makeTestYear("Europe/Lisbon", [
["2003-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2003-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2003-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2003-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2004" : helpers.makeTestYear("Europe/Lisbon", [
["2004-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["2004-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["2004-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["2004-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2005" : helpers.makeTestYear("Europe/Lisbon", [
["2005-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["2005-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["2005-10-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["2005-10-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2006" : helpers.makeTestYear("Europe/Lisbon", [
["2006-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2006-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2006-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2006-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2007" : helpers.makeTestYear("Europe/Lisbon", [
["2007-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2007-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2007-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2007-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2008" : helpers.makeTestYear("Europe/Lisbon", [
["2008-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2008-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2008-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2008-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2009" : helpers.makeTestYear("Europe/Lisbon", [
["2009-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["2009-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["2009-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["2009-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2010" : helpers.makeTestYear("Europe/Lisbon", [
["2010-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["2010-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["2010-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["2010-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2011" : helpers.makeTestYear("Europe/Lisbon", [
["2011-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["2011-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["2011-10-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["2011-10-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2012" : helpers.makeTestYear("Europe/Lisbon", [
["2012-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2012-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2012-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2012-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2013" : helpers.makeTestYear("Europe/Lisbon", [
["2013-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["2013-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["2013-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["2013-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2014" : helpers.makeTestYear("Europe/Lisbon", [
["2014-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2014-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2014-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2014-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2015" : helpers.makeTestYear("Europe/Lisbon", [
["2015-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["2015-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["2015-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["2015-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2016" : helpers.makeTestYear("Europe/Lisbon", [
["2016-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["2016-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["2016-10-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["2016-10-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2017" : helpers.makeTestYear("Europe/Lisbon", [
["2017-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2017-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2017-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2017-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2018" : helpers.makeTestYear("Europe/Lisbon", [
["2018-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2018-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2018-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2018-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2019" : helpers.makeTestYear("Europe/Lisbon", [
["2019-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["2019-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["2019-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["2019-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2020" : helpers.makeTestYear("Europe/Lisbon", [
["2020-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["2020-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["2020-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["2020-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2021" : helpers.makeTestYear("Europe/Lisbon", [
["2021-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["2021-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["2021-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["2021-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2022" : helpers.makeTestYear("Europe/Lisbon", [
["2022-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["2022-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["2022-10-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["2022-10-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2023" : helpers.makeTestYear("Europe/Lisbon", [
["2023-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2023-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2023-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2023-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2024" : helpers.makeTestYear("Europe/Lisbon", [
["2024-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["2024-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["2024-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["2024-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2025" : helpers.makeTestYear("Europe/Lisbon", [
["2025-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2025-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2025-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2025-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2026" : helpers.makeTestYear("Europe/Lisbon", [
["2026-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["2026-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["2026-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["2026-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2027" : helpers.makeTestYear("Europe/Lisbon", [
["2027-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["2027-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["2027-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["2027-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2028" : helpers.makeTestYear("Europe/Lisbon", [
["2028-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2028-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2028-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2028-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2029" : helpers.makeTestYear("Europe/Lisbon", [
["2029-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2029-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2029-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2029-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2030" : helpers.makeTestYear("Europe/Lisbon", [
["2030-03-31T00:59:59+00:00", "00:59:59", "WET", 0],
["2030-03-31T01:00:00+00:00", "02:00:00", "WEST", -60],
["2030-10-27T00:59:59+00:00", "01:59:59", "WEST", -60],
["2030-10-27T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2031" : helpers.makeTestYear("Europe/Lisbon", [
["2031-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2031-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2031-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2031-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2032" : helpers.makeTestYear("Europe/Lisbon", [
["2032-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["2032-03-28T01:00:00+00:00", "02:00:00", "WEST", -60],
["2032-10-31T00:59:59+00:00", "01:59:59", "WEST", -60],
["2032-10-31T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2033" : helpers.makeTestYear("Europe/Lisbon", [
["2033-03-27T00:59:59+00:00", "00:59:59", "WET", 0],
["2033-03-27T01:00:00+00:00", "02:00:00", "WEST", -60],
["2033-10-30T00:59:59+00:00", "01:59:59", "WEST", -60],
["2033-10-30T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2034" : helpers.makeTestYear("Europe/Lisbon", [
["2034-03-26T00:59:59+00:00", "00:59:59", "WET", 0],
["2034-03-26T01:00:00+00:00", "02:00:00", "WEST", -60],
["2034-10-29T00:59:59+00:00", "01:59:59", "WEST", -60],
["2034-10-29T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2035" : helpers.makeTestYear("Europe/Lisbon", [
["2035-03-25T00:59:59+00:00", "00:59:59", "WET", 0],
["2035-03-25T01:00:00+00:00", "02:00:00", "WEST", -60],
["2035-10-28T00:59:59+00:00", "01:59:59", "WEST", -60],
["2035-10-28T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2036" : helpers.makeTestYear("Europe/Lisbon", [
["2036-03-30T00:59:59+00:00", "00:59:59", "WET", 0],
["2036-03-30T01:00:00+00:00", "02:00:00", "WEST", -60],
["2036-10-26T00:59:59+00:00", "01:59:59", "WEST", -60],
["2036-10-26T01:00:00+00:00", "01:00:00", "WET", 0]
]),
"2037" : helpers.makeTestYear("Europe/Lisbon", [
["2037-03-29T00:59:59+00:00", "00:59:59", "WET", 0],
["2037-03-29T01:00:00+00:00", "02:00:00", "WEST", -60],
["2037-10-25T00:59:59+00:00", "01:59:59", "WEST", -60],
["2037-10-25T01:00:00+00:00", "01:00:00", "WET", 0]
])
};
|
moment/moment-timezone
|
tests/zones/europe/lisbon.js
|
JavaScript
|
mit
| 31,300
|
module.exports = {
bower : 'bower_components',
wwwFolder : 'www',
assetsFolder : 'assets',
vendors: 'www/scripts/vendors',
port: 3001
}
|
bhtz/microscope-backbone-amd
|
grunt_tasks/configs.js
|
JavaScript
|
mit
| 146
|
import fs from 'fs';
import path from 'path';
import helpers from './helpers';
const { isOSX, isWindows, isLinux } = helpers;
/**
* Synchronously find a file or directory
* @param {RegExp} pattern regex
* @param {string} base path
* @param {boolean} [findDir] if true, search results will be limited to only directories
* @returns {Array}
*/
function findSync(pattern, basePath, findDir) {
const matches = [];
(function findSyncRecurse(base) {
let children;
try {
children = fs.readdirSync(base);
} catch (exception) {
if (exception.code === 'ENOENT') {
return;
}
throw exception;
}
children.forEach((child) => {
const childPath = path.join(base, child);
const childIsDirectory = fs.lstatSync(childPath).isDirectory();
const patternMatches = pattern.test(childPath);
if (!patternMatches) {
if (!childIsDirectory) {
return;
}
findSyncRecurse(childPath);
return;
}
if (!findDir) {
matches.push(childPath);
return;
}
if (childIsDirectory) {
matches.push(childPath);
}
});
}(basePath));
return matches;
}
function linuxMatch() {
return findSync(/libpepflashplayer\.so/, '/opt/google/chrome')[0];
}
function windowsMatch() {
return findSync(/pepflashplayer\.dll/, 'C:\\Program Files (x86)\\Google\\Chrome')[0];
}
function darwinMatch() {
return findSync(/PepperFlashPlayer.plugin/, '/Applications/Google Chrome.app/', true)[0];
}
function inferFlash() {
if (isOSX()) {
return darwinMatch();
}
if (isWindows()) {
return windowsMatch();
}
if (isLinux()) {
return linuxMatch();
}
console.warn('Unable to determine OS to infer flash player');
return null;
}
export default inferFlash;
|
faceair/nativefier-slack
|
app/src/helpers/inferFlash.js
|
JavaScript
|
mit
| 1,814
|